mirror of
https://github.com/xtreme8000/CavEX.git
synced 2025-01-22 17:23:20 -05:00
Allow immediate drawing of displaylist
This commit is contained in:
parent
2bbae6cb96
commit
a354bc37d1
4 changed files with 28 additions and 8 deletions
2
Makefile
2
Makefile
|
@ -23,7 +23,7 @@ include $(DEVKITPPC)/wii_rules
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
TARGET := $(notdir $(CURDIR))
|
TARGET := $(notdir $(CURDIR))
|
||||||
BUILD := build
|
BUILD := build
|
||||||
SOURCES := source source/block source/platform/graphics source/network source/game source/game/gui source/platform source/cNBT
|
SOURCES := source source/block source/platform/graphics source/network source/game source/game/gui source/platform source/item source/cNBT
|
||||||
DATA :=
|
DATA :=
|
||||||
TEXTURES := textures
|
TEXTURES := textures
|
||||||
INCLUDES :=
|
INCLUDES :=
|
||||||
|
|
|
@ -90,3 +90,19 @@ void displaylist_render(struct displaylist* l) {
|
||||||
(l->index + (uintptr_t)l->data % DISPLAYLIST_CLL - 1)
|
(l->index + (uintptr_t)l->data % DISPLAYLIST_CLL - 1)
|
||||||
/ DISPLAYLIST_CLL * DISPLAYLIST_CLL);
|
/ DISPLAYLIST_CLL * DISPLAYLIST_CLL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void displaylist_render_immediate(struct displaylist* l, uint8_t primitve,
|
||||||
|
uint8_t vtxfmt, uint16_t vtxcnt) {
|
||||||
|
assert(l && l->data);
|
||||||
|
|
||||||
|
uint8_t* base = (uint8_t*)l->data + DISPLAYLIST_CLL + 3;
|
||||||
|
|
||||||
|
GX_Begin(primitve, vtxfmt, vtxcnt);
|
||||||
|
for(uint16_t k = 0; k < vtxcnt; k++) {
|
||||||
|
GX_Position3s16(MEM_U16(base, 0), MEM_U16(base, 2), MEM_U16(base, 4));
|
||||||
|
GX_Color1x8(MEM_U8(base, 6));
|
||||||
|
GX_TexCoord2u8(MEM_U8(base, 7), MEM_U8(base, 8));
|
||||||
|
base += 9;
|
||||||
|
}
|
||||||
|
GX_End();
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@ void displaylist_destroy(struct displaylist* l);
|
||||||
void displaylist_finalize(struct displaylist* l, uint8_t primitve,
|
void displaylist_finalize(struct displaylist* l, uint8_t primitve,
|
||||||
uint8_t vtxfmt, uint16_t vtxcnt);
|
uint8_t vtxfmt, uint16_t vtxcnt);
|
||||||
void displaylist_render(struct displaylist* l);
|
void displaylist_render(struct displaylist* l);
|
||||||
|
void displaylist_render_immediate(struct displaylist* l, uint8_t primitve,
|
||||||
|
uint8_t vtxfmt, uint16_t vtxcnt);
|
||||||
|
|
||||||
void displaylist_pos(struct displaylist* l, int16_t x, int16_t y, int16_t z);
|
void displaylist_pos(struct displaylist* l, int16_t x, int16_t y, int16_t z);
|
||||||
void displaylist_color(struct displaylist* l, uint8_t index);
|
void displaylist_color(struct displaylist* l, uint8_t index);
|
||||||
|
|
|
@ -212,6 +212,8 @@ void gfx_setup() {
|
||||||
|
|
||||||
GX_SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_POS, GX_TEXMTX1);
|
GX_SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_POS, GX_TEXMTX1);
|
||||||
|
|
||||||
|
gfx_update_light(1.0F);
|
||||||
|
|
||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,23 +290,23 @@ void gfx_bind_texture(enum gfx_texture tex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx_mode_world() { }
|
void gfx_mode_world() {
|
||||||
|
gfx_write_buffers(true, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
void gfx_mode_gui() {
|
void gfx_mode_gui() {
|
||||||
gfx_fog(false);
|
gfx_fog(false);
|
||||||
|
|
||||||
Mtx44 projection;
|
Mtx44 projection;
|
||||||
Mtx44 identity;
|
|
||||||
guMtxIdentity(identity);
|
|
||||||
|
|
||||||
guOrtho(projection, 0, gfx_height(), 0, gfx_width(), 0, 10);
|
guOrtho(projection, 0, gfx_height(), 0, gfx_width(), 0, 256);
|
||||||
GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);
|
GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);
|
||||||
GX_LoadPosMtxImm(identity, GX_PNMTX0);
|
gfx_matrix_modelview(GLM_MAT4_IDENTITY);
|
||||||
|
|
||||||
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
|
||||||
|
|
||||||
|
gfx_lighting(false);
|
||||||
gfx_blending(MODE_BLEND);
|
gfx_blending(MODE_BLEND);
|
||||||
gfx_alpha_test(true);
|
gfx_alpha_test(true);
|
||||||
|
gfx_write_buffers(true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx_matrix_projection(mat4 proj, bool is_perspective) {
|
void gfx_matrix_projection(mat4 proj, bool is_perspective) {
|
||||||
|
|
Loading…
Reference in a new issue