Commit c894f825 authored by cutealien's avatar cutealien

Merge near identical code in CTriangleSelector::createFromMesh and...

Merge near identical code in CTriangleSelector::createFromMesh and CTriangleSelector::updateFromMesh (createFromMesh now using updateFromMesh).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4582 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ae9a3a40
...@@ -78,28 +78,9 @@ void CTriangleSelector::createFromMesh(const IMesh* mesh) ...@@ -78,28 +78,9 @@ void CTriangleSelector::createFromMesh(const IMesh* mesh)
for (u32 j=0; j<cnt; ++j) for (u32 j=0; j<cnt; ++j)
totalFaceCount += mesh->getMeshBuffer(j)->getIndexCount(); totalFaceCount += mesh->getMeshBuffer(j)->getIndexCount();
totalFaceCount /= 3; totalFaceCount /= 3;
Triangles.reallocate(totalFaceCount); Triangles.set_used(totalFaceCount);
BoundingBox.reset(0.f, 0.f, 0.f);
for (u32 i=0; i<cnt; ++i)
{
const IMeshBuffer* buf = mesh->getMeshBuffer(i);
const u32 idxCnt = buf->getIndexCount();
const u16* const indices = buf->getIndices();
for (u32 j=0; j<idxCnt; j+=3) updateFromMesh(mesh);
{
Triangles.push_back(core::triangle3df(
buf->getPosition(indices[j+0]),
buf->getPosition(indices[j+1]),
buf->getPosition(indices[j+2])));
const core::triangle3df& tri = Triangles.getLast();
BoundingBox.addInternalPoint(tri.pointA);
BoundingBox.addInternalPoint(tri.pointB);
BoundingBox.addInternalPoint(tri.pointC);
}
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment