VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtOsgModelInstance.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 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 
20 #include <boost/unordered_map.hpp>
21 
22 namespace osg
23 {
24  class Node;
25  class Texture;
26  class StateSet;
27 }
28 
29 namespace makVrv
30 {
31  class DtOsgSceneConnector;
32 
35  class DT_DLL_VRVOSG DtCachedNodeHolder : public DtInstanceHolder<osg::ref_ptr<osg::Node> >
36  {
37  public:
38  DtCachedNodeHolder(DtDe& de,osg::Node* node);
39 
40  virtual ~DtCachedNodeHolder();
41 
42  protected:
43 
44  void releaseGLObjects();
45 
47  };
48 
51  class DT_DLL_VRVOSG DtCachedTextureHolder : public DtInstanceHolder<osg::ref_ptr<osg::Texture> >
52  {
53  public:
55 
56  virtual ~DtCachedTextureHolder();
57 
58  protected:
59 
60  void releaseGLObjects();
61 
63  };
64 
65 
66 
71  {
72  public:
73 
75  virtual ~DtOsgModelInstance();
76 
78  virtual void addToConnector( DtOsgSceneConnector* connector );
79 
82  virtual bool removeFromConnector( DtOsgSceneConnector* connector );
83 
85 
86  virtual osg::Node* rootNode();
87  virtual const osg::Node* rootNode() const;
89 
91 
92  virtual osg::Node* sensorNode();
93  virtual const osg::Node* sensorNode() const;
95 
97  virtual bool saveModelToFile(const std::string& filename) const;
98 
99  virtual void enableColorBlending( bool b );
100 
101  virtual void setBlendColor(float r, float g, float b, float a);
102 
103  virtual void enableTexture( bool onOff );
104 
106 
107 
109  typedef boost::unordered_map<std::string, bool> SensorRegionStateMap;
110 
112  virtual void addDynamicSensorRegion( const std::string& region );
113 
115  virtual void setDynamicSensorRegion( const std::string& region, bool state );
116 
118  virtual bool dynamicSensorRegion( const std::string& region );
119 
121  SensorRegionStateMap const dynamicSensorRegionMap() const;
122 
124  boost::signal< void ( const std::string& ) > signal_dynamicSensorRegionAdded;
125 
127  boost::signal< void ( const std::string&, bool ) > signal_dynamicSensorRegionChanged;
128 
130 
131  //Utility function for reading a Vec4 from a definition.
132  static osg::Vec4 readVec4(const std::string& paramName, const DtModelDefinition& definition);
133 
134  //Utility function for reading a Vec3 from a definition.
135  static osg::Vec3 readVec3(const std::string& paramName, const DtModelDefinition& definition);
136 
137  protected:
138 
141  virtual void updateColorBlending();
142 
143  virtual void updateColorBlending( osg::Node* node );
144  virtual void enableTexture( osg::Node* root, bool onOff );
145 
146  virtual void updateBoundingBoxViaContents();
147 
150 
152  virtual void setRootNode(osg::Node* node);
153 
154  protected:
155 
156  osg::ref_ptr<osg::Node> myModelRoot;
157  osg::ref_ptr<osg::StateSet> myCachedState;
159  };
160 }
161 
162 

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)