Disable depth test

Started by David, November 04, 2011, 01:08:21 PM

Previous topic - Next topic

David

Hi folks,

I want to disable the depth test for some objects in my scene, or to be precise I some objects should always be drawn last, regardless of their depth. Is there a way to do this in JPCT-AE?

By the way, is there a callback (similar to the IRenderhook) which is called before an Object3D is rendered?

Thanks!
David

EgonOlsen

IRenderHook is called before and after the rendering. However, it's called per compiled mesh, not per Object3D. That means that it can be called multiple times per Object3D (but at least once). You can work around this by implementing the setCurrentObject3D() instead.

Concerning your actual question, here's an idea (untested): Implement the IRenderHook for your "delayed" objects. If the first object should be rendered in a frame, clear the zbuffer (FrameBuffer.clearZBufferOnly()). For the next delayed Object3Ds, don't do this. To render these delayed objects after all others, play around with Object3D.setSortOffset(...).

Another idea would be to split the object sets in two worlds. Render the first, clear the zbuffer, render the delayed objects in the other world.