Class Pass

java.lang.Object
com.ardor3d.renderer.pass.Pass
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BloomRenderPass, ParallelSplitShadowMapPass, RenderPass

public abstract class Pass extends Object implements Serializable
Pass encapsulates logic necessary for rendering one or more steps in a multipass technique. Rendering: When renderPass is called, a check is first made to see if the pass isEnabled(). Then any states set on this pass are enforced via Spatial.enforceState(RenderState). This is useful for doing things such as causing this pass to be blended to a previous pass via enforcing an BlendState, etc. Next, doRender(Renderer) is called to do the actual rendering work. Finally, any enforced states set before this pass was run are restored.
See Also:
  • Field Details

    • _spatials

      protected List<Spatial> _spatials
      list of Spatial objects registered with this pass.
    • _enabled

      protected boolean _enabled
      if false, pass will not be updated or rendered.
    • _passStates

      protected final EnumMap<RenderState.StateType,RenderState> _passStates
      RenderStates registered with this pass - if a given state is not null it overrides the corresponding state set during rendering.
    • _context

      protected RenderContext _context
  • Constructor Details

    • Pass

      public Pass()
  • Method Details

    • renderPass

      public final void renderPass(Renderer r)
      if enabled, set the states for this pass and then render.
      Parameters:
      r - the renderer
    • renderPass

      public final void renderPass(TextureRenderer r, int clear, List<Texture> texs)
      if enabled, set the states for this pass and then render.
      Parameters:
      r - the renderer
      clear - the clear
      texs - the list of textures
    • setPassState

      public void setPassState(RenderState state)
      Enforce a particular state. In other words, the given state will override any state of the same type set on a scene object. Remember to clear the state when done enforcing. Very useful for multipass techniques where multiple sets of states need to be applied to a scenegraph drawn multiple times.
      Parameters:
      state - state to enforce
    • clearPassState

      public void clearPassState(RenderState.StateType type)
      Clears an enforced render state index by setting it to null. This allows object specific states to be used.
      Parameters:
      type - The type of RenderState to clear enforcement on.
    • clearPassStates

      public void clearPassStates()
      sets all enforced states to null.
      See Also:
    • doRender

      protected abstract void doRender(Renderer r)
    • doRender

      protected void doRender(TextureRenderer r, int clear, List<Texture> texs)
    • updatePass

      public final void updatePass(double tpf)
      if enabled, call doUpdate to update information for this pass.
      Parameters:
      tpf - the time per frame
    • doUpdate

      protected void doUpdate(double tpf)
    • add

      public void add(Spatial toAdd)
    • get

      public Spatial get(int index)
    • contains

      public boolean contains(Spatial s)
    • remove

      public boolean remove(Spatial toRemove)
    • size

      public int size()
    • isEnabled

      public boolean isEnabled()
      Returns:
      Returns the enabled.
    • setEnabled

      public void setEnabled(boolean enabled)
      Parameters:
      enabled - The enabled to set.
    • cleanUp

      public void cleanUp()