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