Closed Protofall closed 3 years ago
Note to self about the Simple Sprite struct
typedef struct {
uint32 flags; /**< \brief TA command (vertex flags) */
float ax; /**< \brief First X coordinate */
float ay; /**< \brief First Y coordinate */
float az; /**< \brief First Z coordinate */
float bx; /**< \brief Second X coordinate */
float by; /**< \brief Second Y coordinate */
float bz; /**< \brief Second Z coordinate */
float cx; /**< \brief Third X coordinate */
float cy; /**< \brief Third Y coordinate */
float cz; /**< \brief Third Z coordinate */
float dx; /**< \brief Fourth X coordinate */
float dy; /**< \brief Fourth Y coordinate */
uint32 dummy; /**< \brief Dummy value */
uint32 auv; /**< \brief First U/V texture coordinates */
uint32 buv; /**< \brief Second U/V texture coordinates */
uint32 cuv; /**< \brief Third U/V texture coordinates */
} pvr_sprite_txr_t;
We can just do float* ptr = &struct.ax;
and then access offsets of that pointer to "iterate" over the struct
x-es: ptr[i * 3];`
y-es: ptr[1 + (i * 3)];
z-es: ptr[2 + (i * 3)]; // Note there is no "dz", instead you'd hit the dummy value
uv-es: uint32_t* ptr2 = &struct.auv; // There's no "duv" and trying to access it will go outside the struct and badness
The code is a bit weird, especially with the UV cropping code. A review of it would be good (While also implementing the checks for OOB and cropping). This review will probably help address #187 #193