Class SpriteBatchWithZAxis
- java.lang.Object
-
- com.bombinggames.wurfelengine.core.map.rendering.SpriteBatchWithZAxis
-
- All Implemented Interfaces:
com.badlogic.gdx.graphics.g2d.Batch
,com.badlogic.gdx.utils.Disposable
public class SpriteBatchWithZAxis extends java.lang.Object implements com.badlogic.gdx.graphics.g2d.Batch
Draws batched quads using indices.- See Also:
Batch
-
-
Field Summary
Fields Modifier and Type Field Description static int
C1
static int
C2
static int
C3
static int
C4
int
maxSpritesInBatch
The maximum number of sprites rendered in one batch so farint
renderCalls
Number of render calls since the lastbegin()
.int
totalRenderCalls
Number of rendering calls, ever.static int
U1
static int
U2
static int
U3
static int
U4
static int
V1
static int
V2
static int
V3
static int
V4
static int
X1
static int
X2
static int
X3
static int
X4
static int
Y1
static int
Y2
static int
Y3
static int
Y4
static int
Z1
static int
Z2
static int
Z3
static int
Z4
-
Constructor Summary
Constructors Constructor Description SpriteBatchWithZAxis()
Constructs a new SpriteBatch with a size of 1000, one buffer, and the default shader.SpriteBatchWithZAxis(int size)
Constructs a SpriteBatch with one buffer and the default shader.SpriteBatchWithZAxis(int size, com.badlogic.gdx.graphics.glutils.ShaderProgram defaultShader)
Constructs a new SpriteBatch.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
begin()
static com.badlogic.gdx.graphics.glutils.ShaderProgram
createDefaultShader()
Returns a new instance of the default shader used by SpriteBatch for GL2 when no shader is specified.void
disableBlending()
void
dispose()
void
draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y)
void
draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y, float width, float height)
void
draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)
void
draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, boolean clockwise)
void
draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float width, float height, com.badlogic.gdx.math.Affine2 transform)
void
draw(com.badlogic.gdx.graphics.Texture texture, float[] spriteVertices, int offset, int count)
void
draw(com.badlogic.gdx.graphics.Texture texture, float x, float y)
void
draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float width, float height)
void
draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float width, float height, float u, float v, float u2, float v2)
void
draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)
void
draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float width, float height, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)
void
draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight)
void
enableBlending()
void
end()
void
flush()
int
getBlendDstFunc()
int
getBlendSrcFunc()
com.badlogic.gdx.graphics.Color
getColor()
int
getIdx()
float
getPackedColor()
com.badlogic.gdx.math.Matrix4
getProjectionMatrix()
int
getRenderedSprites()
continually increasingcom.badlogic.gdx.graphics.glutils.ShaderProgram
getShader()
com.badlogic.gdx.math.Matrix4
getTransformMatrix()
boolean
isBlendingEnabled()
boolean
isDrawing()
void
setBlendFunction(int srcFunc, int dstFunc)
void
setColor(float color)
void
setColor(float r, float g, float b, float a)
void
setColor(com.badlogic.gdx.graphics.Color tint)
void
setIdx(int idx)
set this field to render same things twicevoid
setProjectionMatrix(com.badlogic.gdx.math.Matrix4 projection)
void
setShader(com.badlogic.gdx.graphics.glutils.ShaderProgram shader)
void
setTransformMatrix(com.badlogic.gdx.math.Matrix4 transform)
protected void
switchTexture(com.badlogic.gdx.graphics.Texture texture)
-
-
-
Field Detail
-
X1
public static final int X1
- See Also:
- Constant Field Values
-
Y1
public static final int Y1
- See Also:
- Constant Field Values
-
Z1
public static final int Z1
- See Also:
- Constant Field Values
-
C1
public static final int C1
- See Also:
- Constant Field Values
-
U1
public static final int U1
- See Also:
- Constant Field Values
-
V1
public static final int V1
- See Also:
- Constant Field Values
-
X2
public static final int X2
- See Also:
- Constant Field Values
-
Y2
public static final int Y2
- See Also:
- Constant Field Values
-
Z2
public static final int Z2
- See Also:
- Constant Field Values
-
C2
public static final int C2
- See Also:
- Constant Field Values
-
U2
public static final int U2
- See Also:
- Constant Field Values
-
V2
public static final int V2
- See Also:
- Constant Field Values
-
X3
public static final int X3
- See Also:
- Constant Field Values
-
Y3
public static final int Y3
- See Also:
- Constant Field Values
-
Z3
public static final int Z3
- See Also:
- Constant Field Values
-
C3
public static final int C3
- See Also:
- Constant Field Values
-
U3
public static final int U3
- See Also:
- Constant Field Values
-
V3
public static final int V3
- See Also:
- Constant Field Values
-
X4
public static final int X4
- See Also:
- Constant Field Values
-
Y4
public static final int Y4
- See Also:
- Constant Field Values
-
Z4
public static final int Z4
- See Also:
- Constant Field Values
-
C4
public static final int C4
- See Also:
- Constant Field Values
-
U4
public static final int U4
- See Also:
- Constant Field Values
-
V4
public static final int V4
- See Also:
- Constant Field Values
-
renderCalls
public int renderCalls
Number of render calls since the lastbegin()
. *
-
totalRenderCalls
public int totalRenderCalls
Number of rendering calls, ever. Will not be reset unless set manually. *
-
maxSpritesInBatch
public int maxSpritesInBatch
The maximum number of sprites rendered in one batch so far. *
-
-
Constructor Detail
-
SpriteBatchWithZAxis
public SpriteBatchWithZAxis()
Constructs a new SpriteBatch with a size of 1000, one buffer, and the default shader.- See Also:
SpriteBatch#SpriteBatch(int, ShaderProgram)
-
SpriteBatchWithZAxis
public SpriteBatchWithZAxis(int size)
Constructs a SpriteBatch with one buffer and the default shader.- Parameters:
size
-- See Also:
SpriteBatch#SpriteBatch(int, ShaderProgram)
-
SpriteBatchWithZAxis
public SpriteBatchWithZAxis(int size, com.badlogic.gdx.graphics.glutils.ShaderProgram defaultShader)
Constructs a new SpriteBatch. Sets the projection matrix to an orthographic projection with y-axis point upwards, x-axis point to the right and the origin being in the bottom left corner of the screen. The projection will be pixel perfect with respect to the current screen resolution.The defaultShader specifies the shader to use. Note that the names for uniforms for this default shader are different than the ones expect for shaders set with
setShader(ShaderProgram)
. SeecreateDefaultShader()
.- Parameters:
size
- The max number of sprites in a single batch. Max of 8191.defaultShader
- The default shader to use. This is not owned by the SpriteBatch and must be disposed separately.
-
-
Method Detail
-
createDefaultShader
public static com.badlogic.gdx.graphics.glutils.ShaderProgram createDefaultShader()
Returns a new instance of the default shader used by SpriteBatch for GL2 when no shader is specified.- Returns:
-
begin
public void begin()
- Specified by:
begin
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
end
public void end()
- Specified by:
end
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setColor
public void setColor(com.badlogic.gdx.graphics.Color tint)
- Specified by:
setColor
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setColor
public void setColor(float r, float g, float b, float a)
- Specified by:
setColor
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setColor
public void setColor(float color)
- Specified by:
setColor
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getColor
public com.badlogic.gdx.graphics.Color getColor()
- Specified by:
getColor
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getPackedColor
public float getPackedColor()
- Specified by:
getPackedColor
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float width, float height, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float width, float height, float u, float v, float u2, float v2)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.Texture texture, float x, float y)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float width, float height)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.Texture texture, float[] spriteVertices, int offset, int count)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y, float width, float height)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, boolean clockwise)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float width, float height, com.badlogic.gdx.math.Affine2 transform)
- Specified by:
draw
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
flush
public void flush()
- Specified by:
flush
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setIdx
public void setIdx(int idx)
set this field to render same things twice- Parameters:
idx
- float position in vertices array
-
getIdx
public int getIdx()
- Returns:
- float position in vertices array
-
disableBlending
public void disableBlending()
- Specified by:
disableBlending
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
enableBlending
public void enableBlending()
- Specified by:
enableBlending
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setBlendFunction
public void setBlendFunction(int srcFunc, int dstFunc)
- Specified by:
setBlendFunction
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getBlendSrcFunc
public int getBlendSrcFunc()
- Specified by:
getBlendSrcFunc
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getBlendDstFunc
public int getBlendDstFunc()
- Specified by:
getBlendDstFunc
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
dispose
public void dispose()
- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
getProjectionMatrix
public com.badlogic.gdx.math.Matrix4 getProjectionMatrix()
- Specified by:
getProjectionMatrix
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getTransformMatrix
public com.badlogic.gdx.math.Matrix4 getTransformMatrix()
- Specified by:
getTransformMatrix
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setProjectionMatrix
public void setProjectionMatrix(com.badlogic.gdx.math.Matrix4 projection)
- Specified by:
setProjectionMatrix
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setTransformMatrix
public void setTransformMatrix(com.badlogic.gdx.math.Matrix4 transform)
- Specified by:
setTransformMatrix
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
switchTexture
protected void switchTexture(com.badlogic.gdx.graphics.Texture texture)
-
setShader
public void setShader(com.badlogic.gdx.graphics.glutils.ShaderProgram shader)
- Specified by:
setShader
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getShader
public com.badlogic.gdx.graphics.glutils.ShaderProgram getShader()
- Specified by:
getShader
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
isBlendingEnabled
public boolean isBlendingEnabled()
- Specified by:
isBlendingEnabled
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
isDrawing
public boolean isDrawing()
- Specified by:
isDrawing
in interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getRenderedSprites
public int getRenderedSprites()
continually increasing- Returns:
- the amount of sprites rendered so far
-
-