VR-Forces 4.10 Class Documentation
 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) 2021 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 <boost/unordered_map.hpp>
22 #include <tbb/concurrent_unordered_map.h>
23 
24 #include <osg/Node>
25 
26 namespace osgDB
27 {
28  class Options;
29 }
30 
31 namespace makVrv
32 {
33  class DtIndirectTextureCollectionPolicy;
34  class DtIndirectGeometryRegistrar;
35  class DtIndirectTextureCollectionPolicyFactory;
36 
37 #define DTINDIRECTMODELSCONTAINER_DEBUG 0
38 
39  class DtIndirectModelsContainerCreator;
44  {
45  public:
46  //friend class so it can be created by its creator
48 
50  virtual ~DtIndirectModelsContainer();
51 
52  protected:
54  DtIndirectModelsContainer(DtDe& de, DtIndirectTextureCollectionPolicyFactory& indirectTextureCollectionPolicyFactory);
55 
56  private:
57 
59  DtIndirectModelsContainer() = delete;
63  DtIndirectModelsContainer &operator=(const DtIndirectModelsContainer &other) = delete;
64 
65  public:
66 
72  virtual bool getModelNode(const std::string& modelName, const osg::Node*& modelNode, int & modelId,
73  bool daylightControlled, float minRange = -1, float maxRange = -1, osgDB::Options *options = 0,
74  bool cullFaceEnabled = true);
75 
77  virtual bool hasModelNode(const std::string& modelName) const;
78 
80  virtual bool addModelNodeIfNeeded(const osg::Node* modelNode, int& modelId, const std::string& modelNameSuffix,
81  bool cullFaceEnabled = true,
82  const DtIndirectPolygonOffset& polygonOffset = DtIndirectPolygonOffset(0.0f,0.0f), bool daylightControlled = false);
83 
85  virtual void registerModelWithRegistrar(const osg::Node* modelNode, const std::string& modelName, const DtModelInfo& modelInfo,
86  bool cullFaceEnabled = true,
87  const DtIndirectPolygonOffset& polygonOffset = DtIndirectPolygonOffset(0.0f, 0.0f), bool daylightControlled = false);
88 
90  virtual DtIndirectGeometryRegistrar* registrar(void);
91 
92  protected:
93 
95  bool checkGeometriesOk(const osg::Node* modelNode, const std::string& modelName);
96 
97  protected:
100 
101  typedef boost::unordered_map<std::string, osg::ref_ptr< const osg::Node > > MapMarkerNameToModelNode;
104 
105  typedef tbb::concurrent_unordered_map<std::string, DtModelInfo> ModelsToModelInfo;
107  tbb::atomic<int> myNextModelId;
108 
110 
111 #if DTINDIRECTMODELSCONTAINER_DEBUG
112  static tbb::atomic<int> myRefCount;
113 #endif
114  };
115 
119  {
120  public:
123 
126 
127  private:
128 
135 
136 
137  public:
139  virtual DtIndirectModelsContainer* create() const;
140 
143  static DtIndirectModelsContainerCreator& instance(DtDe& de);
144 
146  static const std::string& theClassName();
147 
148  protected:
150 
152  };
153 }
tbb::concurrent_unordered_map< std::string, DtModelInfo > ModelsToModelInfo
Definition: DtIndirectModelsContainer.h:105
Virtual base class.
Definition: DtVirtualBaseClass.h:19
DtDe & myDe
Definition: DtIndirectModelsContainer.h:149
DtIndirectTextureCollectionPolicy * myTextureCollectionPolicy
Definition: DtIndirectModelsContainer.h:98
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtModelInfo is a mapping of a &#39;model&#39; name to a &#39;model&#39; id A &#39;model&#39; can have a number of lods...
Definition: DtModelInfo.h:25
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:106
MapMarkerNameToModelNode myMapMarkerNameToModelNode
Definition: DtIndirectModelsContainer.h:102
Abstract class to look in the stateset and collect textures specified via its template The effect tex...
Definition: DtIndirectTextureCollectionPolicy.h:38
class for holding an indirect geometry registrar (which holds the information about how to draw model...
Definition: DtIndirectModelsContainer.h:43
Contains makVrv::DtVirtualBaseClass class.
ModelsToModelInfo myModelsToModelInfo
Definition: DtIndirectModelsContainer.h:106
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
Factory for creating different collection policies.
Definition: DtIndirectTextureCollectionPolicy.h:104
creator for DtIndirectModelsContainer
Definition: DtIndirectModelsContainer.h:118
DtIndirectTextureCollectionPolicyFactory & myIndirectTextureCollectionPolicyFactory
Definition: DtIndirectModelsContainer.h:151
DtModelInfo class declaration.
tbb::atomic< int > myNextModelId
Definition: DtIndirectModelsContainer.h:107
osg::ref_ptr< DtIndirectGeometryRegistrar > myIndirectGeometryRegistrar
Definition: DtIndirectModelsContainer.h:99
non virtual container class for defining a polygon offset state
Definition: DtIndirectPolygonOffset.h:18
Contains DLL export macros.
boost::unordered_map< std::string, osg::ref_ptr< const osg::Node > > MapMarkerNameToModelNode
Definition: DtIndirectModelsContainer.h:101
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
Threading::Mutex myMapMarkerNameToModelNodeMutex
Definition: DtIndirectModelsContainer.h:103
Contains the DtIndirectPolygonOffset class declaration.
DtDe & myDe
Definition: DtIndirectModelsContainer.h:109

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)