From Jean-Sebastien Guay, "When copying a node that had uniforms on it, the copy constructor of osg::Uniform would not copy the array of the original uniform (either _intArray or _floatArray) because none had been allocated and the copy constructor checks that *both* this's array and rhs's array are valid.
I added a call to allocateDataArray() if rhs has (at least) one valid array, which should allocate the right array according to the type. Since the type was copied from rhs, it should create the same array as rhs has, so then it should copy the data in the following lines. "
This commit is contained in:
@@ -218,6 +218,7 @@ void Uniform::copyData(const Uniform& rhs)
|
||||
{
|
||||
// caller must ensure that _type==rhs._type
|
||||
_numElements = rhs._numElements;
|
||||
if (rhs._floatArray.valid() || rhs._intArray.valid()) allocateDataArray();
|
||||
if( _floatArray.valid() && rhs._floatArray.valid() ) *_floatArray = *rhs._floatArray;
|
||||
if( _intArray.valid() && rhs._intArray.valid() ) *_intArray = *rhs._intArray;
|
||||
dirty();
|
||||
|
||||
Reference in New Issue
Block a user