Fixed then normal smoothing function in the .3ds loader and the
osgUtil::SmoothingVisitor so that unused normals at left at 0,0,0 insead of being normalized, which results in (nan,nan,nan).
This commit is contained in:
@@ -391,7 +391,9 @@ osg::GeoSet* ReaderWriter3DS::createGeoSet(Lib3dsMesh *m,FaceList& faceList)
|
||||
// normalize the normal list to unit length normals.
|
||||
for (i=0; i<noVertex; ++i)
|
||||
{
|
||||
osg_normals[i].normalize();
|
||||
// osg_normals[i].normalize();
|
||||
float len = osg_normals[i].length();
|
||||
if (len) osg_normals[i]/=len;
|
||||
}
|
||||
|
||||
geoset->setNormals(osg_normals,osg_indices);
|
||||
|
||||
@@ -119,7 +119,8 @@ void SmoothingVisitor::smooth(osg::GeoSet& gset)
|
||||
|
||||
for(j = 0; j < ncoords; j++ )
|
||||
{
|
||||
norms[j].normalize();
|
||||
float len = norms[j].length();
|
||||
if (len) norms[j]/=len;
|
||||
}
|
||||
|
||||
gset.setNormalBinding(osg::GeoSet::BIND_PERVERTEX);
|
||||
|
||||
Reference in New Issue
Block a user