VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgModelInstance.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
14 
15 #include <osg/ref_ptr>
16 #include <osg/Vec3>
17 #include <osg/Vec4>
18 #include <osg/Texture>
19 #include <osg/Node>
20 
21 #include <boost/unordered_map.hpp>
23 
24 namespace osg
25 {
26  class Node;
27  class Texture;
28  class StateSet;
29 }
30 
31 namespace makVrv
32 {
33  class DtOsgSceneConnector;
34 
37  class DT_DLL_VRVOSG DtCachedNodeHolder : public DtInstanceHolder<osg::ref_ptr<osg::Node> >
38  {
39  public:
40  DtCachedNodeHolder(DtDe& de, osg::Node* node);
41 
42  virtual ~DtCachedNodeHolder();
43 
44  protected:
45 
46  void releaseGLObjects();
47 
49  };
50 
53  class DT_DLL_VRVOSG DtCachedTextureHolder : public DtInstanceHolder<osg::ref_ptr<osg::Texture> >
54  {
55  public:
57 
58  virtual ~DtCachedTextureHolder();
59 
60  protected:
61 
62  void releaseGLObjects();
63 
65  };
66 
67 
68 
73  {
74  public:
75 
78  {
79  USE_GLOBAL, // use the global setting
80  FORCE_OFF, // force alpha to coverage off
81  FORCE_ON //force alpha to coverage on for this model
82  };
83 
84  public:
85 
87  virtual ~DtOsgModelInstance();
88 
89  virtual bool realize(DtModelDefinition& definition);
90 
92  virtual void addToConnector(DtOsgSceneConnector* connector);
93 
96  virtual bool removeFromConnector(DtOsgSceneConnector* connector);
97 
99 
100  virtual osg::Node* rootNode();
101  virtual const osg::Node* rootNode() const;
103 
105 
106  virtual osg::Node* sensorNode();
107  virtual const osg::Node* sensorNode() const;
109 
111  virtual bool saveModelToFile(const std::string& filename) const;
112 
113  virtual void enableColorBlending(bool b);
114 
115  virtual void setBlendColor(float r, float g, float b, float a);
116 
117  virtual void enableTexture(bool onOff);
118 
120 
121 
123  typedef boost::unordered_map<std::string, bool> SensorRegionStateMap;
124 
126  virtual void addDynamicSensorRegion(const std::string& region);
127 
129  virtual void setDynamicSensorRegion(const std::string& region, bool state);
130 
132  virtual bool dynamicSensorRegion(const std::string& region);
133 
135  SensorRegionStateMap const dynamicSensorRegionMap() const;
136 
138  virtual void slot_atcGlobalModelEnableChanged();
139 
141  virtual bool alphaToCoverageEnabled();
142 
145  virtual void registerLightPoints(const std::string& groupName, bool daylightControlledLights);
146 
148  boost::signal< void(const std::string&) > signal_dynamicSensorRegionAdded;
149 
151  boost::signal< void(const std::string&, bool) > signal_dynamicSensorRegionChanged;
152 
154  boost::signal<void(bool)> signal_atcModeEnableChanged;
155 
157 
158  //Utility function for reading a Vec4 from a definition.
159  static osg::Vec4 readVec4(const std::string& paramName, const DtModelDefinition& definition);
160 
161  //Utility function for reading a Vec3 from a definition.
162  static osg::Vec3 readVec3(const std::string& paramName, const DtModelDefinition& definition);
163 
164  protected:
165 
168  virtual void updateColorBlending();
169 
170  virtual void updateColorBlending(osg::Node* node);
171  virtual void enableTexture(osg::Node* root, bool onOff);
172 
173  virtual void updateBoundingBoxViaContents();
174 
177 
179  virtual void setRootNode(osg::Node* node);
180 
181  protected:
182 
183  osg::ref_ptr<osg::Node> myModelRoot;
184  osg::ref_ptr<osg::StateSet> myCachedState;
186 
189 
194  };
195 }
196 
197 

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)