Fixed LWO2 ReaderWriter problem which was down to an the compiler reodering

the evaluation of a Vec3 paramter.
This commit is contained in:
Robert Osfield
2002-09-03 13:04:53 +00:00
parent 46585242a1
commit 0cb75d42e0
6 changed files with 67 additions and 49 deletions

View File

@@ -69,10 +69,10 @@ osgDB::RegisterReaderWriterProxy<ReaderWriterLWO> g_lwoReaderWriterProxy;
osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO2(const std::string& fileName, const osgDB::ReaderWriter::Options*)
{
std::auto_ptr<Lwo2> lwo2(new Lwo2());
std::auto_ptr<Lwo2> lwo2(osgNew Lwo2());
if (lwo2->ReadFile(fileName))
{
osg::ref_ptr<Group> group = new osg::Group();
osg::ref_ptr<Group> group = osgNew osg::Group();
if (lwo2->GenerateGroup(*group)) return group.take();
}
return ReadResult::FILE_NOT_HANDLED;
@@ -146,14 +146,14 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
{
lwMaterial& lw_material = lw->material[itr->first];
gc._geom = new osg::Geometry;
gc._geom = osgNew osg::Geometry;
osg::Vec3Array* vertArray = new osg::Vec3Array(gc._numPoints);
osg::Vec3Array* vertArray = osgNew osg::Vec3Array(gc._numPoints);
gc._vertices = vertArray->begin();
gc._geom->setVertexArray(vertArray);
// set up color.
osg::Vec4Array* colors = new osg::Vec4Array(1);
osg::Vec4Array* colors = osgNew osg::Vec4Array(1);
(*colors)[0].set(lw_material.r,
lw_material.g,
lw_material.b,
@@ -171,9 +171,9 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
if (image)
{
// create state
osg::StateSet* stateset = new osg::StateSet;
osg::StateSet* stateset = osgNew osg::StateSet;
osg::Texture2D* texture = new osg::Texture2D;
osg::Texture2D* texture = osgNew osg::Texture2D;
texture->setImage(image);
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
@@ -181,7 +181,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
gc._geom->setStateSet(stateset);
osg::Vec2Array* texcoordArray = new osg::Vec2Array(gc._numPoints);
osg::Vec2Array* texcoordArray = osgNew osg::Vec2Array(gc._numPoints);
gc._texcoords = texcoordArray->begin();
gc._geom->setTexCoordArray(0,texcoordArray);
}
@@ -198,7 +198,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
{
GeometryCollection& gc = mtgcm[face.material];
gc._geom->addPrimitive(new osg::DrawArrays(osg::Primitive::POLYGON,gc._coordCount,face.index_cnt));
gc._geom->addPrimitive(osgNew osg::DrawArrays(osg::Primitive::POLYGON,gc._coordCount,face.index_cnt));
gc._coordCount += face.index_cnt;
// From the spec_low.lxt :
@@ -225,7 +225,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
}
}
osg::Geode* geode = new osg::Geode;
osg::Geode* geode = osgNew osg::Geode;
osgUtil::Tesselator tesselator;
@@ -239,7 +239,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
if (gc._geom)
{
tesselator.retesselatePolygons(*gc._geom);
//tesselator.retesselatePolygons(*gc._geom);
smoother.smooth(*gc._geom);