Changeset 9549 for OpenSceneGraph/trunk/include/osg/State
- Timestamp:
- 01/26/09 16:16:24 (4 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osg/State (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/State
r9447 r9549 20 20 #include <osg/Uniform> 21 21 #include <osg/BufferObject> 22 #include <osg/observer_ptr> 22 23 23 24 #include <osg/FrameStamp> … … 85 86 * \c captureCurrentState() and \c getModelViewMatrix()). 86 87 */ 87 class OSG_EXPORT State : public Referenced 88 class OSG_EXPORT State : public Referenced, public Observer 88 89 { 89 90 public : … … 961 962 962 963 963 void setLastAppliedProgramObject(const Program::PerContextProgram* program) { if (_lastAppliedProgramObject!=program) { _lastAppliedProgramObject = program; if (program) _appliedProgramObjectSet.insert(program); } } 964 const Program::PerContextProgram* getLastAppliedProgramObject() const { return _lastAppliedProgramObject; } 964 inline void setLastAppliedProgramObject(const Program::PerContextProgram* program) 965 { 966 if (_lastAppliedProgramObject!=program) 967 { 968 _lastAppliedProgramObject = program; 969 if (program && _appliedProgramObjectSet.count(program)==0) 970 { 971 _appliedProgramObjectSet.insert(program); 972 program->addObserver(this); 973 } 974 } 975 } 976 inline const Program::PerContextProgram* getLastAppliedProgramObject() const { return _lastAppliedProgramObject; } 965 977 966 978 inline GLint getUniformLocation( const std::string& name ) const { return _lastAppliedProgramObject ? _lastAppliedProgramObject->getUniformLocation(name) : -1; } … … 1065 1077 void initializeExtensionProcs(); 1066 1078 1079 virtual void objectDeleted(void* object); 1080 1067 1081 protected: 1068 1082 … … 1207 1221 typedef std::vector<ref_ptr<const Matrix> > MatrixStack; 1208 1222 1209 typedef std::set< osg::ref_ptr<const Program::PerContextProgram> >AppliedProgramObjectSet;1223 typedef std::set<const Program::PerContextProgram* > AppliedProgramObjectSet; 1210 1224 1211 1225 ModeMap _modeMap;
