Hi JS, On Wed, Jun 16, 2010 at 1:47 PM, Jean-Sébastien Guay <jean-sebastien.g...@cm-labs.com> wrote: > Just to make sure I understand, you don't mean sorting the indices > themselves, right? That would always give 0...n of course... So I'd have to > calculate the distance between the eye and the vertex at index i, and then > place the indices so that those distances go from largest to smallest. Which > is still not too hard, but a bit slower than sorting unsigned ints of > course... :-)
Your sort functor would take a reference to the Vec3Array+lookvector or an array of the distances to sort against and then make decision of < based on the dereferencing the indices. Preparing an array of distances based would mean you only do the compute of the distance once per vertex, rather twice per < check of which there will nlogn. > OK, and then I'd have a custom osg::Geometry that would use the right > DrawElements for the current context/view in its drawImplementation? Yes a custom Drawable/Geometry would be required. > If I make it really nice > and well encapsulated I could even submit it as an osg::Geometry specialized > for point sprites / particles. Speaking of which, what does osgParticle do > for its rendering of particles? I've never looked at it, perhaps what I'm > doing now is already (partially/completely) done there? The basic osgParticle::ParticleSystem is really crude when it comes to do particle rendering - it manually computes the billboarded quads positions per frame and doesn't do any depth sorting at all. This part of osgParticle could really do with a major revamp. It really should use point sprites as they are pretty standard these days, although... we'd need to check OpenGL ES. A special ParticleGeometry drawable might make a nice base for a refactor of osgParticle. If it could be done right you could have multiple implementations depending upon the hardware capabilities. Robert. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org