Omegastick / bots

1 stars 1 forks source link

Restructure rendering architecture #122

Closed Omegastick closed 5 years ago

Omegastick commented 5 years ago

The current RenderData based system is actually much more inefficient than I thought.

A much better system would have a FrameRenderer object, a reference to which is passed to every object in its draw function. Rather than filling out a RenderData struct, you call the appropriate draw_sprite, add_post_processing_effect, draw_particles, etc. methods.

Once every object has registered what it wants to do with FrameRenderer, FrameRenderer then calls the appropriate methods on Renderer to actually draw stuff.

This way I avoid creating hundreds of arrays for all the RenderData structs I'm making.