VTK  9.0.1
vtkOpenVRPanelRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkImplicitPlaneRepresentation.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 =========================================================================*/
28 #ifndef vtkOpenVRPanelRepresentation_h
29 #define vtkOpenVRPanelRepresentation_h
30 
31 #include "vtkRenderingOpenVRModule.h" // For export macro
33 #include <string> // for ivar
34 
35 class vtkPicker;
36 class vtkTextActor3D;
37 
38 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRPanelRepresentation : public vtkWidgetRepresentation
39 {
40 public:
45 
47 
51  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
54  // Enums define the state of the representation relative to the mouse pointer
55  // position. Used by ComputeInteractionState() to communicate with the
56  // widget. Note that ComputeInteractionState() and several other methods
57  // must be implemented by subclasses.
59  {
60  Outside = 0,
61  Moving
62  };
63 
65 
68  void BuildRepresentation() override;
69  void PlaceWidget(double bounds[6]) override;
71  unsigned long event, void* calldata) override;
73  unsigned long event, void* calldata) override;
75  unsigned long event, void* calldata, int modify = 0) override;
77  unsigned long event, void* calldata) override;
79 
80  // Place the widget with a few more options
81  // This method allows you to place the panel
82  // and provides more options so that you can get
83  // the exact positioning you want.
84  // Bounds are the bounds that you want the panel to
85  // fit within. For World coordinates they should be in
86  // world coordinates. For all others they should be in
87  // physical meters relative to the HMD or controller origin.
88  // The normal is the direction the planel should face.
89  // The coordinate system for the controller is X right
90  // Y up and Z towards the handle. Upvec specifies the
91  // vector to use as up for the panel. Note that upvec
92  // has priority over normal, if they are not orthogonal
93  // normal will be modified to be orthogonal to upvec.
94  // Scale is the physical scale from the RenderWindow
95  // and is used to position/scale the panel correctly.
96  //
97  // Note that you should set the Text on the panel
98  // before calling this method as the positioning
99  // and scaling is done based on the current text.
100  //
101  // All vectors will be normalized prior to use.
102  void PlaceWidgetExtended(
103  const double* bounds, const double* normal, const double* upvec, double scale);
104 
106 
109  void ReleaseGraphicsResources(vtkWindow*) override;
110  int RenderOpaqueGeometry(vtkViewport*) override;
114 
116 
119  void SetText(const char* str);
121 
122  // allow access to the underlying text actor
123  // so that properties can be set
124  vtkGetObjectMacro(TextActor, vtkTextActor3D);
125 
126  // Set the coordinate system to use for this prop
127  void SetCoordinateSystemToWorld();
128  void SetCoordinateSystemToHMD();
129  void SetCoordinateSystemToLeftController();
130  void SetCoordinateSystemToRightController();
131 
133 
136  vtkSetMacro(AllowAdjustment, bool);
137  vtkGetMacro(AllowAdjustment, bool);
138  vtkBooleanMacro(AllowAdjustment, bool);
140 
141 protected:
143  ~vtkOpenVRPanelRepresentation() override;
144 
145  // Keep track of event positions
146  double LastEventPosition[3];
147  double LastEventOrientation[4];
148  double StartEventOrientation[4];
149 
150  double LastScale;
151 
153 
154  void UpdatePose(double* p1, double* d1, double* p2, double* d2);
155 
156  void ComputeMatrix(vtkRenderer* ren);
157 
159  {
160  World = 0,
161  HMD = 1,
164  };
165 
167 
168  // The text
171 
172 private:
174  void operator=(const vtkOpenVRPanelRepresentation&) = delete;
175 };
176 
177 #endif
vtkWidgetRepresentation.h
vtkEventDataDevice::LeftController
@ LeftController
vtkOpenVRPanelRepresentation::Text
std::string Text
Definition: vtkOpenVRPanelRepresentation.h:170
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkOpenVRPanelRepresentation::_InteractionState
_InteractionState
Definition: vtkOpenVRPanelRepresentation.h:58
vtkTextActor3D
An actor that displays text.
Definition: vtkTextActor3D.h:44
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkEventDataDevice::RightController
@ RightController
vtkOpenVRPanelRepresentation::CoordinateSystems
CoordinateSystems
Definition: vtkOpenVRPanelRepresentation.h:158
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:59
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkPicker
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:61
vtkWidgetRepresentation::StartComplexInteraction
virtual void StartComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
Definition: vtkWidgetRepresentation.h:149
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkWidgetRepresentation::ComputeComplexInteractionState
virtual int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *callData, int modify=0)
vtkOpenVRPanelRepresentation::TextActor
vtkTextActor3D * TextActor
Definition: vtkOpenVRPanelRepresentation.h:169
vtkWidgetRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
Definition: vtkWidgetRepresentation.h:216
vtkWidgetRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkWidgetRepresentation.h:213
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:65
vtkWidgetRepresentation::ComplexInteraction
virtual void ComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
Definition: vtkWidgetRepresentation.h:153
vtkWidgetRepresentation::EndComplexInteraction
virtual void EndComplexInteraction(vtkRenderWindowInteractor *, vtkAbstractWidget *, unsigned long, void *)
Definition: vtkWidgetRepresentation.h:157
vtkOpenVRPanelRepresentation
Widget representation for vtkOpenVRPanelWidget Implementation of the popup panel representation for t...
Definition: vtkOpenVRPanelRepresentation.h:38
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkOpenVRPanelRepresentation::LastScale
double LastScale
Definition: vtkOpenVRPanelRepresentation.h:150
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:82
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkWidgetRepresentation::PlaceWidget
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
The following is a suggested API for widget representations.
Definition: vtkWidgetRepresentation.h:134
vtkOpenVRPanelRepresentation::CoordinateSystem
CoordinateSystems CoordinateSystem
Definition: vtkOpenVRPanelRepresentation.h:166
vtkWidgetRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
Definition: vtkWidgetRepresentation.h:215
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:67
vtkWidgetRepresentation::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkWidgetRepresentation.h:218
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkOpenVRPanelRepresentation::AllowAdjustment
bool AllowAdjustment
Definition: vtkOpenVRPanelRepresentation.h:152
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.