VR-Forces 4.3.1 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>
15 #include <vrvUtil/signalslib.h>
16 
17 #include <osg/Node>
18 #include <osg/Texture>
19 #include <osg/ref_ptr>
20 
21 #include <boost/signal.hpp>
22 #include <boost/unordered_map.hpp>
23 
24 namespace makVrv
25 {
26  class DtOsgSceneConnector;
27 
30  class DT_DLL_VRVOSG DtCachedNodeHolder : public DtInstanceHolder<osg::ref_ptr<osg::Node> >
31  {
32  public:
33  DtCachedNodeHolder(DtDe& de,osg::Node* node);
34 
35  virtual ~DtCachedNodeHolder();
36 
37  protected:
38 
39  void releaseGLObjects();
40 
42  };
43 
46  class DT_DLL_VRVOSG DtCachedTextureHolder : public DtInstanceHolder<osg::ref_ptr<osg::Texture> >
47  {
48  public:
50 
51  virtual ~DtCachedTextureHolder();
52 
53  protected:
54 
55  void releaseGLObjects();
56 
58  };
59 
60 
61 
66  {
67  public:
68 
70  virtual ~DtOsgModelInstance();
71 
73  virtual void addToConnector( DtOsgSceneConnector* connector );
74 
77  virtual bool removeFromConnector( DtOsgSceneConnector* connector );
78 
80 
81  virtual osg::Node* rootNode();
82  virtual const osg::Node* rootNode() const;
84 
86 
87  virtual osg::Node* sensorNode();
88  virtual const osg::Node* sensorNode() const;
90 
92  virtual bool saveModelToFile(const std::string& filename) const;
93 
94  virtual void enableColorBlending( bool b );
95 
96  virtual void setBlendColor(float r, float g, float b, float a);
97 
98  virtual void enableTexture( bool onOff );
99 
101 
102 
104  typedef boost::unordered_map<std::string, bool> SensorRegionStateMap;
105 
107  virtual void addDynamicSensorRegion( const std::string& region );
108 
110  virtual void setDynamicSensorRegion( const std::string& region, bool state );
111 
113  virtual bool dynamicSensorRegion( const std::string& region );
114 
116  SensorRegionStateMap const dynamicSensorRegionMap() const;
117 
119  boost::signal< void ( const std::string& ) > signal_dynamicSensorRegionAdded;
120 
122  boost::signal< void ( const std::string&, bool ) > signal_dynamicSensorRegionChanged;
123 
125 
126  //Utility function for reading a Vec4 from a definition.
127  static osg::Vec4 readVec4(const std::string& paramName, const DtModelDefinition& definition);
128 
129  //Utility function for reading a Vec3 from a definition.
130  static osg::Vec3 readVec3(const std::string& paramName, const DtModelDefinition& definition);
131 
132  protected:
133 
136  virtual void updateColorBlending();
137 
138  virtual void updateColorBlending( osg::Node* node );
139  virtual void enableTexture( osg::Node* root, bool onOff );
140 
141  virtual void updateBoundingBoxViaContents();
142 
145 
147  virtual void setRootNode(osg::Node* node);
148 
149  protected:
150 
151  osg::ref_ptr<osg::Node> myModelRoot;
152  osg::ref_ptr<osg::StateSet> myCachedState;
154  };
155 }
156 
157 

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)