VR-Forces 5.0.3 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) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
23 
26 
28 
29 #include <osg/NodeVisitor>
30 #include <osg/Geometry>
31 #include <osg/ref_ptr>
32 
33 #include <stack>
34 
35 
36 namespace osg
37 {
38  class Texture;
39  class LOD;
40 }
41 
42 namespace osgSim
43 {
44  class MultiSwitch;
45  class DOFTransform;
46 }
47 
48 namespace makVrv
49 {
50  class DtIndirectTextureCollectionPolicy;
51  class DtIndirectLimitTextureStrategy;
52  class DtIndirectGeometryStateManager;
53 
54  class DtDynamicTerrainSwitchNode;
55  class DtDynamicTerrainSequenceNode;
56  class DtIndirectAggregateHelper;
57  class DtIndirectModelInfoContainer;
58  class DtLightPointNode;
59  class DtIndirectModelInfo;
60  class DtIndirectDefaultTexturesContainer;
61 
62  class DtDe;
63 
66 
74 
76  template <>
77  inline const char* creatorTypeName<DtIndirectGeometryAggregator>(void) { return "DtIndirectGeometryAggregatorCreator"; }
78 
85  class DT_DLL_VRVOSG DtIndirectGeometryAggregator : public osg::NodeVisitor
86  {
87  public:
89 
92 
93  protected:
98  , DtIndirectModelInfoContainer& aggregatedGeometry
99  , DtIndirectEffectTexturesTemplate& aggregatedEffectTexturesState
100  , DtIndirectGeometryStateManager& stateManager
101  , const DtIndirectTextureCollectionPolicy& textureCollectionPolicy
102  , const DtIndirectLimitTextureStrategy& limitTextureStrategy
103  );
104 
105 
106  private:
107  //Default constructor not implemented
113 
114  public:
115 
117  virtual void aggregate(osg::Node* node, int modelId
118  , const std::string& modelFileName, const std::string& modelDefName
119  , bool cullFaceEnabled, const DtIndirectPolygonOffset& polygonOffset, bool daylightControlled);
120 
122  virtual void apply(osg::Geometry& geometry);
123 
125  virtual void apply(DtDynamicTerrainSwitchNode& node);
126 
128  virtual void apply(osg::Geode& geode);
129 
131  virtual void apply(osg::Node& node);
132 
134  virtual void apply(osg::Switch& node);
135 
137  virtual void apply(osgSim::MultiSwitch& node);
138 
140  virtual void apply(osg::LOD& node);
141 
143  virtual void apply(osg::Sequence& node);
144 
146  virtual void apply(osg::Billboard& node);
147 
149  virtual void apply(DtLightPointNode& node);
150 
153  virtual void augmentModelInfo(osg::Geometry* geometry
154  , const AxisAlignedBoundingBox_32& bbox32
155  , const int state
156  , const DtIndirectGeometryTexturesRefPtr& texturesForThisGeometry
157  , Material& materialForThisGeometry
158  , const bool isLight);
159 
162  virtual void apply(osg::MatrixTransform& matTrans);
163 
165  virtual void apply(osgSim::DOFTransform& node);
166 
168  virtual void apply(osg::LightSource& node) override;
169 
171  virtual int numGeodes() const;
172 
176  virtual int numGeometries() const;
177 
178  protected:
180  virtual Material gatherMaterial(osg::StateSet* ss) const;
181 
183  virtual bool isCullFaceEnabled(const osg::StateSet* ss) const;
184 
186  virtual bool isBlendingEnabled(const osg::StateSet* ss) const;
187 
189  virtual bool isAlphaToCoverageEnabled(const osg::StateSet* ss) const;
190 
192  virtual DtIndirectBlendFunction gatherBlendFunction(const osg::StateSet* ss) const;
193 
195  virtual DtIndirectBlendEquation gatherBlendEquation(const osg::StateSet* ss) const;
196 
198  virtual DtIndirectPolygonOffset gatherPolygonOffset(const osg::StateSet* ss) const;
199 
201  virtual bool isDepthOnly(const osg::StateSet* ss) const;
202 
204  virtual DtIndirectGeometryTextures* gatherTextures(osg::StateSet* ss, const std::string& modelFileName);
205 
207  virtual osg::Geometry* createDebugLightPointCube(DtLightPointNode& node);
208 
210  virtual osg::Geometry* createDebugLightSourceCube(osg::LightSource& node);
211 
213  virtual void applyToSwitchStack(osg::Group* node, osg::NodePath& nodePath);
214 
215  protected:
219 
221 
222  unsigned int myMaxUvOffsetId;
225 
226  std::stack<unsigned int> myLastUvOffsetIdStack;
227 
231 
234  {
238  Material myMaterial;
241 
244 
247 
250 
253 
256 
259  };
260 
262  std::stack<AggregatorData> myDataStack;
263  std::stack<osg::Matrix> myMatrixStack;
264 
265  std::stack<int> myBillboardModeStack;
266 
268 
270 
271  // This stack (unlike the terrain/find nodes visitor is not a regular stack
272  // and needs to maintain the full hierarchical paths as it traverses down
276 
278 
279  // used only for outputting debug messages
280  std::string myModelFileName;
281 
282  std::string myModelDefName;
283 
285 
287 
288  friend class ScopedStackOperator;
289  friend class ScopedAnnotationParser;
290 
292 
294 
297 
299 
301  };
302 
303 }
Contains makVrv::DtIndirectUvOffsetManager class.
Contains the DtIndirectBlendEquation class declaration.
DtIndirectUvOffsetManager::ScrollableUvOffsetIdsAndMultipliers myScrollableUvOffsetIdsAndMultipliers
Definition: DtIndirectGeometryAggregator.h:224
DtMaterial class declaration.
std::stack< int > myBillboardModeStack
Definition: DtIndirectGeometryAggregator.h:265
std::stack< AggregatorData > myDataStack
stack of Aggregator as traversal happens.
Definition: DtIndirectGeometryAggregator.h:262
DtIndirectEffectTexturesTemplate & myAggregatedEffectTexturesState
Definition: DtIndirectGeometryAggregator.h:228
DtIndirectLodManager::DequeIndirectLodInfos myLodStack
Definition: DtIndirectGeometryAggregator.h:267
DtDynamicTerrainSwitchNode replaces an osgSim::multiswitch in a terrain patch (or page) that is tagge...
Definition: DtDynamicTerrainSwitchNode.h:74
DtIndirectDofManager::DequeNodeDofInfoPairs myDofStack
Definition: DtIndirectGeometryAggregator.h:273
DtIndirectGeometryTexturesRefPtr myTextures
current collection of textures
Definition: DtIndirectGeometryAggregator.h:236
bool myModelIsOcean
Definition: DtIndirectGeometryAggregator.h:300
const DtIndirectTextureCollectionPolicy & myTextureCollectionPolicy
Definition: DtIndirectGeometryAggregator.h:277
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
int myCurrentParentId
Definition: DtIndirectGeometryAggregator.h:275
std::string myModelDefName
Definition: DtIndirectGeometryAggregator.h:282
bool myLightSourcesDaylightControlled
Definition: DtIndirectGeometryAggregator.h:293
current state of the model traversal
Definition: DtIndirectGeometryAggregator.h:233
Contains the DtIndirectBlendFunction class declaration.
DtIndirectDefaultTexturesContainer & myDefaultTexturesContainer
cache to avoid repeated look ups via DtIndirectDefaultTexturesContainer::instance(myDe) ...
Definition: DtIndirectGeometryAggregator.h:296
std::deque< NodeSwitchInfoPair > DequeNodeSwitchInfoPairs
Definition: DtIndirectSwitchManager.h:78
DtIndirectGeometryTexturesRefPtr myDefaultTextures
Definition: DtIndirectGeometryAggregator.h:286
Class that loads and contains a bunch of models registered with the registrar. It is owned by the Ind...
Definition: DtIndirectModelInfoContainer.h:82
Abstract class to look in the stateset and collect textures specified via its template The effect tex...
Definition: DtIndirectTextureCollectionPolicy.h:38
unsigned int myMaxUvOffsetId
Definition: DtIndirectGeometryAggregator.h:222
DtIndirectPolygonOffset myPolygonOffset
polygon offset settings.
Definition: DtIndirectGeometryAggregator.h:255
Indirect rendering works because we are able to combine multiple geometries into a single &#39;aggregated...
Definition: DtIndirectGeometryAggregator.h:85
bool myAlphaToCoverageEnabled
a2C enabled or not
Definition: DtIndirectGeometryAggregator.h:246
DtIndirectUvOffsetManager::AnnotationToUvOffsetMap myAnnotationToIdMap
Definition: DtIndirectGeometryAggregator.h:223
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
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:75
non virtual container class for defining a blending function
Definition: DtIndirectBlendFunction.h:29
Contains makVrv::DtIndirectDofManager class.
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:226
const char * creatorTypeName< DtIndirectGeometryAggregator >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectGeometryAggregator.h:77
class to hold osg Textures (diffuse map texture + effect textures) basically just a list of osg textu...
Definition: DtIndirectGeometryTextures.h:26
std::map< std::string, unsigned int > AnnotationToUvOffsetMap
Definition: DtIndirectUvOffsetManager.h:53
int myNumGeometries
Definition: DtIndirectGeometryAggregator.h:217
std::unordered_map< int, MultiplierAndTrackSide > ScrollableUvOffsetIdsAndMultipliers
Definition: DtIndirectUvOffsetManager.h:65
DtIndirectSwitchManager::DequeNodeSwitchInfoPairs mySwitchStack
Definition: DtIndirectGeometryAggregator.h:269
bool myCullFaceEnabled
cull face state
Definition: DtIndirectGeometryAggregator.h:240
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:27
int myMaxDofId
Definition: DtIndirectGeometryAggregator.h:274
int myLastIndexOffset
Definition: DtIndirectGeometryAggregator.h:220
This class is passed as a pointer to DtIndirectTextureProcessor. The processor then uses this in conj...
Definition: DtIndirectLimitTextureStrategy.h:65
DtVirtualBaseClassCreator< DtIndirectGeometryAggregator, DtIndirectModelInfoContainer &, DtIndirectEffectTexturesTemplate &, DtIndirectGeometryStateManager &, const DtIndirectTextureCollectionPolicy &, const DtIndirectLimitTextureStrategy & > DtIndirectGeometryAggregatorCreator
creator
Definition: DtIndirectGeometryAggregator.h:65
DtIndirectBlendFunction myBlendFunction
the blending function
Definition: DtIndirectGeometryAggregator.h:249
Contains makVrv::DtIndirectSwitchManager class.
friend DtIndirectGeometryAggregatorCreator
Definition: DtIndirectGeometryAggregator.h:88
Material myMaterial
current indirect material
Definition: DtIndirectGeometryAggregator.h:238
non virtual container class for defining a blending equation
Definition: DtIndirectBlendEquation.h:30
std::stack< osg::Matrix > myMatrixStack
Definition: DtIndirectGeometryAggregator.h:263
DtIndirectModelInfoContainer & myModelInfoContainer
Definition: DtIndirectGeometryAggregator.h:230
int myNumGeodes
Definition: DtIndirectGeometryAggregator.h:216
std::string myModelFileName
Definition: DtIndirectGeometryAggregator.h:280
Contains makVrv::DtIndirectLodManager class.
int myModelId
Definition: DtIndirectGeometryAggregator.h:218
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:70
bool myBlendingEnabled
blending enabled or not
Definition: DtIndirectGeometryAggregator.h:243
const DtIndirectLimitTextureStrategy & myLimitTextureStrategy
Definition: DtIndirectGeometryAggregator.h:298
Material myDefaultMaterial
Definition: DtIndirectGeometryAggregator.h:284
Contains the DtIndirectGeometryTextures class declaration.
std::deque< IndirectLodInfo > DequeIndirectLodInfos
Definition: DtIndirectLodManager.h:66
DtIndirectGeometryStateManager & myStateManager
Definition: DtIndirectGeometryAggregator.h:229
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:252
DtDe & myDe
Definition: DtIndirectGeometryAggregator.h:291
bool myDepthOnly
depth only?
Definition: DtIndirectGeometryAggregator.h:258

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)