|
|
@ -94,33 +94,16 @@ void RigGeometry::setSourceGeometry(osg::ref_ptr<osg::Geometry> sourceGeometry)
|
|
|
|
if (from.getStateSet())
|
|
|
|
if (from.getStateSet())
|
|
|
|
setStateSet(from.getStateSet());
|
|
|
|
setStateSet(from.getStateSet());
|
|
|
|
|
|
|
|
|
|
|
|
// copy over primitive sets.
|
|
|
|
// shallow copy primitive sets & vertex attributes that we will not modify
|
|
|
|
getPrimitiveSetList() = from.getPrimitiveSetList();
|
|
|
|
getPrimitiveSetList() = from.getPrimitiveSetList();
|
|
|
|
|
|
|
|
setColorArray(from.getColorArray());
|
|
|
|
if (from.getColorArray())
|
|
|
|
setSecondaryColorArray(from.getSecondaryColorArray());
|
|
|
|
setColorArray(from.getColorArray());
|
|
|
|
setFogCoordArray(from.getFogCoordArray());
|
|
|
|
|
|
|
|
setTexCoordArrayList(from.getTexCoordArrayList());
|
|
|
|
if (from.getSecondaryColorArray())
|
|
|
|
setVertexAttribArrayList(from.getVertexAttribArrayList());
|
|
|
|
setSecondaryColorArray(from.getSecondaryColorArray());
|
|
|
|
|
|
|
|
|
|
|
|
// vertices and normals are modified every frame, so we need to deep copy them.
|
|
|
|
if (from.getFogCoordArray())
|
|
|
|
// assign a dedicated VBO to make sure that modifications don't interfere with source geometry's VBO.
|
|
|
|
setFogCoordArray(from.getFogCoordArray());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(unsigned int ti=0;ti<from.getNumTexCoordArrays();++ti)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (from.getTexCoordArray(ti))
|
|
|
|
|
|
|
|
setTexCoordArray(ti,from.getTexCoordArray(ti));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
osg::Geometry::ArrayList& arrayList = from.getVertexAttribArrayList();
|
|
|
|
|
|
|
|
for(unsigned int vi=0;vi< arrayList.size();++vi)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
osg::Array* array = arrayList[vi].get();
|
|
|
|
|
|
|
|
if (array)
|
|
|
|
|
|
|
|
setVertexAttribArray(vi,array);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::VertexBufferObject> vbo (new osg::VertexBufferObject);
|
|
|
|
osg::ref_ptr<osg::VertexBufferObject> vbo (new osg::VertexBufferObject);
|
|
|
|
vbo->setUsage(GL_DYNAMIC_DRAW_ARB);
|
|
|
|
vbo->setUsage(GL_DYNAMIC_DRAW_ARB);
|
|
|
|
|
|
|
|
|
|
|
|