forked from mirror/openmw-tes3mp
RigGeometry check if mesh has normals (Fixes #3667)
This commit is contained in:
parent
81b9b07820
commit
c0faeea938
1 changed files with 12 additions and 6 deletions
|
@ -120,13 +120,17 @@ void RigGeometry::setSourceGeometry(osg::ref_ptr<osg::Geometry> sourceGeometry)
|
||||||
setVertexArray(vertexArray);
|
setVertexArray(vertexArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Array> normalArray = osg::clone(from.getNormalArray(), osg::CopyOp::DEEP_COPY_ALL);
|
if (osg::Array* normals = from.getNormalArray())
|
||||||
if (normalArray)
|
|
||||||
{
|
{
|
||||||
normalArray->setVertexBufferObject(vbo);
|
osg::ref_ptr<osg::Array> normalArray = osg::clone(normals, osg::CopyOp::DEEP_COPY_ALL);
|
||||||
setNormalArray(normalArray, osg::Array::BIND_PER_VERTEX);
|
if (normalArray)
|
||||||
|
{
|
||||||
|
normalArray->setVertexBufferObject(vbo);
|
||||||
|
setNormalArray(normalArray, osg::Array::BIND_PER_VERTEX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (osg::Vec4Array* tangents = dynamic_cast<osg::Vec4Array*>(from.getTexCoordArray(7)))
|
if (osg::Vec4Array* tangents = dynamic_cast<osg::Vec4Array*>(from.getTexCoordArray(7)))
|
||||||
{
|
{
|
||||||
mSourceTangents = tangents;
|
mSourceTangents = tangents;
|
||||||
|
@ -273,7 +277,8 @@ void RigGeometry::update(osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
unsigned short vertex = *vertexIt;
|
unsigned short vertex = *vertexIt;
|
||||||
(*positionDst)[vertex] = resultMat.preMult((*positionSrc)[vertex]);
|
(*positionDst)[vertex] = resultMat.preMult((*positionSrc)[vertex]);
|
||||||
(*normalDst)[vertex] = osg::Matrix::transform3x3((*normalSrc)[vertex], resultMat);
|
if (normalDst)
|
||||||
|
(*normalDst)[vertex] = osg::Matrix::transform3x3((*normalSrc)[vertex], resultMat);
|
||||||
if (tangentDst)
|
if (tangentDst)
|
||||||
{
|
{
|
||||||
osg::Vec4f srcTangent = (*tangentSrc)[vertex];
|
osg::Vec4f srcTangent = (*tangentSrc)[vertex];
|
||||||
|
@ -284,7 +289,8 @@ void RigGeometry::update(osg::NodeVisitor* nv)
|
||||||
}
|
}
|
||||||
|
|
||||||
positionDst->dirty();
|
positionDst->dirty();
|
||||||
normalDst->dirty();
|
if (normalDst)
|
||||||
|
normalDst->dirty();
|
||||||
if (tangentDst)
|
if (tangentDst)
|
||||||
tangentDst->dirty();
|
tangentDst->dirty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue