diff options
Diffstat (limited to 'src/entity.h')
-rw-r--r-- | src/entity.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/entity.h b/src/entity.h index 1ac3422..6246fdd 100644 --- a/src/entity.h +++ b/src/entity.h @@ -45,6 +45,26 @@ typedef struct EntityVelocity { EntityVelocity entityVelocityIdentity(); +typedef struct EntityCollisionMesh { + size_t triangleCount; + Triangle3D * triangles; + Vector3 * normals; +} EntityCollisionMesh; + +typedef struct EntityCollisionModel { + size_t meshCount; + EntityCollisionMesh * meshes; +} EntityCollisionModel; + +EntityCollisionModel entityCreateCollisionModel(Model model); +void entityFreeCollisionModel(EntityCollisionModel model); + +// Only use if both collision models came from the same model. +void entityTransformCollisionModel(Entity * entity); + +// Checks if collision model will need to be transformed. +void entityCheckTransformedCollisionModel(Entity * entity); + // This fucker hit something. typedef struct EntityCollision { bool hit; @@ -64,10 +84,18 @@ typedef struct Entity { Model * model; float radius; // Used for quick collision detection. + + EntityCollisionModel collisionModel; + EntityCollisionModel transformedCollisionModel; + // Use for checking if model been transformed indeed. + bool collisionModelTransformed; Vector3 position; Quaternion rotation; + Vector3 lastPosition; + Quaternion lastRotation; + EntityVelocity velocity; EntityVelocity lastVelocity; @@ -104,12 +132,13 @@ Entity createEntity(EntityType type, Game * game); void closeEntity(Entity * entity); void setEntityRadius(Entity * entity); // Uses model to set radius; -bool checkEntityCollision(Entity entity1, Entity entity2); +bool checkEntityCollision(Entity * entity1, Entity * entity2); -// Helper functions for updating and drawing. +// Helper functions for updating, drawing... void entityDraw(Entity * entity); void entityUpdatePosition(Entity * entity); void entityUpdateRotation(Entity * entity); +void entityUpdateLastValues(Entity * entity); // Should be at top of update function. void entityJoystickControl(Entity * entity, Vector3 stick, float speed); |