diff --git a/example/castle.cpp b/example/castle.cpp new file mode 100644 index 0000000..c64e4f3 --- /dev/null +++ b/example/castle.cpp @@ -0,0 +1,522 @@ +#include + +#include "holly/background.hpp" +#include "holly/core.hpp" +#include "holly/core_bits.hpp" +#include "holly/holly.hpp" +#include "holly/isp_tsp.hpp" +#include "holly/region_array.hpp" +#include "holly/ta_bits.hpp" +#include "holly/ta_fifo_polygon_converter.hpp" +#include "holly/ta_global_parameter.hpp" +#include "holly/ta_parameter.hpp" +#include "holly/ta_vertex_parameter.hpp" +#include "holly/texture_memory_alloc3.hpp" +#include "holly/video_output.hpp" + +#include "sh7091/sh7091.hpp" +#include "sh7091/sh7091_bits.hpp" +#include "sh7091/serial.hpp" +#include "sh7091/vbr.hpp" + +#include "systembus.hpp" +#include "systembus_bits.hpp" + +#include "memorymap.hpp" + +#include "math/vec2.hpp" +#include "math/vec3.hpp" +#include "math/vec4.hpp" +#include "math/mat4x4.hpp" + +using vec2 = vec<2, float>; +using vec3 = vec<3, float>; +using vec4 = vec<4, float>; +using mat4x4 = mat<4, 4, float>; + +#include "x/x.hpp" +#include "model/castle/model.hpp" + +const float deg = 0.017453292519943295; + +void vbr100() +{ + serial::string("vbr100\n"); + serial::string("expevt "); + serial::integer(sh7091.CCN.EXPEVT); + serial::string("intevt "); + serial::integer(sh7091.CCN.INTEVT); + serial::string("tra "); + serial::integer(sh7091.CCN.TRA); + + uint32_t spc; + uint32_t ssr; + asm volatile ("stc spc,%0" : "=r" (spc)); + asm volatile ("stc ssr,%0" : "=r" (ssr)); + serial::string("spc "); + serial::integer(spc); + serial::string("ssr "); + serial::integer(ssr); + + while (1); +} + +void vbr400() +{ + serial::string("vbr400"); + serial::string("expevt "); + serial::integer(sh7091.CCN.EXPEVT); + serial::string("intevt "); + serial::integer(sh7091.CCN.INTEVT); + serial::string("tra "); + serial::integer(sh7091.CCN.TRA); + + uint32_t spc; + uint32_t ssr; + asm volatile ("stc spc,%0" : "=r" (spc)); + asm volatile ("stc ssr,%0" : "=r" (ssr)); + serial::string("spc "); + serial::integer(spc); + serial::string("ssr "); + serial::integer(ssr); + + while (1); +} + +static int render_done = 0; + +void vbr600() +{ + if (sh7091.CCN.EXPEVT == 0 && sh7091.CCN.INTEVT == 0x320) { + uint32_t istnrm = system.ISTNRM; + uint32_t isterr = system.ISTERR; + + if (isterr) { + serial::string("isterr: "); + serial::integer(system.ISTERR); + } + + if (istnrm & istnrm::end_of_render_tsp) { + system.ISTNRM = istnrm::end_of_render_tsp + | istnrm::end_of_render_isp + | istnrm::end_of_render_video; + render_done = 1; + return; + } + } + + serial::string("vbr600"); + serial::string("expevt "); + serial::integer(sh7091.CCN.EXPEVT); + serial::string("intevt "); + serial::integer(sh7091.CCN.INTEVT); + serial::string("tra "); + serial::integer(sh7091.CCN.TRA); + + serial::string("istnrm: "); + serial::integer(system.ISTNRM); + serial::string("isterr: "); + serial::integer(system.ISTERR); + + uint32_t spc; + uint32_t ssr; + asm volatile ("stc spc,%0" : "=r" (spc)); + asm volatile ("stc ssr,%0" : "=r" (ssr)); + serial::string("spc "); + serial::integer(spc); + serial::string("ssr "); + serial::integer(ssr); + + while (1); +} + +void interrupt_init() +{ + system.IML2NRM = 0; + system.IML2ERR = 0; + system.IML2EXT = 0; + + system.IML4NRM = 0; + system.IML4ERR = 0; + system.IML4EXT = 0; + + system.IML6NRM = 0; + system.IML6ERR = 0; + system.IML6EXT = 0; + + system.ISTERR = 0xffffffff; + system.ISTNRM = 0xffffffff; + + sh7091.CCN.INTEVT = 0; + sh7091.CCN.EXPEVT = 0; + + uint32_t vbr = reinterpret_cast(&__vbr_link_start) - 0x100; + serial::string("vbr "); + serial::integer(vbr); + serial::string("vbr100 "); + serial::integer(reinterpret_cast(&vbr100)); + + asm volatile ("ldc %0,vbr" + : + : "r" (vbr)); + + uint32_t sr; + asm volatile ("stc sr,%0" + : "=r" (sr)); + serial::string("sr "); + serial::integer(sr); + + sr &= ~sh::sr::bl; // BL + sr &= ~sh::sr::imask(15); // imask + + serial::string("sr "); + serial::integer(sr); + + asm volatile ("ldc %0,sr" + : + : "r" (sr)); +} + +void global_polygon_type_0(ta_parameter_writer& writer, uint32_t texture_address, uint32_t list, uint32_t cull) +{ + const uint32_t parameter_control_word = para_control::para_type::polygon_or_modifier_volume + | list + | obj_control::col_type::packed_color + ; + + const uint32_t isp_tsp_instruction_word = isp_tsp_instruction_word::depth_compare_mode::greater + | cull; + + const uint32_t tsp_instruction_word = tsp_instruction_word::fog_control::no_fog + | tsp_instruction_word::src_alpha_instr::one + | tsp_instruction_word::dst_alpha_instr::zero + | tsp_instruction_word::texture_u_size::from_int(256) + | tsp_instruction_word::texture_v_size::from_int(256) + ; + + const uint32_t texture_control_word = texture_control_word::pixel_format::_565 + | texture_control_word::scan_order::twiddled + | texture_control_word::texture_address(texture_address / 8); + + writer.append() = + ta_global_parameter::polygon_type_0(parameter_control_word, + isp_tsp_instruction_word, + tsp_instruction_word, + texture_control_word, + 0, // data_size_for_sort_dma + 0 // next_address_for_sort_dma + ); +} + +#define assert(b) \ + do { \ + if (!(b)) { \ + serial::string(__FILE__); \ + serial::character(':'); \ + serial::integer(__LINE__, ' '); \ + serial::string(__func__); \ + serial::string(": assertion failed: "); \ + serial::string(#b); \ + serial::character('\n'); \ + while (1); \ + } \ + } while (0); + +vec3 screen_transform(const mat4x4& screen, vec3 v) +{ + v = screen * v; + + float dim = 480 / 2.0; + + return { + v.x / v.z * dim + 640 / 2.0f, + v.y / v.z * dim + 480 / 2.0f, + 1 / v.z, + }; +} + +static inline void render_tri(ta_parameter_writer& writer, + uint32_t base_color, + vec3 ap, + vec3 bp, + vec3 cp) +{ + if (ap.z < 0 || bp.z < 0 || cp.z < 0) + return; + + writer.append() = + ta_vertex_parameter::polygon_type_0(polygon_vertex_parameter_control_word(false), + ap.x, ap.y, ap.z, + base_color + ); // offset_color + + writer.append() = + ta_vertex_parameter::polygon_type_0(polygon_vertex_parameter_control_word(false), + bp.x, bp.y, bp.z, + base_color + ); // offset_color + + writer.append() = + ta_vertex_parameter::polygon_type_0(polygon_vertex_parameter_control_word(true), + cp.x, cp.y, cp.z, + base_color + ); // offset_color +} + +constexpr inline mat4x4 screen_rotation(float theta) +{ + //float zt = -0.7853981633974483 + (0.2); + float zt = deg * 0; + float xt = -(sin(theta * 4) * 0.5 + 0.5); + //float xt = 0.7853981633974483 * 3.7; + + mat4x4 rx = { + 1, 0, 0, 0, + 0, cos(xt), -sin(xt), 0, + 0, sin(xt), cos(xt), 0, + 0, 0, 0, 1, + }; + + mat4x4 rz = { + cos(zt), -sin(zt), 0, 0, + sin(zt), cos(zt), 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }; + + mat4x4 t = { + 1, 0, 0, 0, + 0, -1, 0, 300, + 0, 0, 1, 500, + 0, 0, 0, 1, + }; + + return t * rx * rz; +} + +uint32_t xorshift_state = 0x12345678; + +/* The state must be initialized to non-zero */ +uint32_t xorshift32() +{ + /* Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" */ + uint32_t x = xorshift_state; + x ^= x << 13; + x ^= x >> 17; + x ^= x << 5; + return xorshift_state = x; +} + +const frame * frames[] = { + &frame_x3ds_Box08, + &frame_x3ds_Box09, + &frame_x3ds_Box02, + &frame_x3ds_Cone02, + &frame_x3ds_Cylinder02, + &frame_x3ds_Box21, + &frame_x3ds_Box22, + &frame_x3ds_Box23, + &frame_x3ds_Box24, + &frame_x3ds_Box25, + &frame_x3ds_Box26, + &frame_x3ds_Box27, + &frame_x3ds_Cylinder03, + &frame_x3ds_Cone03, + &frame_x3ds_Cylinder01, + &frame_x3ds_Box01, + &frame_x3ds_Box28, + &frame_x3ds_Box03, + &frame_x3ds_roof, + &frame_x3ds_walkway, +}; + +static inline void render_mesh(ta_parameter_writer& writer, + const mat4x4& screen, + const mat4x4& model, + const mesh * mesh) +{ + //mesh->vertices; + for (int i = 0; i < mesh->n_faces; i++) { + const auto& indices = mesh->faces[i].face_vertex_indices; + uint32_t base_color = xorshift32(); + render_tri(writer, + base_color, + screen_transform(screen, model * mesh->vertices[indices[0]]), + screen_transform(screen, model * mesh->vertices[indices[1]]), + screen_transform(screen, model * mesh->vertices[indices[2]])); + } +} + +static inline void render_frame(ta_parameter_writer& writer, + const mat4x4& screen, + const frame * frame) +{ + xorshift_state = 0x12345678; + + const mat4x4 identity{}; + + const mat4x4 * transform_matrix = &identity; + + int ix = 0; + while (true) { + const data_object * obj = frame->objects[ix]; + if (obj == nullptr) + break; + + switch (obj->tag) { + case tag::frame_transform_matrix: + transform_matrix = &obj->frame_transform_matrix.frame_matrix; + break; + case tag::mesh: + render_mesh(writer, screen, *transform_matrix, &obj->mesh); + break; + default: + break; + } + + ix += 1; + } +} + +void render_castle(ta_parameter_writer& writer, const mat4x4& screen) +{ + for (uint32_t i = 0; i < (sizeof (frames)) / (sizeof (frames[0])); i++) { + render_frame(writer, screen, frames[i]); + } +} + +static float theta = deg * 360; +void transfer_scene(ta_parameter_writer& writer) +{ + const mat4x4 screen = screen_rotation(theta); + + global_polygon_type_0(writer, texture_memory_alloc.texture.start, + para_control::list_type::opaque, + isp_tsp_instruction_word::culling_mode::no_culling); + + render_castle(writer, screen); + + // end of opaque list + writer.append() = + ta_global_parameter::end_of_list(para_control::para_type::end_of_list); + + theta += deg * 0.1; +} + +void transfer_ta_fifo_texture_memory_32byte(void * dst, void * src, int length) +{ + uint32_t out_addr = (uint32_t)dst; + sh7091.CCN.QACR0 = ((reinterpret_cast(out_addr) >> 24) & 0b11100); + sh7091.CCN.QACR1 = ((reinterpret_cast(out_addr) >> 24) & 0b11100); + + volatile uint32_t * base = &store_queue[(out_addr & 0x03ffffc0) / 4]; + uint32_t * src32 = reinterpret_cast(src); + + length = (length + 31) & ~31; // round up to nearest multiple of 32 + while (length > 0) { + base[0] = src32[0]; + base[1] = src32[1]; + base[2] = src32[2]; + base[3] = src32[3]; + base[4] = src32[4]; + base[5] = src32[5]; + base[6] = src32[6]; + base[7] = src32[7]; + asm volatile ("pref @%0" + : // output + : "r" (&base[0]) // input + : "memory"); + length -= 32; + base += 8; + src32 += 8; + } +} + +uint8_t __attribute__((aligned(32))) ta_parameter_buf[1024 * 1024]; + +void main() +{ + serial::init(0); + + interrupt_init(); + + constexpr uint32_t ta_alloc = 0 + | ta_alloc_ctrl::pt_opb::no_list + | ta_alloc_ctrl::tm_opb::no_list + | ta_alloc_ctrl::t_opb::no_list + | ta_alloc_ctrl::om_opb::no_list + | ta_alloc_ctrl::o_opb::_16x4byte; + + constexpr int render_passes = 1; + constexpr struct opb_size opb_size[render_passes] = { + { + .opaque = 16 * 4, + .opaque_modifier = 0, + .translucent = 0, + .translucent_modifier = 0, + .punch_through = 0 + } + }; + + holly.SOFTRESET = softreset::pipeline_soft_reset + | softreset::ta_soft_reset; + holly.SOFTRESET = 0; + + core_init(); + + system.IML6NRM = istnrm::end_of_render_tsp; + + const int framebuffer_width = 640; + const int framebuffer_height = 480; + const int tile_width = framebuffer_width / 32; + const int tile_height = framebuffer_height / 32; + + for (int i = 0; i < 2; i++) { + region_array_multipass(tile_width, + tile_height, + opb_size, + render_passes, + texture_memory_alloc.region_array[i].start, + texture_memory_alloc.object_list[i].start); + + background_parameter2(texture_memory_alloc.background[i].start, + 0xff202040); + } + + int ta = 0; + int core = 0; + + ta_parameter_writer writer = ta_parameter_writer(ta_parameter_buf); + + video_output::set_mode_vga(); + while (1) { + ta_polygon_converter_init2(texture_memory_alloc.isp_tsp_parameters[ta].start, + texture_memory_alloc.isp_tsp_parameters[ta].end, + texture_memory_alloc.object_list[ta].start, + texture_memory_alloc.object_list[ta].end, + opb_size[0].total(), + ta_alloc, + tile_width, + tile_height); + writer.offset = 0; + transfer_scene(writer); + ta_polygon_converter_writeback(writer.buf, writer.offset); + ta_polygon_converter_transfer(writer.buf, writer.offset); + ta_wait_opaque_list(); + + render_done = 0; + core_start_render2(texture_memory_alloc.region_array[core].start, + texture_memory_alloc.isp_tsp_parameters[core].start, + texture_memory_alloc.background[core].start, + texture_memory_alloc.framebuffer[core].start, + framebuffer_width); + //serial::string("wait render_done"); + while (render_done == 0) { + asm volatile ("nop"); + }; + + while (!spg_status::vsync(holly.SPG_STATUS)); + holly.FB_R_SOF1 = texture_memory_alloc.framebuffer[ta].start; + while (spg_status::vsync(holly.SPG_STATUS)); + } +} diff --git a/example/example.mk b/example/example.mk index c878a08..8fb3775 100644 --- a/example/example.mk +++ b/example/example.mk @@ -889,3 +889,16 @@ DRAGON_OBJ = \ example/dragon.elf: LDSCRIPT = $(LIB)/main.lds example/dragon.elf: $(START_OBJ) $(DRAGON_OBJ) + +CASTLE_OBJ = \ + example/castle.o \ + holly/core.o \ + holly/region_array.o \ + holly/background.o \ + holly/ta_fifo_polygon_converter.o \ + holly/video_output.o \ + sh7091/serial.o \ + $(LIBGCC) + +example/castle.elf: LDSCRIPT = $(LIB)/main.lds +example/castle.elf: $(START_OBJ) $(CASTLE_OBJ) diff --git a/model/castle/model.hpp b/model/castle/model.hpp index fac6630..aacc92a 100644 --- a/model/castle/model.hpp +++ b/model/castle/model.hpp @@ -9783,6 +9783,7 @@ const material material_x3ds_mat_castlestone = { .objects = { reinterpret_cast(&texture_filename_0), + nullptr, } }; @@ -9800,6 +9801,7 @@ const material material_x3ds_mat_Material__3 = { .objects = { reinterpret_cast(&texture_filename_1), + nullptr, } }; @@ -9817,6 +9819,7 @@ const material material_x3ds_mat_shingle = { .objects = { reinterpret_cast(&texture_filename_2), + nullptr, } }; @@ -9834,6 +9837,7 @@ const material material_x3ds_mat_Material__8 = { .objects = { reinterpret_cast(&texture_filename_3), + nullptr, } }; @@ -9848,6 +9852,7 @@ const frame frame_x3ds_Box08 = { .objects = { reinterpret_cast(&frame_transform_matrix_0), reinterpret_cast(&mesh_Box08), + nullptr, } }; @@ -9872,6 +9877,7 @@ const mesh mesh_Box08 = { reinterpret_cast(&mesh_material_list_0), reinterpret_cast(&mesh_normals_0), reinterpret_cast(&mesh_texture_coords_0), + nullptr, } }; @@ -9883,6 +9889,7 @@ const mesh_material_list mesh_material_list_0 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -10006,6 +10013,7 @@ const frame frame_x3ds_Box09 = { .objects = { reinterpret_cast(&frame_transform_matrix_1), reinterpret_cast(&mesh_Box09), + nullptr, } }; @@ -10030,6 +10038,7 @@ const mesh mesh_Box09 = { reinterpret_cast(&mesh_material_list_1), reinterpret_cast(&mesh_normals_1), reinterpret_cast(&mesh_texture_coords_1), + nullptr, } }; @@ -10041,6 +10050,7 @@ const mesh_material_list mesh_material_list_1 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -10392,6 +10402,7 @@ const frame frame_x3ds_Box02 = { .objects = { reinterpret_cast(&frame_transform_matrix_2), reinterpret_cast(&mesh_Box02), + nullptr, } }; @@ -10416,6 +10427,7 @@ const mesh mesh_Box02 = { reinterpret_cast(&mesh_material_list_2), reinterpret_cast(&mesh_normals_2), reinterpret_cast(&mesh_texture_coords_2), + nullptr, } }; @@ -10427,6 +10439,7 @@ const mesh_material_list mesh_material_list_2 = { .objects = { reinterpret_cast(&material_x3ds_mat_Material__3), + nullptr, } }; @@ -10466,6 +10479,7 @@ const frame frame_x3ds_Cone02 = { .objects = { reinterpret_cast(&frame_transform_matrix_3), reinterpret_cast(&mesh_Cone02), + nullptr, } }; @@ -10490,6 +10504,7 @@ const mesh mesh_Cone02 = { reinterpret_cast(&mesh_material_list_3), reinterpret_cast(&mesh_normals_3), reinterpret_cast(&mesh_texture_coords_3), + nullptr, } }; @@ -10501,6 +10516,7 @@ const mesh_material_list mesh_material_list_3 = { .objects = { reinterpret_cast(&material_x3ds_mat_shingle), + nullptr, } }; @@ -10566,6 +10582,7 @@ const frame frame_x3ds_Cylinder02 = { .objects = { reinterpret_cast(&frame_transform_matrix_4), reinterpret_cast(&mesh_Cylinder02), + nullptr, } }; @@ -10590,6 +10607,7 @@ const mesh mesh_Cylinder02 = { reinterpret_cast(&mesh_material_list_4), reinterpret_cast(&mesh_normals_4), reinterpret_cast(&mesh_texture_coords_4), + nullptr, } }; @@ -10601,6 +10619,7 @@ const mesh_material_list mesh_material_list_4 = { .objects = { reinterpret_cast(&material_x3ds_mat_Material__3), + nullptr, } }; @@ -10643,6 +10662,7 @@ const frame frame_x3ds_Box21 = { .objects = { reinterpret_cast(&frame_transform_matrix_5), reinterpret_cast(&mesh_Box21), + nullptr, } }; @@ -10667,6 +10687,7 @@ const mesh mesh_Box21 = { reinterpret_cast(&mesh_material_list_5), reinterpret_cast(&mesh_normals_5), reinterpret_cast(&mesh_texture_coords_5), + nullptr, } }; @@ -10678,6 +10699,7 @@ const mesh_material_list mesh_material_list_5 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -11079,6 +11101,7 @@ const frame frame_x3ds_Box22 = { .objects = { reinterpret_cast(&frame_transform_matrix_6), reinterpret_cast(&mesh_Box22), + nullptr, } }; @@ -11103,6 +11126,7 @@ const mesh mesh_Box22 = { reinterpret_cast(&mesh_material_list_6), reinterpret_cast(&mesh_normals_6), reinterpret_cast(&mesh_texture_coords_6), + nullptr, } }; @@ -11114,6 +11138,7 @@ const mesh_material_list mesh_material_list_6 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -11465,6 +11490,7 @@ const frame frame_x3ds_Box23 = { .objects = { reinterpret_cast(&frame_transform_matrix_7), reinterpret_cast(&mesh_Box23), + nullptr, } }; @@ -11489,6 +11515,7 @@ const mesh mesh_Box23 = { reinterpret_cast(&mesh_material_list_7), reinterpret_cast(&mesh_normals_7), reinterpret_cast(&mesh_texture_coords_7), + nullptr, } }; @@ -11500,6 +11527,7 @@ const mesh_material_list mesh_material_list_7 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -11901,6 +11929,7 @@ const frame frame_x3ds_Box24 = { .objects = { reinterpret_cast(&frame_transform_matrix_8), reinterpret_cast(&mesh_Box24), + nullptr, } }; @@ -11925,6 +11954,7 @@ const mesh mesh_Box24 = { reinterpret_cast(&mesh_material_list_8), reinterpret_cast(&mesh_normals_8), reinterpret_cast(&mesh_texture_coords_8), + nullptr, } }; @@ -11936,6 +11966,7 @@ const mesh_material_list mesh_material_list_8 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -12059,6 +12090,7 @@ const frame frame_x3ds_Box25 = { .objects = { reinterpret_cast(&frame_transform_matrix_9), reinterpret_cast(&mesh_Box25), + nullptr, } }; @@ -12083,6 +12115,7 @@ const mesh mesh_Box25 = { reinterpret_cast(&mesh_material_list_9), reinterpret_cast(&mesh_normals_9), reinterpret_cast(&mesh_texture_coords_9), + nullptr, } }; @@ -12094,6 +12127,7 @@ const mesh_material_list mesh_material_list_9 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -12445,6 +12479,7 @@ const frame frame_x3ds_Box26 = { .objects = { reinterpret_cast(&frame_transform_matrix_10), reinterpret_cast(&mesh_Box26), + nullptr, } }; @@ -12469,6 +12504,7 @@ const mesh mesh_Box26 = { reinterpret_cast(&mesh_material_list_10), reinterpret_cast(&mesh_normals_10), reinterpret_cast(&mesh_texture_coords_10), + nullptr, } }; @@ -12480,6 +12516,7 @@ const mesh_material_list mesh_material_list_10 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -12881,6 +12918,7 @@ const frame frame_x3ds_Box27 = { .objects = { reinterpret_cast(&frame_transform_matrix_11), reinterpret_cast(&mesh_Box27), + nullptr, } }; @@ -12905,6 +12943,7 @@ const mesh mesh_Box27 = { reinterpret_cast(&mesh_material_list_11), reinterpret_cast(&mesh_normals_11), reinterpret_cast(&mesh_texture_coords_11), + nullptr, } }; @@ -12916,6 +12955,7 @@ const mesh_material_list mesh_material_list_11 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -13267,6 +13307,7 @@ const frame frame_x3ds_Cylinder03 = { .objects = { reinterpret_cast(&frame_transform_matrix_12), reinterpret_cast(&mesh_Cylinder03), + nullptr, } }; @@ -13291,6 +13332,7 @@ const mesh mesh_Cylinder03 = { reinterpret_cast(&mesh_material_list_12), reinterpret_cast(&mesh_normals_12), reinterpret_cast(&mesh_texture_coords_12), + nullptr, } }; @@ -13302,6 +13344,7 @@ const mesh_material_list mesh_material_list_12 = { .objects = { reinterpret_cast(&material_x3ds_mat_Material__3), + nullptr, } }; @@ -13344,6 +13387,7 @@ const frame frame_x3ds_Cone03 = { .objects = { reinterpret_cast(&frame_transform_matrix_13), reinterpret_cast(&mesh_Cone03), + nullptr, } }; @@ -13368,6 +13412,7 @@ const mesh mesh_Cone03 = { reinterpret_cast(&mesh_material_list_13), reinterpret_cast(&mesh_normals_13), reinterpret_cast(&mesh_texture_coords_13), + nullptr, } }; @@ -13379,6 +13424,7 @@ const mesh_material_list mesh_material_list_13 = { .objects = { reinterpret_cast(&material_x3ds_mat_shingle), + nullptr, } }; @@ -13444,6 +13490,7 @@ const frame frame_x3ds_Cylinder01 = { .objects = { reinterpret_cast(&frame_transform_matrix_14), reinterpret_cast(&mesh_Cylinder01), + nullptr, } }; @@ -13468,6 +13515,7 @@ const mesh mesh_Cylinder01 = { reinterpret_cast(&mesh_material_list_14), reinterpret_cast(&mesh_normals_14), reinterpret_cast(&mesh_texture_coords_14), + nullptr, } }; @@ -13479,6 +13527,7 @@ const mesh_material_list mesh_material_list_14 = { .objects = { reinterpret_cast(&material_x3ds_mat_castlestone), + nullptr, } }; @@ -13907,6 +13956,7 @@ const frame frame_x3ds_Box01 = { .objects = { reinterpret_cast(&frame_transform_matrix_15), reinterpret_cast(&mesh_Box01), + nullptr, } }; @@ -13931,6 +13981,7 @@ const mesh mesh_Box01 = { reinterpret_cast(&mesh_material_list_15), reinterpret_cast(&mesh_normals_15), reinterpret_cast(&mesh_texture_coords_15), + nullptr, } }; @@ -13942,6 +13993,7 @@ const mesh_material_list mesh_material_list_15 = { .objects = { reinterpret_cast(&material_x3ds_mat_Material__8), + nullptr, } }; @@ -13982,6 +14034,7 @@ const frame frame_x3ds_Box28 = { .objects = { reinterpret_cast(&frame_transform_matrix_16), reinterpret_cast(&mesh_Box28), + nullptr, } }; @@ -14006,6 +14059,7 @@ const mesh mesh_Box28 = { reinterpret_cast(&mesh_material_list_16), reinterpret_cast(&mesh_normals_16), reinterpret_cast(&mesh_texture_coords_16), + nullptr, } }; @@ -14017,6 +14071,7 @@ const mesh_material_list mesh_material_list_16 = { .objects = { reinterpret_cast(&material_x3ds_mat_Material__8), + nullptr, } }; @@ -14057,6 +14112,7 @@ const frame frame_x3ds_Box03 = { .objects = { reinterpret_cast(&frame_transform_matrix_17), reinterpret_cast(&mesh_Box03), + nullptr, } }; @@ -14081,6 +14137,7 @@ const mesh mesh_Box03 = { reinterpret_cast(&mesh_material_list_17), reinterpret_cast(&mesh_normals_17), reinterpret_cast(&mesh_texture_coords_17), + nullptr, } }; @@ -14092,6 +14149,7 @@ const mesh_material_list mesh_material_list_17 = { .objects = { reinterpret_cast(&material_x3ds_mat_Material__8), + nullptr, } }; @@ -14123,6 +14181,7 @@ const frame frame_x3ds_roof = { .objects = { reinterpret_cast(&frame_transform_matrix_18), reinterpret_cast(&mesh_roof), + nullptr, } }; @@ -14147,6 +14206,7 @@ const mesh mesh_roof = { reinterpret_cast(&mesh_material_list_18), reinterpret_cast(&mesh_normals_18), reinterpret_cast(&mesh_texture_coords_18), + nullptr, } }; @@ -14158,6 +14218,7 @@ const mesh_material_list mesh_material_list_18 = { .objects = { reinterpret_cast(&material_x3ds_mat_shingle), + nullptr, } }; @@ -14187,6 +14248,7 @@ const frame frame_x3ds_walkway = { .objects = { reinterpret_cast(&frame_transform_matrix_19), reinterpret_cast(&mesh_walkway), + nullptr, } }; @@ -14211,6 +14273,7 @@ const mesh mesh_walkway = { reinterpret_cast(&mesh_material_list_19), reinterpret_cast(&mesh_normals_19), reinterpret_cast(&mesh_texture_coords_19), + nullptr, } }; @@ -14222,6 +14285,7 @@ const mesh_material_list mesh_material_list_19 = { .objects = { reinterpret_cast(&material_x3ds_mat_Material__8), + nullptr, } }; @@ -14321,6 +14385,7 @@ const animation_set animation_set_x3ds_animset_0 = { reinterpret_cast(&animation_x3ds_anim_17), reinterpret_cast(&animation_x3ds_anim_18), reinterpret_cast(&animation_x3ds_anim_19), + nullptr, } }; @@ -14331,6 +14396,7 @@ const animation animation_x3ds_anim_0 = { reinterpret_cast(&frame_x3ds_Box08), reinterpret_cast(&animation_key_0), reinterpret_cast(&animation_key_1), + nullptr, } }; @@ -14359,6 +14425,7 @@ const animation animation_x3ds_anim_1 = { reinterpret_cast(&frame_x3ds_Box09), reinterpret_cast(&animation_key_2), reinterpret_cast(&animation_key_3), + nullptr, } }; @@ -14387,6 +14454,7 @@ const animation animation_x3ds_anim_2 = { reinterpret_cast(&frame_x3ds_Box02), reinterpret_cast(&animation_key_4), reinterpret_cast(&animation_key_5), + nullptr, } }; @@ -14415,6 +14483,7 @@ const animation animation_x3ds_anim_3 = { reinterpret_cast(&frame_x3ds_Cone02), reinterpret_cast(&animation_key_6), reinterpret_cast(&animation_key_7), + nullptr, } }; @@ -14443,6 +14512,7 @@ const animation animation_x3ds_anim_4 = { reinterpret_cast(&frame_x3ds_Cylinder02), reinterpret_cast(&animation_key_8), reinterpret_cast(&animation_key_9), + nullptr, } }; @@ -14471,6 +14541,7 @@ const animation animation_x3ds_anim_5 = { reinterpret_cast(&frame_x3ds_Box21), reinterpret_cast(&animation_key_10), reinterpret_cast(&animation_key_11), + nullptr, } }; @@ -14499,6 +14570,7 @@ const animation animation_x3ds_anim_6 = { reinterpret_cast(&frame_x3ds_Box22), reinterpret_cast(&animation_key_12), reinterpret_cast(&animation_key_13), + nullptr, } }; @@ -14527,6 +14599,7 @@ const animation animation_x3ds_anim_7 = { reinterpret_cast(&frame_x3ds_Box23), reinterpret_cast(&animation_key_14), reinterpret_cast(&animation_key_15), + nullptr, } }; @@ -14555,6 +14628,7 @@ const animation animation_x3ds_anim_8 = { reinterpret_cast(&frame_x3ds_Box24), reinterpret_cast(&animation_key_16), reinterpret_cast(&animation_key_17), + nullptr, } }; @@ -14583,6 +14657,7 @@ const animation animation_x3ds_anim_9 = { reinterpret_cast(&frame_x3ds_Box25), reinterpret_cast(&animation_key_18), reinterpret_cast(&animation_key_19), + nullptr, } }; @@ -14611,6 +14686,7 @@ const animation animation_x3ds_anim_10 = { reinterpret_cast(&frame_x3ds_Box26), reinterpret_cast(&animation_key_20), reinterpret_cast(&animation_key_21), + nullptr, } }; @@ -14639,6 +14715,7 @@ const animation animation_x3ds_anim_11 = { reinterpret_cast(&frame_x3ds_Box27), reinterpret_cast(&animation_key_22), reinterpret_cast(&animation_key_23), + nullptr, } }; @@ -14667,6 +14744,7 @@ const animation animation_x3ds_anim_12 = { reinterpret_cast(&frame_x3ds_Cylinder03), reinterpret_cast(&animation_key_24), reinterpret_cast(&animation_key_25), + nullptr, } }; @@ -14695,6 +14773,7 @@ const animation animation_x3ds_anim_13 = { reinterpret_cast(&frame_x3ds_Cone03), reinterpret_cast(&animation_key_26), reinterpret_cast(&animation_key_27), + nullptr, } }; @@ -14723,6 +14802,7 @@ const animation animation_x3ds_anim_14 = { reinterpret_cast(&frame_x3ds_Cylinder01), reinterpret_cast(&animation_key_28), reinterpret_cast(&animation_key_29), + nullptr, } }; @@ -14751,6 +14831,7 @@ const animation animation_x3ds_anim_15 = { reinterpret_cast(&frame_x3ds_Box01), reinterpret_cast(&animation_key_30), reinterpret_cast(&animation_key_31), + nullptr, } }; @@ -14779,6 +14860,7 @@ const animation animation_x3ds_anim_16 = { reinterpret_cast(&frame_x3ds_Box28), reinterpret_cast(&animation_key_32), reinterpret_cast(&animation_key_33), + nullptr, } }; @@ -14807,6 +14889,7 @@ const animation animation_x3ds_anim_17 = { reinterpret_cast(&frame_x3ds_Box03), reinterpret_cast(&animation_key_34), reinterpret_cast(&animation_key_35), + nullptr, } }; @@ -14835,6 +14918,7 @@ const animation animation_x3ds_anim_18 = { reinterpret_cast(&frame_x3ds_roof), reinterpret_cast(&animation_key_36), reinterpret_cast(&animation_key_37), + nullptr, } }; @@ -14863,6 +14947,7 @@ const animation animation_x3ds_anim_19 = { reinterpret_cast(&frame_x3ds_walkway), reinterpret_cast(&animation_key_38), reinterpret_cast(&animation_key_39), + nullptr, } }; diff --git a/x/gen.py b/x/gen.py index c0ade31..c644cc6 100644 --- a/x/gen.py +++ b/x/gen.py @@ -303,6 +303,8 @@ def generate_definition(obj): reference_name = obj_value(o).name o = obj_map[reference_name] yield f"reinterpret_cast(&{get_obj_name(o)})," + # end of objects list + yield f"nullptr," yield "}" yield "};"