VTK  9.3.20240426
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
23VTK_ABI_NAMESPACE_BEGIN
24class vtkTextActor3D;
25
26class VTKRENDERINGVR_EXPORT vtkVRPanelRepresentation : public vtkWidgetRepresentation
27{
28public:
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.
91 const double* bounds, const double* normal, const double* upvec, double scale);
92
94
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
119
121
124 vtkSetMacro(AllowAdjustment, bool);
125 vtkGetMacro(AllowAdjustment, bool);
126 vtkBooleanMacro(AllowAdjustment, bool);
128
129protected:
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
145
147 {
148 World = 0,
149 HMD = 1,
152 };
153
155
156 // The text
158 std::string Text;
159
160private:
162 void operator=(const vtkVRPanelRepresentation&) = delete;
163};
164
165VTK_ABI_NAMESPACE_END
166#endif
define the API for widget / widget representation
a simple class to control print indentation
Definition vtkIndent.h:108
platform-independent render window interaction including picking and frame rate control.
abstract specification for renderers
An actor that displays text.
Widget representation for vtkVRPanelWidget Implementation of the popup panel representation for the v...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkVRPanelWidget.
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkVRPanelWidget.
void PlaceWidgetExtended(const double *bounds, const double *normal, const double *upvec, double scale)
void ComputeMatrix(vtkRenderer *ren)
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting the rendering process.
void SetCoordinateSystemToRightController()
~vtkVRPanelRepresentation() override
static vtkVRPanelRepresentation * New()
Instantiate the class.
void UpdatePose(double *p1, double *d1, double *p2, double *d2)
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
void StartComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkVRPanelWidget.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting the rendering process.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
void SetCoordinateSystemToLeftController()
void SetText(const char *str)
Set panel text.
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
Methods to interface with the vtkVRPanelWidget.
void BuildRepresentation() override
Methods to interface with the vtkVRPanelWidget.
void EndComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkVRPanelWidget.
abstract specification for Viewports
Definition vtkViewport.h:65
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64