From b9180823404b61327eeef7e0cf619449fbc718b5 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Sun, 9 Feb 2025 10:37:51 -0600 Subject: [PATCH] add cube --- cube.hpp | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 cube.hpp diff --git a/cube.hpp b/cube.hpp new file mode 100644 index 0000000..0e5005b --- /dev/null +++ b/cube.hpp @@ -0,0 +1,105 @@ +#pragma once + +#include + +#include "../model.h" + +// floating-point +vertex_position cube_position[] = { + {1.0, 1.0, -1.0}, + {1.0, -1.0, -1.0}, + {1.0, 1.0, 1.0}, + {1.0, -1.0, 1.0}, + {-1.0, 1.0, -1.0}, + {-1.0, -1.0, -1.0}, + {-1.0, 1.0, 1.0}, + {-1.0, -1.0, 1.0}, +}; + +// floating-point +vertex_texture cube_texture[] = { + {0.625, 0.5}, + {0.875, 0.5}, + {0.875, 0.75}, + {0.625, 0.75}, + {0.375, 0.75}, + {0.625, 1.0}, + {0.375, 1.0}, + {0.375, 0.0}, + {0.625, 0.0}, + {0.625, 0.25}, + {0.375, 0.25}, + {0.125, 0.5}, + {0.375, 0.5}, + {0.125, 0.75}, +}; + +// floating-point +vertex_normal cube_normal[] = { + {0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0}, + {-1.0, 0.0, 0.0}, + {0.0, -1.0, 0.0}, + {1.0, 0.0, 0.0}, + {0.0, 0.0, -1.0}, +}; + +union quadrilateral cube_Cube_quadrilateral[] = { + { .v = { + {0, 0, 0}, + {4, 1, 0}, + {6, 2, 0}, + {2, 3, 0}, + }}, + { .v = { + {3, 4, 1}, + {2, 3, 1}, + {6, 5, 1}, + {7, 6, 1}, + }}, + { .v = { + {7, 7, 2}, + {6, 8, 2}, + {4, 9, 2}, + {5, 10, 2}, + }}, + { .v = { + {5, 11, 3}, + {1, 12, 3}, + {3, 4, 3}, + {7, 13, 3}, + }}, + { .v = { + {1, 12, 4}, + {0, 0, 4}, + {2, 3, 4}, + {3, 4, 4}, + }}, + { .v = { + {5, 10, 5}, + {4, 9, 5}, + {0, 0, 5}, + {1, 12, 5}, + }}, +}; + +struct object cube_Cube = { + .triangle = NULL, + .quadrilateral = &cube_Cube_quadrilateral[0], + .triangle_count = 0, + .quadrilateral_count = 6, + .material = Material, +}; + +struct object * cube_object_list[] = { + &cube_Cube, +}; + +struct model cube_model = { + .position = &cube_position[0], + .texture = &cube_texture[0], + .normal = &cube_normal[0], + .object = &cube_object_list[0], + .object_count = 1, +}; +