}
this.currentWorld = currentWorld;
}
private void draw(GL2ES2 gl, Drawable drawable) {
final Sprite sprite = sprites.get(drawable.getSpriteId());
final Texture texture = textures.get(drawable.getSpriteId());
texture.bind(gl);
final int paddingRight = sprite.getPaddingRight() == null ? 0 : sprite.getPaddingRight();
final int paddingBottom = sprite.getPaddingBottom() == null ? 0 : sprite.getPaddingBottom();
if (CHECK_DRAWING_SEQUENCE) {
if (lastLayer >= drawable.getLayer()) {
lastLayer = drawable.getLayer();
} else {
throw new IllegalStateException();
}
}
matrix.glPushMatrix();
matrix.glTranslatef(
drawable.getX() - (sprite.getWidth() - paddingRight) / 2,
drawable.getY() - (sprite.getHeight() - paddingBottom) / 2,
0);
matrix.glScalef(sprite.getWidth(), sprite.getHeight(), drawable.getLayer());
shader.uniform(gl, uniformData);
gl.glDrawElements(GL2ES2.GL_TRIANGLES,
elementsBuffer.getComponentCount() * elementsBuffer.getElementCount(),
elementsBuffer.getComponentType(), elementsBuffer.getVBOOffset());