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