VTK  9.0.1
vtkOpenVRControlsHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkOpenVRControlsHelper.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 =========================================================================*/
24 #ifndef vtkOpenVRControlsHelper_h
25 #define vtkOpenVRControlsHelper_h
26 
27 #include "vtkEventData.h" // for enums
28 #include "vtkNew.h" // for iVar
29 #include "vtkProp.h"
30 #include "vtkRenderingOpenVRModule.h" // For export macro
31 #include "vtkStdString.h" // needed for vtkStdString iVar.
32 #include "vtkWeakPointer.h" // needed for vtkWeakPointer iVar.
33 
34 class vtkActor;
35 class vtkProperty;
36 class vtkPolyData;
37 class vtkPolyDataMapper;
38 class vtkCellArray;
39 class vtkPoints;
40 class vtkTextActor3D;
41 class vtkTransform;
42 
43 class vtkLineSource;
44 class vtkPolyDataMapper;
45 class vtkRenderer;
46 class vtkCallbackCommand;
47 
48 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRControlsHelper : public vtkProp
49 {
50 public:
54  static vtkOpenVRControlsHelper* New();
55 
57 
61  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
65  {
66  Back = -1,
67  Front = 1
68  };
69 
70  enum DrawSides
71  {
72  Left = -1,
73  Right = 1
74  };
75 
77 
80  void BuildRepresentation();
81  void UpdateRepresentation();
83 
85 
88  void ReleaseGraphicsResources(vtkWindow*) override;
89  int RenderOpaqueGeometry(vtkViewport*) override;
93 
95 
98  void SetText(vtkStdString str);
100 
101  void SetTooltipInfo(const char* s, int buttonSide, int drawSide, const char* txt)
102  {
103  if (!s || !txt)
104  {
105  return;
106  }
107  this->ComponentName = vtkStdString(s);
108  this->DrawSide = drawSide;
109  this->ButtonSide = buttonSide;
110  this->SetText(vtkStdString(txt));
111  }
112 
113  void SetEnabled(bool enabled);
114  vtkGetMacro(Enabled, bool);
115  vtkBooleanMacro(Enabled, bool);
116 
117  void SetDevice(vtkEventDataDevice val);
118 
119  virtual void SetRenderer(vtkRenderer* ren);
120  virtual vtkRenderer* GetRenderer();
121 
122 protected:
124  ~vtkOpenVRControlsHelper() override;
125 
126  double FrameSize[2];
127 
128  // The text
131 
132  // The line
136 
138 
139  // Tooltip parameters
141  int DrawSide; // Left/Right
142  int ButtonSide; // Front/Back
143 
144  bool Enabled;
145 
146  double ControlPositionLC[3];
147 
148  // The renderer in which this widget is placed
150 
152  unsigned long ObserverTag;
153  static void MoveEvent(vtkObject* object, unsigned long event, void* clientdata, void* calldata);
154 
155  void InitControlPosition();
156 
158  double LastPhysicalTranslation[3];
159  double LastEventPosition[3];
160  double LastEventOrientation[4];
163 
164 private:
166  void operator=(const vtkOpenVRControlsHelper&) = delete;
167 };
168 
169 #endif
vtkNew< vtkTransform > TempTransform
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkWeakPointer< vtkRenderer > Renderer
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
abstract base class for most VTK objects
Definition: vtkObject.h:62
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:61
virtual int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:221
virtual vtkTypeBool HasTranslucentPolygonalGeometry()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
Definition: vtkProp.h:285
abstract specification for renderers
Definition: vtkRenderer.h:67
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
int vtkTypeBool
Definition: vtkABI.h:69
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:306
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkCallbackCommand * MoveCallbackCommand
supports function callbacks
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:25
An actor that displays text.
create a line defined by two end points
Definition: vtkLineSource.h:60
map vtkPolyData to graphics primitives
object to represent cell connectivity
Definition: vtkCellArray.h:179
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Definition: vtkProp.h:222
void SetTooltipInfo(const char *s, int buttonSide, int drawSide, const char *txt)
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Tooltip helper explaining controls Helper class to draw one tooltip per button around the controller...
represent and manipulate 3D points
Definition: vtkPoints.h:33