From fb83a47d788f42c887584a645ef8c59227d98132 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 23 Mar 2009 20:25:51 +0000 Subject: [PATCH] From Aric Aumann, fixed handling of null texture coordinates --- src/osgPlugins/x/ReaderWriterDirectX.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/x/ReaderWriterDirectX.cpp b/src/osgPlugins/x/ReaderWriterDirectX.cpp index fdfc7de62..51c673b91 100644 --- a/src/osgPlugins/x/ReaderWriterDirectX.cpp +++ b/src/osgPlugins/x/ReaderWriterDirectX.cpp @@ -155,8 +155,6 @@ osg::Geode* ReaderWriterDirectX::convertFromDX(DX::Mesh & mesh, const DX::MeshTextureCoords* meshTexCoords = mesh.getMeshTextureCoords(); //std::cerr << "texcoord=" << meshTexCoords << std::endl; - if (!meshTexCoords) - return NULL; /* * - MeshMaterialList contains a list of Material and a per-face @@ -288,7 +286,8 @@ osg::Geode* ReaderWriterDirectX::convertFromDX(DX::Mesh & mesh, osg::Vec3Array* vertexArray = (osg::Vec3Array*) geom->getVertexArray(); osg::Vec3Array* normalArray = (osg::Vec3Array*) geom->getNormalArray(); - osg::Vec2Array* texCoordArray = (osg::Vec2Array*) geom->getTexCoordArray(0); + osg::Vec2Array* texCoordArray=NULL; // only make them if the original has them + if(meshTexCoords) texCoordArray = (osg::Vec2Array*) geom->getTexCoordArray(0); // Add vertices, normals, texcoords for (unsigned int j = 0; j < np; j++) {