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) 2023 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 #include <unordered_set>
26 
27 
28 #define DTINDIRECTMODELSCONTAINER_DEBUG 0
29 
30 namespace osgDB
31 {
32  class Options;
33 }
34 
35 namespace makVrv
36 {
37  class DtIndirectTextureCollectionPolicy;
38  class DtIndirectGeometryRegistrar;
39  class DtIndirectTextureCollectionPolicyFactory;
40  class DtIndirectLimitTextureStrategy;
41 
44 
47 
49  template <>
50  inline const char* creatorTypeName<DtIndirectModelsContainer>(void) { return "DtIndirectModelsContainerCreator"; }
51 
56  {
57  public:
58  //friend class so it can be created by its creator
60 
62  virtual ~DtIndirectModelsContainer();
63 
64  protected:
66  DtIndirectModelsContainer(DtDe& de, const DtIndirectLimitTextureStrategy& limitTextureStrategy);
67 
68  private:
69 
71  DtIndirectModelsContainer() = delete;
75  DtIndirectModelsContainer &operator=(const DtIndirectModelsContainer &other) = delete;
76 
77  public:
78 
79  struct ModelParams
80  {
81  bool myDaylightControlled = true;
82  float myMinRange = -1;
83  float myMaxRange = -1;
84  bool myCullFaceEnabled = true;
85  float myAlphaCutOff = 0.0f;
86  float myDisableDecalProjectors = 0.0f;
87  bool myAddTopLevelSwitch = false;
88  std::string myLightPointGroupName = "";
89  };
90 
96  virtual bool getModelNode(const std::string& modelName, const std::string& modelDefName
97  , const osg::Node*& modelNode, int & modelId, const ModelParams& params, osgDB::Options* options);
98 
100  virtual bool hasModelNode(const std::string& modelName) const;
101 
103  virtual const osg::Node* findModelNode(const std::string& modelName) const;
104 
106  virtual int findModelId(const std::string& modelName) const;
107 
109  virtual bool addModelNodeIfNeeded(osg::ref_ptr<const osg::Node> modelNode, int& modelId, const std::string& modelNameSuffix,
110  bool cullFaceEnabled,
111  const DtIndirectPolygonOffset& polygonOffset, bool daylightControlled);
112 
114  virtual DtIndirectGeometryRegistrar* registrar(void);
115 
116  protected:
117 
119  bool checkGeometriesOk(const osg::Node* modelNode, const std::string& modelName) const;
120 
121  protected:
123 
124  typedef std::unordered_map<std::string, osg::ref_ptr< const osg::Node > > MapMarkerNameToModelNode;
127 
128  typedef tbb::concurrent_unordered_map<std::string, DtModelInfo> ModelsToModelInfo;
130  tbb::atomic<int> myNextModelId;
131 
133 
134 #if DTINDIRECTMODELSCONTAINER_DEBUG
135  static tbb::atomic<int> myRefCount;
136 #endif
137  };
138 }
tbb::concurrent_unordered_map< std::string, DtModelInfo > ModelsToModelInfo
Definition: DtIndirectModelsContainer.h:128
const char * creatorTypeName< DtIndirectModelsContainer >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectModelsContainer.h:50
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:109
Definition: DtIndirectModelsContainer.h:79
MapMarkerNameToModelNode myMapMarkerNameToModelNode
Definition: DtIndirectModelsContainer.h:125
friend DtIndirectModelsContainerCreator
Definition: DtIndirectModelsContainer.h:59
class for holding an indirect geometry registrar (which holds the information about how to draw model...
Definition: DtIndirectModelsContainer.h:55
std::unordered_map< std::string, osg::ref_ptr< const osg::Node > > MapMarkerNameToModelNode
Definition: DtIndirectModelsContainer.h:124
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
ModelsToModelInfo myModelsToModelInfo
Definition: DtIndirectModelsContainer.h:129
DtVirtualBaseClassCreator< DtIndirectModelsContainer, const DtIndirectLimitTextureStrategy & > DtIndirectModelsContainerCreator
creator
Definition: DtIndirectModelsContainer.h:43
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
DtModelInfo class declaration.
The indirect system uses this in conjunction with the system wide limits (for entity/terrain) to clam...
Definition: DtIndirectLimitTextureStrategy.h:65
tbb::atomic< int > myNextModelId
Definition: DtIndirectModelsContainer.h:130
osg::ref_ptr< DtIndirectGeometryRegistrar > myIndirectGeometryRegistrar
Definition: DtIndirectModelsContainer.h:122
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:72
Threading::Mutex myMapMarkerNameToModelNodeMutex
Definition: DtIndirectModelsContainer.h:126
Contains the DtIndirectPolygonOffset class declaration.
DtDe & myDe
Definition: DtIndirectModelsContainer.h:132

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)