VTK
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.
58  enum _InteractionState { Outside=0, Moving };
59 
61 
64  void BuildRepresentation() override;
65  void PlaceWidget(double bounds[6]) override;
68  vtkAbstractWidget *widget,
69  unsigned long event, void *calldata) override;
72  vtkAbstractWidget *widget,
73  unsigned long event, void *calldata) override;
76  vtkAbstractWidget *widget,
77  unsigned long event, void *calldata, int modify = 0) override;
80  vtkAbstractWidget *widget,
81  unsigned long event, void *calldata) override;
83 
84  // Place the widget with a few more options
85  // This method allows you to place the panel
86  // and provides more options so that you can get
87  // the exact positioning you want.
88  // Bounds are the bounds that you want the panel to
89  // fit within. For World coordinates they should be in
90  // world coordinates. For all others they should be in
91  // physical meters relative to the HMD or controller origin.
92  // The normal is the direction the planel should face.
93  // The coordinate system for the controller is X right
94  // Y up and Z towards the handle. Upvec specifies the
95  // vector to use as up for the panel. Note that upvec
96  // has priority over normal, if they are not orthogonal
97  // normal will be modified to be orthogonal to upvec.
98  // Scale is the physical scale from the RenderWindow
99  // and is used to position/scale the panel correctly.
100  //
101  // Note that you should set the Text on the panel
102  // before calling this method as the positioning
103  // and scaling is done based on the current text.
104  //
105  // All vectors will be normalized prior to use.
106  void PlaceWidgetExtended(const double *bounds,
107  const double *normal, const double *upvec, double scale);
108 
110 
118 
120 
123  void SetText(const char* str);
125 
126  // allow access to the underlying text actor
127  // so that properties can be set
128  vtkGetObjectMacro(TextActor, vtkTextActor3D);
129 
130  // Set the coordinate system to use for this prop
135 
137 
140  vtkSetMacro(AllowAdjustment, bool);
141  vtkGetMacro(AllowAdjustment, bool);
142  vtkBooleanMacro(AllowAdjustment, bool);
144 
145 protected:
148 
149  // Keep track of event positions
150  double LastEventPosition[3];
151  double LastEventOrientation[4];
152  double StartEventOrientation[4];
153 
154  double LastScale;
155 
157 
158  void UpdatePose(double *p1, double *d1, double *p2, double *d2);
159 
160 
162 
164  World = 0,
165  HMD = 1,
168  };
169 
171 
172  // The text
175 
176 private:
178  void operator=(const vtkOpenVRPanelRepresentation&) = delete;
179 };
180 
181 #endif
vtkWidgetRepresentation.h
vtkEventDataDevice::LeftController
@ LeftController
vtkOpenVRPanelRepresentation::Text
std::string Text
Definition: vtkOpenVRPanelRepresentation.h:174
vtkOpenVRPanelRepresentation::New
static vtkOpenVRPanelRepresentation * New()
Instantiate the class.
vtkX3D::scale
@ scale
Definition: vtkX3D.h:229
vtkOpenVRPanelRepresentation::UpdatePose
void UpdatePose(double *p1, double *d1, double *p2, double *d2)
vtkOpenVRPanelRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkOpenVRPanelRepresentation::_InteractionState
_InteractionState
Definition: vtkOpenVRPanelRepresentation.h:58
vtkTextActor3D
An actor that displays text.
Definition: vtkTextActor3D.h:48
vtkEventDataDevice::RightController
@ RightController
vtkOpenVRPanelRepresentation::CoordinateSystems
CoordinateSystems
Definition: vtkOpenVRPanelRepresentation.h:163
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:61
vtkOpenVRPanelRepresentation::BuildRepresentation
void BuildRepresentation() override
Methods to interface with the vtkOpenVRPanelWidget.
vtkOpenVRPanelRepresentation::StartComplexInteraction
void StartComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
vtkPicker
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:59
vtkOpenVRPanelRepresentation::~vtkOpenVRPanelRepresentation
~vtkOpenVRPanelRepresentation() override
vtkOpenVRPanelRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkOpenVRPanelRepresentation::ComputeComplexInteractionState
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
vtkOpenVRPanelRepresentation::TextActor
vtkTextActor3D * TextActor
Definition: vtkOpenVRPanelRepresentation.h:173
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:64
vtkOpenVRPanelRepresentation
Widget representation for vtkOpenVRPanelWidget Implementation of the popup panel representation for t...
Definition: vtkOpenVRPanelRepresentation.h:39
vtkOpenVRPanelRepresentation::ComplexInteraction
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkOpenVRPanelRepresentation::PlaceWidgetExtended
void PlaceWidgetExtended(const double *bounds, const double *normal, const double *upvec, double scale)
vtkOpenVRPanelRepresentation::SetText
void SetText(const char *str)
Set panel text.
vtkOpenVRPanelRepresentation::SetCoordinateSystemToLeftController
void SetCoordinateSystemToLeftController()
vtkOpenVRPanelRepresentation::ComputeMatrix
void ComputeMatrix(vtkRenderer *ren)
vtkOpenVRPanelRepresentation::PlaceWidget
void PlaceWidget(double bounds[6]) override
vtkOpenVRPanelRepresentation::SetCoordinateSystemToHMD
void SetCoordinateSystemToHMD()
vtkOpenVRPanelRepresentation::LastScale
double LastScale
Definition: vtkOpenVRPanelRepresentation.h:154
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:79
vtkOpenVRPanelRepresentation::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:48
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkOpenVRPanelRepresentation::CoordinateSystem
CoordinateSystems CoordinateSystem
Definition: vtkOpenVRPanelRepresentation.h:170
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkOpenVRPanelRepresentation::SetCoordinateSystemToRightController
void SetCoordinateSystemToRightController()
vtkOpenVRPanelRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkOpenVRPanelRepresentation::SetCoordinateSystemToWorld
void SetCoordinateSystemToWorld()
vtkOpenVRPanelRepresentation::EndComplexInteraction
void EndComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkOpenVRPanelRepresentation::vtkOpenVRPanelRepresentation
vtkOpenVRPanelRepresentation()
vtkOpenVRPanelRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
vtkOpenVRPanelRepresentation::AllowAdjustment
bool AllowAdjustment
Definition: vtkOpenVRPanelRepresentation.h:156