VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectGeometryAggregator.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2024 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
24 
27 
29 
30 #include <osg/NodeVisitor>
31 #include <osg/Geometry>
32 #include <osg/ref_ptr>
33 
34 #include <stack>
35 
36 
37 namespace osg
38 {
39  class Texture;
40  class LOD;
41 }
42 
43 namespace osgSim
44 {
45  class MultiSwitch;
46  class DOFTransform;
47 }
48 
49 namespace makVrv
50 {
51  class DtIndirectTextureCollectionPolicy;
52  class DtIndirectLimitTextureStrategy;
53  class DtIndirectGeometryStateManager;
54 
55  class DtDynamicTerrainSwitchNode;
56  class DtDynamicTerrainSequenceNode;
57  class DtIndirectAggregateHelper;
58  class DtIndirectModelInfoContainer;
59  class DtLightPointNode;
60  class DtIndirectModelInfo;
61  class DtIndirectDefaultTexturesContainer;
62  class DtIndirectTexturePrototypeManager;
63  class DtIndirectModelRegistrationInfo;
64 
65  class DtDe;
66 
67  struct DtCopyModelDataStructure;
68 
71 
79 
81  template <>
82  inline const char* creatorTypeName<DtIndirectGeometryAggregator>(void) { return "DtIndirectGeometryAggregatorCreator"; }
83 
90  class DT_DLL_VRVOSG DtIndirectGeometryAggregator : public osg::NodeVisitor
91  {
92  public:
94 
97 
98  protected:
103  , DtIndirectModelInfoContainer& aggregatedGeometry
104  , DtIndirectEffectTexturesTemplate& aggregatedEffectTexturesState
105  , DtIndirectGeometryStateManager& stateManager
106  , const DtIndirectTextureCollectionPolicy& textureCollectionPolicy
107  , const DtIndirectLimitTextureStrategy& limitTextureStrategy
108  );
109 
110 
111  private:
112  //Default constructor not implemented
118 
119  public:
120 
122  virtual void aggregate(const DtIndirectModelRegistrationInfo& info);
123 
125  virtual void apply(osg::Geometry& geometry);
126 
128  virtual void apply(DtDynamicTerrainSwitchNode& node);
129 
131  virtual void apply(DtIndirectIndexedMultiSwitch& node);
132 
134  virtual void apply(osg::Geode& geode);
135 
137  virtual void apply(osg::Node& node);
138 
140  virtual void apply(osg::Switch& node);
141 
143  virtual void apply(osgSim::MultiSwitch& node);
144 
146  virtual void apply(osg::LOD& node);
147 
149  virtual void apply(osg::Sequence& node);
150 
152  virtual void apply(osg::Billboard& node);
153 
155  virtual void apply(DtLightPointNode& node);
156 
159  virtual void augmentModelInfo(osg::Geometry* geometry
160  , const AxisAlignedBoundingBox_32& bbox32
161  , const int state
162  , const DtIndirectGeometryTextures& texturesForThisGeometry
163  , Material& materialForThisGeometry
164  , const bool isLight);
165 
168  virtual void apply(osg::MatrixTransform& matTrans);
169 
171  virtual void apply(osgSim::DOFTransform& node);
172 
174  virtual void apply(osg::LightSource& node) override;
175 
177  virtual int numGeodes() const;
178 
182  virtual int numGeometries() const;
183 
184  protected:
186  virtual Material gatherMaterial(osg::StateSet* ss) const;
187 
189  virtual bool isCullFaceEnabled(const osg::StateSet* ss) const;
190 
192  virtual bool isBlendingEnabled(const osg::StateSet* ss) const;
193 
195  virtual bool isAlphaToCoverageEnabled(const osg::StateSet* ss) const;
196 
198  virtual DtIndirectBlendFunction gatherBlendFunction(const osg::StateSet* ss) const;
199 
201  virtual DtIndirectBlendEquation gatherBlendEquation(const osg::StateSet* ss) const;
202 
204  virtual DtIndirectPolygonOffset gatherPolygonOffset(const osg::StateSet* ss) const;
205 
207  virtual bool isDepthOnly(const osg::StateSet* ss) const;
208 
210  virtual void gatherTextures(DtIndirectGeometryTextures& outTextures, const osg::StateSet* ss, const std::string& modelFileName);
211 
213  virtual osg::Geometry* createDebugLightPointCube(DtLightPointNode& node);
214 
216  virtual osg::Geometry* createDebugLightSourceCube(osg::LightSource& node);
217 
219  virtual void applyToSwitchStack(osg::Group* node, osg::NodePath& nodePath);
220 
222  virtual void computeIndicesOffetAndCount(osg::Geometry* geomPtr, int& indicesOffset, int& indicesCount);
223 
224  protected:
228 
230 
231  unsigned int myMaxUvOffsetId;
234 
235  std::stack<unsigned int> myLastUvOffsetIdStack;
236 
240 
243  {
247  Material myMaterial;
250 
253 
256 
259 
262 
265 
268  };
269 
271  std::stack<AggregatorData> myDataStack;
272  std::stack<osg::Matrix> myMatrixStack;
273 
274  std::stack<int> myBillboardModeStack;
275 
277 
279 
280  // This stack (unlike the terrain/find nodes visitor is not a regular stack
281  // and needs to maintain the full hierarchical paths as it traverses down
285 
287 
288  // used only for outputting debug messages
289  std::string myModelFileName;
290 
291  std::string myModelDefName;
292 
294 
296 
297  friend class ScopedStackOperator;
298  friend class ScopedAnnotationParser;
299 
301 
303 
306 
308 
310 
312 
314 
316 
318  DtIndirectIndexedMultiSwitch* myCurrentIndexedMultiSwitch = nullptr;
319 
321  const DtIndirectModelSubGeometry::VertexRange* myVerticesRange = nullptr;
322 
324  const DtIndirectModelSubGeometry::IndexRange* myIndicesRange = nullptr;
325  };
326 }
Contains makVrv::DtIndirectUvOffsetManager class.
Contains the DtIndirectBlendEquation class declaration.
DtCopyModelDataStructure * myCopyModelDataStructure
Definition: DtIndirectGeometryAggregator.h:315
A Vertex Range given to DtIndirectModelSubGeometry to facility targeting a specific subset of the geo...
Definition: DtIndirectModelSubGeometry.h:62
DtIndirectUvOffsetManager::ScrollableUvOffsetIdsAndMultipliers myScrollableUvOffsetIdsAndMultipliers
Definition: DtIndirectGeometryAggregator.h:233
DtMaterial class declaration.
std::stack< int > myBillboardModeStack
Definition: DtIndirectGeometryAggregator.h:274
std::stack< AggregatorData > myDataStack
stack of Aggregator as traversal happens.
Definition: DtIndirectGeometryAggregator.h:271
DtIndirectEffectTexturesTemplate & myAggregatedEffectTexturesState
Definition: DtIndirectGeometryAggregator.h:237
DtIndirectLodManager::DequeIndirectLodInfos myLodStack
Definition: DtIndirectGeometryAggregator.h:276
DtDynamicTerrainSwitchNode replaces an osgSim::multiswitch in a terrain patch (or page) that is tagge...
Definition: DtDynamicTerrainSwitchNode.h:74
DtIndirectDofManager::DequeNodeDofInfoPairs myDofStack
Definition: DtIndirectGeometryAggregator.h:282
bool myModelIsOcean
Definition: DtIndirectGeometryAggregator.h:309
const DtIndirectTextureCollectionPolicy & myTextureCollectionPolicy
Definition: DtIndirectGeometryAggregator.h:286
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
int myCurrentParentId
Definition: DtIndirectGeometryAggregator.h:284
std::string myModelDefName
Definition: DtIndirectGeometryAggregator.h:291
bool myLightSourcesDaylightControlled
Definition: DtIndirectGeometryAggregator.h:302
current state of the model traversal
Definition: DtIndirectGeometryAggregator.h:242
Contains the DtIndirectBlendFunction class declaration.
DtIndirectGeometryTextures myDefaultTextures
Definition: DtIndirectGeometryAggregator.h:295
This class manages DtIndirectTexturePrototypes during the lifetime of the application.
Definition: DtIndirectTexturePrototypeManager.h:86
DtIndirectDefaultTexturesContainer & myDefaultTexturesContainer
cache to avoid repeated look ups via DtIndirectDefaultTexturesContainer::instance(myDe) ...
Definition: DtIndirectGeometryAggregator.h:305
std::deque< NodeSwitchInfoPair > DequeNodeSwitchInfoPairs
Definition: DtIndirectSwitchManager.h:76
Definition: DtIndirectModelInfoContainer.h:62
Class that loads and contains a bunch of models registered with the registrar. It is owned by the Ind...
Definition: DtIndirectModelInfoContainer.h:88
Abstract class to look in the stateset and collect textures specified via its template The effect tex...
Definition: DtIndirectTextureCollectionPolicy.h:43
This node allows for the indirecting system to index into a geometry object with the intent to have a...
Definition: DtIndirectIndexedMultiSwitch.h:27
The information required to register a model with the registrar.
Definition: DtIndirectModelRegistrationInfo.h:24
unsigned int myMaxUvOffsetId
Definition: DtIndirectGeometryAggregator.h:231
DtIndirectPolygonOffset myPolygonOffset
polygon offset settings.
Definition: DtIndirectGeometryAggregator.h:264
Indirect rendering works because we are able to combine multiple geometries into a single &#39;aggregated...
Definition: DtIndirectGeometryAggregator.h:90
bool myAlphaToCoverageEnabled
a2C enabled or not
Definition: DtIndirectGeometryAggregator.h:255
DtIndirectUvOffsetManager::AnnotationToUvOffsetMap myAnnotationToIdMap
Definition: DtIndirectGeometryAggregator.h:232
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
Contains the DtIndirectEffectTexturesTemplate class declaration.
Template for 32/64 bit Axis Aligned bounding boxesnot virtual because its stored as is on the GPU...
Definition: DtAxisAlignedBoundingBox.h:27
std::deque< NodeDofInfoPair > DequeNodeDofInfoPairs
Definition: DtIndirectDofManager.h:76
non virtual container class for defining a blending function
Definition: DtIndirectBlendFunction.h:29
Contains makVrv::DtIndirectDofManager class.
An Index Range given to DtIndirectModelSubGeometry to facility targeting a specific subset of the geo...
Definition: DtIndirectModelSubGeometry.h:70
Axis Aligned Bounding Box class.
Simple state/glmodes class for handling setting up modes It can now handle generic state modes and at...
Definition: DtIndirectGeometryStateManager.h:31
std::stack< unsigned int > myLastUvOffsetIdStack
Definition: DtIndirectGeometryAggregator.h:235
const char * creatorTypeName< DtIndirectGeometryAggregator >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectGeometryAggregator.h:82
This class represents the list of DtIndirectTexturePrototypes belonging to a particular sub-geometry...
Definition: DtIndirectGeometryTextures.h:38
std::map< std::string, unsigned int > AnnotationToUvOffsetMap
Definition: DtIndirectUvOffsetManager.h:53
int myNumGeometries
Definition: DtIndirectGeometryAggregator.h:226
std::unordered_map< int, MultiplierAndTrackSide > ScrollableUvOffsetIdsAndMultipliers
Definition: DtIndirectUvOffsetManager.h:65
DtIndirectSwitchManager::DequeNodeSwitchInfoPairs mySwitchStack
Definition: DtIndirectGeometryAggregator.h:278
bool myCullFaceEnabled
cull face state
Definition: DtIndirectGeometryAggregator.h:249
Derived from osg::Node and is a replacement for the osgSim::LightPointNode represents a group of ligh...
Definition: DtLightPointNode.h:37
loads and contains various core default textures used by the indirect system
Definition: DtIndirectDefaultTexturesContainer.h:30
Contains makVrv::DtIndirectIndexedMultiSwitch class.
int myMaxDofId
Definition: DtIndirectGeometryAggregator.h:283
int myLastIndexOffset
Definition: DtIndirectGeometryAggregator.h:229
The indirect system uses this in conjunction with the system wide limits (for entity/terrain) to clam...
Definition: DtIndirectLimitTextureStrategy.h:65
DtVirtualBaseClassCreator< DtIndirectGeometryAggregator, DtIndirectModelInfoContainer &, DtIndirectEffectTexturesTemplate &, DtIndirectGeometryStateManager &, const DtIndirectTextureCollectionPolicy &, const DtIndirectLimitTextureStrategy & > DtIndirectGeometryAggregatorCreator
creator
Definition: DtIndirectGeometryAggregator.h:70
DtIndirectBlendFunction myBlendFunction
the blending function
Definition: DtIndirectGeometryAggregator.h:258
Contains makVrv::DtIndirectSwitchManager class.
friend DtIndirectGeometryAggregatorCreator
Definition: DtIndirectGeometryAggregator.h:93
Material myMaterial
current indirect material
Definition: DtIndirectGeometryAggregator.h:247
non virtual container class for defining a blending equation
Definition: DtIndirectBlendEquation.h:30
std::stack< osg::Matrix > myMatrixStack
Definition: DtIndirectGeometryAggregator.h:272
DtIndirectModelInfoContainer & myModelInfoContainer
Definition: DtIndirectGeometryAggregator.h:239
int myNumGeodes
Definition: DtIndirectGeometryAggregator.h:225
std::string myModelFileName
Definition: DtIndirectGeometryAggregator.h:289
Contains makVrv::DtIndirectLodManager class.
int myModelId
Definition: DtIndirectGeometryAggregator.h:227
non virtual container class for defining a polygon offset state
Definition: DtIndirectPolygonOffset.h:18
Contains DLL export macros.
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
bool myBlendingEnabled
blending enabled or not
Definition: DtIndirectGeometryAggregator.h:252
DtIndirectGeometryTextures myTextures
current collection of textures
Definition: DtIndirectGeometryAggregator.h:245
const DtIndirectLimitTextureStrategy & myLimitTextureStrategy
Definition: DtIndirectGeometryAggregator.h:307
Material myDefaultMaterial
Definition: DtIndirectGeometryAggregator.h:293
Contains the DtIndirectGeometryTextures class declaration.
std::deque< IndirectLodInfo > DequeIndirectLodInfos
Definition: DtIndirectLodManager.h:67
DtIndirectGeometryStateManager & myStateManager
Definition: DtIndirectGeometryAggregator.h:238
Contains the DtIndirectPolygonOffset class declaration.
Class that allows you to abstractly register effect texture types the effect texture types are client...
Definition: DtIndirectEffectTexturesTemplate.h:40
DtIndirectBlendEquation myBlendEquation
the blending equation
Definition: DtIndirectGeometryAggregator.h:261
DtDe & myDe
Definition: DtIndirectGeometryAggregator.h:300
DtIndirectTexturePrototypeManager & myTexturePrototypeManager
Definition: DtIndirectGeometryAggregator.h:313
bool myDepthOnly
depth only?
Definition: DtIndirectGeometryAggregator.h:267
bool myModelIsShadowCastOff
Definition: DtIndirectGeometryAggregator.h:311

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)