com.jme3.renderer.queue
Class RenderQueue

java.lang.Object
  extended by com.jme3.renderer.queue.RenderQueue

public class RenderQueue
extends java.lang.Object

RenderQueue is used to queue up and sort geometries for rendering.


Nested Class Summary
static class RenderQueue.Bucket
          The render queue Bucket specifies the bucket to which the spatial will be placed when rendered.
static class RenderQueue.ShadowMode
          ShadowMode is a marker used to specify how shadow effects should treat the spatial.
 
Constructor Summary
RenderQueue()
          Creates a new RenderQueue, the default comparators are used for all geometry lists.
 
Method Summary
 void addToQueue(Geometry g, RenderQueue.Bucket bucket)
          Adds a geometry to the given bucket.
 void addToShadowQueue(Geometry g, RenderQueue.ShadowMode shadBucket)
          Adds a geometry to a shadow bucket.
 void clear()
           
 GeometryList getShadowQueueContent(RenderQueue.ShadowMode shadBucket)
           
 boolean isQueueEmpty(RenderQueue.Bucket bucket)
           
 void renderQueue(RenderQueue.Bucket bucket, RenderManager rm, Camera cam)
           
 void renderQueue(RenderQueue.Bucket bucket, RenderManager rm, Camera cam, boolean clear)
           
 void renderShadowQueue(GeometryList list, RenderManager rm, Camera cam, boolean clear)
           
 void renderShadowQueue(RenderQueue.ShadowMode shadBucket, RenderManager rm, Camera cam, boolean clear)
           
 void setGeometryComparator(RenderQueue.Bucket bucket, GeometryComparator c)
          Sets a different geometry comparator for the specified bucket, one of Gui, Opaque, Sky, or Transparent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RenderQueue

public RenderQueue()
Creates a new RenderQueue, the default comparators are used for all geometry lists.

Method Detail

setGeometryComparator

public void setGeometryComparator(RenderQueue.Bucket bucket,
                                  GeometryComparator c)
Sets a different geometry comparator for the specified bucket, one of Gui, Opaque, Sky, or Transparent. The GeometryComparators are used to sort the accumulated list of geometries before actual rendering occurs.

The most significant comparator is the one for the transparent bucket since there is no correct way to sort the transparent bucket that will handle all geometry all the time. In certain cases, the application may know the best way to sort and now has the option of configuring a specific implementation.

The default comparators are:


addToShadowQueue

public void addToShadowQueue(Geometry g,
                             RenderQueue.ShadowMode shadBucket)
Adds a geometry to a shadow bucket. Note that this operation is done automatically by the RenderManager. SceneProcessors that handle shadow rendering should fetch the queue by using getShadowQueueContent(com.jme3.renderer.queue.RenderQueue.ShadowMode), by default no action is taken on the shadow queues.

Parameters:
g - The geometry to add
shadBucket - The shadow bucket type, if it is RenderQueue.ShadowMode.CastAndReceive, it is added to both the cast and the receive buckets.

addToQueue

public void addToQueue(Geometry g,
                       RenderQueue.Bucket bucket)
Adds a geometry to the given bucket. The RenderManager automatically handles this task when flattening the scene graph. The bucket to add the geometry is determined by Spatial.getQueueBucket().

Parameters:
g - The geometry to add
bucket - The bucket to add to, usually Spatial.getQueueBucket().

getShadowQueueContent

public GeometryList getShadowQueueContent(RenderQueue.ShadowMode shadBucket)
Parameters:
shadBucket - The shadow mode to retrieve the queue content for. Only Cast and Receive are valid.
Returns:
The cast or receive GeometryList

renderShadowQueue

public void renderShadowQueue(GeometryList list,
                              RenderManager rm,
                              Camera cam,
                              boolean clear)

renderShadowQueue

public void renderShadowQueue(RenderQueue.ShadowMode shadBucket,
                              RenderManager rm,
                              Camera cam,
                              boolean clear)

isQueueEmpty

public boolean isQueueEmpty(RenderQueue.Bucket bucket)

renderQueue

public void renderQueue(RenderQueue.Bucket bucket,
                        RenderManager rm,
                        Camera cam)

renderQueue

public void renderQueue(RenderQueue.Bucket bucket,
                        RenderManager rm,
                        Camera cam,
                        boolean clear)

clear

public void clear()