VTK  9.7.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 "vtkRenderingVRModule.h" // For export macro
20 
21 #include <string> // for ivar
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkTextActor3D;
25 
26 class VTKRENDERINGVR_EXPORT vtkVRPanelRepresentation : public vtkWidgetRepresentation
27 {
28 public:
32  static vtkVRPanelRepresentation* New();
33 
35 
39  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
42  // Enums define the state of the representation relative to the mouse pointer
43  // position. Used by ComputeInteractionState() to communicate with the
44  // widget. Note that ComputeInteractionState() and several other methods
45  // must be implemented by subclasses.
47  {
48  Outside = 0,
49  Moving
50  };
51 
53 
56  void BuildRepresentation() override;
57  void PlaceWidget(double bounds[6]) override;
59  unsigned long event, void* calldata) override;
61  unsigned long event, void* calldata) override;
63  unsigned long event, void* calldata, int modify = 0) override;
65  unsigned long event, void* calldata) override;
67 
68  // Place the widget with a few more options
69  // This method allows you to place the panel
70  // and provides more options so that you can get
71  // the exact positioning you want.
72  // Bounds are the bounds that you want the panel to
73  // fit within. For World coordinates they should be in
74  // world coordinates. For all others they should be in
75  // physical meters relative to the HMD or controller origin.
76  // The normal is the direction the planel should face.
77  // The coordinate system for the controller is X right
78  // Y up and Z towards the handle. Upvec specifies the
79  // vector to use as up for the panel. Note that upvec
80  // has priority over normal, if they are not orthogonal
81  // normal will be modified to be orthogonal to upvec.
82  // Scale is the physical scale from the RenderWindow
83  // and is used to position/scale the panel correctly.
84  //
85  // Note that you should set the Text on the panel
86  // before calling this method as the positioning
87  // and scaling is done based on the current text.
88  //
89  // All vectors will be normalized prior to use.
90  void PlaceWidgetExtended(
91  const double* bounds, const double* normal, const double* upvec, double scale);
92 
94 
97  void ReleaseGraphicsResources(vtkWindow*) override;
98  int RenderOpaqueGeometry(vtkViewport*) override;
102 
104 
107  void SetText(const char* str);
109 
110  // allow access to the underlying text actor
111  // so that properties can be set
112  vtkGetObjectMacro(TextActor, vtkTextActor3D);
113 
114  // Set the coordinate system to use for this prop
115  void SetCoordinateSystemToWorld();
116  void SetCoordinateSystemToHMD();
117  void SetCoordinateSystemToLeftController();
118  void SetCoordinateSystemToRightController();
119 
121 
124  vtkSetMacro(AllowAdjustment, bool);
125  vtkGetMacro(AllowAdjustment, bool);
126  vtkBooleanMacro(AllowAdjustment, bool);
128 
129 protected:
131  ~vtkVRPanelRepresentation() override;
132 
133  // Keep track of event positions
134  double LastEventPosition[3];
135  double LastEventOrientation[4];
136  double StartEventOrientation[4];
137 
138  double LastScale;
139 
141 
142  void UpdatePose(double* p1, double* d1, double* p2, double* d2);
143 
144  void ComputeMatrix(vtkRenderer* ren);
145 
147  {
148  World = 0,
149  HMD = 1,
152  };
153 
155 
156  // The text
159 
160 private:
162  void operator=(const vtkVRPanelRepresentation&) = delete;
163 };
164 
165 VTK_ABI_NAMESPACE_END
166 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
virtual void PlaceWidget(double bounds[6])
The following is a suggested API for widget representations.
abstract specification for Viewports
Definition: vtkViewport.h:46
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:63
virtual void EndComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
virtual void StartComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
platform-independent render window interaction including picking and frame rate control.
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...
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...