VTK  9.3.0
vtkVRPanelRepresentation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
15 #ifndef vtkVRPanelRepresentation_h
16 #define vtkVRPanelRepresentation_h
17 
18 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
19 #include "vtkRenderingVRModule.h" // For export macro
21 
22 #include <string> // for ivar
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkTextActor3D;
26 
27 class VTKRENDERINGVR_EXPORT vtkVRPanelRepresentation : public vtkWidgetRepresentation
28 {
29 public:
34 
36 
40  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
43  // Enums define the state of the representation relative to the mouse pointer
44  // position. Used by ComputeInteractionState() to communicate with the
45  // widget. Note that ComputeInteractionState() and several other methods
46  // must be implemented by subclasses.
48  {
49  Outside = 0,
50  Moving
51  };
52 #if !defined(VTK_LEGACY_REMOVE)
53  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
55 #endif
56 
58 
61  void BuildRepresentation() override;
62  void PlaceWidget(double bounds[6]) override;
64  unsigned long event, void* calldata) override;
66  unsigned long event, void* calldata) override;
68  unsigned long event, void* calldata, int modify = 0) override;
70  unsigned long event, void* calldata) override;
72 
73  // Place the widget with a few more options
74  // This method allows you to place the panel
75  // and provides more options so that you can get
76  // the exact positioning you want.
77  // Bounds are the bounds that you want the panel to
78  // fit within. For World coordinates they should be in
79  // world coordinates. For all others they should be in
80  // physical meters relative to the HMD or controller origin.
81  // The normal is the direction the planel should face.
82  // The coordinate system for the controller is X right
83  // Y up and Z towards the handle. Upvec specifies the
84  // vector to use as up for the panel. Note that upvec
85  // has priority over normal, if they are not orthogonal
86  // normal will be modified to be orthogonal to upvec.
87  // Scale is the physical scale from the RenderWindow
88  // and is used to position/scale the panel correctly.
89  //
90  // Note that you should set the Text on the panel
91  // before calling this method as the positioning
92  // and scaling is done based on the current text.
93  //
94  // All vectors will be normalized prior to use.
96  const double* bounds, const double* normal, const double* upvec, double scale);
97 
99 
107 
109 
112  void SetText(const char* str);
114 
115  // allow access to the underlying text actor
116  // so that properties can be set
117  vtkGetObjectMacro(TextActor, vtkTextActor3D);
118 
119  // Set the coordinate system to use for this prop
124 
126 
129  vtkSetMacro(AllowAdjustment, bool);
130  vtkGetMacro(AllowAdjustment, bool);
131  vtkBooleanMacro(AllowAdjustment, bool);
133 
134 protected:
137 
138  // Keep track of event positions
139  double LastEventPosition[3];
140  double LastEventOrientation[4];
141  double StartEventOrientation[4];
142 
143  double LastScale;
144 
146 
147  void UpdatePose(double* p1, double* d1, double* p2, double* d2);
148 
150 
152  {
153  World = 0,
154  HMD = 1,
157  };
158 
160 
161  // The text
164 
165 private:
167  void operator=(const vtkVRPanelRepresentation&) = delete;
168 };
169 
170 VTK_ABI_NAMESPACE_END
171 #endif
define the API for widget / widget representation
a simple class to control print indentation
Definition: vtkIndent.h:29
platform-independent render window interaction including picking and frame rate control.
abstract specification for renderers
Definition: vtkRenderer.h:62
An actor that displays text.
Widget representation for vtkVRPanelWidget Implementation of the popup panel representation for the v...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkVRPanelWidget.
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkVRPanelWidget.
void PlaceWidgetExtended(const double *bounds, const double *normal, const double *upvec, double scale)
void ComputeMatrix(vtkRenderer *ren)
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting the rendering process.
void SetCoordinateSystemToRightController()
~vtkVRPanelRepresentation() override
void UpdatePose(double *p1, double *d1, double *p2, double *d2)
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
void StartComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkVRPanelWidget.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting the rendering process.
static vtkVRPanelRepresentation * New()
Instantiate the class.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
void SetCoordinateSystemToLeftController()
void SetText(const char *str)
Set panel text.
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
Methods to interface with the vtkVRPanelWidget.
void BuildRepresentation() override
Methods to interface with the vtkVRPanelWidget.
void EndComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkVRPanelWidget.
abstract specification for Viewports
Definition: vtkViewport.h:45
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:28
@ scale
Definition: vtkX3D.h:229
@ string
Definition: vtkX3D.h:490
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DEPRECATED_IN_9_2_0(reason)