Closed DarthSharkie closed 5 months ago
Both of these are possible and done. Commit references to follow, once they're stable (too much local rebasing/reworking).
This is a runaway train! Once the point computation was done (basically copied from ApelRenderer
default methods), it became clear that the point computation could be done by Instruction
instances. More steps added to top comment!
Instruction
point computation and caching is done and working.
Commits:
ApelRenderer
client-side: https://github.com/GitBrincie212/Apel-Mod/commit/c504fad9cfe5c3778b459208e3951f116fe4ea1ecomputePoints
to Instruction
: https://github.com/GitBrincie212/Apel-Mod/commit/cfed8b3e59a3d8d7a39c6ad4bf92772dff0af760Merged in https://github.com/GitBrincie212/Apel-Mod/pull/22.
Common base renderer: https://github.com/GitBrincie212/Apel-Mod/pull/23.
As I worked on this, realized that the draw...
methods in ApelRenderer
are turning into a "unit" shape with scale, rotate, and translate operations performed. This doesn't cover line-based shapes (AFAICT), but it does cover 3D equation-defined shapes. Actually, on second thought, all lines can be made into unit vectors...but is that worth it? Probably not.
Their draw...
methods should be drawShape(ParticleEffect, amount, scale, rotate, translate)
. Scale can be float, Vector2f, or Vector3f depending on shape, but should probably just be Vector3f when implementing, since that's what the Matrix4f
will want when using translateRotateScale
. Allocating that in ParticleObjects consistently would allow for ease of profiling (due to consistency) vs. conditionally allocating in ApelRenderer
and implementations.
Caching can then be done based on the (shape, amount)
tuple, and Matrix4f#transformPosition(point)
called on each point.
If the unit shapes are computing, the computePoints()
method could do the caching internally to the Instruction
...need to consider if this is better than the renderer. Instructions could save computation by doing this.
ApelClient
to a payload handlerApelRenderer
can be implemented client-sideEdit:
This is a runaway train! Once the point computation was done (basically copied from
ApelRenderer
default methods), it became clear that the point computation could be done byInstruction
instances. I think the path forward looks like this:computePoints
toInstruction
interface. Implement for all (or throwUnsupportedOperationException
for things likePType
andFrame
that don't have points).DefaultApelRenderer
) should use the same caches, and just have a differentdrawParticle
implementation.