Replaced the use of osgUtil::TriStripVisitor with ogUtil::MeshOptimizer usage to improve performance.
Fixed set setColorArray assignement to pass in the color binding
This commit is contained in:
parent
c9b1c234a6
commit
71583b825f
@ -43,6 +43,7 @@
|
|||||||
#include <osgDB/FileNameUtils>
|
#include <osgDB/FileNameUtils>
|
||||||
|
|
||||||
#include <osgUtil/TriStripVisitor>
|
#include <osgUtil/TriStripVisitor>
|
||||||
|
#include <osgUtil/MeshOptimizers>
|
||||||
#include <osgUtil/SmoothingVisitor>
|
#include <osgUtil/SmoothingVisitor>
|
||||||
#include <osgUtil/Tessellator>
|
#include <osgUtil/Tessellator>
|
||||||
|
|
||||||
@ -533,8 +534,7 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model,
|
|||||||
|
|
||||||
if (colors)
|
if (colors)
|
||||||
{
|
{
|
||||||
geometry->setColorArray(colors);
|
geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
|
||||||
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numPointElements>0)
|
if (numPointElements>0)
|
||||||
@ -654,12 +654,6 @@ osg::Geometry* ReaderWriterOBJ::convertElementListToGeometry(obj::Model& model,
|
|||||||
obj::Element& element = *(*itr);
|
obj::Element& element = *(*itr);
|
||||||
if (element.dataType==obj::Element::POLYGON)
|
if (element.dataType==obj::Element::POLYGON)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_DRAWARRAYLENGTHS
|
#ifdef USE_DRAWARRAYLENGTHS
|
||||||
drawArrayLengths->push_back(element.vertexIndices.size());
|
drawArrayLengths->push_back(element.vertexIndices.size());
|
||||||
#else
|
#else
|
||||||
@ -804,8 +798,14 @@ osg::Node* ReaderWriterOBJ::convertModelToSceneGraph(obj::Model& model, ObjOptio
|
|||||||
// tri strip polygons to improve graphics peformance
|
// tri strip polygons to improve graphics peformance
|
||||||
if (!localOptions.noTriStripPolygons)
|
if (!localOptions.noTriStripPolygons)
|
||||||
{
|
{
|
||||||
osgUtil::TriStripVisitor tsv;
|
osgUtil::IndexMeshVisitor imv;
|
||||||
tsv.stripify(*geometry);
|
imv.makeMesh(*geometry);
|
||||||
|
|
||||||
|
osgUtil::VertexCacheVisitor vcv;
|
||||||
|
vcv.optimizeVertices(*geometry);
|
||||||
|
|
||||||
|
osgUtil::VertexAccessOrderVisitor vaov;
|
||||||
|
vaov.optimizeOrder(*geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no normals present add them.
|
// if no normals present add them.
|
||||||
|
Loading…
Reference in New Issue
Block a user