From b6fe330b853610c287f4678cd2458f0d60757639 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 25 Nov 2008 14:15:55 +0000 Subject: [PATCH] Added support for unsigned int uniforms --- src/osgPlugins/osg/Uniform.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/osg/Uniform.cpp b/src/osgPlugins/osg/Uniform.cpp index 15a6019b3..f88b1c691 100644 --- a/src/osgPlugins/osg/Uniform.cpp +++ b/src/osgPlugins/osg/Uniform.cpp @@ -42,18 +42,31 @@ bool Uniform_readLocalData(Object& obj, Input& fr) if (fr[0].matchWord("type")) { // post-May 2006 format (OSG versions > 1.0) - uniform.setType( Uniform::getTypeId( fr[1].getStr() ) ); + ++fr; + + if (fr.matchSequence("unsigned int")) + { + uniform.setType( Uniform::getTypeId( "unsigned int" ) ); + fr += 2; + } + else + { + uniform.setType( Uniform::getTypeId( fr[0].getStr() ) ); + ++fr; + } + unsigned int numElements; - fr[2].getUInt(numElements); + fr[0].getUInt(numElements); uniform.setNumElements( numElements ); - fr+=3; + ++fr; iteratorAdvanced = true; Array* data = Array_readLocalData(fr); uniform.setArray( dynamic_cast(data) ); uniform.setArray( dynamic_cast(data) ); + uniform.setArray( dynamic_cast(data) ); } #if 1 //[ // Deprecated; for backwards compatibility only. @@ -233,6 +246,7 @@ bool Uniform_writeLocalData(const Object& obj,Output& fw) if( uniform.getFloatArray() ) Array_writeLocalData( *uniform.getFloatArray(), fw ); if( uniform.getIntArray() ) Array_writeLocalData( *uniform.getIntArray(), fw ); + if( uniform.getUIntArray() ) Array_writeLocalData( *uniform.getUIntArray(), fw ); if (uniform.getUpdateCallback()) {