Hydr8gon / sm64

A port of Super Mario 64 for the DSi
Creative Commons Zero v1.0 Universal
127 stars 10 forks source link

Paintings fixed math #36

Open AngelTomkins opened 4 months ago

AngelTomkins commented 4 months ago

Vertex displacement math is very slow, it currently uses floating point math. Per vertex it runs 16 floating point operations. (including a square root) This implementation only affects the graphical rendering of paintings and "floor paintings" like HMC and CotMC.

This PR converts all the values of the painting used in the vertex displacement math once per frame and operates on them all. This change makes the frame rate in HMC's room in the basement stay below 33 ms frame time. Thus staying at 30 fps. This affects the wobble effect when bonking or jumping into paintings too.

This change does not preserve the build for non DSi targets.

AngelTomkins commented 4 months ago

This PR now preserves the build for non TARGET_NDS devices

AngelTomkins commented 4 months ago

The graphics looks identical to me everywhere except for in HMC entrance, the centre of the "wobble" is slightly offset, and I'm not sure why. I will keep looking into this. image