accmltr / scala-games

A game engine for writing games in Scala.
MIT License
4 stars 0 forks source link

Enable batch-rendering #19

Closed accmltr closed 8 months ago

accmltr commented 10 months ago

Overview

If there are RenderManager and RenderedElement classes, the render pipeline can use the managers to render the elements that belong to them. This can be used to do batch rendering, e.g. a PolygonRenderManager could group PolygonRenderedElement instances by layer and then render groups by writing all vertices and indices for the polygons into single buffers and render them in one draw-call.

The RenderManager and RenderedElement should also be extendable by user classes, so users have the potential to render anything the way they want to and optimize it for their specific use cases.

Engine Performance

Batch rendering should then be implemented for all out-of-the-box elements that are included in the engine: polygons, lines, textures etc.

References

The following old commit contains an rough implementation of this system:

24bd3c2

accmltr commented 10 months ago

I think rendering should be split into data classes and renderers for those classes.