VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectModelsContainer.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
16 
18 
20 
21 #include <osg/Node>
22 
23 #include <tbb/concurrent_unordered_map.h>
24 #include <unordered_map>
25 
26 #include <string>
27 
28 #define DTINDIRECTMODELSCONTAINER_DEBUG 0
29 
30 namespace osgDB
31 {
32  class Options;
33 }
34 
35 
37 {
38  size_t hash( const std::string& x ) const
39  {
40  size_t h = 0;
41  for( const char* s = x.c_str(); *s; ++s )
42  h = (h * 17) ^ *s;
43  return h;
44  }
46  bool equal( const std::string& x, const std::string& y ) const
47  {
48  return x == y;
49  }
50 };
51 namespace makVrv
52 {
53  class DtIndirectTextureCollectionPolicy;
54  class DtIndirectGeometryRegistrar;
55  class DtIndirectTextureCollectionPolicyFactory;
56  class DtIndirectLimitTextureStrategy;
57  class DtIndirectModelRegistrationInfo;
58 
61 
64 
66  template <>
67  inline const char* creatorTypeName<DtIndirectModelsContainer>(void) { return "DtIndirectModelsContainerCreator"; }
68 
73  {
74  public:
75  //friend class so it can be created by its creator
77 
79  virtual ~DtIndirectModelsContainer();
80 
81  protected:
83  DtIndirectModelsContainer(DtDe& de, const DtIndirectLimitTextureStrategy& limitTextureStrategy);
84 
85  private:
86 
88  DtIndirectModelsContainer() = delete;
92  DtIndirectModelsContainer &operator=(const DtIndirectModelsContainer &other) = delete;
93 
94  public:
95 
96  struct ModelParams
97  {
98  bool myDaylightControlled = true;
99  float myMinRange = -1;
100  float myMaxRange = -1;
101  bool myCullFaceEnabled = true;
102  float myAlphaCutOff = 0.0f;
103  float myDisableDecalProjectors = 0.0f;
104  bool myAddTopLevelSwitch = false;
105  std::string myLightPointGroupName = "";
106  };
107 
108  virtual void setIndirectGeometryProcessedCallback(std::function<void(const DtIndirectModelRegistrationInfo&)>* callback);
109 
115  virtual bool getModelNode(const std::string& modelName, const std::string& modelDefName
116  , const osg::Node*& modelNode, int & modelId, const ModelParams& params, osgDB::Options* options
117  , std::function<void(osg::ref_ptr<osg::Node>)>* createdNodeCallback=nullptr);
118 
120  virtual bool hasModelNode(const std::string& modelName) const;
121 
123  virtual const osg::Node* findModelNode(const std::string& modelName) const;
124 
126  virtual int findModelId(const std::string& modelName) const;
127 
129  virtual bool addModelNodeIfNeeded(osg::ref_ptr<const osg::Node> modelNode, int& modelId, const std::string& modelNameSuffix,
130  bool cullFaceEnabled, const DtIndirectPolygonOffset& polygonOffset, bool daylightControlled);
131 
133  virtual DtIndirectGeometryRegistrar* registrar(void);
134 
135  protected:
136 
138  bool checkGeometriesOk(const osg::Node* modelNode, const std::string& modelName) const;
139 
140  protected:
142 
143  typedef std::unordered_map<std::string, osg::ref_ptr< const osg::Node > > MapMarkerNameToModelNode;
146 
147  typedef tbb::concurrent_unordered_map<std::string, DtModelInfo*> ModelsToModelInfo;
149  std::atomic<int> myNextModelId;
150 
152 
153 #if DTINDIRECTMODELSCONTAINER_DEBUG
154  static std::atomic<int> myRefCount;
155 #endif
156  };
157 }
const char * creatorTypeName< DtIndirectModelsContainer >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectModelsContainer.h:67
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:111
Definition: DtIndirectModelsContainer.h:96
MapMarkerNameToModelNode myMapMarkerNameToModelNode
Definition: DtIndirectModelsContainer.h:144
size_t hash(const std::string &x) const
Definition: DtIndirectModelsContainer.h:38
The information required to register a model with the registrar.
Definition: DtIndirectModelRegistrationInfo.h:24
friend DtIndirectModelsContainerCreator
Definition: DtIndirectModelsContainer.h:76
DtVirtualBaseClassCreator< DtIndirectModelsContainer, const DtIndirectLimitTextureStrategy & > DtIndirectModelsContainerCreator
creator
Definition: DtIndirectModelsContainer.h:60
class for holding an indirect geometry registrar (which holds the information about how to draw model...
Definition: DtIndirectModelsContainer.h:72
std::unordered_map< std::string, osg::ref_ptr< const osg::Node > > MapMarkerNameToModelNode
Definition: DtIndirectModelsContainer.h:143
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
ModelsToModelInfo myModelsToModelInfo
Definition: DtIndirectModelsContainer.h:148
bool equal(const std::string &x, const std::string &y) const
True if strings are equal.
Definition: DtIndirectModelsContainer.h:46
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
std::atomic< int > myNextModelId
Definition: DtIndirectModelsContainer.h:149
DtModelInfo class declaration.
The indirect system uses this in conjunction with the system wide limits (for entity/terrain) to clam...
Definition: DtIndirectLimitTextureStrategy.h:65
Definition: DtIndirectModelsContainer.h:36
osg::ref_ptr< DtIndirectGeometryRegistrar > myIndirectGeometryRegistrar
Definition: DtIndirectModelsContainer.h:141
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
Threading::Mutex myMapMarkerNameToModelNodeMutex
Definition: DtIndirectModelsContainer.h:145
Contains the DtIndirectPolygonOffset class declaration.
DtDe & myDe
Definition: DtIndirectModelsContainer.h:151
tbb::concurrent_unordered_map< std::string, DtModelInfo * > ModelsToModelInfo
Definition: DtIndirectModelsContainer.h:147

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)