#ifndef TC_PHYSICS_SIMULATION_H #define TC_PHYSICS_SIMULATION_H #include #include #include #include typedef struct tc_physics_entity tc_physics_entity_s; typedef struct tc_entity_physics_attributes tc_entity_physics_attributes_s; struct tc_entity_physics_attributes { bool_t has_gravity; bool_t raw_movement; bool_t raw_rotation; tc_vec3f_s acceleration; tc_vec3f_s spin; }; typedef enum { TC_PHYSICS_ENTITY, TC_PHYSICS_ENTITY_GROUP } tc_physics_entity_type_e; struct tc_physics_entity { tc_physics_entity_s *super; // relative_position: The position of this physics entity relative to its super-entity tc_vec3f_s relative_position; tc_physics_entity_type_e type; union specific { struct entity { char *name; tc_entity_s *entity; } entity; struct subentity_group { u32_t num_entities; tc_physics_entity_s *entities; } group; } value; }; typedef struct tc_physics_simulation { tc_physics_entity_s world_root; } tc_physics_simulation_s; tc_physics_simulation_s tc_new_physics_simulation (); void tc_add_physics_object (tc_physics_simulation_s *simulation, tc_physics_entity_s object); void tc_add_physics_object_to (tc_physics_entity_s *container, tc_physics_entity_s object); tc_physics_entity_s tc_new_physics_entity (); void tc_tick_physics (tc_physics_simulation_s *simulation, f32_t delta); tc_primitive_s * tc_cast_line (tc_physics_simulation_s *simulation, tc_line_s line); #endif