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 #include <osg/Node>
20 
21 #include <boost/unordered_map.hpp>
22 
23 namespace osg
24 {
25  class Node;
26  class Texture;
27  class StateSet;
28 }
29 
30 namespace makVrv
31 {
32  class DtOsgSceneConnector;
33 
36  class DT_DLL_VRVOSG DtCachedNodeHolder : public DtInstanceHolder<osg::ref_ptr<osg::Node> >
37  {
38  public:
39  DtCachedNodeHolder(DtDe& de,osg::Node* node);
40 
41  virtual ~DtCachedNodeHolder();
42 
43  protected:
44 
45  void releaseGLObjects();
46 
48  };
49 
52  class DT_DLL_VRVOSG DtCachedTextureHolder : public DtInstanceHolder<osg::ref_ptr<osg::Texture> >
53  {
54  public:
56 
57  virtual ~DtCachedTextureHolder();
58 
59  protected:
60 
61  void releaseGLObjects();
62 
64  };
65 
66 
67 
72  {
73  public:
74 
76  virtual ~DtOsgModelInstance();
77 
79  virtual void addToConnector( DtOsgSceneConnector* connector );
80 
83  virtual bool removeFromConnector( DtOsgSceneConnector* connector );
84 
86 
87  virtual osg::Node* rootNode();
88  virtual const osg::Node* rootNode() const;
90 
92 
93  virtual osg::Node* sensorNode();
94  virtual const osg::Node* sensorNode() const;
96 
98  virtual bool saveModelToFile(const std::string& filename) const;
99 
100  virtual void enableColorBlending( bool b );
101 
102  virtual void setBlendColor(float r, float g, float b, float a);
103 
104  virtual void enableTexture( bool onOff );
105 
107 
108 
110  typedef boost::unordered_map<std::string, bool> SensorRegionStateMap;
111 
113  virtual void addDynamicSensorRegion( const std::string& region );
114 
116  virtual void setDynamicSensorRegion( const std::string& region, bool state );
117 
119  virtual bool dynamicSensorRegion( const std::string& region );
120 
122  SensorRegionStateMap const dynamicSensorRegionMap() const;
123 
125  boost::signal< void ( const std::string& ) > signal_dynamicSensorRegionAdded;
126 
128  boost::signal< void ( const std::string&, bool ) > signal_dynamicSensorRegionChanged;
129 
131 
132  //Utility function for reading a Vec4 from a definition.
133  static osg::Vec4 readVec4(const std::string& paramName, const DtModelDefinition& definition);
134 
135  //Utility function for reading a Vec3 from a definition.
136  static osg::Vec3 readVec3(const std::string& paramName, const DtModelDefinition& definition);
137 
138  protected:
139 
142  virtual void updateColorBlending();
143 
144  virtual void updateColorBlending( osg::Node* node );
145  virtual void enableTexture( osg::Node* root, bool onOff );
146 
147  virtual void updateBoundingBoxViaContents();
148 
151 
153  virtual void setRootNode(osg::Node* node);
154 
155  protected:
156 
157  osg::ref_ptr<osg::Node> myModelRoot;
158  osg::ref_ptr<osg::StateSet> myCachedState;
160  };
161 }
162 
163 

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)