Fixed line endings.

This commit is contained in:
hiker 2014-12-09 08:05:16 +11:00
parent 5b62d94c5b
commit 2c2847e912

View File

@ -1479,52 +1479,52 @@ void CSkinnedMesh::calculateTangents(
*/
CSkinnedMesh *CSkinnedMesh::clone()
{
CSkinnedMesh* skinned_mesh = new CSkinnedMesh();
for (u32 i = 0; i < getMeshBuffers().size(); i++)
{
SSkinMeshBuffer * buffer = skinned_mesh->addMeshBuffer();
*buffer = *(getMeshBuffers()[i]);
}
for (u32 j = 0; j < getAllJoints().size(); ++j)
{
ISkinnedMesh::SJoint *joint = skinned_mesh->addJoint();
*joint = *(getAllJoints()[j]);
}
// fix children pointers (they still have old pointers)
core::array<ISkinnedMesh::SJoint*> & new_joints = skinned_mesh->getAllJoints();
for (u32 i = 0; i < new_joints.size(); ++i)
{
ISkinnedMesh::SJoint * joint = new_joints[i];
for (u32 c = 0; c < joint->Children.size(); ++c)
{
// the child is one of the oldJoints and must be replaced by the newjoint on the same index
bool found = false;
for (u32 k = 0; k < AllJoints.size(); ++k)
{
if (joint->Children[c] == AllJoints[k])
{
joint->Children[c] = new_joints[k];
found = true;
break;
}
} // k < old_joints.size
if (!found)
found = true;
} // c < joint->Children.size()
} // i < new_joints.size()
// In finalize the values from LocalBuffers are copied into
// Weights[].StaticPos. Since skinned_mesh already has the correct
// values in Weights, we have to copy the values from Weights
// into LocalBuffer (so that in the copy from LocalBuffer to weights
// no values are overwritten).
// FIXME: Not ideal, better would be not to copy the values in
// finalize().
CSkinnedMesh* skinned_mesh = new CSkinnedMesh();
for (u32 i = 0; i < getMeshBuffers().size(); i++)
{
SSkinMeshBuffer * buffer = skinned_mesh->addMeshBuffer();
*buffer = *(getMeshBuffers()[i]);
}
for (u32 j = 0; j < getAllJoints().size(); ++j)
{
ISkinnedMesh::SJoint *joint = skinned_mesh->addJoint();
*joint = *(getAllJoints()[j]);
}
// fix children pointers (they still have old pointers)
core::array<ISkinnedMesh::SJoint*> & new_joints = skinned_mesh->getAllJoints();
for (u32 i = 0; i < new_joints.size(); ++i)
{
ISkinnedMesh::SJoint * joint = new_joints[i];
for (u32 c = 0; c < joint->Children.size(); ++c)
{
// the child is one of the oldJoints and must be replaced by the newjoint on the same index
bool found = false;
for (u32 k = 0; k < AllJoints.size(); ++k)
{
if (joint->Children[c] == AllJoints[k])
{
joint->Children[c] = new_joints[k];
found = true;
break;
}
} // k < old_joints.size
if (!found)
found = true;
} // c < joint->Children.size()
} // i < new_joints.size()
// In finalize the values from LocalBuffers are copied into
// Weights[].StaticPos. Since skinned_mesh already has the correct
// values in Weights, we have to copy the values from Weights
// into LocalBuffer (so that in the copy from LocalBuffer to weights
// no values are overwritten).
// FIXME: Not ideal, better would be not to copy the values in
// finalize().
for (unsigned int i = 0; i<AllJoints.size(); ++i)
{
SJoint *joint = AllJoints[i];
@ -1537,11 +1537,11 @@ CSkinnedMesh *CSkinnedMesh::clone()
skinned_mesh->LocalBuffers[buffer_id]->getVertex(vertex_id)->Normal = joint->Weights[j].StaticNormal;
}
}
skinned_mesh->finalize();
skinned_mesh->finalize();
return skinned_mesh;
return skinned_mesh;
} // clone