GitBrincie212 / Apel-Mod

Apel is a library that brings particle animations to the table with flexible behaviour and a clean developer interface. It promises also lots of predefined shapes & paths to help the developer on their particle scene
Other
2 stars 1 forks source link

Extract base renderer class and subinterface from ApelRenderer #23

Closed DarthSharkie closed 2 months ago

DarthSharkie commented 2 months ago

ApelRenderer's default methods are useful for multiple implementations, but they are inefficient because they don't cache anything. Caching is difficult within an interface unless using static caches defined elsewhere. To prevent that awkward approach, extract a BaseApelRenderer that can cache and provide good implementations for the draw... methods.

Second, since DefaultApelRenderer and ApelNetworkRenderer both must run server side due to needing the ServerWorld, create a subinterface ApelServerRenderer that exposes the server world instance. Move their factory methods to that subinterface.

This winds up touching a lot of particle objects and animators, but they all run server side, too, so having them reference ApelServerRenderer is correct and will prevent interfaces without a server world from being used.

Clean up some unnecessary parameters and methods, too.

DarthSharkie commented 2 months ago

Let's not merge this until I can update it after https://github.com/GitBrincie212/Apel-Mod/pull/24 is merged. The refactor of the renderers might work, but it will be a cleaner, easier read/merge.

DarthSharkie commented 2 months ago

This should be good to go now.