Author Topic: Disable depth test  (Read 1411 times)

Offline David

  • byte
  • *
  • Posts: 1
    • View Profile
Disable depth test
« on: November 04, 2011, 01:08:21 pm »
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
« Last Edit: November 04, 2011, 01:46:41 pm by David »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12065
    • View Profile
    • http://www.jpct.net
Re: Disable depth test
« Reply #1 on: November 04, 2011, 02:14:52 pm »
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.