VTK  9.3.1
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:
33  static vtkVRPanelRepresentation* New();
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.
95  void PlaceWidgetExtended(
96  const double* bounds, const double* normal, const double* upvec, double scale);
97 
99 
102  void ReleaseGraphicsResources(vtkWindow*) override;
103  int RenderOpaqueGeometry(vtkViewport*) override;
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
120  void SetCoordinateSystemToWorld();
121  void SetCoordinateSystemToHMD();
122  void SetCoordinateSystemToLeftController();
123  void SetCoordinateSystemToRightController();
124 
126 
129  vtkSetMacro(AllowAdjustment, bool);
130  vtkGetMacro(AllowAdjustment, bool);
131  vtkBooleanMacro(AllowAdjustment, bool);
133 
134 protected:
136  ~vtkVRPanelRepresentation() override;
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 
149  void ComputeMatrix(vtkRenderer* ren);
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
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
virtual void PlaceWidget(double vtkNotUsed(bounds)[6])
The following is a suggested API for widget representations.
abstract specification for Viewports
Definition: vtkViewport.h:44
#define VTK_DEPRECATED_IN_9_2_0(reason)
virtual int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *callData, int modify=0)
virtual void ComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
abstract specification for renderers
Definition: vtkRenderer.h:61
virtual void EndComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
virtual void StartComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
platform-independent render window interaction including picking and frame rate control.
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
a simple class to control print indentation
Definition: vtkIndent.h:28
Widget representation for vtkVRPanelWidget Implementation of the popup panel representation for the v...
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
An actor that displays text.
define the API for widget / widget representation
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...