com.threerings.opengl.renderer
Class SimpleBatch

java.lang.Object
  extended by com.threerings.opengl.renderer.Batch
      extended by com.threerings.opengl.renderer.SimpleBatch
All Implemented Interfaces:
Cloneable

public class SimpleBatch
extends Batch

A batch that consists of a set of render states and a stateless draw command.


Nested Class Summary
static class SimpleBatch.CallList
          Draws the batch by calling a display list containing the geometry.
static class SimpleBatch.DrawArrays
          Draws the batch by calling GL11.glDrawArrays(int, int, int).
static class SimpleBatch.DrawBufferElements
          Draws the batch by calling GL11.glDrawElements(int, java.nio.ByteBuffer) using the current buffer object.
static class SimpleBatch.DrawBufferRangeElements
          Draws the batch by calling GL12.glDrawRangeElements(int, int, int, java.nio.ByteBuffer) using the current buffer object.
static class SimpleBatch.DrawCommand
          The superclass for the stateless draw commands that actually draw the primitives.
static class SimpleBatch.DrawElements
          Draws the batch by calling GL11.glDrawElements(int, java.nio.ByteBuffer).
static class SimpleBatch.DrawRangeElements
          Draws the batch by calling GL12.glDrawRangeElements(int, int, int, java.nio.ByteBuffer).
static class SimpleBatch.DrawShortElements
          Draws the batch by calling GL11.glDrawElements(int, java.nio.ByteBuffer) using a short buffer.
static class SimpleBatch.DrawShortRangeElements
          Draws the batch by calling GL12.glDrawRangeElements(int, int, int, java.nio.ByteBuffer) using a short buffer.
 
Field Summary
 
Fields inherited from class com.threerings.opengl.renderer.Batch
depth, key
 
Constructor Summary
SimpleBatch(RenderState[] states, SimpleBatch.DrawCommand command)
          Creates a new batch with the specified states and command.
 
Method Summary
 SimpleBatch clone()
           
static SimpleBatch.DrawElements createDrawBufferElements(int mode, int start, int end, int count, int type, long offset)
          Creates a SimpleBatch.DrawBufferRangeElements if the driver supports it; otherwise, falls back and creates a SimpleBatch.DrawBufferElements.
static SimpleBatch.DrawElements createDrawShortElements(int mode, int start, int end, ShortBuffer indices)
          Creates a SimpleBatch.DrawShortRangeElements if the driver supports it; otherwise, falls back and creates a SimpleBatch.DrawShortElements.
 boolean draw(Renderer renderer)
          Draws this batch using the specified renderer.
 SimpleBatch.DrawCommand getCommand()
          Returns a reference to the batch's draw command.
 int getPrimitiveCount()
          Returns the number of primitives in this batch (optional; returns zero by default).
 RenderState[] getStates()
          Returns a reference to the batch's set of render states.
 void updateKey()
          Updates the batch's state key using the current set of states.
 
Methods inherited from class com.threerings.opengl.renderer.Batch
compareKeys
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBatch

public SimpleBatch(RenderState[] states,
                   SimpleBatch.DrawCommand command)
Creates a new batch with the specified states and command.

Method Detail

createDrawBufferElements

public static SimpleBatch.DrawElements createDrawBufferElements(int mode,
                                                                int start,
                                                                int end,
                                                                int count,
                                                                int type,
                                                                long offset)
Creates a SimpleBatch.DrawBufferRangeElements if the driver supports it; otherwise, falls back and creates a SimpleBatch.DrawBufferElements.


createDrawShortElements

public static SimpleBatch.DrawElements createDrawShortElements(int mode,
                                                               int start,
                                                               int end,
                                                               ShortBuffer indices)
Creates a SimpleBatch.DrawShortRangeElements if the driver supports it; otherwise, falls back and creates a SimpleBatch.DrawShortElements.


getStates

public RenderState[] getStates()
Returns a reference to the batch's set of render states.


getCommand

public SimpleBatch.DrawCommand getCommand()
Returns a reference to the batch's draw command.


updateKey

public void updateKey()
Updates the batch's state key using the current set of states.


draw

public boolean draw(Renderer renderer)
Description copied from class: Batch
Draws this batch using the specified renderer.

Specified by:
draw in class Batch
Returns:
true if the batch changed the color state, in which case it should be invalidated.

getPrimitiveCount

public int getPrimitiveCount()
Description copied from class: Batch
Returns the number of primitives in this batch (optional; returns zero by default).

Overrides:
getPrimitiveCount in class Batch

clone

public SimpleBatch clone()
Overrides:
clone in class Batch


Copyright © 2011. All Rights Reserved.