VTK  9.1.0
vtkVRPanelRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkVRPanelRepresentation.h
5 
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
27 #ifndef vtkVRPanelRepresentation_h
28 #define vtkVRPanelRepresentation_h
29 
30 #include "vtkRenderingVRModule.h" // For export macro
32 #include <string> // for ivar
33 
34 class vtkPicker;
35 class vtkTextActor3D;
36 
37 class VTKRENDERINGVR_EXPORT vtkVRPanelRepresentation : public vtkWidgetRepresentation
38 {
39 public:
44 
46 
50  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
53  // Enums define the state of the representation relative to the mouse pointer
54  // position. Used by ComputeInteractionState() to communicate with the
55  // widget. Note that ComputeInteractionState() and several other methods
56  // must be implemented by subclasses.
58  {
59  Outside = 0,
60  Moving
61  };
62 
64 
67  void BuildRepresentation() override;
68  void PlaceWidget(double bounds[6]) override;
70  unsigned long event, void* calldata) override;
72  unsigned long event, void* calldata) override;
74  unsigned long event, void* calldata, int modify = 0) override;
76  unsigned long event, void* calldata) override;
78 
79  // Place the widget with a few more options
80  // This method allows you to place the panel
81  // and provides more options so that you can get
82  // the exact positioning you want.
83  // Bounds are the bounds that you want the panel to
84  // fit within. For World coordinates they should be in
85  // world coordinates. For all others they should be in
86  // physical meters relative to the HMD or controller origin.
87  // The normal is the direction the planel should face.
88  // The coordinate system for the controller is X right
89  // Y up and Z towards the handle. Upvec specifies the
90  // vector to use as up for the panel. Note that upvec
91  // has priority over normal, if they are not orthogonal
92  // normal will be modified to be orthogonal to upvec.
93  // Scale is the physical scale from the RenderWindow
94  // and is used to position/scale the panel correctly.
95  //
96  // Note that you should set the Text on the panel
97  // before calling this method as the positioning
98  // and scaling is done based on the current text.
99  //
100  // All vectors will be normalized prior to use.
102  const double* bounds, const double* normal, const double* upvec, double scale);
103 
105 
113 
115 
118  void SetText(const char* str);
120 
121  // allow access to the underlying text actor
122  // so that properties can be set
123  vtkGetObjectMacro(TextActor, vtkTextActor3D);
124 
125  // Set the coordinate system to use for this prop
130 
132 
135  vtkSetMacro(AllowAdjustment, bool);
136  vtkGetMacro(AllowAdjustment, bool);
137  vtkBooleanMacro(AllowAdjustment, bool);
139 
140 protected:
143 
144  // Keep track of event positions
145  double LastEventPosition[3];
146  double LastEventOrientation[4];
147  double StartEventOrientation[4];
148 
149  double LastScale;
150 
152 
153  void UpdatePose(double* p1, double* d1, double* p2, double* d2);
154 
156 
158  {
159  World = 0,
160  HMD = 1,
161  LeftController = 2,
162  RightController = 3,
163  };
164 
166 
167  // The text
170 
171 private:
173  void operator=(const vtkVRPanelRepresentation&) = delete;
174 };
175 
176 #endif
vtkWidgetRepresentation.h
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkVRPanelRepresentation::AllowAdjustment
bool AllowAdjustment
Definition: vtkVRPanelRepresentation.h:151
vtkVRPanelRepresentation::_InteractionState
_InteractionState
Definition: vtkVRPanelRepresentation.h:58
vtkTextActor3D
An actor that displays text.
Definition: vtkTextActor3D.h:45
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkVRPanelRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkVRPanelRepresentation::TextActor
vtkTextActor3D * TextActor
Definition: vtkVRPanelRepresentation.h:168
vtkVRPanelRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
vtkPicker
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:62
vtkVRPanelRepresentation::SetText
void SetText(const char *str)
Set panel text.
vtkVRPanelRepresentation::New
static vtkVRPanelRepresentation * New()
Instantiate the class.
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkVRPanelRepresentation
Widget representation for vtkVRPanelWidget Implementation of the popup panel representation for the v...
Definition: vtkVRPanelRepresentation.h:38
vtkVRPanelRepresentation::PlaceWidgetExtended
void PlaceWidgetExtended(const double *bounds, const double *normal, const double *upvec, double scale)
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:66
vtkVRPanelRepresentation::CoordinateSystems
CoordinateSystems
Definition: vtkVRPanelRepresentation.h:158
vtkVRPanelRepresentation::EndComplexInteraction
void EndComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
vtkVRPanelRepresentation::ComputeMatrix
void ComputeMatrix(vtkRenderer *ren)
vtkVRPanelRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
vtkVRPanelRepresentation::SetCoordinateSystemToRightController
void SetCoordinateSystemToRightController()
vtkVRPanelRepresentation::Text
std::string Text
Definition: vtkVRPanelRepresentation.h:169
vtkVRPanelRepresentation::SetCoordinateSystemToWorld
void SetCoordinateSystemToWorld()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkVRPanelRepresentation::PlaceWidget
void PlaceWidget(double bounds[6]) override
vtkVRPanelRepresentation::ComplexInteraction
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
vtkVRPanelRepresentation::ComputeComplexInteractionState
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:192
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkVRPanelRepresentation::UpdatePose
void UpdatePose(double *p1, double *d1, double *p2, double *d2)
vtkVRPanelRepresentation::StartComplexInteraction
void StartComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
vtkVRPanelRepresentation::CoordinateSystem
CoordinateSystems CoordinateSystem
Definition: vtkVRPanelRepresentation.h:165
vtkVRPanelRepresentation::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:182
vtkVRPanelRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
vtkVRPanelRepresentation::vtkVRPanelRepresentation
vtkVRPanelRepresentation()
vtkVRPanelRepresentation::BuildRepresentation
void BuildRepresentation() override
Methods to interface with the vtkVRPanelWidget.
vtkVRPanelRepresentation::SetCoordinateSystemToLeftController
void SetCoordinateSystemToLeftController()
vtkVRPanelRepresentation::~vtkVRPanelRepresentation
~vtkVRPanelRepresentation() override
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkVRPanelRepresentation::LastScale
double LastScale
Definition: vtkVRPanelRepresentation.h:149
vtkVRPanelRepresentation::SetCoordinateSystemToHMD
void SetCoordinateSystemToHMD()