Skip to content

Add variables that bake 3D offsets into a sprite

Cheariisan requested to merge Chearii/RingRacers:sprvisoffsets into master

This adds the variables bakexoff, bakeyoff, and bakezoff, to the mobj_t struct, which are offsets aligned to the actual sprite; this gives the offsets the appearance of them being "baked" into the sprite. These offsets are also affected by a sprite's rotation values (rollangle, pitch, and roll), allowing modders to create the visual of something "attached" to the object without needing to manually set offsets.

Along with that, the bakexpiv, bakeypiv, and bakezpiv variables have been added, which are also baked into a sprite, but do not rotate, allowing for slightly more control with the baked offsets.

All of these values are angled to the actual object's angle in 3D space, making attachment visuals far easier.

This may seem redundant with the existing spritexoffset and spriteyoffset variables, but the pseudo-3D visuals present here would not normally be possible without potentially desync-prone usage of R_PointToAngle or R_PointToAnglePlayer.

sprvisangled.webm

sliptidedemo.webm

pivotpower

Although Legacy GL is deprecated, I've implemented rudimentary support of these flags for it where necessary. Some aspects, such as vertical/horizontal flips, may not look fully correct with 3D models.

sprvisangled_legacyglmodels.webm

sliptidedemo_ogl.webm

pivotpower_ogl

Everything has been tested in a Windows build.

Edited by Cheariisan

Merge request reports

Loading