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.BatchDraws batched quads using indices.- See Also:
Batch
-
-
Field Summary
Fields Modifier and Type Field Description static intC1static intC2static intC3static intC4intmaxSpritesInBatchThe maximum number of sprites rendered in one batch so farintrenderCallsNumber of render calls since the lastbegin().inttotalRenderCallsNumber of rendering calls, ever.static intU1static intU2static intU3static intU4static intV1static intV2static intV3static intV4static intX1static intX2static intX3static intX4static intY1static intY2static intY3static intY4static intZ1static intZ2static intZ3static intZ4
-
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 voidbegin()static com.badlogic.gdx.graphics.glutils.ShaderProgramcreateDefaultShader()Returns a new instance of the default shader used by SpriteBatch for GL2 when no shader is specified.voiddisableBlending()voiddispose()voiddraw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y)voiddraw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y, float width, float height)voiddraw(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)voiddraw(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)voiddraw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float width, float height, com.badlogic.gdx.math.Affine2 transform)voiddraw(com.badlogic.gdx.graphics.Texture texture, float[] spriteVertices, int offset, int count)voiddraw(com.badlogic.gdx.graphics.Texture texture, float x, float y)voiddraw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float width, float height)voiddraw(com.badlogic.gdx.graphics.Texture texture, float x, float y, float width, float height, float u, float v, float u2, float v2)voiddraw(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)voiddraw(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)voiddraw(com.badlogic.gdx.graphics.Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight)voidenableBlending()voidend()voidflush()intgetBlendDstFunc()intgetBlendSrcFunc()com.badlogic.gdx.graphics.ColorgetColor()intgetIdx()floatgetPackedColor()com.badlogic.gdx.math.Matrix4getProjectionMatrix()intgetRenderedSprites()continually increasingcom.badlogic.gdx.graphics.glutils.ShaderProgramgetShader()com.badlogic.gdx.math.Matrix4getTransformMatrix()booleanisBlendingEnabled()booleanisDrawing()voidsetBlendFunction(int srcFunc, int dstFunc)voidsetColor(float color)voidsetColor(float r, float g, float b, float a)voidsetColor(com.badlogic.gdx.graphics.Color tint)voidsetIdx(int idx)set this field to render same things twicevoidsetProjectionMatrix(com.badlogic.gdx.math.Matrix4 projection)voidsetShader(com.badlogic.gdx.graphics.glutils.ShaderProgram shader)voidsetTransformMatrix(com.badlogic.gdx.math.Matrix4 transform)protected voidswitchTexture(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:
beginin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
end
public void end()
- Specified by:
endin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setColor
public void setColor(com.badlogic.gdx.graphics.Color tint)
- Specified by:
setColorin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setColor
public void setColor(float r, float g, float b, float a)- Specified by:
setColorin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setColor
public void setColor(float color)
- Specified by:
setColorin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getColor
public com.badlogic.gdx.graphics.Color getColor()
- Specified by:
getColorin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getPackedColor
public float getPackedColor()
- Specified by:
getPackedColorin 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:
drawin 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:
drawin 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:
drawin 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:
drawin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.Texture texture, float x, float y)- Specified by:
drawin 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:
drawin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.Texture texture, float[] spriteVertices, int offset, int count)- Specified by:
drawin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y)- Specified by:
drawin 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:
drawin 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:
drawin 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:
drawin 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:
drawin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
flush
public void flush()
- Specified by:
flushin 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:
disableBlendingin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
enableBlending
public void enableBlending()
- Specified by:
enableBlendingin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setBlendFunction
public void setBlendFunction(int srcFunc, int dstFunc)- Specified by:
setBlendFunctionin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getBlendSrcFunc
public int getBlendSrcFunc()
- Specified by:
getBlendSrcFuncin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getBlendDstFunc
public int getBlendDstFunc()
- Specified by:
getBlendDstFuncin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
dispose
public void dispose()
- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
getProjectionMatrix
public com.badlogic.gdx.math.Matrix4 getProjectionMatrix()
- Specified by:
getProjectionMatrixin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getTransformMatrix
public com.badlogic.gdx.math.Matrix4 getTransformMatrix()
- Specified by:
getTransformMatrixin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setProjectionMatrix
public void setProjectionMatrix(com.badlogic.gdx.math.Matrix4 projection)
- Specified by:
setProjectionMatrixin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
setTransformMatrix
public void setTransformMatrix(com.badlogic.gdx.math.Matrix4 transform)
- Specified by:
setTransformMatrixin 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:
setShaderin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getShader
public com.badlogic.gdx.graphics.glutils.ShaderProgram getShader()
- Specified by:
getShaderin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
isBlendingEnabled
public boolean isBlendingEnabled()
- Specified by:
isBlendingEnabledin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
isDrawing
public boolean isDrawing()
- Specified by:
isDrawingin interfacecom.badlogic.gdx.graphics.g2d.Batch
-
getRenderedSprites
public int getRenderedSprites()
continually increasing- Returns:
- the amount of sprites rendered so far
-
-