#ifndef TC_PHYSICS_PRIMITIVES_H #define TC_PHYSICS_PRIMITIVES_H #include #include #include typedef struct tc_physics_mesh tc_physics_mesh_s; typedef struct tc_aabb tc_aabb_s; typedef struct tc_obb tc_obb_s; typedef struct tc_plane tc_plane_s; typedef struct tc_ellipsoid tc_ellipsoid_s; typedef struct tc_ray tc_ray_s; typedef struct tc_line tc_line_s; typedef enum { TC_PRIMITIVE_AABB, TC_PRIMITIVE_OBB, TC_PRIMITIVE_PLANE, TC_PRIMITIVE_ELLIPSOID, TC_PRIMITIVE_RAY, TC_PRIMITIVE_LINE } tc_primitive_type_e; struct tc_aabb { tc_vec3f_s start; tc_vec3f_s size; }; struct tc_obb { tc_vec3f_s start; tc_vec3f_s size; tc_vec3f_s rotation; }; struct tc_plane { tc_vec3f_s center; tc_vec3f_s rotation; tc_vec2i_s size; }; struct tc_ellipsoid { tc_vec3f_s center; tc_vec3f_s extent; }; struct tc_ray { tc_vec3f_s start; tc_vec3f_s rotation; }; struct tc_line { tc_vec3f_s start; tc_vec3f_s end; }; typedef union tc_primitive { tc_aabb_s aabb; tc_obb_s obb; tc_plane_s plane; tc_ellipsoid_s sphere; tc_line_s line; tc_ray_s ray; } tc_primitive_u; typedef struct tc_primitive_container { tc_primitive_type_e type; tc_primitive_u data; } tc_primitive_s; struct tc_physics_mesh { u32_t num_primitives; union { struct complex { u32_t primitives_capacity; tc_primitive_s *primitives; } complex; struct simple { tc_primitive_s primitive; } simple; } value; }; tc_physics_mesh_s tc_wrap_aabb (tc_vec3f_s start, tc_vec3f_s size); #endif // TC_PHYSICS_PRIMITIVES_H