VR-Forces 4.1 Class Documentation
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 namespace makVrv
22 {
23  class DtOsgSceneConnector;
24 
27  class DT_DLL_VRVOSG DtCachedNodeHolder : public DtInstanceHolder<osg::ref_ptr<osg::Node> >
28  {
29  public:
30  DtCachedNodeHolder(DtDe& de,osg::Node* node);
31 
32  virtual ~DtCachedNodeHolder();
33 
34  protected:
35 
36  void releaseGLObjects();
37 
39  };
40 
43  class DT_DLL_VRVOSG DtCachedTextureHolder : public DtInstanceHolder<osg::ref_ptr<osg::Texture> >
44  {
45  public:
47 
48  virtual ~DtCachedTextureHolder();
49 
50  protected:
51 
52  void releaseGLObjects();
53 
55  };
56 
57 
58 
63  {
64  public:
65 
67  virtual ~DtOsgModelInstance();
68 
70  virtual void addToConnector( DtOsgSceneConnector* connector );
71 
74  virtual bool removeFromConnector( DtOsgSceneConnector* connector );
75 
77 
78  virtual osg::Node* rootNode();
79  virtual const osg::Node* rootNode() const;
81 
83  virtual bool saveModelToFile(const std::string& filename) const;
84 
85  virtual void enableColorBlending( bool b );
86 
87  virtual void setBlendColor(float r, float g, float b, float a);
88 
89  virtual void enableTexture( bool onOff );
90 
91  //Utility function for reading a Vec4 from a definition.
92  static osg::Vec4 readVec4(const std::string& paramName, const DtModelDefinition& definition);
93 
94  //Utility function for reading a Vec3 from a definition.
95  static osg::Vec3 readVec3(const std::string& paramName, const DtModelDefinition& definition);
96 
97  protected:
98 
101  virtual void updateColorBlending();
102 
103  virtual void updateColorBlending( osg::Node* node );
104  virtual void enableTexture( osg::Node* root, bool onOff );
105 
106  virtual void updateBoundingBoxViaContents();
107 
110 
112  virtual void setRootNode(osg::Node* node);
113 
114  protected:
115 
116  osg::ref_ptr<osg::Node> myModelRoot;
117  osg::ref_ptr<osg::StateSet> myCachedState;
118  };
119 
122  {
123  public:
125  static DtOsgModelInstanceSignaler& instance(DtDe&);
126 
129 
131  boost::signal<void (DtModelInstance&)> signal_modelCreated;
132 
134  boost::signal<void (DtModelInstance&)> signal_modelChanged;
135 
138  boost::signal<void (DtModelInstance&)> signal_modelToBeDestroyed;
139 
140  protected:
141 
144 
145  private:
148  };
149 }
150 
151 

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)