Sorting Polygons on CustomSceneNode
Sorting Polygons on CustomSceneNode
I created my own custom scene node and it works properly but the problem with it is that it always draws the polygons in the same order and disregards the z-buffer. Is there a way I can fix this? Obviously I could just do an algorithm to sort per frame based on distance to the camera but my node can have several thousand polys and sorting every frame seems horribly inefficient. Is there a better way of handling this? Thanks for any help.
Thanks, hybrid. Here is where I set up the materials:
And
The reason I have a custom node is because I created a class that turns a point cloud into a surface, which none of the existing nodes could do for me.
Code: Select all
Material.Wireframe = false;
Material.Lighting = false;
Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
setMaterialFlag(video::EMF_BILINEAR_FILTER,false);
setMaterialFlag(video::EMF_ANISOTROPIC_FILTER,true);
setMaterialFlag(video::EMF_ZBUFFER,true);
setMaterialFlag(video::EMF_ZWRITE_ENABLE,true);
setMaterialFlag(video::EMF_BACK_FACE_CULLING,true);
AutomaticCullingState = scene::EAC_OFF;
Code: Select all
void CCustomNode::OnRegisterSceneNode()
{
if (IsVisible)
SceneManager->registerNodeForRendering(this);
ISceneNode::OnRegisterSceneNode();
}