VTK  9.3.20240327
vtkOpenGLAvatar.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
11 #ifndef vtkOpenGLAvatar_h
12 #define vtkOpenGLAvatar_h
13 
14 #include "vtkAvatar.h"
15 #include "vtkNew.h" // for ivars
16 #include "vtkRenderingVRModule.h" // For export macro
17 
18 VTK_ABI_NAMESPACE_BEGIN
19 class vtkOpenGLActor;
21 class vtkOpenGLRenderer;
22 class vtkVRRay;
23 class vtkFlagpoleLabel;
24 class vtkTextProperty;
25 
26 class VTKRENDERINGVR_EXPORT vtkOpenGLAvatar : public vtkAvatar
27 {
28 public:
29  static vtkOpenGLAvatar* New();
30  vtkTypeMacro(vtkOpenGLAvatar, vtkAvatar);
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
36  int RenderOpaqueGeometry(vtkViewport* vp) override;
38 
39  double* GetBounds() VTK_SIZEHINT(6) override;
40 
41  void SetUseLeftHand(bool val) override;
42  void SetUseRightHand(bool val) override;
43  void SetShowHandsOnly(bool val) override;
44 
45  // Set Ray parameters
46  void SetLeftShowRay(bool v);
47  void SetRightShowRay(bool v);
48  void SetRayLength(double length);
49 
50  void SetLabel(const char* label);
51  vtkTextProperty* GetLabelTextProperty();
52 
53 protected:
55  ~vtkOpenGLAvatar() override;
56 
57  // move the torso and arms based on head/hand inputs.
58  void CalcBody();
59 
61  vtkNew<vtkOpenGLActor> HeadActor;
63  vtkNew<vtkOpenGLActor> LeftHandActor;
64  vtkNew<vtkOpenGLPolyDataMapper> RightHandMapper;
65  vtkNew<vtkOpenGLActor> RightHandActor;
66  vtkNew<vtkOpenGLPolyDataMapper> BodyMapper[NUM_BODY];
67  vtkNew<vtkOpenGLActor> BodyActor[NUM_BODY];
68 
69  vtkNew<vtkVRRay> LeftRay;
70  vtkNew<vtkVRRay> RightRay;
71 
72  vtkNew<vtkFlagpoleLabel> LabelActor;
73 
74 private:
75  vtkOpenGLAvatar(const vtkOpenGLAvatar&) = delete;
76  void operator=(const vtkOpenGLAvatar&) = delete;
77 };
78 
79 VTK_ABI_NAMESPACE_END
80 #endif
Renders head and hands for a user in VR.
Definition: vtkAvatar.h:22
Renders a flagpole (line) with a label at the top that faces the camera.
a simple class to control print indentation
Definition: vtkIndent.h:108
Allocate and hold a VTK object.
Definition: vtkNew.h:160
OpenGL actor.
OpenGL Avatar.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RenderTranslucentPolygonalGeometry(vtkViewport *vp) override
Support the standard render methods.
static vtkOpenGLAvatar * New()
double * GetBounds() override
Return a reference to the Prop3D's composite transform.
int RenderOpaqueGeometry(vtkViewport *vp) override
Actual Avatar render method.
PolyDataMapper using OpenGL to render.
OpenGL renderer.
represent text properties.
VR device model.
Definition: vtkVRRay.h:25
abstract specification for Viewports
Definition: vtkViewport.h:64
@ length
Definition: vtkX3D.h:393
#define VTK_SIZEHINT(...)