src/battle_effect/battle_effect_render_mesh.c
C software mesh renderers: filled, textured and wireframe meshes. More…
Included by battle_effect.c.
Structures
| Name | Description | |
|---|---|---|
struct | SOLID_FACE | A triangle of the model: where its three corners start in the vertex buffer (in words) and its colour. |
struct | MESH_POLYGON | One mesh face: its three corners as word offsets into the vertex buffer (vertex index * 3), padded to an effect step's 28 bytes. |
struct | WIRE_FACE | A triangle of the wireframe model: where its three corners start in the vertex buffer (in words) and the colour its edges are drawn in. |
Macros
| Name | Description | |
|---|---|---|
#define | XOR_SWAP (a, b) | Swaps two integers without a temporary. |
#define | FILL_SPAN (row, xa, xb) | Fills one scanline of the canvas (8x8 tiles, 16 to a row) from xa to xb, keeping the brighter of each pixel's colour and color. |
#define | DIFF_ABS (v) ((v) >= 0 ? (v) : -(v)) | The size of v. |
#define | DRAW_SPAN (y) | One textured scanline at canvas row y, from xA to xB, keeping the brighter of the canvas and texture colour. |
#define | STEP_RIGHTWARD () | The texture steps along a scanline, from the middle corner's row. |
#define | STEP_LEFTWARD () |
Functions
| Name | Description | |
|---|---|---|
void | btRenderFillMesh (Sint32 vertexCount, Sint32 faceCount) | Unused: nothing calls it. |
void | btRenderDrawTexturedMesh (Sint32 vertexCount, Sint32 faceCount, Sint32 (*uvs)[3][2], Sint32 textureShift) | Unused: nothing calls it. |
void | btRenderDrawMeshWireframe (Sint32 vertexCount, Sint32 faceCount) | Unused: nothing calls it. |
Description
C software mesh renderers: filled, textured and wireframe meshes. Part of
battle_effect.c.
Macros in detail
XOR_SWAP
#define XOR_SWAP(a, b)
Swaps two integers without a temporary.
Referenced by btRenderDrawTexturedMesh() and btRenderFillMesh().
Definition at line 5 of file battle_effect_render_mesh.c.
FILL_SPAN
#define FILL_SPAN(row, xa, xb)
Fills one scanline of the canvas (8x8 tiles, 16 to a row) from xa to xb, keeping the brighter of each pixel's colour and color.
Referenced by btRenderFillMesh().
Definition at line 24 of file battle_effect_render_mesh.c.
DIFF_ABS
#define DIFF_ABS(v) ((v) >= 0 ? (v) : -(v))
The size of v.
Definition at line 159 of file battle_effect_render_mesh.c.
DRAW_SPAN
#define DRAW_SPAN(y)
One textured scanline at canvas row y, from xA to xB, keeping the brighter of the canvas and texture colour.
Referenced by btRenderDrawTexturedMesh().
Definition at line 163 of file battle_effect_render_mesh.c.
STEP_RIGHTWARD
#define STEP_RIGHTWARD()
The texture steps along a scanline, from the middle corner's row.
Referenced by btRenderDrawTexturedMesh().
Definition at line 190 of file battle_effect_render_mesh.c.
STEP_LEFTWARD
#define STEP_LEFTWARD()
Referenced by btRenderDrawTexturedMesh().
Definition at line 200 of file battle_effect_render_mesh.c.
Functions in detail
btRenderFillMesh
void btRenderFillMesh(Sint32 vertexCount, Sint32 faceCount)
Unused: nothing calls it. A solid renderer, the filled twin of
btRenderDrawMeshWireframe. Transforms the vertexCount points in the sheet
block by the current matrix, then fills every face of the effect state's list
that faces the camera into the canvas, centred at (64, 64), keeping the
brighter colour where faces overlap. Each triangle is sorted by y and filled
in two halves, top to middle and middle to bottom, along 16.16 edge slopes.
References Sint32, syCalcPoint(), syDivFX() and syDMAXCopy().
Definition at line 47 of file battle_effect_render_mesh.c.
btRenderDrawTexturedMesh
void btRenderDrawTexturedMesh(Sint32 vertexCount, Sint32 faceCount, Sint32 (*uvs)[3][2], Sint32 textureShift)
Unused: nothing calls it. Transforms vertexCount vertices (16.16 x, y, z in the heap's vertex buffer) in place, then draws each front-facing face of the mesh at the start of the effect state as an affine-textured triangle: uvs gives each face's three texture corners (16.16), the texture is the effect sprite sheet, textureShift its row length as a power of two. Coordinates are offset by 64 pixels into the canvas.
References Sint32, syCalcPoint(), syDivFX() and syDMAXCopy().
Definition at line 215 of file battle_effect_render_mesh.c.
btRenderDrawMeshWireframe
void btRenderDrawMeshWireframe(Sint32 vertexCount, Sint32 faceCount)
Unused: nothing calls it. A wireframe renderer. Transforms the vertexCount points in the sheet block by the current matrix, then draws the three edges of every face of the effect state's list that faces the camera (its corners run counter-clockwise on screen) as clipped lines into the canvas, centred at (64, 64).
References btEffectDrawClippedCanvasLine(), Sint32, syCalcPoint() and syDMAXCopy().
Definition at line 408 of file battle_effect_render_mesh.c.