Skip to Content
The Alchemy Project

src/battle_effect/battle_effect_render.c

Drawing models: transforming and projecting their corners, the model list, textures copied to IWRAM, and an unused run of the ARM fill kernel. More…

Included by battle_effect.c.

Structures

NameDescription
structPOOL_ENTRYA RENDER_MODEL as btRenderAllocateModelList clears it: head and next over its kind and flags, tail over its texture scroll and the padding after it, one word.

Macros

NameDescription
#defineMODEL_TEXTURE_IN_PLACE 4The texture stays where it is, even when IWRAM has room for a copy.
#defineLOAD_KERNEL_WORDS (to, code, bytes, words)Copies a kernel whose DMA control is a word of its own.
#defineCOPY_TEXTURE ()Copies the model's texture into IWRAM unless it is to stay in place.

Typedefs

NameDescription
typedef void (*MODEL_KERNEL )(RENDER_MODEL *model);

Functions

NameDescription
voidbtRenderRunFillMeshKernel (Sint32 vertexCount, Sint32 faceCount)Unused: nothing calls it.
voidbtRenderTransformVertices (const void *corners, void *vertices, Sint32 count)Copies the ARM vertex kernel into a heap block and runs it: count packed Sint8 vertices through the current transform into screen coordinates.
voidbtRenderProjectVertices (MODEL_VERTEX *vertices, PROJECTED_VERTEX *screen, Sint32 count)Projects count model vertices through syConvert3Dto2D into screen coordinates.
RENDER_MODEL *btRenderAllocateModelList (Sint32 count)Allocates count model entries plus a cleared one that ends the list.
BoolbtRenderCopyTextureToIWRAM (TEXTURE *src, TEXTURE *copy)Copies a texture's pixels into a heap block when IWRAM has room for them; returns 1 with copy set up, 0 when there is no room.
voidbtRenderDrawModelList (RENDER_MODEL *model)Draws a list of models.

Description

Drawing models: transforming and projecting their corners, the model list, textures copied to IWRAM, and an unused run of the ARM fill kernel. Part of battle_effect.c.

Macros in detail

MODEL_TEXTURE_IN_PLACE

#define MODEL_TEXTURE_IN_PLACE 4

The texture stays where it is, even when IWRAM has room for a copy.

Definition at line 104 of file battle_effect_render.c.

LOAD_KERNEL_WORDS

#define LOAD_KERNEL_WORDS(to, code, bytes, words)

Copies a kernel whose DMA control is a word of its own.

Referenced by btRenderDrawModelList().

Definition at line 109 of file battle_effect_render.c.

COPY_TEXTURE

#define COPY_TEXTURE()

Copies the model's texture into IWRAM unless it is to stay in place.

Referenced by btRenderDrawModelList().

Definition at line 117 of file battle_effect_render.c.

Typedefs in detail

MODEL_KERNEL

typedef void (*MODEL_KERNEL)(RENDER_MODEL *model);

Referenced by btRenderDrawModelList().

Definition at line 106 of file battle_effect_render.c.

Functions in detail

btRenderRunFillMeshKernel

void btRenderRunFillMeshKernel(Sint32 vertexCount, Sint32 faceCount)

Unused: nothing calls it. Copies btRenderFillMeshKernel (render_fill_mesh_kernels.s), an ARM build of btRenderFillMesh: the same transform of vertexCount points centred at (64, 64), back faces dropped and each triangle sorted by y with XOR swaps, into a heap block (DMA 3, words), runs it there and frees the block.

References btRenderFillMeshKernel, btRenderFillMeshKernelCodeSize, Sint32 and syHeapRelease().

Definition at line 10 of file battle_effect_render.c.

btRenderTransformVertices

void btRenderTransformVertices(const void *corners, void *vertices, Sint32 count)

Copies the ARM vertex kernel into a heap block and runs it: count packed Sint8 vertices through the current transform into screen coordinates.

References btRenderTransformKernel, btRenderTransformKernelCodeSize, Sint32 and syHeapRelease().

Referenced by btEffectRunAzul(), btEffectRunBallLightning(), btEffectRunBreaths(), btEffectRunCards(), btEffectRunCastingImpact(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCoatlicue(), btEffectRunCruelRuin(), btEffectRunCrystal(), btEffectRunDaedalus(), btEffectRunDaedalusStrike(), btEffectRunDeathPlunge(), btEffectRunDiamondBerg(), btEffectRunDjinniSign(), btEffectRunEclipse(), btEffectRunElementCards(), btEffectRunFirePuppet(), btEffectRunFlora(), btEffectRunFormChange(), btEffectRunFume(), btEffectRunGaspFamily(), btEffectRunGeode(), btEffectRunGeyser(), btEffectRunHaures(), btEffectRunHeavyBlow(), btEffectRunIris(), btEffectRunJudgment(), btEffectRunLeapingStrike(), btEffectRunLegend(), btEffectRunLifeShear(), btEffectRunLightSurge(), btEffectRunLiquifier(), btEffectRunMegiddo(), btEffectRunMeteorBlow(), btEffectRunMirroredWall(), btEffectRunMoloch(), btEffectRunOdyssey(), btEffectRunRadiantFire(), btEffectRunRagingHeat(), btEffectRunRisingDragon(), btEffectRunRisingDragonEnemy(), btEffectRunRushingStrike(), btEffectRunSabreDance(), btEffectRunTargetStrike(), btEffectRunTrident(), btEffectRunTripleChomp(), btEffectRunTumblingQuads(), btEffectRunTwistingColumn(), btEffectRunUlysses() and 5 more.

Definition at line 22 of file battle_effect_render.c.

btRenderProjectVertices

void btRenderProjectVertices(MODEL_VERTEX *vertices, PROJECTED_VERTEX *screen, Sint32 count)

Projects count model vertices through syConvert3Dto2D into screen coordinates.

References Sint32 and syConvert3Dto2D().

Referenced by btEffectRunDjinniCharge(), btEffectRunSerac() and btEffectRunTwistingColumn().

Definition at line 36 of file battle_effect_render.c.

btRenderAllocateModelList

RENDER_MODEL *btRenderAllocateModelList(Sint32 count)

Allocates count model entries plus a cleared one that ends the list.

References Sint32 and syHeapAllocateEWRAM().

Referenced by btEffectRunAzul(), btEffectRunBallLightning(), btEffectRunBreaths(), btEffectRunCards(), btEffectRunCastingImpact(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCoatlicue(), btEffectRunCruelRuin(), btEffectRunCrystal(), btEffectRunDaedalus(), btEffectRunDaedalusStrike(), btEffectRunDeathPlunge(), btEffectRunDiamondBerg(), btEffectRunDjinniCharge(), btEffectRunDjinniSign(), btEffectRunEclipse(), btEffectRunElementCards(), btEffectRunFirePuppet(), btEffectRunFlora(), btEffectRunFormChange(), btEffectRunFume(), btEffectRunGaspFamily(), btEffectRunGeode(), btEffectRunGeyser(), btEffectRunHaures(), btEffectRunHeavyBlow(), btEffectRunIris(), btEffectRunJudgment(), btEffectRunLeapingStrike(), btEffectRunLegend(), btEffectRunLifeShear(), btEffectRunLightSurge(), btEffectRunLiquifier(), btEffectRunMegiddo(), btEffectRunMeteorBlow(), btEffectRunMirroredWall(), btEffectRunMoloch(), btEffectRunOdyssey(), btEffectRunRadiantFire(), btEffectRunRagingHeat(), btEffectRunRisingDragon(), btEffectRunRisingDragonEnemy(), btEffectRunRushingStrike(), btEffectRunSabreDance(), btEffectRunSerac(), btEffectRunTargetStrike(), btEffectRunTrident(), btEffectRunTripleChomp(), btEffectRunTumblingQuads() and 7 more.

Definition at line 69 of file battle_effect_render.c.

btRenderCopyTextureToIWRAM

Bool btRenderCopyTextureToIWRAM(TEXTURE *src, TEXTURE *copy)

Copies a texture's pixels into a heap block when IWRAM has room for them; returns 1 with copy set up, 0 when there is no room.

References Sint32, syHeapAllocate() and syHeapGetRemainingIWRAM().

Definition at line 85 of file battle_effect_render.c.

btRenderDrawModelList

void btRenderDrawModelList(RENDER_MODEL *model)

Draws a list of models. A run of models of one kind loads that kind's rasterizer into IWRAM once, and it is freed when the kind changes. Before a textured model is drawn, its texture is copied into IWRAM where there is room, and the copy is freed after the model is drawn.

References btRenderShadedAdditiveKernel, btRenderShadedAdditiveKernelCodeSize, btRenderShadedKernel, btRenderShadedKernelCodeSize, btRenderShadedKernelCodeWords, btRenderShadedMaxKernel, btRenderShadedMaxKernelCodeSize, btRenderSolidAdditiveKernel, btRenderSolidAdditiveKernelCodeSize, btRenderSolidKernel, btRenderSolidKernelCodeSize, btRenderSolidMaxKernel, btRenderSolidMaxKernelCodeSize, btRenderSolidNarrowKernel, btRenderSolidNarrowKernelCodeSize, btRenderTexturedAdditiveKernel, btRenderTexturedAdditiveKernelCodeSize, btRenderTexturedKernel, btRenderTexturedKernelCodeSize, btRenderTexturedKernelCodeWords, btRenderTexturedMaxKernel, btRenderTexturedMaxKernelCodeSize, btRenderTexturedNarrowKernel, btRenderTexturedNarrowKernelCodeSize, btRenderTexturedNarrowKernelCodeWords, Sint32 and syHeapRelease().

Referenced by btEffectRunAzul(), btEffectRunBallLightning(), btEffectRunBreaths(), btEffectRunCards(), btEffectRunCastingImpact(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCoatlicue(), btEffectRunCruelRuin(), btEffectRunCrystal(), btEffectRunDaedalus(), btEffectRunDaedalusStrike(), btEffectRunDeathPlunge(), btEffectRunDiamondBerg(), btEffectRunDjinniCharge(), btEffectRunDjinniSign(), btEffectRunEclipse(), btEffectRunElementCards(), btEffectRunFirePuppet(), btEffectRunFlora(), btEffectRunFormChange(), btEffectRunFume(), btEffectRunGaspFamily(), btEffectRunGeode(), btEffectRunGeyser(), btEffectRunHaures(), btEffectRunHeavyBlow(), btEffectRunIris(), btEffectRunJudgment(), btEffectRunLeapingStrike(), btEffectRunLegend(), btEffectRunLifeShear(), btEffectRunLightSurge(), btEffectRunLiquifier(), btEffectRunMegiddo(), btEffectRunMeteorBlow(), btEffectRunMirroredWall(), btEffectRunMoloch(), btEffectRunOdyssey(), btEffectRunRadiantFire(), btEffectRunRagingHeat(), btEffectRunRisingDragon(), btEffectRunRisingDragonEnemy(), btEffectRunRushingStrike(), btEffectRunSabreDance(), btEffectRunSerac(), btEffectRunTargetStrike(), btEffectRunTrident(), btEffectRunTripleChomp(), btEffectRunTumblingQuads() and 7 more.

Definition at line 128 of file battle_effect_render.c.