From 34b05124a959b7e7645673247172ab0ebe2fa58a Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Sun, 4 May 2025 01:37:35 -0500 Subject: [PATCH] example: add door --- example/door.cpp | 653 ++++++++++++++++++++++++++++++++++++++ example/example.mk | 15 + model/door/door.h | 767 ++++++++++++++++++++++++++++++++++++--------- printf/compat.h | 24 -- 4 files changed, 1291 insertions(+), 168 deletions(-) create mode 100644 example/door.cpp diff --git a/example/door.cpp b/example/door.cpp new file mode 100644 index 0000000..3036fa1 --- /dev/null +++ b/example/door.cpp @@ -0,0 +1,653 @@ +#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_alloc5.hpp" +#include "holly/video_output.hpp" + +#include "systembus.hpp" +#include "systembus_bits.hpp" + +#include "maple/maple.hpp" +#include "maple/maple_host_command_writer.hpp" +#include "maple/maple_bus_bits.hpp" +#include "maple/maple_bus_commands.hpp" +#include "maple/maple_bus_ft0.hpp" + +#include "memorymap.hpp" + +#include "sh7091/sh7091.hpp" +#include "sh7091/sh7091_bits.hpp" +#include "sh7091/serial.hpp" +#include "printf/printf.h" + +#include "math/vec2.hpp" +#include "math/vec3.hpp" +#include "math/vec4.hpp" +#include "math/mat2x2.hpp" +#include "math/mat3x3.hpp" +#include "math/mat4x4.hpp" +#include "math/geometry.hpp" + +#include "interrupt.hpp" + +#include "font/font_bitmap.hpp" +#include "font/verite_8x16/verite_8x16.data.h" +#include "palette.hpp" +#include "printf/unparse.h" + +#include "assert.h" + +using vec2 = vec<2, float>; +using vec3 = vec<3, float>; +using vec4 = vec<4, float>; +using mat4x4 = mat<4, 4, float>; + +struct polygon { + int a, b, c, d; +}; + +struct mesh { + const vec3 * position; + const int position_length; + const vec3 * normal; + const int normal_length; + const polygon * polygons; + const int polygons_length; + // vec2 * uv_layers[]; // support for multiple UV maps + // int uv_layers_length; +}; + +struct transform { + const vec3 scale; + const vec4 rotation; + const vec3 location; +}; + +struct object { + const struct mesh * mesh; + const transform transforms[26]; +}; + +#include "model/door/door.h" + +#define _fsrra(n) (1.0f / (__builtin_sqrtf(n))) + +static ft0::data_transfer::data_format data[4]; + +uint8_t send_buf[1024] __attribute__((aligned(32))); +uint8_t recv_buf[1024] __attribute__((aligned(32))); + +void do_get_condition() +{ + auto writer = maple::host_command_writer(send_buf, recv_buf); + + using command_type = maple::get_condition; + using response_type = maple::data_transfer; + + auto [host_command, host_response] + = writer.append_command_all_ports(); + + for (int port = 0; port < 4; port++) { + auto& data_fields = host_command[port].bus_data.data_fields; + data_fields.function_type = std::byteswap(function_type::controller); + } + maple::dma_start(send_buf, writer.send_offset, + recv_buf, writer.recv_offset); + + for (uint8_t port = 0; port < 4; port++) { + auto& bus_data = host_response[port].bus_data; + if (bus_data.command_code != response_type::command_code) { + return; + } + auto& data_fields = bus_data.data_fields; + if ((std::byteswap(data_fields.function_type) & function_type::controller) == 0) { + return; + } + + data[port].digital_button = data_fields.data.digital_button; + for (int i = 0; i < 6; i++) { + data[port].analog_coordinate_axis[i] + = data_fields.data.analog_coordinate_axis[i]; + } + } +} + +void vbr100() +{ + serial::string("vbr100\n"); + interrupt_exception(); +} + +void vbr400() +{ + serial::string("vbr400\n"); + interrupt_exception(); +} + +const int framebuffer_width = 640; +const int framebuffer_height = 480; +const int tile_width = framebuffer_width / 32; +const int tile_height = framebuffer_height / 32; + +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::_32x4byte; + +constexpr int ta_cont_count = 1; +constexpr struct opb_size opb_size[ta_cont_count] = { + { + .opaque = 32 * 4, + .opaque_modifier = 0, + .translucent = 0, + .translucent_modifier = 0, + .punch_through = 0 + } +}; + +static volatile int ta_in_use = 0; +static volatile int core_in_use = 0; +static volatile int next_frame = 0; +static volatile int framebuffer_ix = 0; +static volatile int next_frame_ix = 0; + +static inline void pump_events(uint32_t istnrm) +{ + if (istnrm & istnrm::v_blank_in) { + system.ISTNRM = istnrm::v_blank_in; + + next_frame = 1; + holly.FB_R_SOF1 = texture_memory_alloc.framebuffer[next_frame_ix].start; + } + + if (istnrm & istnrm::end_of_render_tsp) { + system.ISTNRM = istnrm::end_of_render_tsp + | istnrm::end_of_render_isp + | istnrm::end_of_render_video; + + next_frame_ix = framebuffer_ix; + framebuffer_ix += 1; + if (framebuffer_ix >= 3) framebuffer_ix = 0; + + core_in_use = 0; + } + + if (istnrm & istnrm::end_of_transferring_opaque_list) { + system.ISTNRM = istnrm::end_of_transferring_opaque_list; + + core_in_use = 1; + core_start_render2(texture_memory_alloc.region_array.start, + texture_memory_alloc.isp_tsp_parameters.start, + texture_memory_alloc.background[0].start, + texture_memory_alloc.framebuffer[framebuffer_ix].start, + framebuffer_width); + + ta_in_use = 0; + } +} + +void vbr600() +{ + uint32_t sr; + asm volatile ("stc sr,%0" : "=r" (sr)); + sr |= sh::sr::imask(15); + asm volatile ("ldc %0,sr" : : "r" (sr)); + //serial::string("imask\n"); + + //check_pipeline(); + + 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); + } + + pump_events(istnrm); + + sr &= ~sh::sr::imask(15); + asm volatile ("ldc %0,sr" : : "r" (sr)); + + return; + } + + serial::string("vbr600\n"); + interrupt_exception(); +} + +void global_polygon_type_1(ta_parameter_writer& writer, + uint32_t para_control_obj_control, + uint32_t texture_u_v_size, + uint32_t texture_control_word, + const float a = 1.0f, + const float r = 1.0f, + const float g = 1.0f, + const float b = 1.0f + ) +{ + const uint32_t parameter_control_word = para_control::para_type::polygon_or_modifier_volume + | obj_control::col_type::intensity_mode_1 + | obj_control::gouraud + | para_control_obj_control + ; + + const uint32_t isp_tsp_instruction_word = isp_tsp_instruction_word::depth_compare_mode::greater + | isp_tsp_instruction_word::culling_mode::no_culling + ; + + const uint32_t tsp_instruction_word = tsp_instruction_word::fog_control::no_fog + | tsp_instruction_word::texture_shading_instruction::decal + //| tsp_instruction_word::src_alpha_instr::one + //| tsp_instruction_word::dst_alpha_instr::zero + | texture_u_v_size + ; + + writer.append() = + ta_global_parameter::polygon_type_1(parameter_control_word, + isp_tsp_instruction_word, + tsp_instruction_word, + texture_control_word, + a, + r, + g, + b + ); +} + +static inline void render_quad(ta_parameter_writer& writer, + vec3 ap, + vec3 bp, + vec3 cp, + vec3 dp, + float li) +{ + if (ap.z < 0 || bp.z < 0 || cp.z < 0 || dp.z < 0) + return; + + writer.append() = + ta_vertex_parameter::polygon_type_2(polygon_vertex_parameter_control_word(false), + ap.x, ap.y, ap.z, + li); + + writer.append() = + ta_vertex_parameter::polygon_type_2(polygon_vertex_parameter_control_word(false), + bp.x, bp.y, bp.z, + li); + + writer.append() = + ta_vertex_parameter::polygon_type_2(polygon_vertex_parameter_control_word(false), + dp.x, dp.y, dp.z, + li); + + writer.append() = + ta_vertex_parameter::polygon_type_2(polygon_vertex_parameter_control_word(true), + cp.x, cp.y, cp.z, + li); +} + +static inline vec3 screen_transform(vec3 v) +{ + float dim = 480 / 2.0; + + return { + v.x / (1.f * v.z) * dim + 640 / 2.0f, + v.y / (1.f * v.z) * dim + 480 / 2.0f, + 1 / v.z, + }; +} + +#define _fsrra(n) (1.0f / (__builtin_sqrtf(n))) + +static inline float inverse_length(vec3 v) +{ + float f = dot(v, v); + return _fsrra(f); +} + +float light_intensity(vec3 l1, vec3 l2, vec3 n) +{ + float intensity = 0.2f; + { + float n_dot_l = dot(n, l1); + if (n_dot_l > 0) + intensity += 0.9f * n_dot_l * (inverse_length(n) * inverse_length(l1)); + } + { + float n_dot_l = dot(n, l2); + if (n_dot_l > 0) + intensity += 0.9f * n_dot_l * (inverse_length(n) * inverse_length(l2)); + } + + if (intensity > 1.0f) + intensity = 1.0f; + + return intensity; +} + +static inline vec3 normal_transform(const mat4x4& trans, vec3 normal) +{ + vec4 n = trans * (vec4){normal.x, normal.y, normal.z, 0.f}; // no translation component + return {n.x, n.y, n.z}; +} + +const vec3 light_vec = {20, -20, -20}; +const vec3 light_vec2 = {20, 20, 20}; + +mat4x4 scale(vec3 s) +{ + return { + s.x, 0, 0, 0, + 0, s.y, 0, 0, + 0, 0, s.z, 0, + 0, 0, 0, 1, + }; +} + +mat4x4 translate(vec3 t) +{ + return { + 1, 0, 0, t.x, + 0, 1, 0, t.y, + 0, 0, 1, t.z, + 0, 0, 0, 1, + }; +} + +//mat4x4 rodrigues(vec4 r) __attribute__ ((optimize(1))); +mat4x4 rodrigues(vec4 r) +{ + const vec3 k = {r.y, r.z, r.w}; + const float t = r.x; + + const mat4x4 K = { + 0, -k.z, k.y, 0, + k.z, 0, -k.x, 0, + -k.y, k.x, 0, 0, + 0, 0, 0, 1, + }; + + const mat4x4 I = { + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + }; + + const mat4x4 R = I + (K * sin(t)) + ((K * K) * (1 - cos(t))); + + return R; +} + +mat4x4 quaternion(vec4 r) +{ + return { + 1 - (2 * r.y * r.y) - (2 * r.z * r.z), (2 * r.x * r.y) - (2 * r.z * r.w), (2 * r.x * r.z) + (2 * r.y * r.w), 0, + (2 * r.x * r.y) + (2 * r.z * r.w), 1 - (2 * r.x * r.x) - (2 * r.z * r.z), (2 * r.y * r.z) - (2 * r.x * r.w), 0, + (2 * r.x * r.z) - (2 * r.y * r.w), (2 * r.y * r.z) + (2 * r.x * r.w), 1 - (2 * r.x * r.x) - (2 * r.y * r.y), 0, + 0, 0, 0, 1, + }; +} + +constexpr int animation_frames = 26; +constexpr int ticks_per_animation_frame = 64; +constexpr float tick_div = 1.0f / (float)ticks_per_animation_frame; + +void transfer_mesh(ta_parameter_writer& writer, const mat4x4& trans, const object * object, int animation_tick) +{ + const mesh * mesh = object->mesh; + uint32_t control = para_control::list_type::opaque; + uint32_t texture_uv_size = 0; + uint32_t texture_control_word = 0; + + global_polygon_type_1(writer, + control, + texture_uv_size, + texture_control_word); + + vec3 position_cache[mesh->position_length]; + vec3 normal_cache[mesh->normal_length]; + + int frame_ix0 = animation_tick / ticks_per_animation_frame; + int frame_ix1 = frame_ix0 + 1; + if (frame_ix1 >= animation_frames) + frame_ix1 = 0; + + float lerp = (float)(animation_tick - (frame_ix0 * ticks_per_animation_frame)) * tick_div; + + const transform& t0 = object->transforms[frame_ix0]; + const transform& t1 = object->transforms[frame_ix1]; + + vec3 location = t0.location + ((t1.location - t0.location) * lerp); + vec4 rotation = t0.rotation + ((t1.rotation - t0.rotation) * lerp); + vec3 _scale = t0.scale + ((t1.scale - t0.scale) * lerp); + + mat4x4 trans1 = trans + * translate(location) + * quaternion(rotation) + * scale(_scale); + + for (int i = 0; i < mesh->position_length; i++) { + position_cache[i] = trans1 * mesh->position[i]; + normal_cache[i] = normal_transform(trans * quaternion(rotation), mesh->normal[i]); + } + + for (int i = 0; i < mesh->polygons_length; i++) { + const polygon * p = &mesh->polygons[i]; + + vec3 ap = screen_transform(position_cache[p->a]); + vec3 bp = screen_transform(position_cache[p->b]); + vec3 cp = screen_transform(position_cache[p->c]); + vec3 dp = screen_transform(position_cache[p->d]); + + float li = light_intensity(light_vec, light_vec2, normal_cache[p->a]); + assert(li > 0); + + render_quad(writer, ap, bp, cp, dp, li); + } +} + +void transfer_scene(ta_parameter_writer& writer, const mat4x4& trans, int animation_tick) +{ + // opaque list + { + transfer_mesh(writer, trans, &objects[0], animation_tick); + transfer_mesh(writer, trans, &objects[1], animation_tick); + transfer_mesh(writer, trans, &objects[2], animation_tick); + + writer.append() = + ta_global_parameter::end_of_list(para_control::para_type::end_of_list); + } +} + +void update_analog(mat4x4& screen, mat4x4& model) +{ + const float l_ = static_cast(data[0].analog_coordinate_axis[0]) * (1.f / 255.f); + const float r_ = static_cast(data[0].analog_coordinate_axis[1]) * (1.f / 255.f); + + const float x_ = static_cast(data[0].analog_coordinate_axis[2] - 0x80) / 127.f; + const float y_ = static_cast(data[0].analog_coordinate_axis[3] - 0x80) / 127.f; + + int ra = ft0::data_transfer::digital_button::ra(data[0].digital_button) == 0; + int la = ft0::data_transfer::digital_button::la(data[0].digital_button) == 0; + + float yt = -0.05f * x_; + float xt = 0.05f * y_; + + float x = 0; + if (ra && !la) x = -0.05; + if (la && !ra) x = 0.05; + + float y = 0; + float z = -0.05f * r_ + 0.05f * l_; + + mat4x4 t = { + 1, 0, 0, x, + 0, 1, 0, z, + 0, 0, 1, y, + 0, 0, 0, 1, + }; + + mat4x4 rx = { + 1, 0, 0, 0, + 0, cos(xt), -sin(xt), 0, + 0, sin(xt), cos(xt), 0, + 0, 0, 0, 1, + }; + + mat4x4 ry = { + cos(yt), 0, sin(yt), 0, + 0, 1, 0, 0, + -sin(yt), 0, cos(yt), 0, + 0, 0, 0, 1, + }; + + screen = screen * t; + model = model * ry * rx; +} + +int format_float(char * s, float num, int pad_length) +{ + int offset = 0; + bool negative = num < 0; + if (negative) num = -num; + int32_t whole = num; + int digits = digits_base10(whole); + offset += unparse_base10_unsigned(&s[offset], whole, pad_length, ' '); + if (negative) + s[offset - (digits + 1)] = '-'; + s[offset++] = '.'; + int32_t fraction = (int32_t)((num - (float)whole) * 1000.0); + if (fraction < 0) + fraction = -fraction; + offset += unparse_base10_unsigned(&s[offset], fraction, 3, '0'); + return offset; +} + +void render_matrix(ta_parameter_writer& writer, const mat4x4& trans) +{ + for (int row = 0; row < 4; row++) { + char __attribute__((aligned(4))) s[64]; + for (uint32_t i = 0; i < (sizeof (s)) / 4; i++) + reinterpret_cast(s)[i] = 0x20202020; + + int offset = 0; + offset += format_float(&s[offset], trans[row][0], 7); + offset += format_float(&s[offset], trans[row][1], 7); + offset += format_float(&s[offset], trans[row][2], 7); + offset += format_float(&s[offset], trans[row][3], 7); + + serial::string((uint8_t *)s, offset); + serial::character('\n'); + } + serial::character('\n'); +} + +uint8_t __attribute__((aligned(32))) ta_parameter_buf[1024 * 1024 * 3]; + +int main() +{ + sh7091.TMU.TSTR = 0; // stop all timers + sh7091.TMU.TOCR = tmu::tocr::tcoe::tclk_is_external_clock_or_input_capture; + sh7091.TMU.TCR0 = tmu::tcr0::tpsc::p_phi_256; // 256 / 50MHz = 5.12 μs ; underflows in ~1 hour + sh7091.TMU.TCOR0 = 0xffff'ffff; + sh7091.TMU.TCNT0 = 0xffff'ffff; + sh7091.TMU.TSTR = tmu::tstr::str0::counter_start; + + serial::init(0); + + interrupt_init(); + + holly.SOFTRESET = softreset::pipeline_soft_reset + | softreset::ta_soft_reset; + holly.SOFTRESET = 0; + + core_init(); + + holly.FPU_SHAD_SCALE = fpu_shad_scale::simple_shadow_enable::parameter_selection_volume_mode; + + system.IML6NRM = istnrm::end_of_render_tsp + | istnrm::v_blank_in + | istnrm::end_of_transferring_opaque_list; + + region_array_multipass(tile_width, + tile_height, + opb_size, + ta_cont_count, + texture_memory_alloc.region_array.start, + texture_memory_alloc.object_list.start); + + background_parameter2(texture_memory_alloc.background[0].start, + 0xff202040); + + ta_parameter_writer writer = ta_parameter_writer(ta_parameter_buf, (sizeof (ta_parameter_buf))); + + video_output::set_mode_vga(); + + mat4x4 screen_trans = { + 1, 0, 0, 0, + 0, 0, -1, 0, + 0, 1, 0, 7, + 0, 0, 0, 1, + }; + + mat4x4 model_trans = { + 0.805, -0.577, 0.136, 0, + 0.592, 0.773, -0.224, 0, + 0.024, 0.262, 0.964, 0, + 0, 0, 0, 1, + }; + + do_get_condition(); + int animation_tick = 0; + while (1) { + if (0 && animation_tick == 0) { + serial::string("screen:\n"); + render_matrix(writer, screen_trans); + serial::string("model:\n"); + render_matrix(writer, model_trans); + } + + maple::dma_wait_complete(); + do_get_condition(); + writer.offset = 0; + + update_analog(screen_trans, model_trans); + transfer_scene(writer, screen_trans * model_trans, animation_tick); + + // increment tick + animation_tick += 1; + if (animation_tick >= animation_frames * ticks_per_animation_frame) + animation_tick = 0; + + while (ta_in_use); + while (core_in_use); + ta_in_use = 1; + ta_polygon_converter_init2(texture_memory_alloc.isp_tsp_parameters.start, + texture_memory_alloc.isp_tsp_parameters.end, + texture_memory_alloc.object_list.start, + texture_memory_alloc.object_list.end, + opb_size[0].total(), + ta_alloc, + tile_width, + tile_height); + ta_polygon_converter_writeback(writer.buf, writer.offset); + ta_polygon_converter_transfer(writer.buf, writer.offset); + + while (next_frame) + next_frame = 0; + } +} diff --git a/example/example.mk b/example/example.mk index f62a0e0..23e0346 100644 --- a/example/example.mk +++ b/example/example.mk @@ -1022,3 +1022,18 @@ MOD_OBJ = \ example/mod.elf: LDSCRIPT = $(LIB)/main.lds example/mod.elf: $(START_OBJ) $(MOD_OBJ) + +DOOR_OBJ = \ + example/door.o \ + holly/core.o \ + holly/region_array.o \ + holly/background.o \ + holly/ta_fifo_polygon_converter.o \ + holly/video_output.o \ + sh7091/serial.o \ + maple/maple.o \ + printf/unparse.o \ + $(LIBGCC) + +example/door.elf: LDSCRIPT = $(LIB)/main.lds +example/door.elf: $(START_OBJ) $(DOOR_OBJ) diff --git a/model/door/door.h b/model/door/door.h index 2012297..e988fb1 100644 --- a/model/door/door.h +++ b/model/door/door.h @@ -1,158 +1,637 @@ const vec3 mesh_Cylinder_position[] = { - {0.0, 1.0, -1.0}, - {0.0, 1.0, 1.0}, - {0.19509032368659973, 0.9807852506637573, -1.0}, - {0.19509032368659973, 0.9807852506637573, 1.0}, - {0.3826834559440613, 0.9238795042037964, -1.0}, - {0.3826834559440613, 0.9238795042037964, 1.0}, - {0.5555702447891235, 0.8314695954322815, -1.0}, - {0.5555702447891235, 0.8314695954322815, 1.0}, - {0.7071067690849304, 0.7071067690849304, -1.0}, - {0.7071067690849304, 0.7071067690849304, 1.0}, - {0.8314695954322815, 0.5555702447891235, -1.0}, - {0.8314695954322815, 0.5555702447891235, 1.0}, - {0.9238795042037964, 0.3826834559440613, -1.0}, - {0.9238795042037964, 0.3826834559440613, 1.0}, - {0.9807852506637573, 0.19509032368659973, -1.0}, - {0.9807852506637573, 0.19509032368659973, 1.0}, - {1.0, 0.0, -1.0}, - {1.0, 0.0, 1.0}, - {0.9807852506637573, -0.19509032368659973, -1.0}, - {0.9807852506637573, -0.19509032368659973, 1.0}, - {0.9238795042037964, -0.3826834559440613, -1.0}, - {0.9238795042037964, -0.3826834559440613, 1.0}, - {0.8314695954322815, -0.5555702447891235, -1.0}, - {0.8314695954322815, -0.5555702447891235, 1.0}, - {0.7071067690849304, -0.7071067690849304, -1.0}, - {0.7071067690849304, -0.7071067690849304, 1.0}, - {0.5555702447891235, -0.8314695954322815, -1.0}, - {0.5555702447891235, -0.8314695954322815, 1.0}, - {0.3826834559440613, -0.9238795042037964, -1.0}, - {0.3826834559440613, -0.9238795042037964, 1.0}, - {0.19509032368659973, -0.9807852506637573, -1.0}, - {0.19509032368659973, -0.9807852506637573, 1.0}, - {0.0, -1.0, -1.0}, - {0.0, -1.0, 1.0}, - {-0.19509032368659973, -0.9807852506637573, -1.0}, - {-0.19509032368659973, -0.9807852506637573, 1.0}, - {-0.3826834559440613, -0.9238795042037964, -1.0}, - {-0.3826834559440613, -0.9238795042037964, 1.0}, - {-0.5555702447891235, -0.8314695954322815, -1.0}, - {-0.5555702447891235, -0.8314695954322815, 1.0}, - {-0.7071067690849304, -0.7071067690849304, -1.0}, - {-0.7071067690849304, -0.7071067690849304, 1.0}, - {-0.8314695954322815, -0.5555702447891235, -1.0}, - {-0.8314695954322815, -0.5555702447891235, 1.0}, - {-0.9238795042037964, -0.3826834559440613, -1.0}, - {-0.9238795042037964, -0.3826834559440613, 1.0}, - {-0.9807852506637573, -0.19509032368659973, -1.0}, - {-0.9807852506637573, -0.19509032368659973, 1.0}, - {-1.0, 0.0, -1.0}, - {-1.0, 0.0, 1.0}, - {-0.9807852506637573, 0.19509032368659973, -1.0}, - {-0.9807852506637573, 0.19509032368659973, 1.0}, - {-0.9238795042037964, 0.3826834559440613, -1.0}, - {-0.9238795042037964, 0.3826834559440613, 1.0}, - {-0.8314695954322815, 0.5555702447891235, -1.0}, - {-0.8314695954322815, 0.5555702447891235, 1.0}, - {-0.7071067690849304, 0.7071067690849304, -1.0}, - {-0.7071067690849304, 0.7071067690849304, 1.0}, - {-0.5555702447891235, 0.8314695954322815, -1.0}, - {-0.5555702447891235, 0.8314695954322815, 1.0}, - {-0.3826834559440613, 0.9238795042037964, -1.0}, - {-0.3826834559440613, 0.9238795042037964, 1.0}, - {-0.19509032368659973, 0.9807852506637573, -1.0}, - {-0.19509032368659973, 0.9807852506637573, 1.0}, - {0.8070226311683655, 0.0, 0.9663905501365662}, - {0.8070226311683655, 0.0, -0.9663905501365662}, - {0.8070226311683655, -12.08585262298584, 0.9663905501365662}, - {0.8070226311683655, -12.08585262298584, -0.9663905501365662}, - {-0.8070226311683655, 0.0, 0.9663905501365662}, - {-0.8070226311683655, 0.0, -0.9663905501365662}, - {-0.8070226311683655, -12.08585262298584, 0.9663905501365662}, - {-0.8070226311683655, -12.08585262298584, -0.9663905501365662}, + {0.0, 1.0, -1.0}, + {0.0, 1.0, 1.0}, + {0.19509032368659973, 0.9807852506637573, -1.0}, + {0.19509032368659973, 0.9807852506637573, 1.0}, + {0.3826834559440613, 0.9238795042037964, -1.0}, + {0.3826834559440613, 0.9238795042037964, 1.0}, + {0.5555702447891235, 0.8314695954322815, -1.0}, + {0.5555702447891235, 0.8314695954322815, 1.0}, + {0.7071067690849304, 0.7071067690849304, -1.0}, + {0.7071067690849304, 0.7071067690849304, 1.0}, + {0.8314695954322815, 0.5555702447891235, -1.0}, + {0.8314695954322815, 0.5555702447891235, 1.0}, + {0.9238795042037964, 0.3826834559440613, -1.0}, + {0.9238795042037964, 0.3826834559440613, 1.0}, + {0.9807852506637573, 0.19509032368659973, -1.0}, + {0.9807852506637573, 0.19509032368659973, 1.0}, + {1.0, 0.0, -1.0}, + {1.0, 0.0, 1.0}, + {0.9807852506637573, -0.19509032368659973, -1.0}, + {0.9807852506637573, -0.19509032368659973, 1.0}, + {0.9238795042037964, -0.3826834559440613, -1.0}, + {0.9238795042037964, -0.3826834559440613, 1.0}, + {0.8314695954322815, -0.5555702447891235, -1.0}, + {0.8314695954322815, -0.5555702447891235, 1.0}, + {0.7071067690849304, -0.7071067690849304, -1.0}, + {0.7071067690849304, -0.7071067690849304, 1.0}, + {0.5555702447891235, -0.8314695954322815, -1.0}, + {0.5555702447891235, -0.8314695954322815, 1.0}, + {0.3826834559440613, -0.9238795042037964, -1.0}, + {0.3826834559440613, -0.9238795042037964, 1.0}, + {0.19509032368659973, -0.9807852506637573, -1.0}, + {0.19509032368659973, -0.9807852506637573, 1.0}, + {0.0, -1.0, -1.0}, + {0.0, -1.0, 1.0}, + {-0.19509032368659973, -0.9807852506637573, -1.0}, + {-0.19509032368659973, -0.9807852506637573, 1.0}, + {-0.3826834559440613, -0.9238795042037964, -1.0}, + {-0.3826834559440613, -0.9238795042037964, 1.0}, + {-0.5555702447891235, -0.8314695954322815, -1.0}, + {-0.5555702447891235, -0.8314695954322815, 1.0}, + {-0.7071067690849304, -0.7071067690849304, -1.0}, + {-0.7071067690849304, -0.7071067690849304, 1.0}, + {-0.8314695954322815, -0.5555702447891235, -1.0}, + {-0.8314695954322815, -0.5555702447891235, 1.0}, + {-0.9238795042037964, -0.3826834559440613, -1.0}, + {-0.9238795042037964, -0.3826834559440613, 1.0}, + {-0.9807852506637573, -0.19509032368659973, -1.0}, + {-0.9807852506637573, -0.19509032368659973, 1.0}, + {-1.0, 0.0, -1.0}, + {-1.0, 0.0, 1.0}, + {-0.9807852506637573, 0.19509032368659973, -1.0}, + {-0.9807852506637573, 0.19509032368659973, 1.0}, + {-0.9238795042037964, 0.3826834559440613, -1.0}, + {-0.9238795042037964, 0.3826834559440613, 1.0}, + {-0.8314695954322815, 0.5555702447891235, -1.0}, + {-0.8314695954322815, 0.5555702447891235, 1.0}, + {-0.7071067690849304, 0.7071067690849304, -1.0}, + {-0.7071067690849304, 0.7071067690849304, 1.0}, + {-0.5555702447891235, 0.8314695954322815, -1.0}, + {-0.5555702447891235, 0.8314695954322815, 1.0}, + {-0.3826834559440613, 0.9238795042037964, -1.0}, + {-0.3826834559440613, 0.9238795042037964, 1.0}, + {-0.19509032368659973, 0.9807852506637573, -1.0}, + {-0.19509032368659973, 0.9807852506637573, 1.0}, + {0.8070226311683655, 0.0, 0.9663905501365662}, + {0.8070226311683655, 0.0, -0.9663905501365662}, + {0.8070226311683655, -12.08585262298584, 0.9663905501365662}, + {0.8070226311683655, -12.08585262298584, -0.9663905501365662}, + {-0.8070226311683655, 0.0, 0.9663905501365662}, + {-0.8070226311683655, 0.0, -0.9663905501365662}, + {-0.8070226311683655, -12.08585262298584, 0.9663905501365662}, + {-0.8070226311683655, -12.08585262298584, -0.9663905501365662}, }; -struct polygon { - int a, b, c, d; +const vec3 mesh_Cylinder_normal[] = { + {-1.3093614192882796e-08, 0.7278828620910645, -0.6857015490531921}, + {1.3876757520847605e-08, 0.7278828620910645, 0.6857014894485474}, + {0.1420028954744339, 0.713896632194519, -0.6857015490531921}, + {0.14200294017791748, 0.7138966917991638, 0.6857016086578369}, + {0.2785486578941345, 0.672476053237915, -0.6857016086578369}, + {0.2785486578941345, 0.672476053237915, 0.6857015490531921}, + {0.4043900668621063, 0.6052124500274658, -0.6857015490531921}, + {0.4043900668621063, 0.6052124500274658, 0.6857014894485474}, + {0.5146908760070801, 0.5146908760070801, -0.6857014894485474}, + {0.5146909356117249, 0.5146909356117249, 0.6857014894485474}, + {0.6052124500274658, 0.4043900668621063, -0.6857015490531921}, + {0.6052124500274658, 0.4043900668621063, 0.6857014894485474}, + {0.672476053237915, 0.2785486578941345, -0.6857016086578369}, + {0.672476053237915, 0.2785486578941345, 0.6857015490531921}, + {0.713896632194519, 0.1420029103755951, -0.6857015490531921}, + {0.7138966917991638, 0.1420029252767563, 0.6857016086578369}, + {0.7278828620910645, 0.0, -0.6857015490531921}, + {0.7278828620910645, 0.0, 0.6857014894485474}, + {0.713896632194519, -0.1420029103755951, -0.6857015490531921}, + {0.7138966917991638, -0.1420029252767563, 0.6857016086578369}, + {0.672476053237915, -0.2785486578941345, -0.6857016086578369}, + {0.672476053237915, -0.2785486578941345, 0.6857015490531921}, + {0.6052124500274658, -0.4043900668621063, -0.6857015490531921}, + {0.6052124500274658, -0.4043900668621063, 0.6857014894485474}, + {0.5146908760070801, -0.5146908760070801, -0.6857014894485474}, + {0.5146909356117249, -0.5146909356117249, 0.6857014894485474}, + {0.4043900668621063, -0.6052124500274658, -0.6857015490531921}, + {0.4043900668621063, -0.6052124500274658, 0.6857014894485474}, + {0.2785486578941345, -0.672476053237915, -0.6857016086578369}, + {0.2785486578941345, -0.672476053237915, 0.6857015490531921}, + {0.1420028954744339, -0.713896632194519, -0.6857015490531921}, + {0.14200294017791748, -0.7138966917991638, 0.6857016086578369}, + {-1.3093614192882796e-08, -0.7278828620910645, -0.6857015490531921}, + {1.3093613304704377e-08, -0.7278828620910645, 0.6857014894485474}, + {-0.1420029252767563, -0.713896632194519, -0.6857015490531921}, + {-0.1420029103755951, -0.7138966917991638, 0.6857016086578369}, + {-0.2785486578941345, -0.672476053237915, -0.6857016086578369}, + {-0.2785486578941345, -0.672476053237915, 0.6857015490531921}, + {-0.4043900668621063, -0.6052124500274658, -0.6857015490531921}, + {-0.4043900668621063, -0.6052124500274658, 0.6857014894485474}, + {-0.5146908760070801, -0.5146908760070801, -0.6857014894485474}, + {-0.5146909356117249, -0.5146909356117249, 0.6857014894485474}, + {-0.6052124500274658, -0.4043900668621063, -0.6857015490531921}, + {-0.6052124500274658, -0.4043900668621063, 0.6857014894485474}, + {-0.672476053237915, -0.2785486578941345, -0.6857016086578369}, + {-0.672476053237915, -0.2785486578941345, 0.6857015490531921}, + {-0.713896632194519, -0.1420029103755951, -0.6857015490531921}, + {-0.7138966917991638, -0.1420029252767563, 0.6857016086578369}, + {-0.7278828620910645, 0.0, -0.6857015490531921}, + {-0.7278828620910645, 0.0, 0.6857014894485474}, + {-0.713896632194519, 0.1420029103755951, -0.6857015490531921}, + {-0.7138966917991638, 0.1420029252767563, 0.6857016086578369}, + {-0.672476053237915, 0.2785486578941345, -0.6857016086578369}, + {-0.672476053237915, 0.2785486578941345, 0.6857015490531921}, + {-0.6052124500274658, 0.4043900668621063, -0.6857015490531921}, + {-0.6052124500274658, 0.4043900668621063, 0.6857014894485474}, + {-0.5146908760070801, 0.5146908760070801, -0.6857014894485474}, + {-0.5146909356117249, 0.5146909356117249, 0.6857014894485474}, + {-0.4043900668621063, 0.6052124500274658, -0.6857015490531921}, + {-0.4043900668621063, 0.6052124500274658, 0.6857014894485474}, + {-0.2785486578941345, 0.672476053237915, -0.6857016086578369}, + {-0.27854862809181213, 0.672476053237915, 0.6857015490531921}, + {-0.1420029252767563, 0.713896632194519, -0.6857015490531921}, + {-0.1420028954744339, 0.7138966917991638, 0.6857016086578369}, + {-0.5773502588272095, -0.5773502588272095, -0.5773502588272095}, + {-0.5773502588272095, -0.5773502588272095, 0.5773502588272095}, + {-0.5773502588272095, 0.5773502588272095, -0.5773502588272095}, + {-0.5773502588272095, 0.5773502588272095, 0.5773502588272095}, + {0.5773502588272095, -0.5773502588272095, -0.5773502588272095}, + {0.5773502588272095, -0.5773502588272095, 0.5773502588272095}, + {0.5773502588272095, 0.5773502588272095, -0.5773502588272095}, + {0.5773502588272095, 0.5773502588272095, 0.5773502588272095}, }; const polygon mesh_Cylinder_polygons[] = { - {0, 1, 3, 2}, - {2, 3, 5, 4}, - {4, 5, 7, 6}, - {6, 7, 9, 8}, - {8, 9, 11, 10}, - {10, 11, 13, 12}, - {12, 13, 15, 14}, - {14, 15, 17, 16}, - {16, 17, 19, 18}, - {18, 19, 21, 20}, - {20, 21, 23, 22}, - {22, 23, 25, 24}, - {24, 25, 27, 26}, - {26, 27, 29, 28}, - {28, 29, 31, 30}, - {30, 31, 33, 32}, - {32, 33, 35, 34}, - {34, 35, 37, 36}, - {36, 37, 39, 38}, - {38, 39, 41, 40}, - {40, 41, 43, 42}, - {42, 43, 45, 44}, - {44, 45, 47, 46}, - {46, 47, 49, 48}, - {48, 49, 51, 50}, - {50, 51, 53, 52}, - {52, 53, 55, 54}, - {54, 55, 57, 56}, - {56, 57, 59, 58}, - {58, 59, 61, 60}, - //{3, 1, 63, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5}, - {60, 61, 63, 62}, - {62, 63, 1, 0}, - //{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62}, - {64, 65, 67, 66}, - {66, 67, 71, 70}, - {70, 71, 69, 68}, - {68, 69, 65, 64}, - {66, 70, 68, 64}, - {71, 67, 65, 69}, -}; - - - -struct mesh { - vec3 * position; - int position_length; - polygon * polygons; - int polygons_length; - // vec2 * uv_layers[]; // support for multiple UV maps - // int uv_layers_length; + {0, 1, 3, 2}, + {2, 3, 5, 4}, + {4, 5, 7, 6}, + {6, 7, 9, 8}, + {8, 9, 11, 10}, + {10, 11, 13, 12}, + {12, 13, 15, 14}, + {14, 15, 17, 16}, + {16, 17, 19, 18}, + {18, 19, 21, 20}, + {20, 21, 23, 22}, + {22, 23, 25, 24}, + {24, 25, 27, 26}, + {26, 27, 29, 28}, + {28, 29, 31, 30}, + {30, 31, 33, 32}, + {32, 33, 35, 34}, + {34, 35, 37, 36}, + {36, 37, 39, 38}, + {38, 39, 41, 40}, + {40, 41, 43, 42}, + {42, 43, 45, 44}, + {44, 45, 47, 46}, + {46, 47, 49, 48}, + {48, 49, 51, 50}, + {50, 51, 53, 52}, + {52, 53, 55, 54}, + {54, 55, 57, 56}, + {56, 57, 59, 58}, + {58, 59, 61, 60}, + // {3, 1, 63, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5}, + {60, 61, 63, 62}, + {62, 63, 1, 0}, + // {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62}, + {64, 65, 67, 66}, + {66, 67, 71, 70}, + {70, 71, 69, 68}, + {68, 69, 65, 64}, + {66, 70, 68, 64}, + {71, 67, 65, 69}, }; const mesh mesh_Cylinder = { - position = mesh_Cylinder_position, - position_length = (sizeof (mesh_Cylinder_position)) / (sizeof (mesh_Cylinder_position[0])), - polygons = mesh_Cylinder_polygons, - polygons_length = (sizeof (mesh_Cylinder_polygons)) / (sizeof (mesh_Cylinder_polygons[0])), + .position = mesh_Cylinder_position, + .position_length = (sizeof (mesh_Cylinder_position)) / (sizeof (mesh_Cylinder_position[0])), + .normal = mesh_Cylinder_normal, + .normal_length = (sizeof (mesh_Cylinder_normal)) / (sizeof (mesh_Cylinder_normal[0])), + .polygons = mesh_Cylinder_polygons, + .polygons_length = (sizeof (mesh_Cylinder_polygons)) / (sizeof (mesh_Cylinder_polygons[0])), }; -struct object { - struct mesh * mesh; - vec4 rotation; - vec3 location; +const vec3 mesh_Plane_position[] = { + {-1.0, -1.0, 0.0}, + {1.0, -1.0, 0.0}, + {-1.0, 1.0, 0.0}, + {1.0, 1.0, 0.0}, }; -struct object objects[] = { - { // object Cylinder - .mesh = &mesh_Cylinder, - .rotation = {0.6241188049316406, 0.6737393736839294, -0.051736120134592056, -0.7371557950973511}; - .location = {0.0, 0.0, 0.0}; - }, - { // object Cylinder.001 - .mesh = &mesh_Cylinder - .rotation = {0.6241188049316406, 0.6737393736839294, -0.051736120134592056, -0.7371557950973511} - .location = {-1.21906316280365, -4.1197733879089355, 1.3510278463363647} - } +const vec3 mesh_Plane_normal[] = { + {0.0, 0.0, 1.0}, + {0.0, 0.0, 1.0}, + {0.0, 0.0, 1.0}, + {0.0, 0.0, 1.0}, }; + +const polygon mesh_Plane_polygons[] = { + {0, 1, 3, 2}, +}; + +const mesh mesh_Plane = { + .position = mesh_Plane_position, + .position_length = (sizeof (mesh_Plane_position)) / (sizeof (mesh_Plane_position[0])), + .normal = mesh_Plane_normal, + .normal_length = (sizeof (mesh_Plane_normal)) / (sizeof (mesh_Plane_normal[0])), + .polygons = mesh_Plane_polygons, + .polygons_length = (sizeof (mesh_Plane_polygons)) / (sizeof (mesh_Plane_polygons[0])), +}; + +const struct object objects[] = { +{ // object_Cylinder + .mesh = &mesh_Cylinder, + .transforms = { + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {-0.17411774396896362, 1.2829737663269043, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, -0.7095549702644348, 0.7046501636505127}, + .location = {-0.17411774396896362, 1.2829737663269043, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, -0.9900816679000854, 0.14049309492111206}, + .location = {-0.17411774396896362, 1.2829737663269043, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, -0.9900816679000854, 0.14049309492111206}, + .location = {-1.2004966735839844, 1.4295992851257324, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, -0.7707193493843079, -0.6371749043464661}, + .location = {-0.17411774396896362, 1.2829737663269043, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, 0.0, -0.9998301267623901}, + .location = {-0.17411774396896362, 1.2829737663269043, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, 0.0, -0.9998301267623901}, + .location = {-0.17411774396896362, 1.4570916891098022, 1.0172151327133179}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.674102246761322, 9.05716035504156e-08, -0.7384079694747925}, + .location = {-0.17411774396896362, 1.4570916891098022, 1.0172151327133179}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {7.105427357601002e-15, 0.07341092824935913, 9.863413197308546e-09, -0.9971314072608948}, + .location = {-0.17411774396896362, 1.4570916891098022, 1.0172151327133179}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {8.881784197001252e-15, -0.7132257223129272, -9.582819160414147e-08, -0.7006920576095581}, + .location = {-0.17411774396896362, 1.4570916891098022, 1.0172151327133179}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {-0.41403844952583313, -0.5753914713859558, -0.4214446544647217, -0.5652800798416138}, + .location = {-0.17411774396896362, 1.4570916891098022, 1.0172151327133179}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.17411774396896362, 1.4570916891098022, 1.0172151327133179}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.22385987639427185, 1.4322822093963623, 0.08445566892623901}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.2736019790172577, 1.4074726104736328, -0.8483037948608398}, + }, + { + .scale = {-0.3669049143791199, -0.3669043779373169, -2.294285774230957}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.2736019790172577, 1.4074726104736328, -0.8483037948608398}, + }, + { + .scale = {-0.328095018863678, -0.3280945420265198, -2.0516042709350586}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.2736019790172577, 1.4074726104736328, -0.8483037948608398}, + }, + { + .scale = {-0.24995586276054382, -0.24995550513267517, -1.5629940032958984}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.2736020088195801, 1.4074726104736328, -0.8483036756515503}, + }, + { + .scale = {-0.18125203251838684, -0.18125177919864655, -1.1333833932876587}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.6257487535476685, -0.12201344966888428, -0.7337116003036499}, + }, + { + .scale = {-0.1360633820295334, -0.13606318831443787, -0.8508152365684509}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.9778954982757568, -1.6514995098114014, -0.6191197037696838}, + }, + { + .scale = {-0.11979856342077255, -0.11979840695858002, -0.7491101026535034}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.2736020088195801, 1.4074726104736328, -0.8483036756515503}, + }, + { + .scale = {-0.11979856342077255, -0.11979840695858002, -0.7491101026535034}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.6785774230957031, 1.470827341079712, -0.3385288119316101}, + }, + { + .scale = {-0.11979856342077255, -0.11979840695858002, -0.7491101026535034}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-1.0835528373718262, 1.534182071685791, 0.17124605178833008}, + }, + { + .scale = {-0.11979856342077255, -0.11979840695858002, -0.7491101026535034}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.4907200336456299, 3.0393598079681396, -0.2160150706768036}, + }, + { + .scale = {-0.11979856342077255, -0.11979840695858002, -0.7491101026535034}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {0.1021127700805664, 4.810014724731445, -0.6032761931419373}, + }, + { + .scale = {-0.06404907256364822, -0.06404897570610046, -0.4005039632320404}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.6499484181404114, 5.05035400390625, 0.36885154247283936}, + }, + { + .scale = {-0.06404907256364822, -0.06404897570610046, -0.4005039632320404}, + .rotation = {0.10327523946762085, -0.7013112306594849, -0.6960657835006714, -0.11247029900550842}, + .location = {-0.7891490459442139, 1.8649418354034424, -0.12118154764175415}, + }, +} +}, +{ // object_Cylinder_001 + .mesh = &mesh_Cylinder, + .transforms = { + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {-1.163840413093567, -3.6748032569885254, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {-0.42154842615127563, -3.610654592514038, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, 0.1964225471019745, 0.9805193543434143}, + .location = {-1.163840413093567, -3.6748032569885254, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, 0.7082359790802002, 0.7059757113456726}, + .location = {-1.163840413093567, -3.6748032569885254, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, 0.15257558226585388, 0.9882917404174805}, + .location = {-1.163840413093567, -3.6748032569885254, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {-1.163840413093567, -3.6748032569885254, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.3590230941772461, -0.2107132524251938, 0.4602247476577759, 0.7841527462005615}, + .location = {-1.163840413093567, -3.6748032569885254, 0.0}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.581929087638855, 0.4367288649082184, 0.045419543981552124, 0.684516966342926}, + .location = {1.0447076559066772, -3.6748032569885254, -0.13746146857738495}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.581929087638855, 0.4367288649082184, 0.045419543981552124, 0.684516966342926}, + .location = {0.6873077750205994, -3.6748030185699463, -1.2096610069274902}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.581929087638855, 0.4367288649082184, 0.045419543981552124, 0.684516966342926}, + .location = {1.3654509782791138, -2.538454532623291, -1.2096611261367798}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.581929087638855, 0.4367288649082184, 0.045419543981552124, 0.684516966342926}, + .location = {2.0435943603515625, -1.4021062850952148, -1.2096611261367798}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {0.581929087638855, 0.4367288649082184, 0.045419543981552124, 0.684516966342926}, + .location = {0.6231590509414673, -3.793936252593994, -1.2096611261367798}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {-0.006399685516953468, 0.516791820526123, -0.3504992723464966, 0.7810477018356323}, + .location = {0.6231590509414673, -3.793936252593994, -1.2096611261367798}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {-0.006399685516953468, 0.516791820526123, -0.3504992723464966, 0.7810477018356323}, + .location = {0.973638117313385, -2.921048641204834, -0.00512462854385376}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {-0.006399685516953468, 0.516791820526123, -0.3504992723464966, 0.7810477018356323}, + .location = {1.3241169452667236, -2.0481619834899902, 1.1994110345840454}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {-0.2789987325668335, 0.43477651476860046, -0.4540197253227234, 0.6456944942474365}, + .location = {1.3241169452667236, -2.0481619834899902, 1.1994110345840454}, + }, + { + .scale = {-0.1654829978942871, -0.16548274457454681, -1.034778356552124}, + .rotation = {-0.5515977740287781, 0.35276123881340027, -0.557540237903595, 0.5103414058685303}, + .location = {1.3241169452667236, -2.0481619834899902, 1.1994110345840454}, + }, + { + .scale = {-0.09310457110404968, -0.09310442954301834, -0.5821903347969055}, + .rotation = {-0.5515977740287781, 0.35276123881340027, -0.557540237903595, 0.5103414058685303}, + .location = {1.3241169452667236, -2.0481619834899902, 1.1994110345840454}, + }, + { + .scale = {-0.09310457110404968, -0.09310442954301834, -0.5821903347969055}, + .rotation = {-0.5702332854270935, 0.24765875935554504, -0.7618234157562256, -0.18200069665908813}, + .location = {1.3241169452667236, -2.0481619834899902, 1.1994110345840454}, + }, + { + .scale = {-0.09310457110404968, -0.09310442954301834, -0.5821903347969055}, + .rotation = {-0.41060131788253784, 0.07548045367002487, -0.6442144513130188, -0.7095368504524231}, + .location = {1.5200085639953613, -2.5571110248565674, 0.8536138534545898}, + }, + { + .scale = {-0.09310457110404968, -0.09310442954301834, -0.5821903347969055}, + .rotation = {-0.2509693205356598, -0.011723816394805908, -0.5266055464744568, -0.8121352791786194}, + .location = {1.8838070631027222, -3.502302408218384, 0.21141916513442993}, + }, + { + .scale = {-0.09310457110404968, -0.09310442954301834, -0.5821903347969055}, + .rotation = {-0.5702332854270935, 0.24765875935554504, -0.7618234157562256, -0.18200069665908813}, + .location = {2.0796985626220703, -4.011251926422119, -0.13437795639038086}, + }, + { + .scale = {-0.09310457110404968, -0.09310442954301834, -0.5821903347969055}, + .rotation = {-0.37255892157554626, 0.09426629543304443, -0.6047671437263489, -0.5284574031829834}, + .location = {1.6047816276550293, -3.6961779594421387, 0.5133815407752991}, + }, + { + .scale = {-0.09310457110404968, -0.09310442954301834, -0.5821903347969055}, + .rotation = {-0.17488455772399902, -0.05912616848945618, -0.4477108418941498, -0.8749140501022339}, + .location = {1.1298646926879883, -3.381103992462158, 1.161141037940979}, + }, + { + .scale = {-0.26138949394226074, -0.2613891065120697, -1.6344894170761108}, + .rotation = {-0.17488455772399902, -0.05912616848945618, -0.4477108418941498, -0.8749140501022339}, + .location = {1.1298646926879883, -3.381103992462158, 1.161141037940979}, + }, + { + .scale = {-0.26138949394226074, -0.2613891065120697, -1.6344894170761108}, + .rotation = {0.12136265635490417, -0.21794843673706055, -0.09972268342971802, -0.9632368087768555}, + .location = {1.1298646926879883, -3.381103992462158, 1.161141037940979}, + }, +} +}, +{ // object_Plane + .mesh = &mesh_Plane, + .transforms = { + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, + { + .scale = {2.206200361251831, 6.7966437339782715, 6.7966437339782715}, + .rotation = {0.0, 0.0, 0.0, 1.0}, + .location = {0.0, 0.0, 0.0}, + }, +} +}, +}; + diff --git a/printf/compat.h b/printf/compat.h index 93e0a2f..6f70f09 100644 --- a/printf/compat.h +++ b/printf/compat.h @@ -1,25 +1 @@ #pragma once - -#ifndef offsetof -#define offsetof(type, member) __builtin_offsetof (type, member) -#endif - -#ifndef bool -#define bool int -#endif - -#ifndef false -#define false 0 -#endif - -#ifndef true -#define true 1 -#endif - -#ifndef static_assert -#define static_assert(s) _Static_assert(s, ""); -#endif - -#ifndef nullptr -#define nullptr ((void *)0) -#endif