VR-Forces 5.0.2 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) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
13 #include <vrvCore/DtUniqueID.h>
15 
16 #include <string>
17 #include <vector>
18 
19 #include <matrix/vlVector.h>
20 #include <matrix/vlTaitBryan.h>
21 
22 #include <vrvUtil/signalslib.h>
23 
24 namespace makVrv
25 {
26  class DtModelDefinition;
27  class DtDe;
28 
40  {
41  public:
42 
44  DtModelInstance(DtDe& de);
45 
47  virtual ~DtModelInstance();
48 
51  virtual bool realize(DtModelDefinition& definition);
52 
55  virtual bool cloneInstance(DtModelDefinition& definition);
56 
59  const std::string& realizedDefinitionName() const;
60 
62  virtual bool saveModelToFile(const std::string& filename) const;
63 
65  const DtVector& boundingBoxExtents() const;
66 
68  void getBoundingBoxExtents(double& x, double& y, double& z) const;
69 
71  const DtVector& boundingBoxCenter() const;
72 
74  void getBoundingBoxCenter(double& x, double& y, double& z) const;
75 
77  void getBoundingBoxComponents( DtVector& minimum, DtVector& maximum );
78 
80 
82  const DtVector& allGeometryboundingBoxExtents() const;
84  void getAllGeometryBoundingBoxExtents(double& x, double& y, double& z) const;
86  const DtVector& allGeometryboundingBoxCenter() const;
88  void getAllGeometryBoundingBoxCenter(double& x, double& y, double& z) const;
90  void getAllGeometryBoundingBoxComponents(DtVector& minimum, DtVector& maximum);
91 
94  virtual void setContributesToBound( bool trueOrFalse );
95 
98  bool contributesToBound() const;
99 
101  virtual void setVisible(bool isVisible) = 0;
102 
104  virtual void setBlendColor(float r, float g, float b, float a);
105 
109  virtual void enableColorBlending( bool b );
110 
111  //Utility function for reading a float from a definition.
112  static float readFloat(const std::string& paramName, const DtModelDefinition& definition);
113 
114  //Utility function for reading a Vec4 from a definition.
115  static DtVector readVector(const std::string& paramName, const DtModelDefinition& definition);
116 
117  boost::signalslib::signal<void (DtModelInstance*)> signal_modelInstanceChanged;
118 
119  protected:
120 
127 
128  //We need the full size of the geometry with all switches active to get a max bounds for instancing.
133 
135 
136  //Note about myColorBlendingEnabled: If this particular model has instancing enabled then this flag is set to false
137  // and color blending is handled by the instance manager.
139  float myBlendRed;
140  float myBlendBlue;
143 
144  };
145 
149  {
150  public:
151 
153  virtual ~DtModelInstanceCreator();
154 
156  virtual DtModelInstance* create(DtDe& de) = 0;
157 
158  protected:
159 
161  };
162 
163 }
DtVector myBoundingBoxCenter
Definition: DtModelInstance.h:123
The base class for all model instances.
Definition: DtModelInstance.h:39
bool myColorBlendingEnabled
Definition: DtModelInstance.h:138
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:131
boost::signalslib::signal< void(DtModelInstance *)> signal_modelInstanceChanged
Definition: DtModelInstance.h:117
DtVector myAllGeometryBoundingBoxMaximum
Definition: DtModelInstance.h:132
DtVector myBoundingBoxMaximum
Definition: DtModelInstance.h:126
DtVector myAllGeometryBoundingBoxExtents
Definition: DtModelInstance.h:130
A model definition Interaction any number of named parameters, and also can be used to store cached d...
Definition: DtModelDefinition.h:38
float myBlendBlue
Definition: DtModelInstance.h:140
Contains makVrv::DtVirtualBaseClass class.
std::string myRealizedModelDefinitionName
Definition: DtModelInstance.h:122
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
The polymorphic creator for the DtModelInstance.
Definition: DtModelInstance.h:148
bool myContributesToBound
Definition: DtModelInstance.h:134
float myBlendAlpha
Definition: DtModelInstance.h:142
DtDe & myDe
Definition: DtModelInstance.h:121
DtVector myBoundingBoxMinimum
Definition: DtModelInstance.h:125
float myBlendRed
Definition: DtModelInstance.h:139
DtVector myBoundingBoxExtents
Definition: DtModelInstance.h:124
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:70
DtVector myAllGeometryBoundingBoxCenter
Definition: DtModelInstance.h:129
float myBlendGreen
Definition: DtModelInstance.h:141
Contains DLL export macros.

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)