From 288f92ff5b81eec1f743ab76c126368037cf687c Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 15 Jun 2026 22:40:28 -0400 Subject: [PATCH] prep --- code/duffle/lottes_tape.h | 5 +++++ code/gte_hello/hello_gte.c | 43 ++++++++++++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/code/duffle/lottes_tape.h b/code/duffle/lottes_tape.h index 755864c..b4e781e 100644 --- a/code/duffle/lottes_tape.h +++ b/code/duffle/lottes_tape.h @@ -152,6 +152,11 @@ internal MipsAtom_(set_gte_world) { mips_yield() }; +internal MipsAtom_(cube_tri) { + + mips_yield() +}; + internal MipsAtom_(floor_tri) { mac_load_tri_indices(R_T0, R_T1, R_T2), mac_load_tri_verts( R_T0, R_T1, R_T2), diff --git a/code/gte_hello/hello_gte.c b/code/gte_hello/hello_gte.c index c6b25df..3027291 100644 --- a/code/gte_hello/hello_gte.c +++ b/code/gte_hello/hello_gte.c @@ -191,7 +191,7 @@ void update(PrimitiveArena* pa, U4* ordering_buf) S4 flag; //???? // Draw Cube - if (1) + if (0) { m3s2_rotation (& static_mem.cube.rot, & static_mem.tform_world); m3s2_translation(& static_mem.tform_world, & static_mem.cube.pos); @@ -230,6 +230,41 @@ void update(PrimitiveArena* pa, U4* ordering_buf) // static_mem.cube.rot.z += 12; static_mem.cube.rot.y += 30; } + // Draw cube (tape method) + if (0) + { + m3s2_rotation (& static_mem.cube.rot, & static_mem.tform_world); + m3s2_translation(& static_mem.tform_world, & static_mem.cube.pos); + m3s2_scale (& static_mem.tform_world, & static_mem.cube.scale); + // gte_matrix_set_rotation (& static_mem.tform_world); + // gte_matrix_set_translation(& static_mem.tform_world); + + U4 prim_base = u4_(pa->buf[static_mem.active_buf_id]); + U4 prim_cursor = prim_base + pa->used; + + LP_ U4 mem_temp_tape[512]; FArena tape_arena; farena_init(& tape_arena, slice_ut_arr(mem_temp_tape)); + TapeBuilder tb = tb_make(&tape_arena); tb_scope(& tb) { + tb_emit(& tb, code_bind_workspace); + tb_data(& tb, prim_cursor); + tb_data(& tb, u4_(static_mem.cube.faces)); + tb_data(& tb, u4_(static_mem.cube.verts)); + tb_data(& tb, u4_(ordering_buf)); + + tb_emit(& tb, code_set_gte_world); + tb_data(& tb, u4_(& static_mem.tform_world)); + + for (U4 i = 0; i < Cube_num_faces; i++) { + tb_emit(& tb, code_cube_tri); + } + + tb_emit(& tb, code_sync_prim_cursor); + tb_data(& tb, u4_(& pa->used)); + tb_data(& tb, prim_base); + } + tape_run(tb_slice(tb)); + + static_mem.cube.rot.y += 30; + } // Draw Floor if (0) { @@ -291,8 +326,8 @@ void update(PrimitiveArena* pa, U4* ordering_buf) m3s2_rotation (& static_mem.floor.rot, & static_mem.tform_world); m3s2_translation(& static_mem.tform_world, & static_mem.floor.pos); m3s2_scale (& static_mem.tform_world, & static_mem.floor.scale); - gte_matrix_set_rotation (& static_mem.tform_world); - gte_matrix_set_translation(& static_mem.tform_world); + // gte_matrix_set_rotation (& static_mem.tform_world); + // gte_matrix_set_translation(& static_mem.tform_world); U4 prim_base = u4_(pa->buf[static_mem.active_buf_id]); U4 prim_cursor = prim_base + pa->used; @@ -339,7 +374,7 @@ void update(PrimitiveArena* pa, U4* ordering_buf) // 2. code_diag_color -> Tests OT and Prim Arena memory // 3. code_diag_gte -> Tests Vertex arrays and GTE Math // tb_emit(& tb, code_diag_yield); - // tb_emit(& tb, code_diag_color); + // tb_emit(& tb, code_diag_color); //TODO(Ed): Stopped working // tb_emit(& tb, code_diag_gte); } }