2.8 branch: Uniform lookup by cached name ID. Trunk revisions r11952, r11998, and r12074.

This commit is contained in:
Paul MARTZ
2011-05-02 22:13:01 +00:00
parent 288fb20eb6
commit 2f7167d011
5 changed files with 65 additions and 12 deletions

View File

@@ -259,6 +259,9 @@ class OSG_EXPORT Uniform : public Object
/** Return the internal data array type corresponding to a GLSL type */
static GLenum getInternalArrayType( Type t );
/** Return the number that the name maps to uniquely */
static unsigned int getNameID(const std::string& name);
/** convenient scalar (non-array) constructors w/ assignment */
explicit Uniform( const char* name, float f );
explicit Uniform( const char* name, int i );
@@ -463,6 +466,8 @@ class OSG_EXPORT Uniform : public Object
inline void setModifiedCount(unsigned int mc) { _modifiedCount = mc; }
inline unsigned int getModifiedCount() const { return _modifiedCount; }
/** Get the number that the Uniform's name maps to uniquely */
unsigned int getNameID() const;
void apply(const GL2Extensions* ext, GLint location) const;
@@ -484,6 +489,8 @@ class OSG_EXPORT Uniform : public Object
Type _type;
unsigned int _numElements;
unsigned int _nameID;
// The internal data for osg::Uniforms are stored as an array of
// getInternalArrayType() of length getInternalArrayNumElements().