Skip to content

cf_draw3d_sprite

Category: draw3d
GitHub: cute_draw3d.h


Submits a sprite as a textured quad at a 3d position, oriented by the transform stack.

void cf_draw3d_sprite(const CF_Sprite* sprite, CF_V3 position);
Parameters Description
sprite The sprite. Its current frame supplies the image, exactly like
cf_draw3d_push_texture; animated sprites animate in the world.
position The world position of the quad's center.

Remarks

This is sugar over cf_draw3d_mesh: a shared unit quad in the xy plane (facing +z under an identity transform), sized sprite->w by sprite->h pixels times sprite->scale (set the scale to your world-units-per-pixel), composed onto the current transform stack, and submitted with the sprite pushed as its texture. Rotate it like anything else -- cf_draw3d_rotate before the call orients the quad, which is the tool for decals, standees, and paper-doll planes. Everything about mesh submission applies: your pushed shader receives the image via the contract's in_uv/in_uv_rect lanes, consecutive sprites coalesce into one instanced draw, and many different images share that draw through the texture atlas.

For quads that automatically face the camera, use cf_draw3d_billboard.

cf_draw3d_billboard
cf_draw3d_mesh
cf_draw3d_push_texture
CF_Sprite
cf_draw3d_push_shader