Initial upload

This commit is contained in:
2025-04-15 11:29:46 +09:00
commit b915d56f73
212 changed files with 43262 additions and 0 deletions

21
source/Geometry.c Normal file
View File

@@ -0,0 +1,21 @@
#include "Geometry.h"
void quad_create(vec3s center, vec3s forward, vec3s up, float size, uint8_t material_id, triangle_collection_t* collection)
{
float half_size = size / 2.0f;
vec3s right = glms_vec3_cross(forward, up);
vec3s scaled_right = glms_vec3_scale(right, half_size);
vec3s scaled_up = glms_vec3_scale(up, half_size);
vec3s temp_sub = glms_vec3_sub(center, scaled_right);
vec3s temp_add = glms_vec3_add(center, scaled_right);
vec3s top_left = glms_vec3_add(temp_sub, scaled_up);
vec3s top_right = glms_vec3_add(temp_add, scaled_up);
vec3s bottom_right = glms_vec3_sub(temp_add, scaled_up);
vec3s bottom_left = glms_vec3_sub(temp_sub, scaled_up);
triangle_create(top_left, bottom_left, top_right, material_id, collection);
triangle_create(top_right, bottom_right, bottom_left, material_id, collection);
}