Hi!
I'm working on a small graphic engine to understand how it work. I would like to integrate sprite support but I don't know what is the best way to manage them.
Right now, I've got the following design:
- Material: Object's apparence
- Geometry: Object's structure (vertex format, buffers, …)
- Transformable: Object's properties (rotation, position, scale)
And finally:
- Drawable: A drawable element (With Material, a Geometry and Transformable attributs)
- Mesh: A 3D object (inherit from Drawable) Text: A text (using Freetype behind, inherit from Drawable)
- Sprite: Not sure about that here.
I've read how others framework do that:
- In some case a Sprite is a Drawable like a Mesh, batching is made later by the renderer
- Sometimes, Sprite didn't exist, the user call SpriteBatch.createSprite(x, y, w, h)
What is the best method? In the second method, how can I perform picking in this case? To make a sprite, should I update Geometry's uv/positions or the Material (with a shader) ?
Thanks!