Made a big mess of the codebase

This commit is contained in:
2025-08-28 07:14:13 -05:00
parent 30232d1275
commit af1329710d
44 changed files with 1363 additions and 388 deletions

View File

@@ -6,9 +6,11 @@
*/
#pragma once
#include "ecs/ecscomponent.h"
#include "dusk.h"
#include "display/color.h"
#define CAMERA_COUNT_MAX 4
typedef enum {
CAMERA_TYPE_PERSPECTIVE,
CAMERA_TYPE_ORTHOGRAPHIC
@@ -17,6 +19,8 @@ typedef enum {
typedef struct {
cameraprojectiontype_t type;
mat4 transform;
union {
struct {
float_t fov;
@@ -34,31 +38,22 @@ typedef struct {
float_t farClip;
} camera_t;
extern camera_t CAMERA_DATA[ECS_ENTITY_COUNT_MAX];
extern ecscomponent_t CAMERA_COMPONENT;
extern ecsid_t CAMERA_MAIN;
#define cameraAdd(id) ((camera_t*)ecsComponentDataAdd(&CAMERA_COMPONENT, id))
#define cameraGet(id) ((camera_t*)ecsComponentDataGet(&CAMERA_COMPONENT, id))
#define cameraHas(id) ecsComponentDataHas(&CAMERA_COMPONENT, id)
#define cameraRemove(id) ecsComponentDataRemove(&CAMERA_COMPONENT, id)
extern camera_t CAMERA_DATA[CAMERA_COUNT_MAX];
extern camera_t *CAMERA_MAIN;
/**
* Callback function called when a new entity is added to the camera component.
* Initializes the camera data for the entity.
*
* @param id The ID of the newly added entity.
* Initializes a camera to default values.
*/
void cameraEntityAdded(const ecsid_t id);
void cameraInit(camera_t *camera);
/**
* Pushes the camera's view matrix onto the matrix stack.
*
* @param id The ID of the camera entity to use.
*/
void cameraPush(const ecsid_t id);
void cameraPushMatrix(camera_t* camera);
/**
* Pops the camera's view matrix off the matrix stack.
*/
void cameraPop(void);
void cameraPopMatrix(void);