|
Howdy Bart Bart De Lathouwer pisze:
Simplest solution is just not draw such mesh at all. :-) I usually create display list for mesh, then for each mesh I keep very simple struct like this: struct SimpleRenderingMesh { GLuint displayList; Lib3dsNode* node; }; Then I can keep such structures in any way convenient. And draw them in any order I need. You should determine distance of mesh from camera, then order meshes by their distances. Actually you just need to sort transparent meshes, opaque meshes order is not important. To find mentioned distance there are at least two methods which come to my mind: M1. simple calculating distance between two points: for each mesh: Point3 distVec = mesh->center - camera->position; float distance = distVec.Length(); M2. signed distance from view plane: for each mesh: float distance = ( mesh->center - camera->position ) * camera->viewVect; /// * is for dot_product "mesh->center" is actually translation taken from node's matrix: x = matrix[3][0], y = matrix[3][1], z = matrix[3][2]; To sort things out, there are many methods available, try googling for them. In plain "C" you may use "qsort" defined in header <cstdlib> to sort any table by any criteria, with C++ you may use "sort" from standard header <algorithm> but that's the other story. that's right. transparency may be defined on vertices of mesh or by alpha channel in texture. Well, hope that helps :-) Greetings Rafal |
------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________ lib3ds-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lib3ds-devel
