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