From f2e4618431141443d60bc1bd93e3edd30465ffd0 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Fri, 9 May 2025 13:52:41 -0500 Subject: [PATCH] model: add grid --- blender.py | 20 +- example/lighting.cpp | 33 +- math/transform.hpp | 28 ++ model/blender_export.h | 21 ++ model/grid.h | 786 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 852 insertions(+), 36 deletions(-) create mode 100644 model/blender_export.h create mode 100644 model/grid.h diff --git a/blender.py b/blender.py index cbaf19e..9086c63 100644 --- a/blender.py +++ b/blender.py @@ -1,10 +1,10 @@ import bpy def render_vec3(v): - return f"{{{v.x}, {v.y}, {v.z}}}" + return f"{{{v.x:.6f}, {v.y:.6f}, {v.z:.6f}}}" def render_vec2(v): - return f"{{{v.x}, {v.y}}}" + return f"{{{v.x:.6f}, {v.y:.6f}}}" def render_mesh_vertices(f, name, vertices): f.write(f"const vec3 {name}_position[] = {{\n") @@ -50,8 +50,12 @@ def render_scale(f, scale): f.write(f" .scale = {s},\n") def render_rotation_axis_angle(f, r): - r = f"{{{r[0]}, {r[1]}, {r[2]}, {r[3]}}}" - f.write(f" .rotation = {r},\n") + r = f"{{{r[1]:.6f}, {r[2]:.6f}, {r[3]:.6f}, {r[0]:.6f}}}" + f.write(f" .rotation = {r}, // rotation_axis_angle (XYZ T)\n") + +def render_rotation_quaternion(f, r): + r = f"{{{r[1]:.6f}, {r[2]:.6f}, {r[3]:.6f}, {r[0]:.6f}}}" + f.write(f" .rotation = {r}, // quaternion (XYZW)\n") def render_mesh(f, name, mesh): f.write(f"const vec2 * {name}_uv_layers[] = {{\n") @@ -130,12 +134,16 @@ def export_scene(f): f.write(" ") render_scale(f, object.scale) f.write(" ") - render_rotation_axis_angle(f, object.rotation_axis_angle) + old_mode = object.rotation_mode + object.rotation_mode = 'QUATERNION' + #render_rotation_axis_angle(f, object.rotation_axis_angle) + render_rotation_quaternion(f, object.rotation_quaternion) + object.rotation_mode = old_mode f.write(" ") render_location(f, object.location) f.write(" },\n") f.write("};\n\n") -with open("output.h", "w") as f: +with open("/home/bilbo/output.h", "w") as f: export_scene(f) diff --git a/example/lighting.cpp b/example/lighting.cpp index ee3e73a..83cebd4 100644 --- a/example/lighting.cpp +++ b/example/lighting.cpp @@ -52,39 +52,12 @@ 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))) +#include "model/blender_export.h" +#include "model/grid.h" static ft0::data_transfer::data_format data[4]; -+uint8_t send_buf[1024] __attribute__((aligned(32))); +uint8_t send_buf[1024] __attribute__((aligned(32))); uint8_t recv_buf[1024] __attribute__((aligned(32))); void do_get_condition() diff --git a/math/transform.hpp b/math/transform.hpp index ed56b42..c32bb86 100644 --- a/math/transform.hpp +++ b/math/transform.hpp @@ -77,6 +77,34 @@ inline constexpr mat<4, 4, T> rotate_axis_angle(vec<3, T> u, T t) }; } +template +inline constexpr mat<4, 4, T> rotate_axis_angle(vec<4, T> u) +{ + return rotate_axis_angle({u.x, u.y, u.z}, u.w); +} + +template +inline constexpr mat<4, 4, T> rotate_quaternion(vec<4, T> v) +{ + T xx2 = 2 * r.x * r.x; + T xy2 = 2 * r.x * r.y; + T xz2 = 2 * r.x * r.z; + T xw2 = 2 * r.x * r.w; + T yy2 = 2 * r.y * r.y; + T yz2 = 2 * r.y * r.z; + T yw2 = 2 * r.y * r.w; + T zz2 = 2 * r.z * r.z; + T zw2 = 2 * r.z * r.w; + + return { + 1 - yy2 - zz2, xy2 - zw2, xz2 + yw2, 0, + xy2 + zw2, 1 - xx2 - zz2, yz2 - xw2, 0, + xz2 - yw2, yz2 + xw2, 1 - xx2 - yy2, 0, + 0, 0, 0, 1, + }; +} + + template inline constexpr vec<3, T> normal_multiply(mat<4, 4, T> m, vec<3, T> n) { diff --git a/model/blender_export.h b/model/blender_export.h new file mode 100644 index 0000000..89a4a63 --- /dev/null +++ b/model/blender_export.h @@ -0,0 +1,21 @@ +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; + const vec2 ** uv_layers; + const int uv_layers_length; +}; + +struct object { + const struct mesh * mesh; + const vec3 scale; + const vec4 rotation; + const vec3 location; +}; diff --git a/model/grid.h b/model/grid.h new file mode 100644 index 0000000..a8fd8eb --- /dev/null +++ b/model/grid.h @@ -0,0 +1,786 @@ +const vec3 mesh_Grid_position[] = { + {-1.000000, -1.000000, 0.000000}, + {-0.800000, -1.000000, 0.000000}, + {-0.600000, -1.000000, 0.000000}, + {-0.400000, -1.000000, 0.000000}, + {-0.200000, -1.000000, 0.000000}, + {0.000000, -1.000000, 0.000000}, + {0.200000, -1.000000, 0.000000}, + {0.400000, -1.000000, 0.000000}, + {0.600000, -1.000000, 0.000000}, + {0.800000, -1.000000, 0.000000}, + {1.000000, -1.000000, 0.000000}, + {-1.000000, -0.800000, 0.000000}, + {-0.800000, -0.800000, 0.000000}, + {-0.600000, -0.800000, 0.000000}, + {-0.400000, -0.800000, 0.000000}, + {-0.200000, -0.800000, 0.000000}, + {0.000000, -0.800000, 0.000000}, + {0.200000, -0.800000, 0.000000}, + {0.400000, -0.800000, 0.000000}, + {0.600000, -0.800000, 0.000000}, + {0.800000, -0.800000, 0.000000}, + {1.000000, -0.800000, 0.000000}, + {-1.000000, -0.600000, 0.000000}, + {-0.800000, -0.600000, 0.000000}, + {-0.600000, -0.600000, 0.000000}, + {-0.400000, -0.600000, 0.000000}, + {-0.200000, -0.600000, 0.000000}, + {0.000000, -0.600000, 0.000000}, + {0.200000, -0.600000, 0.000000}, + {0.400000, -0.600000, 0.000000}, + {0.600000, -0.600000, 0.000000}, + {0.800000, -0.600000, 0.000000}, + {1.000000, -0.600000, 0.000000}, + {-1.000000, -0.400000, 0.000000}, + {-0.800000, -0.400000, 0.000000}, + {-0.600000, -0.400000, 0.000000}, + {-0.400000, -0.400000, 0.000000}, + {-0.200000, -0.400000, 0.000000}, + {0.000000, -0.400000, 0.000000}, + {0.200000, -0.400000, 0.000000}, + {0.400000, -0.400000, 0.000000}, + {0.600000, -0.400000, 0.000000}, + {0.800000, -0.400000, 0.000000}, + {1.000000, -0.400000, 0.000000}, + {-1.000000, -0.200000, 0.000000}, + {-0.800000, -0.200000, 0.000000}, + {-0.600000, -0.200000, 0.000000}, + {-0.400000, -0.200000, 0.000000}, + {-0.200000, -0.200000, 0.000000}, + {0.000000, -0.200000, 0.000000}, + {0.200000, -0.200000, 0.000000}, + {0.400000, -0.200000, 0.000000}, + {0.600000, -0.200000, 0.000000}, + {0.800000, -0.200000, 0.000000}, + {1.000000, -0.200000, 0.000000}, + {-1.000000, 0.000000, 0.000000}, + {-0.800000, 0.000000, 0.000000}, + {-0.600000, 0.000000, 0.000000}, + {-0.400000, 0.000000, 0.000000}, + {-0.200000, 0.000000, 0.000000}, + {0.000000, 0.000000, 0.000000}, + {0.200000, 0.000000, 0.000000}, + {0.400000, 0.000000, 0.000000}, + {0.600000, 0.000000, 0.000000}, + {0.800000, 0.000000, 0.000000}, + {1.000000, 0.000000, 0.000000}, + {-1.000000, 0.200000, 0.000000}, + {-0.800000, 0.200000, 0.000000}, + {-0.600000, 0.200000, 0.000000}, + {-0.400000, 0.200000, 0.000000}, + {-0.200000, 0.200000, 0.000000}, + {0.000000, 0.200000, 0.000000}, + {0.200000, 0.200000, 0.000000}, + {0.400000, 0.200000, 0.000000}, + {0.600000, 0.200000, 0.000000}, + {0.800000, 0.200000, 0.000000}, + {1.000000, 0.200000, 0.000000}, + {-1.000000, 0.400000, 0.000000}, + {-0.800000, 0.400000, 0.000000}, + {-0.600000, 0.400000, 0.000000}, + {-0.400000, 0.400000, 0.000000}, + {-0.200000, 0.400000, 0.000000}, + {0.000000, 0.400000, 0.000000}, + {0.200000, 0.400000, 0.000000}, + {0.400000, 0.400000, 0.000000}, + {0.600000, 0.400000, 0.000000}, + {0.800000, 0.400000, 0.000000}, + {1.000000, 0.400000, 0.000000}, + {-1.000000, 0.600000, 0.000000}, + {-0.800000, 0.600000, 0.000000}, + {-0.600000, 0.600000, 0.000000}, + {-0.400000, 0.600000, 0.000000}, + {-0.200000, 0.600000, 0.000000}, + {0.000000, 0.600000, 0.000000}, + {0.200000, 0.600000, 0.000000}, + {0.400000, 0.600000, 0.000000}, + {0.600000, 0.600000, 0.000000}, + {0.800000, 0.600000, 0.000000}, + {1.000000, 0.600000, 0.000000}, + {-1.000000, 0.800000, 0.000000}, + {-0.800000, 0.800000, 0.000000}, + {-0.600000, 0.800000, 0.000000}, + {-0.400000, 0.800000, 0.000000}, + {-0.200000, 0.800000, 0.000000}, + {0.000000, 0.800000, 0.000000}, + {0.200000, 0.800000, 0.000000}, + {0.400000, 0.800000, 0.000000}, + {0.600000, 0.800000, 0.000000}, + {0.800000, 0.800000, 0.000000}, + {1.000000, 0.800000, 0.000000}, + {-1.000000, 1.000000, 0.000000}, + {-0.800000, 1.000000, 0.000000}, + {-0.600000, 1.000000, 0.000000}, + {-0.400000, 1.000000, 0.000000}, + {-0.200000, 1.000000, 0.000000}, + {0.000000, 1.000000, 0.000000}, + {0.200000, 1.000000, 0.000000}, + {0.400000, 1.000000, 0.000000}, + {0.600000, 1.000000, 0.000000}, + {0.800000, 1.000000, 0.000000}, + {1.000000, 1.000000, 0.000000}, +}; + +const vec2 mesh_Grid_UVMap_uvmap[] = { + {0.000000, 0.000000}, + {0.100000, 0.000000}, + {0.100000, 0.100000}, + {0.000000, 0.100000}, + {0.100000, 0.000000}, + {0.200000, 0.000000}, + {0.200000, 0.100000}, + {0.100000, 0.100000}, + {0.200000, 0.000000}, + {0.300000, 0.000000}, + {0.300000, 0.100000}, + {0.200000, 0.100000}, + {0.300000, 0.000000}, + {0.400000, 0.000000}, + {0.400000, 0.100000}, + {0.300000, 0.100000}, + {0.400000, 0.000000}, + {0.500000, 0.000000}, + {0.500000, 0.100000}, + {0.400000, 0.100000}, + {0.500000, 0.000000}, + {0.600000, 0.000000}, + {0.600000, 0.100000}, + {0.500000, 0.100000}, + {0.600000, 0.000000}, + {0.700000, 0.000000}, + {0.700000, 0.100000}, + {0.600000, 0.100000}, + {0.700000, 0.000000}, + {0.800000, 0.000000}, + {0.800000, 0.100000}, + {0.700000, 0.100000}, + {0.800000, 0.000000}, + {0.900000, 0.000000}, + {0.900000, 0.100000}, + {0.800000, 0.100000}, + {0.900000, 0.000000}, + {1.000000, 0.000000}, + {1.000000, 0.100000}, + {0.900000, 0.100000}, + {0.000000, 0.100000}, + {0.100000, 0.100000}, + {0.100000, 0.200000}, + {0.000000, 0.200000}, + {0.100000, 0.100000}, + {0.200000, 0.100000}, + {0.200000, 0.200000}, + {0.100000, 0.200000}, + {0.200000, 0.100000}, + {0.300000, 0.100000}, + {0.300000, 0.200000}, + {0.200000, 0.200000}, + {0.300000, 0.100000}, + {0.400000, 0.100000}, + {0.400000, 0.200000}, + {0.300000, 0.200000}, + {0.400000, 0.100000}, + {0.500000, 0.100000}, + {0.500000, 0.200000}, + {0.400000, 0.200000}, + {0.500000, 0.100000}, + {0.600000, 0.100000}, + {0.600000, 0.200000}, + {0.500000, 0.200000}, + {0.600000, 0.100000}, + {0.700000, 0.100000}, + {0.700000, 0.200000}, + {0.600000, 0.200000}, + {0.700000, 0.100000}, + {0.800000, 0.100000}, + {0.800000, 0.200000}, + {0.700000, 0.200000}, + {0.800000, 0.100000}, + {0.900000, 0.100000}, + {0.900000, 0.200000}, + {0.800000, 0.200000}, + {0.900000, 0.100000}, + {1.000000, 0.100000}, + {1.000000, 0.200000}, + {0.900000, 0.200000}, + {0.000000, 0.200000}, + {0.100000, 0.200000}, + {0.100000, 0.300000}, + {0.000000, 0.300000}, + {0.100000, 0.200000}, + {0.200000, 0.200000}, + {0.200000, 0.300000}, + {0.100000, 0.300000}, + {0.200000, 0.200000}, + {0.300000, 0.200000}, + {0.300000, 0.300000}, + {0.200000, 0.300000}, + {0.300000, 0.200000}, + {0.400000, 0.200000}, + {0.400000, 0.300000}, + {0.300000, 0.300000}, + {0.400000, 0.200000}, + {0.500000, 0.200000}, + {0.500000, 0.300000}, + {0.400000, 0.300000}, + {0.500000, 0.200000}, + {0.600000, 0.200000}, + {0.600000, 0.300000}, + {0.500000, 0.300000}, + {0.600000, 0.200000}, + {0.700000, 0.200000}, + {0.700000, 0.300000}, + {0.600000, 0.300000}, + {0.700000, 0.200000}, + {0.800000, 0.200000}, + {0.800000, 0.300000}, + {0.700000, 0.300000}, + {0.800000, 0.200000}, + {0.900000, 0.200000}, + {0.900000, 0.300000}, + {0.800000, 0.300000}, + {0.900000, 0.200000}, + {1.000000, 0.200000}, + {1.000000, 0.300000}, + {0.900000, 0.300000}, + {0.000000, 0.300000}, + {0.100000, 0.300000}, + {0.100000, 0.400000}, + {0.000000, 0.400000}, + {0.100000, 0.300000}, + {0.200000, 0.300000}, + {0.200000, 0.400000}, + {0.100000, 0.400000}, + {0.200000, 0.300000}, + {0.300000, 0.300000}, + {0.300000, 0.400000}, + {0.200000, 0.400000}, + {0.300000, 0.300000}, + {0.400000, 0.300000}, + {0.400000, 0.400000}, + {0.300000, 0.400000}, + {0.400000, 0.300000}, + {0.500000, 0.300000}, + {0.500000, 0.400000}, + {0.400000, 0.400000}, + {0.500000, 0.300000}, + {0.600000, 0.300000}, + {0.600000, 0.400000}, + {0.500000, 0.400000}, + {0.600000, 0.300000}, + {0.700000, 0.300000}, + {0.700000, 0.400000}, + {0.600000, 0.400000}, + {0.700000, 0.300000}, + {0.800000, 0.300000}, + {0.800000, 0.400000}, + {0.700000, 0.400000}, + {0.800000, 0.300000}, + {0.900000, 0.300000}, + {0.900000, 0.400000}, + {0.800000, 0.400000}, + {0.900000, 0.300000}, + {1.000000, 0.300000}, + {1.000000, 0.400000}, + {0.900000, 0.400000}, + {0.000000, 0.400000}, + {0.100000, 0.400000}, + {0.100000, 0.500000}, + {0.000000, 0.500000}, + {0.100000, 0.400000}, + {0.200000, 0.400000}, + {0.200000, 0.500000}, + {0.100000, 0.500000}, + {0.200000, 0.400000}, + {0.300000, 0.400000}, + {0.300000, 0.500000}, + {0.200000, 0.500000}, + {0.300000, 0.400000}, + {0.400000, 0.400000}, + {0.400000, 0.500000}, + {0.300000, 0.500000}, + {0.400000, 0.400000}, + {0.500000, 0.400000}, + {0.500000, 0.500000}, + {0.400000, 0.500000}, + {0.500000, 0.400000}, + {0.600000, 0.400000}, + {0.600000, 0.500000}, + {0.500000, 0.500000}, + {0.600000, 0.400000}, + {0.700000, 0.400000}, + {0.700000, 0.500000}, + {0.600000, 0.500000}, + {0.700000, 0.400000}, + {0.800000, 0.400000}, + {0.800000, 0.500000}, + {0.700000, 0.500000}, + {0.800000, 0.400000}, + {0.900000, 0.400000}, + {0.900000, 0.500000}, + {0.800000, 0.500000}, + {0.900000, 0.400000}, + {1.000000, 0.400000}, + {1.000000, 0.500000}, + {0.900000, 0.500000}, + {0.000000, 0.500000}, + {0.100000, 0.500000}, + {0.100000, 0.600000}, + {0.000000, 0.600000}, + {0.100000, 0.500000}, + {0.200000, 0.500000}, + {0.200000, 0.600000}, + {0.100000, 0.600000}, + {0.200000, 0.500000}, + {0.300000, 0.500000}, + {0.300000, 0.600000}, + {0.200000, 0.600000}, + {0.300000, 0.500000}, + {0.400000, 0.500000}, + {0.400000, 0.600000}, + {0.300000, 0.600000}, + {0.400000, 0.500000}, + {0.500000, 0.500000}, + {0.500000, 0.600000}, + {0.400000, 0.600000}, + {0.500000, 0.500000}, + {0.600000, 0.500000}, + {0.600000, 0.600000}, + {0.500000, 0.600000}, + {0.600000, 0.500000}, + {0.700000, 0.500000}, + {0.700000, 0.600000}, + {0.600000, 0.600000}, + {0.700000, 0.500000}, + {0.800000, 0.500000}, + {0.800000, 0.600000}, + {0.700000, 0.600000}, + {0.800000, 0.500000}, + {0.900000, 0.500000}, + {0.900000, 0.600000}, + {0.800000, 0.600000}, + {0.900000, 0.500000}, + {1.000000, 0.500000}, + {1.000000, 0.600000}, + {0.900000, 0.600000}, + {0.000000, 0.600000}, + {0.100000, 0.600000}, + {0.100000, 0.700000}, + {0.000000, 0.700000}, + {0.100000, 0.600000}, + {0.200000, 0.600000}, + {0.200000, 0.700000}, + {0.100000, 0.700000}, + {0.200000, 0.600000}, + {0.300000, 0.600000}, + {0.300000, 0.700000}, + {0.200000, 0.700000}, + {0.300000, 0.600000}, + {0.400000, 0.600000}, + {0.400000, 0.700000}, + {0.300000, 0.700000}, + {0.400000, 0.600000}, + {0.500000, 0.600000}, + {0.500000, 0.700000}, + {0.400000, 0.700000}, + {0.500000, 0.600000}, + {0.600000, 0.600000}, + {0.600000, 0.700000}, + {0.500000, 0.700000}, + {0.600000, 0.600000}, + {0.700000, 0.600000}, + {0.700000, 0.700000}, + {0.600000, 0.700000}, + {0.700000, 0.600000}, + {0.800000, 0.600000}, + {0.800000, 0.700000}, + {0.700000, 0.700000}, + {0.800000, 0.600000}, + {0.900000, 0.600000}, + {0.900000, 0.700000}, + {0.800000, 0.700000}, + {0.900000, 0.600000}, + {1.000000, 0.600000}, + {1.000000, 0.700000}, + {0.900000, 0.700000}, + {0.000000, 0.700000}, + {0.100000, 0.700000}, + {0.100000, 0.800000}, + {0.000000, 0.800000}, + {0.100000, 0.700000}, + {0.200000, 0.700000}, + {0.200000, 0.800000}, + {0.100000, 0.800000}, + {0.200000, 0.700000}, + {0.300000, 0.700000}, + {0.300000, 0.800000}, + {0.200000, 0.800000}, + {0.300000, 0.700000}, + {0.400000, 0.700000}, + {0.400000, 0.800000}, + {0.300000, 0.800000}, + {0.400000, 0.700000}, + {0.500000, 0.700000}, + {0.500000, 0.800000}, + {0.400000, 0.800000}, + {0.500000, 0.700000}, + {0.600000, 0.700000}, + {0.600000, 0.800000}, + {0.500000, 0.800000}, + {0.600000, 0.700000}, + {0.700000, 0.700000}, + {0.700000, 0.800000}, + {0.600000, 0.800000}, + {0.700000, 0.700000}, + {0.800000, 0.700000}, + {0.800000, 0.800000}, + {0.700000, 0.800000}, + {0.800000, 0.700000}, + {0.900000, 0.700000}, + {0.900000, 0.800000}, + {0.800000, 0.800000}, + {0.900000, 0.700000}, + {1.000000, 0.700000}, + {1.000000, 0.800000}, + {0.900000, 0.800000}, + {0.000000, 0.800000}, + {0.100000, 0.800000}, + {0.100000, 0.900000}, + {0.000000, 0.900000}, + {0.100000, 0.800000}, + {0.200000, 0.800000}, + {0.200000, 0.900000}, + {0.100000, 0.900000}, + {0.200000, 0.800000}, + {0.300000, 0.800000}, + {0.300000, 0.900000}, + {0.200000, 0.900000}, + {0.300000, 0.800000}, + {0.400000, 0.800000}, + {0.400000, 0.900000}, + {0.300000, 0.900000}, + {0.400000, 0.800000}, + {0.500000, 0.800000}, + {0.500000, 0.900000}, + {0.400000, 0.900000}, + {0.500000, 0.800000}, + {0.600000, 0.800000}, + {0.600000, 0.900000}, + {0.500000, 0.900000}, + {0.600000, 0.800000}, + {0.700000, 0.800000}, + {0.700000, 0.900000}, + {0.600000, 0.900000}, + {0.700000, 0.800000}, + {0.800000, 0.800000}, + {0.800000, 0.900000}, + {0.700000, 0.900000}, + {0.800000, 0.800000}, + {0.900000, 0.800000}, + {0.900000, 0.900000}, + {0.800000, 0.900000}, + {0.900000, 0.800000}, + {1.000000, 0.800000}, + {1.000000, 0.900000}, + {0.900000, 0.900000}, + {0.000000, 0.900000}, + {0.100000, 0.900000}, + {0.100000, 1.000000}, + {0.000000, 1.000000}, + {0.100000, 0.900000}, + {0.200000, 0.900000}, + {0.200000, 1.000000}, + {0.100000, 1.000000}, + {0.200000, 0.900000}, + {0.300000, 0.900000}, + {0.300000, 1.000000}, + {0.200000, 1.000000}, + {0.300000, 0.900000}, + {0.400000, 0.900000}, + {0.400000, 1.000000}, + {0.300000, 1.000000}, + {0.400000, 0.900000}, + {0.500000, 0.900000}, + {0.500000, 1.000000}, + {0.400000, 1.000000}, + {0.500000, 0.900000}, + {0.600000, 0.900000}, + {0.600000, 1.000000}, + {0.500000, 1.000000}, + {0.600000, 0.900000}, + {0.700000, 0.900000}, + {0.700000, 1.000000}, + {0.600000, 1.000000}, + {0.700000, 0.900000}, + {0.800000, 0.900000}, + {0.800000, 1.000000}, + {0.700000, 1.000000}, + {0.800000, 0.900000}, + {0.900000, 0.900000}, + {0.900000, 1.000000}, + {0.800000, 1.000000}, + {0.900000, 0.900000}, + {1.000000, 0.900000}, + {1.000000, 1.000000}, + {0.900000, 1.000000}, +}; + +const vec3 mesh_Grid_polygon_normal[] = { + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, + {0.000000, 0.000000, 1.000000}, +}; + +const polygon mesh_Grid_polygons[] = { + {0, 1, 12, 11}, + {1, 2, 13, 12}, + {2, 3, 14, 13}, + {3, 4, 15, 14}, + {4, 5, 16, 15}, + {5, 6, 17, 16}, + {6, 7, 18, 17}, + {7, 8, 19, 18}, + {8, 9, 20, 19}, + {9, 10, 21, 20}, + {11, 12, 23, 22}, + {12, 13, 24, 23}, + {13, 14, 25, 24}, + {14, 15, 26, 25}, + {15, 16, 27, 26}, + {16, 17, 28, 27}, + {17, 18, 29, 28}, + {18, 19, 30, 29}, + {19, 20, 31, 30}, + {20, 21, 32, 31}, + {22, 23, 34, 33}, + {23, 24, 35, 34}, + {24, 25, 36, 35}, + {25, 26, 37, 36}, + {26, 27, 38, 37}, + {27, 28, 39, 38}, + {28, 29, 40, 39}, + {29, 30, 41, 40}, + {30, 31, 42, 41}, + {31, 32, 43, 42}, + {33, 34, 45, 44}, + {34, 35, 46, 45}, + {35, 36, 47, 46}, + {36, 37, 48, 47}, + {37, 38, 49, 48}, + {38, 39, 50, 49}, + {39, 40, 51, 50}, + {40, 41, 52, 51}, + {41, 42, 53, 52}, + {42, 43, 54, 53}, + {44, 45, 56, 55}, + {45, 46, 57, 56}, + {46, 47, 58, 57}, + {47, 48, 59, 58}, + {48, 49, 60, 59}, + {49, 50, 61, 60}, + {50, 51, 62, 61}, + {51, 52, 63, 62}, + {52, 53, 64, 63}, + {53, 54, 65, 64}, + {55, 56, 67, 66}, + {56, 57, 68, 67}, + {57, 58, 69, 68}, + {58, 59, 70, 69}, + {59, 60, 71, 70}, + {60, 61, 72, 71}, + {61, 62, 73, 72}, + {62, 63, 74, 73}, + {63, 64, 75, 74}, + {64, 65, 76, 75}, + {66, 67, 78, 77}, + {67, 68, 79, 78}, + {68, 69, 80, 79}, + {69, 70, 81, 80}, + {70, 71, 82, 81}, + {71, 72, 83, 82}, + {72, 73, 84, 83}, + {73, 74, 85, 84}, + {74, 75, 86, 85}, + {75, 76, 87, 86}, + {77, 78, 89, 88}, + {78, 79, 90, 89}, + {79, 80, 91, 90}, + {80, 81, 92, 91}, + {81, 82, 93, 92}, + {82, 83, 94, 93}, + {83, 84, 95, 94}, + {84, 85, 96, 95}, + {85, 86, 97, 96}, + {86, 87, 98, 97}, + {88, 89, 100, 99}, + {89, 90, 101, 100}, + {90, 91, 102, 101}, + {91, 92, 103, 102}, + {92, 93, 104, 103}, + {93, 94, 105, 104}, + {94, 95, 106, 105}, + {95, 96, 107, 106}, + {96, 97, 108, 107}, + {97, 98, 109, 108}, + {99, 100, 111, 110}, + {100, 101, 112, 111}, + {101, 102, 113, 112}, + {102, 103, 114, 113}, + {103, 104, 115, 114}, + {104, 105, 116, 115}, + {105, 106, 117, 116}, + {106, 107, 118, 117}, + {107, 108, 119, 118}, + {108, 109, 120, 119}, +}; + +const vec2 * mesh_Grid_uv_layers[] = { + mesh_Grid_UVMap_uvmap, +}; + +const mesh mesh_Grid = { + .position = mesh_Grid_position, + .position_length = (sizeof (mesh_Grid_position)) / (sizeof (mesh_Grid_position[0])), + .polygon_normal = mesh_Grid_polyon_normal, + .polygon_normal_length = (sizeof (mesh_Grid_polygon_normal)) / (sizeof (mesh_Grid_polygon_normal[0])), + .polygons = mesh_Grid_polygons, + .polygons_length = (sizeof (mesh_Grid_polygons)) / (sizeof (mesh_Grid_polygons[0])), + .uv_layers = mesh_Grid_uv_layers, + .uv_layers_length = (sizeof (mesh_Grid_uv_layers)) / (sizeof (mesh_Grid_uv_layers[0])), +}; + +const struct object objects[] = { + { // object_Grid + .mesh = &mesh_Grid, + .scale = {1.000000, 1.000000, 1.000000}, + .rotation = {0.000000, 0.000000, 0.000000, 1.000000}, // quaternion (XYZW) + .location = {0.000000, 0.000000, 1.000000}, + }, + { // object_Grid_001 + .mesh = &mesh_Grid, + .scale = {1.000000, 1.000000, 1.000000}, + .rotation = {-0.000000, 1.000000, -0.000000, -0.000000}, // quaternion (XYZW) + .location = {0.000000, 0.000000, -1.000000}, + }, + { // object_Grid_002 + .mesh = &mesh_Grid, + .scale = {1.000000, 1.000000, 1.000000}, + .rotation = {-0.000000, 0.707107, 0.000000, 0.707107}, // quaternion (XYZW) + .location = {1.000000, 0.000000, 0.000000}, + }, + { // object_Grid_003 + .mesh = &mesh_Grid, + .scale = {1.000000, 1.000000, 1.000000}, + .rotation = {0.000000, -0.707107, 0.000000, 0.707107}, // quaternion (XYZW) + .location = {-1.000000, 0.000000, 0.000000}, + }, + { // object_Grid_004 + .mesh = &mesh_Grid, + .scale = {1.000000, 1.000000, 1.000000}, + .rotation = {-0.500000, -0.500000, -0.500000, 0.500000}, // quaternion (XYZW) + .location = {0.000000, 1.000000, 0.000000}, + }, + { // object_Grid_005 + .mesh = &mesh_Grid, + .scale = {1.000000, 1.000000, 1.000000}, + .rotation = {0.500000, -0.500000, 0.500000, 0.500000}, // quaternion (XYZW) + .location = {0.000000, -1.000000, 0.000000}, + }, +};