54 char default_name[256];
56 sprintf(default_name,
"%s_default", name);
61 printf(
"NO DEFAULT STATE FOUND: %s\n", name);
108 printf(
"NO AC SLOT FOUND\n");
140 printf(
"NO AC SLOT FOUND\n");
156 bool found_entity =
false;
172 printf(
"NO ENT SLOT FOUND\n");
181 if (asset_instance && mn_id != -1)
198 if (physics_component)
209 if (animation_component)
Engine specific types and defines.
Vector mesh_nodes
MeshNodes.
int skin
The GLTFSkin to be modified by this Entity (skeletal animations).
void(* fn[ESTATE_MAX])(void *)
AnimationComponent * ac
The AnimationComponent inside of ANIMATION_COMPONENTS.
int mesh_node
The top-most MeshNode that belongs to this Entity.
AABB aabb
The AABB over each MeshNode via Asset.
Globals GLOBALS
Engine Globals.
bool free
If the component is empty.
bool free
If the Entity is empty.
struct AssetInstance * instance
The AssetInstance that spawned this Entity.
#define MAX_ENTITY_STATES
Maximim Entity states for behaviors.
Entity * ent
The pointer to the Entity.
State * state
The current State that describes actions for this Entity.
PhysicsComponent * pc
The PhysicsComponent inside of PHYSICS_COMPONENTS.
AABB aabb
The bounding box over all MeshNodes for this Entity.
The animation component for interpolation between AnimationKeyframes.
A instance of an Asset that retains its node structure but can be duplicated into multiple instances ...
Entity structure that holds components and references to the data it owns.
Entity States that control what functions are available for an Entity.
int STATE_COUNT
The amount of states inside of STATE_REGISTRY.
void update_entities()
TODO: Entity update loop.
State * find_default_state(const char *name)
void destroy_entity(Entity *ent)
Deletes an entity by simply freeing it and its components.
AnimationComponent * create_animation_component(Entity *ent)
Creates an animation component for an entity.
State STATE_REGISTRY[MAX_ENTITY_STATES]
Registry for entity states used for entity events and behaviors.
PhysicsComponent * create_physics_component(Entity *ent, CollisionType collision_type, PhysicsType physics_type)
Creates an physics component for an entity.
State * find_state_by_name(const char *name)
void STATES_INIT()
Initializes entity states, which are a registry of function pointers used for entity events and behav...
Entity * create_entity(AssetInstance *asset_instance, int mn_id, bool physics_component, bool animation_component)
Creates an entity using the free list of ENTITIES.
void(*) func_ptr_t(void *)
ECS creation and maintenance.
void ESTATE_chair_interact(void *data)
ECS registry for behaviors.
Entity * ent
Which Entity this component belongs to.
bool free
If this is an empty component.
void init_PC(int mesh_node, PhysicsComponent *pc, AABB ai_aabb, CollisionType collision_type, PhysicsType physics_type)
Initializes a PhysicsComponent.
CollisionType
Defines collision types with different behaviors and mesh setup and validation.
PhysicsType
Defines physics types with different behaviors in impulse resolution.
Entity Component used for physics resolution.
int skin
The GLTFSkin it controls.
Entity * ent
The Entity this MeshNode refers to (all children point to the same Entity as parent).
PhysicsComponent * pc
The physics controller initialized based on data from this MeshNode.
CollisionType collision_type
The type of collision to apply for the PhysicsComponent that may not have been created yet.
char name[256]
The name generated on loading from file.
int mesh
The Mesh it references.
PhysicsType physics_mode
The type of physics to apply for the PhysicsComponent that may not have been created yet.
MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to ...
Important globals for the entire engine and initialization functions that are mainly called on engine...
#define MAX_PHYSICS_COMPONENTS
#define MAX_ANIMATION_COMPONENTS
AABB aabb
The AABB of the mesh.
A Mesh with geometry data that is either initialized as static or dynamic and split into SubMeshes.
PhysicsComponent PHYSICS_COMPONENTS[MAX_PHYSICS_COMPONENTS]
Entity ENTITIES[MAX_ENTITIES]
AnimationComponent ANIMATION_COMPONENTS[MAX_ANIMATION_COMPONENTS]
Mesh functions that modify and initialize Mesh data.
PhysicsComponent impulse resolution and collision detection and acceleration structure traversal.
#define CAST_VEC(vec, type)