Removed array::erase from loops in Octtree.h and COctTreeTriangleSelector.cpp, they now generate a lot faster.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@684 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
db6011aae3
commit
fcbf4a1a19
|
@ -1,6 +1,6 @@
|
|||
Changes in version 1.3.1 (?? Mar 2007)
|
||||
|
||||
- Some fixes in the 3d basic structures: plane3d.classifyPointRelation no
|
||||
- Some fixes in the 3d basic structures: plane3d.classifyPointRelation now
|
||||
correctly returns the relation, it returned the opposite before. Also
|
||||
renamed existsInterSection to existsIntersection for consistency.
|
||||
triangle3d.isOnSameSide is now private - it's just a helper class not
|
||||
|
@ -89,6 +89,8 @@ Changes in version 1.3.1 (?? Mar 2007)
|
|||
- Fixed a crash when using Octtrees caused by unnecessary dropping of meshes when
|
||||
deserializing the scene node.
|
||||
|
||||
- Removed an array::erase from Octtrees and Octtree triangle selector.
|
||||
|
||||
GUI:
|
||||
|
||||
- Fixed a messagebox focus bug when no 'okay' button was present
|
||||
|
|
|
@ -70,6 +70,7 @@ void COctTreeTriangleSelector::constructOctTree(SOctTreeNode* node)
|
|||
node->Box.getEdges(edges);
|
||||
|
||||
core::aabbox3d<f32> box;
|
||||
core::array<core::triangle3df> keepTriangles;
|
||||
|
||||
// calculate children
|
||||
|
||||
|
@ -85,10 +86,19 @@ void COctTreeTriangleSelector::constructOctTree(SOctTreeNode* node)
|
|||
if (node->Triangles[i].isTotalInsideBox(box))
|
||||
{
|
||||
node->Child[ch]->Triangles.push_back(node->Triangles[i]);
|
||||
node->Triangles.erase(i);
|
||||
--i;
|
||||
//node->Triangles.erase(i);
|
||||
//--i;
|
||||
}
|
||||
else
|
||||
{
|
||||
keepTriangles.push_back(node->Triangles[i]);
|
||||
}
|
||||
}
|
||||
memcpy(node->Triangles.pointer(), keepTriangles.pointer(),
|
||||
sizeof(core::triangle3df)*keepTriangles.size());
|
||||
|
||||
node->Triangles.set_used(keepTriangles.size());
|
||||
keepTriangles.set_used(0);
|
||||
|
||||
if (node->Child[ch]->Triangles.empty())
|
||||
{
|
||||
|
|
|
@ -189,6 +189,7 @@ private:
|
|||
|
||||
// calculate all children
|
||||
core::aabbox3d<f32> box;
|
||||
core::array<u16> keepIndices;
|
||||
|
||||
if (totalPrimitives > minimalPolysPerNode && !Box.isEmpty())
|
||||
for (s32 ch=0; ch<8; ++ch)
|
||||
|
@ -219,13 +220,19 @@ private:
|
|||
tic.Indices.push_back((*indices)[i].Indices[t+1]);
|
||||
tic.Indices.push_back((*indices)[i].Indices[t+2]);
|
||||
|
||||
(*indices)[i].Indices.erase(t, 3);
|
||||
|
||||
t-=3;
|
||||
|
||||
added = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
keepIndices.push_back((*indices)[i].Indices[t]);
|
||||
keepIndices.push_back((*indices)[i].Indices[t+1]);
|
||||
keepIndices.push_back((*indices)[i].Indices[t+2]);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy( (*indices)[i].Indices.pointer(), keepIndices.pointer(), keepIndices.size()*sizeof(u16));
|
||||
(*indices)[i].Indices.set_used(keepIndices.size());
|
||||
keepIndices.set_used(0);
|
||||
}
|
||||
|
||||
if (added)
|
||||
|
|
Loading…
Reference in New Issue