Changeset 3202
- Timestamp:
- 07/28/04 21:56:22 (9 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 4 modified
-
include/osgGL2/ProgramObject (modified) (3 diffs)
-
include/osgGL2/UniformValue (modified) (2 diffs)
-
src/osgGL2/ProgramObject.cpp (modified) (2 diffs)
-
src/osgGL2/UniformValue.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgGL2/ProgramObject
r3159 r3202 69 69 70 70 /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/ 71 virtual int compare(const osg::StateAttribute& sa) const 72 { 73 // check the types are equal and then create the rhs variable 74 // used by the COMPARE_StateAttribute_Paramter macro's below. 75 COMPARE_StateAttribute_Types(ProgramObject,sa) 76 77 // compare each parameter in turn against the rhs. 78 COMPARE_StateAttribute_Parameter(_shaderObjectList); 79 // COMPARE_StateAttribute_Parameter(_pcpoList); 80 81 return 0; // passed all the above comparison macro's, must be equal. 82 } 71 virtual int compare(const osg::StateAttribute& sa) const; 83 72 84 73 /** If enabled, install our shader program in the GL pipeline, … … 183 172 protected: /*data*/ 184 173 bool _enabled; 185 std::vector< ShaderObjectPtr > _shaderObjectList; 174 175 typedef std::vector< ShaderObjectPtr > ShaderObjectList; 176 ShaderObjectList _shaderObjectList; 186 177 mutable osg::buffered_value< osg::ref_ptr<PerContextProgObj> > _pcpoList; 187 178 mutable int _frameNumberOfLastPCPOUpdate; … … 219 210 ShaderObject(const ShaderObject& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); 220 211 META_Object(osgGL2, ShaderObject); 212 213 int compare(const ShaderObject& sa) const; 221 214 222 215 // data access methods. -
OpenSceneGraph/trunk/include/osgGL2/UniformValue
r2595 r3202 49 49 virtual void apply( Extensions *ext, const GLhandleARB progObj ) const = 0; 50 50 51 virtual int compare(const UniformValue& uv) const; 52 51 53 protected: 52 54 UniformValue( const char* uniformName ) : _name( uniformName ) {}; … … 74 76 UniformValueTemplate( const char* uniformName, T value ) : 75 77 UniformValue( uniformName ), _value( value ) {} 78 76 79 virtual void apply( Extensions *ext, const GLhandleARB progObj ) const; 80 81 virtual int compare(const UniformValue& uv) const 82 { 83 if (this==&uv) return 0; 84 const std::type_info* type_lhs = &typeid(*this); 85 const std::type_info* type_rhs = &typeid(uv); 86 if (type_lhs->before(*type_rhs)) return -1; 87 if (*type_lhs != *type_rhs) return 1; 88 const UniformValueTemplate& rhs = static_cast<const UniformValueTemplate&>(uv); 89 90 if (_name<rhs._name) return -1; 91 if (rhs._name<_name) return 1; 92 93 if (_value<rhs._value) return -1; 94 if (rhs._value<_value) return 1; 95 96 return 0; 97 } 77 98 78 99 protected: -
OpenSceneGraph/trunk/src/osgGL2/ProgramObject.cpp
r3171 r3202 172 172 } 173 173 174 int ProgramObject::compare(const osg::StateAttribute& sa) const 175 { 176 // check the types are equal and then create the rhs variable 177 // used by the COMPARE_StateAttribute_Paramter macro's below. 178 COMPARE_StateAttribute_Types(ProgramObject,sa) 179 180 if (_shaderObjectList.size()<rhs._shaderObjectList.size()) return -1; 181 if (_shaderObjectList.size()>rhs._shaderObjectList.size()) return 1; 182 183 ShaderObjectList::const_iterator litr=_shaderObjectList.begin(); 184 ShaderObjectList::const_iterator ritr=rhs._shaderObjectList.begin(); 185 for(; 186 litr!=_shaderObjectList.end(); 187 ++litr,++ritr) 188 { 189 int result = (*litr)->compare(*(*ritr)); 190 if (result!=0) return result; 191 } 192 193 194 if (_univalList.size()<rhs._univalList.size()) return -1; 195 if (_univalList.size()>rhs._univalList.size()) return 1; 196 197 UniformValueList::const_iterator luitr=_univalList.begin(); 198 UniformValueList::const_iterator ruitr=rhs._univalList.begin(); 199 for(; 200 luitr!=_univalList.end(); 201 ++luitr,++ruitr) 202 { 203 int result = (*luitr)->compare(*(*ruitr)); 204 if (result!=0) return result; 205 } 206 207 return 0; // passed all the above comparison macro's, must be equal. 208 } 209 174 210 175 211 // mark all PCPOs as needing a relink … … 414 450 { 415 451 /*TODO*/ 452 } 453 454 int ShaderObject::compare(const ShaderObject& so) const 455 { 456 if (getShaderSource()<so.getShaderSource()) return -1; 457 if (so.getShaderSource()<getShaderSource()) return 1; 458 return 0; 416 459 } 417 460 -
OpenSceneGraph/trunk/src/osgGL2/UniformValue.cpp
r2772 r3202 25 25 using namespace osgGL2; 26 26 using namespace osg; 27 28 int UniformValue::compare(const UniformValue& uv) const 29 { 30 if (_name<uv._name) return -1; 31 if (uv._name<_name) return 1; 32 return 0; 33 } 27 34 28 35 int UniformValue::getLocation( Extensions *ext, const GLhandleARB progObj ) const
