public final class Batch extends java.lang.Object implements IDestroyable
BufferPool memory,
meaning no allocation (BufferPool is pre-allocated).
Batch is rendered efficiently and can be rendered with
hardware instancing (requires GLApiExt.instancing).Batch class offers low level rendering methods for rendering
with simple shading or with a specified Shader.Batch is also integrated in
the rendering pipeline Renderer.render(Batch, com.bonzaiengine.math.Transform,
com.bonzaiengine.material.IMaterial, int)| Modifier and Type | Class and Description |
|---|---|
static interface |
Batch.IBatchAttributes |
| Modifier and Type | Method and Description |
|---|---|
void |
alloc(boolean hasUv,
boolean hasNrm,
boolean hasClr)
Allocate the reserved vertices and indices
|
void |
alloc(int numUv,
boolean hasNrm,
boolean hasClr) |
static byte[] |
c(Color4 c) |
static byte[] |
c(float r,
float g,
float b) |
static byte[] |
c(float r,
float g,
float b,
float a) |
void |
destroy(IGL gl) |
void |
disableColors()
Disable colors
|
void |
disableNormals()
Disable normals
|
void |
disableTexCoords()
Disable texture coordinates
|
void |
enableColors()
Enable colors
|
void |
enableNormals()
Enable normals
|
void |
enableTexCoords()
Enable texture coordinates
|
void |
free()
Free memory buffers
|
int |
getNumIndices() |
int |
getNumIndicesWritten() |
int |
getNumVertices() |
int |
getNumVerticesWritten() |
Batch.IBatchAttributes |
getUserAttributes() |
boolean |
hasColors() |
boolean |
hasNormals() |
boolean |
hasTexCoords() |
static float[] |
n(Vec3 n) |
static Batch |
newPersistent()
Persistent
Batch allocating persistent memory, must be destroyed with destroy(IGL) |
static Batch |
newVolatile()
Volatile
Batch allocating volatile memory in BufferPool |
static float[] |
pos(float x,
float y,
float z) |
static float[] |
pos(Vec3 vec) |
void |
putIndex(int index) |
void |
putIndices() |
void |
putIndices(int[] indices) |
void |
putQuadAsTriangles(int i0,
int i1,
int i2,
int i3)
Put two triangles: (0,1,2) (0,2,3)
|
void |
putVertex(float[] p,
float[] tc,
float[] n,
byte[] c) |
void |
putVertex(int numVertex,
float[] p,
float[] tc,
float[] n,
byte[] c) |
void |
render(IGL gl,
boolean diffuseTexture,
boolean alphaTest)
Render the geometry with the specified texture, if any
|
void |
render(IGL gl,
boolean diffuseTexture,
boolean alphaTest,
boolean sdFont,
Lights<?> lights) |
void |
reserve(int numVertices,
int numIndices,
int polygonType)
Reserve the specified vertices and indices for this
Batch. |
void |
rewind()
Rewind memory buffer after data are filled
|
void |
setDynamicHint(boolean dynamicHint) |
void |
setUserAttributes(Batch.IBatchAttributes userAttributes) |
static float[] |
uv(float u,
float v) |
public static final Batch newPersistent()
Batch allocating persistent memory, must be destroyed with destroy(IGL)Batchpublic static final Batch newVolatile()
Batch allocating volatile memory in BufferPoolBatchpublic void setDynamicHint(boolean dynamicHint)
dynamicHint - true to specified this Batch may be dynamically updatedpublic void setUserAttributes(Batch.IBatchAttributes userAttributes)
public Batch.IBatchAttributes getUserAttributes()
public void reserve(int numVertices,
int numIndices,
int polygonType)
Batch.polygonType is the samepublic void alloc(boolean hasUv,
boolean hasNrm,
boolean hasClr)
reserve(int, int, int)public void alloc(int numUv,
boolean hasNrm,
boolean hasClr)
public void putVertex(float[] p,
float[] tc,
float[] n,
byte[] c)
public void putVertex(int numVertex,
float[] p,
float[] tc,
float[] n,
byte[] c)
public void putIndex(int index)
public void putIndices(int[] indices)
public void putIndices()
public void putQuadAsTriangles(int i0,
int i1,
int i2,
int i3)
public void rewind()
public void free()
public int getNumVertices()
public int getNumVerticesWritten()
public int getNumIndices()
public int getNumIndicesWritten()
public boolean hasTexCoords()
public boolean hasNormals()
public boolean hasColors()
public void disableTexCoords()
public void enableTexCoords()
java.lang.IllegalStateException - if hasTexCoords() return falsepublic void disableNormals()
public void enableNormals()
java.lang.IllegalStateException - if hasNormals() return falsepublic void disableColors()
public void enableColors()
java.lang.IllegalStateException - if hasColors() return falsepublic void destroy(IGL gl)
destroy in interface IDestroyablepublic void render(IGL gl, boolean diffuseTexture, boolean alphaTest)
gl - textureId - reference of the texture already binded, or null if not texturespublic void render(IGL gl, boolean diffuseTexture, boolean alphaTest, boolean sdFont, Lights<?> lights)
public static final float[] pos(float x,
float y,
float z)
public static final float[] pos(Vec3 vec)
public static final float[] uv(float u,
float v)
public static final float[] n(Vec3 n)
public static final byte[] c(Color4 c)
public static final byte[] c(float r,
float g,
float b)
public static final byte[] c(float r,
float g,
float b,
float a)
Bonzai Engine 1.3.4 11/12/2015 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2015 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com