Build fixes for new osg::Geometry

This commit is contained in:
Robert Osfield
2013-06-21 10:59:03 +00:00
parent deb074120e
commit 18d6d298bf
3 changed files with 15 additions and 12 deletions

View File

@@ -70,9 +70,9 @@ osg::Geode* daeReader::getOrCreateGeometry(domGeometry *pDomGeometry, domBind_ma
osg::Geometry* geom = pCopiedOsgGeode->getDrawable(i)->asGeometry();
if (geom)
{
if (!geom->areFastPathsUsed() && !geom->getInternalOptimizedGeometry())
if (geom->containsDeprecatedData())
{
//geom->computeInternalOptimizedGeometry();
geom->fixDeprecatedData();
}
}
}
@@ -798,7 +798,7 @@ typedef std::map<VertexIndices, GLuint> VertexIndicesIndexMap;
/// Creates a value array, packed in a osg::Array, corresponding to indexed values.
template <class ArrayType, int Value>
ArrayType createGeometryArray(domSourceReader & sourceReader, const VertexIndicesIndexMap & vertexIndicesIndexMap, int texcoordNum=-1) {
ArrayType* createGeometryArray(domSourceReader & sourceReader, const VertexIndicesIndexMap & vertexIndicesIndexMap, int texcoordNum=-1) {
const ArrayType * source = sourceReader.getArray<ArrayType>();
if (!source) return 0;
ArrayType * pArray = new ArrayType(osg::Geometry::BIND_PER_VERTEX);

View File

@@ -1290,10 +1290,10 @@ bool daeReader::copyTextureCoordinateSet(const osg::StateSet* ss, const osg::Geo
{
if (!strcmp(bvia[k]->getSemantic(), texCoordSetName.c_str()) && !strcmp(bvia[k]->getInput_semantic(), COMMON_PROFILE_INPUT_TEXCOORD))
{
unsigned set = bvia[k]->getInput_set();
unsigned int set = bvia[k]->getInput_set();
if (set < cachedGeometry->getNumTexCoordArrays())
{
clonedGeometry->setTexCoordData(localTextureUnit, cachedGeometry->getTexCoordData(set));
clonedGeometry->setTexCoordArray(localTextureUnit, const_cast<osg::Array*>(cachedGeometry->getTexCoordArray(set)));
}
else
{
@@ -1315,7 +1315,7 @@ bool daeReader::copyTextureCoordinateSet(const osg::StateSet* ss, const osg::Geo
IdToCoordIndexMap::const_iterator it = _texCoordIdMap.find(ba[k]->getTarget());
if (it!=_texCoordIdMap.end()&& (cachedGeometry->getNumTexCoordArrays()>it->second))
{
clonedGeometry->setTexCoordData(localTextureUnit, cachedGeometry->getTexCoordData(it->second));
clonedGeometry->setTexCoordArray(localTextureUnit, const_cast<osg::Array*>(cachedGeometry->getTexCoordArray(it->second)));
}
else
{
@@ -1328,7 +1328,7 @@ bool daeReader::copyTextureCoordinateSet(const osg::StateSet* ss, const osg::Geo
{
if (cachedGeometry->getNumTexCoordArrays())
{
clonedGeometry->setTexCoordData(localTextureUnit, cachedGeometry->getTexCoordData(0));
clonedGeometry->setTexCoordArray(localTextureUnit, const_cast<osg::Array*>(cachedGeometry->getTexCoordArray(0)));
}
}
}

View File

@@ -550,9 +550,12 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st
domPolygons *polys = NULL;
domPolylist *polylist = NULL;
ArrayNIndices verts( geom->getVertexArray(), geom->getVertexIndices() );
ArrayNIndices normals( geom->getNormalArray(), geom->getNormalIndices() );
ArrayNIndices colors( geom->getColorArray(), geom->getColorIndices() );
// make sure no deprecated indices or BIND_PER_PRIMITIVE remain
if (geom->containsDeprecatedData()) geom->fixDeprecatedData();
ArrayNIndices verts( geom->getVertexArray(), 0 );
ArrayNIndices normals( geom->getNormalArray(), 0 );
ArrayNIndices colors( geom->getColorArray(), 0 );
// RS BUG
// getNumTexCoordArrays may return larger number
@@ -562,7 +565,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st
{
if (geom->getTexCoordArray(i))
{
texcoords.push_back( ArrayNIndices( geom->getTexCoordArray( i ), geom->getTexCoordIndices( i ) ) );
texcoords.push_back( ArrayNIndices( geom->getTexCoordArray( i ), 0 ) );
}
}
std::vector<ArrayNIndices> vertexAttributes;
@@ -570,7 +573,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st
{
if (geom->getVertexAttribArray(i))
{
vertexAttributes.push_back(ArrayNIndices( geom->getVertexAttribArray( i ), geom->getVertexAttribIndices(i)));
vertexAttributes.push_back(ArrayNIndices( geom->getVertexAttribArray( i ), 0));
}
}