VTK
vtkOpenVRModel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 
5 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6 All rights reserved.
7 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
23 #ifndef vtkOpenVRModel_h
24 #define vtkOpenVRModel_h
25 
26 #include "vtkRenderingOpenVRModule.h" // For export macro
27 #include "vtkObject.h"
28 #include "vtkOpenGLHelper.h" // ivar
29 #include "vtkNew.h" // for ivar
30 #include <openvr.h> // for ivars
31 
33 class vtkRenderWindow;
35 class vtkTextureObject;
36 class vtkMatrix4x4;
37 class vtkOpenVRRay;
38 
39 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRModel : public vtkObject
40 {
41 public:
42  static vtkOpenVRModel *New();
43  vtkTypeMacro(vtkOpenVRModel, vtkObject);
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
46  bool Build(vtkOpenVRRenderWindow *win);
47  void Render(vtkOpenVRRenderWindow *win,
48  const vr::TrackedDevicePose_t &pose);
49 
50  const std::string & GetName() const {
51  return this->ModelName;
52  }
53  void SetName(const std::string & modelName) {
54  this->ModelName = modelName;
55  };
56 
57  // show the model
58  void SetVisibility(bool v) {
59  this->Visibility = v;
60  };
61  bool GetVisibility() {
62  return this->Visibility;
63  };
64 
65  //Set Ray parameters
66  void SetShowRay(bool v);
67  void SetRayLength(double length);
68 
69  void ReleaseGraphicsResources(vtkRenderWindow *win);
70 
71  // the tracked device this model represents if any
72  vr::TrackedDeviceIndex_t TrackedDevice;
73 
74  vr::RenderModel_t *RawModel;
75 
76 protected:
78  ~vtkOpenVRModel() override;
79 
81 
82  bool Visibility;
83  bool Loaded;
85 
86  vr::RenderModel_TextureMap_t *RawTexture;
91 
92  //Controller ray
94 
95 private:
96  vtkOpenVRModel(const vtkOpenVRModel&) = delete;
97  void operator=(const vtkOpenVRModel&) = delete;
98 };
99 
100 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkNew< vtkTextureObject > TextureObject
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkNew< vtkOpenVRRay > Ray
vr::RenderModel_TextureMap_t * RawTexture
void SetVisibility(bool v)
void SetName(const std::string &modelName)
a simple class to control print indentation
Definition: vtkIndent.h:39
vr::RenderModel_t * RawModel
abstracts an OpenGL texture object.
OpenVR rendering window.
create a window for renderers to draw into
vr::TrackedDeviceIndex_t TrackedDevice
const std::string & GetName() const
bool GetVisibility()
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkOpenGLVertexBufferObject * ModelVBO
vtkOpenGLHelper ModelHelper
OpenVR device model.
std::string ModelName
vtkNew< vtkMatrix4x4 > PoseMatrix