CTriangleSelector::getTriangles - not implemented ?

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
bucheron
Posts: 7
Joined: Sun Apr 17, 2005 10:38 pm

CTriangleSelector::getTriangles - not implemented ?

Post by bucheron »

It would be nice to write in the doc that getTriangles (for a aabbox32) is not properly implemented and that it doesn't return the triangles which are in a box, but all triangles !

Check below, you will see that the aabbox is not used at all. By the way, has anyone implemented the proper function ?

Code: Select all

//! Gets all triangles which lie within a specific bounding box.
void CTriangleSelector::getTriangles(core::triangle3df* triangles, 
									 s32 arraySize, s32& outTriangleCount, 
									const core::aabbox3d<f32>& box,
									const core::matrix4* transform)
{
	// return all triangles
	getTriangles(triangles, arraySize, outTriangleCount, transform);
}
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Code: Select all

//! Gets all triangles which lie within a specific bounding box.
void CTriangleSelector::getTriangles(core::triangle3df* triangles, 
									 s32 arraySize, s32& outTriangleCount, 
									const core::aabbox3d<f32>& box,
									const core::matrix4* transform)
{    

    //changed by electron so actually only returns triangles in aabbox
   	s32 cnt = Triangles.size();
	if (cnt > arraySize)
		cnt = arraySize;

	core::matrix4 mat;

	if (transform)
		mat = (*transform);

	if (SceneNode)
		mat *= SceneNode->getAbsoluteTransformation();

    outTriangleCount=0;
	for (s32 i=0; i<cnt; ++i)
	{
        if(Triangles[i].isTotalInsideBox(box))
        {
		triangles[i] = Triangles[i];
		mat.transformVect(triangles[i].pointA);
		mat.transformVect(triangles[i].pointB);
		mat.transformVect(triangles[i].pointC);
		outTriangleCount++;
        }
	}
	
}
Note that this is already in IrrlichtNX
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Post Reply