VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtModelInstance.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
13 #include <vrvCore/DtUniqueID.h>
14 
15 #include <vrvMath/DtVector4.h>
16 
17 #include <string>
18 #include <vector>
19 
20 #include <matrix/vlVector.h>
21 #include <matrix/vlTaitBryan.h>
22 
23 #include <vrvUtil/signalslib.h>
25 
26 namespace makVrv
27 {
28  class DtDe;
29  class DtDefinitionCachePayload;
30  class DtModelDefinition;
31  class DtModelLoadParams;
32 
44  {
45  public:
46 
48  DtModelInstance(DtDe& de);
49 
51  virtual ~DtModelInstance();
52 
55  virtual bool realize(const DtModelDefinition& definition);
56 
62  virtual bool cloneInstanceBackground(const DtModelDefinition& definition,
63  const std::string& filename, const DtModelLoadParams& params,
64  DtDefinitionCachePayload& payload);
65 
70  virtual bool cloneInstanceMainThread(const DtModelDefinition& definition,
71  const std::string& filename);
72 
75  const std::string& realizedDefinitionName() const;
76 
78  virtual bool saveModelToFile(const std::string& filename) const;
79 
81  const DtVector& boundingBoxExtents() const;
82 
84  void getBoundingBoxExtents(double& x, double& y, double& z) const;
85 
87  const DtVector& boundingBoxCenter() const;
88 
90  void getBoundingBoxCenter(double& x, double& y, double& z) const;
91 
93  void getBoundingBoxComponents( DtVector& minimum, DtVector& maximum );
94 
96 
98  const DtVector& allGeometryboundingBoxExtents() const;
100  void getAllGeometryBoundingBoxExtents(double& x, double& y, double& z) const;
102  const DtVector& allGeometryboundingBoxCenter() const;
104  void getAllGeometryBoundingBoxCenter(double& x, double& y, double& z) const;
106  void getAllGeometryBoundingBoxComponents(DtVector& minimum, DtVector& maximum);
107 
110  virtual void setContributesToBound( bool trueOrFalse );
111 
114  bool contributesToBound() const;
115 
117  virtual void setVisible(bool isVisible) = 0;
118 
120  virtual void setBlendColor(float r, float g, float b, float a);
121 
125  virtual void enableColorBlending( bool b );
126 
128  virtual void setSensorMask(unsigned int sensorMask);
129 
130  //Utility function for reading a float from a definition.
131  static float readFloat(const std::string& paramName, const DtModelDefinition& definition);
132 
133  //Utility function for reading a 3 value Vector from a definition.
134  static DtVector readVector(const std::string& paramName, const DtModelDefinition& definition);
135 
136  //Utility function for reading a 4 floating point value Vector from a definition.
137  static DtVector4<float> readVector4(const std::string& paramName, const DtModelDefinition& definition);
138 
139  boost::signalslib::signal<void (DtModelInstance*)> signal_modelInstanceChanged;
140 
141  protected:
142 
149 
150  //We need the full size of the geometry with all switches active to get a max bounds for instancing.
155 
157 
158  //Note about myColorBlendingEnabled: If this particular model has instancing enabled then this flag is set to false
159  // and color blending is handled by the instance manager.
161  float myBlendRed;
162  float myBlendBlue;
165 
166  };
167 
171  {
172  public:
173 
175  virtual ~DtModelInstanceCreator();
176 
178  virtual DtModelInstance* create(DtDe& de) = 0;
179 
180  protected:
181 
183  };
184 
185 }
DtVector myBoundingBoxCenter
Definition: DtModelInstance.h:145
The base class for all model instances.
Definition: DtModelInstance.h:43
bool myColorBlendingEnabled
Definition: DtModelInstance.h:160
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
DtVector myAllGeometryBoundingBoxMinimum
Definition: DtModelInstance.h:153
boost::signalslib::signal< void(DtModelInstance *)> signal_modelInstanceChanged
Definition: DtModelInstance.h:139
DtVector myAllGeometryBoundingBoxMaximum
Definition: DtModelInstance.h:154
DtVector myBoundingBoxMaximum
Definition: DtModelInstance.h:148
4 dimensional vector
DtVector myAllGeometryBoundingBoxExtents
Definition: DtModelInstance.h:152
A model definition Interaction any number of named parameters, and also can be used to store cached d...
Definition: DtModelDefinition.h:44
float myBlendBlue
Definition: DtModelInstance.h:162
Contains makVrv::DtVirtualBaseClass class.
std::string myRealizedModelDefinitionName
Definition: DtModelInstance.h:144
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
The polymorphic creator for the DtModelInstance.
Definition: DtModelInstance.h:170
bool myContributesToBound
Definition: DtModelInstance.h:156
float myBlendAlpha
Definition: DtModelInstance.h:164
DtDe & myDe
Definition: DtModelInstance.h:143
DtVector myBoundingBoxMinimum
Definition: DtModelInstance.h:147
float myBlendRed
Definition: DtModelInstance.h:161
DtVector myBoundingBoxExtents
Definition: DtModelInstance.h:146
Contains makVrv::DtUniqueID type.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
DtVector myAllGeometryBoundingBoxCenter
Definition: DtModelInstance.h:151
Parameters pre-read from a DtModelDefinition, either from the live definition on the main thread via ...
Definition: DtModelLoadParams.h:34
float myBlendGreen
Definition: DtModelInstance.h:163
Accumulates definition cache entries produced by a background load.
Definition: DtDefinitionCachePayload.h:37
Contains DLL export macros.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)