Skip to content

Instantly share code, notes, and snippets.

@xoppa
Last active August 29, 2015 14:27
Show Gist options
  • Save xoppa/7c7c10ca52f65b00aa99 to your computer and use it in GitHub Desktop.
Save xoppa/7c7c10ca52f65b00aa99 to your computer and use it in GitHub Desktop.
Pseudo code of a simple RenderableProvider
public class GameBoard implements RenderableProvider {
public static class BoardPiece extends Renderable {
public Matrix4 localTransform = new Matrix4();
}
public Array<BoardPiece> pieces = new Array<BoardPiece>();
public Matrix4 transform = new Matrix4();
@Override
public void getRenderables (Array<Renderable> renderables, Pool<Renderable> pool) {
for (BoardPiece piece : pieces) {
piece.worldTransform.set(transform).mul(piece.localTransform);
renderables.add(piece);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment