VTK  9.2.6
vtkVRModel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkVRModel.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 =========================================================================*/
25 #ifndef vtkVRModel_h
26 #define vtkVRModel_h
27 
28 #include "vtkNew.h" // for ivar
29 #include "vtkObject.h"
30 #include "vtkOpenGLHelper.h" // ivar
31 #include "vtkRenderingVRModule.h" // For export macro
32 
33 class vtkMatrix4x4;
36 class vtkTextureObject;
37 class vtkVRRay;
38 
39 class VTKRENDERINGVR_EXPORT vtkVRModel : public vtkObject
40 {
41 public:
42  vtkTypeMacro(vtkVRModel, vtkObject);
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
45  bool Build(vtkOpenGLRenderWindow* win);
46 
47  void Render(vtkOpenGLRenderWindow* win, vtkMatrix4x4* poseInTrackingCoordinates);
48 
49  const std::string& GetName() const { return this->ModelName; }
50  void SetName(const std::string& modelName) { this->ModelName = modelName; }
51 
52  // show the model
53  void SetVisibility(bool v) { this->Visibility = v; }
54  bool GetVisibility() { return this->Visibility; }
55 
56  // Set Ray parameters
57  void SetShowRay(bool v);
58  void SetRayLength(double length);
59  void SetRayColor(double r, double g, double b);
60  vtkVRRay* GetRay() { return this->Ray; }
61 
62  void ReleaseGraphicsResources(vtkWindow* win);
63 
64 protected:
65  vtkVRModel();
66  ~vtkVRModel() override;
67 
68  virtual void FillModelHelper() = 0;
69  virtual void SetPositionAndTCoords() = 0;
70  virtual void CreateTextureObject(vtkOpenGLRenderWindow* win) = 0;
71  virtual void LoadModelAndTexture(vtkOpenGLRenderWindow* win) = 0;
72 
74 
75  bool Visibility;
76  bool Loaded;
78 
83 
84  // Controller ray
86 
87 private:
88  vtkVRModel(const vtkVRModel&) = delete;
89  void operator=(const vtkVRModel&) = delete;
90 };
91 
92 #endif
OpenGL rendering window.
abstract base class for most VTK objects
Definition: vtkObject.h:62
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.
std::string ModelName
Definition: vtkVRModel.h:73
VR device model.
Definition: vtkVRRay.h:35
vtkNew< vtkTextureObject > TextureObject
Definition: vtkVRModel.h:81
bool GetVisibility()
Definition: vtkVRModel.h:54
vtkOpenGLHelper ModelHelper
Definition: vtkVRModel.h:79
VR device model.
Definition: vtkVRModel.h:39
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkNew< vtkVRRay > Ray
Definition: vtkVRModel.h:85
void SetVisibility(bool v)
Definition: vtkVRModel.h:53
vtkOpenGLVertexBufferObject * ModelVBO
Definition: vtkVRModel.h:80
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkVRRay * GetRay()
Definition: vtkVRModel.h:60
bool Loaded
Definition: vtkVRModel.h:76
bool Visibility
Definition: vtkVRModel.h:75
bool FailedToLoad
Definition: vtkVRModel.h:77
abstracts an OpenGL texture object.
const std::string & GetName() const
Definition: vtkVRModel.h:49
void SetName(const std::string &modelName)
Definition: vtkVRModel.h:50
vtkNew< vtkMatrix4x4 > ModelToProjectionMatrix
Definition: vtkVRModel.h:82