From 18d6d298bf484c1dd243d553e2b051c3d4edb33f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 21 Jun 2013 10:59:03 +0000 Subject: [PATCH] Build fixes for new osg::Geometry --- src/osgPlugins/dae/daeRGeometry.cpp | 6 +++--- src/osgPlugins/dae/daeRMaterials.cpp | 8 ++++---- src/osgPlugins/dae/daeWGeometry.cpp | 13 ++++++++----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/osgPlugins/dae/daeRGeometry.cpp b/src/osgPlugins/dae/daeRGeometry.cpp index afde51959..2ba5ef59d 100644 --- a/src/osgPlugins/dae/daeRGeometry.cpp +++ b/src/osgPlugins/dae/daeRGeometry.cpp @@ -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 VertexIndicesIndexMap; /// Creates a value array, packed in a osg::Array, corresponding to indexed values. template -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(); if (!source) return 0; ArrayType * pArray = new ArrayType(osg::Geometry::BIND_PER_VERTEX); diff --git a/src/osgPlugins/dae/daeRMaterials.cpp b/src/osgPlugins/dae/daeRMaterials.cpp index 5e73fdf9e..fa1f6bb3d 100644 --- a/src/osgPlugins/dae/daeRMaterials.cpp +++ b/src/osgPlugins/dae/daeRMaterials.cpp @@ -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(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(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(cachedGeometry->getTexCoordArray(0))); } } } diff --git a/src/osgPlugins/dae/daeWGeometry.cpp b/src/osgPlugins/dae/daeWGeometry.cpp index e52d16584..6fe3a41d4 100644 --- a/src/osgPlugins/dae/daeWGeometry.cpp +++ b/src/osgPlugins/dae/daeWGeometry.cpp @@ -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 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)); } }