com.threed.jpct
Interface IRenderHook


public interface IRenderHook

Provides a hook into the rendering pipeline of Object3Ds. This is meant to be used for executing your own OpenGL (or whatever...) code directly in the render pipeline.
A render hook is attached to an Object3D. However, this doesn't mean that it's only called once per object. In fact, an object can be compiled into hundreds of display lists/vertex arrays. These methods will be called for each of them, if they are going to be rendered in this frame.


Method Summary
 void afterRendering(int polyID)
          Will be called immediately after the actual rendering takes place.
 void beforeRendering(int polyID)
          Will be called immediately before the actual rendering takes place.
 void onDispose()
          Will be called, if the underlying compiled structures get disposed.
 boolean repeatRendering()
          If this returns true, the same geometry that was rendered will be rendered again using the exact same settings. beforeRendering() won't be called again. afterRendering() won't be called yet.
 void setCurrentObject3D(Object3D obj)
          Sets the currently rendered object.
 void setCurrentShader(GLSLShader shader)
          Sets the currently active shader.
 void setTransparency(float transparency)
          Set which transparency value is used for this object.
 

Method Detail

beforeRendering

void beforeRendering(int polyID)
Will be called immediately before the actual rendering takes place. It is guaranteed that this happens within the thread that is bound to the OpenGL context, i.e. you can execute OpenGL commands within here. Texture stages, blending modes, lighting and all is already set up as the object's configuration demands it.
If GLSLShader is being used, it's also ensured that this method will be called before initializing the shader, so that you can set Object3D specific uniforms here.

Parameters:
polyID - the ID of the polygon that is first in the current list that is about to render.

afterRendering

void afterRendering(int polyID)
Will be called immediately after the actual rendering takes place. It is guaranteed that this happens within the thread that is bound to the OpenGL context, i.e. you can execute OpenGL commands within here.

Parameters:
polyID - the ID of the polygon that is first in the current list that is about to render.

setCurrentObject3D

void setCurrentObject3D(Object3D obj)
Sets the currently rendered object. This will be called before calling beforeRendering()

Parameters:
obj - the current Object3D

setCurrentShader

void setCurrentShader(GLSLShader shader)
Sets the currently active shader. This will be called after beforeRendering().

Parameters:
shader - the shader or null if none is used

setTransparency

void setTransparency(float transparency)
Set which transparency value is used for this object. This is the value OpenGL uses, not the one assigned to the object, i.e. it has already been processed. This will be called before setCurrentObject3D().


onDispose

void onDispose()
Will be called, if the underlying compiled structures get disposed. It's not guaranteed that this will happen in an application and depending on the object's compiled structure, it may happen several times.


repeatRendering

boolean repeatRendering()
If this returns true, the same geometry that was rendered will be rendered again using the exact same settings. beforeRendering() won't be called again. afterRendering() won't be called yet.
The rendering will be redone as often as this method returns true. If this method always returns true, you've created an infinite loop.

Returns:
true, if the rendering should be redone, false otherwise.