cleaned more stuff
This commit is contained in:
@@ -7,42 +7,59 @@
|
||||
|
||||
#pragma once
|
||||
#include "ecs/ecscomponent.h"
|
||||
#include "display/color.h"
|
||||
|
||||
typedef enum {
|
||||
CAMERA_TYPE_PERSPECTIVE,
|
||||
CAMERA_TYPE_ORTHOGRAPHIC
|
||||
} cameraprojectiontype_t;
|
||||
|
||||
typedef struct {
|
||||
float_t view[16]; // 4x4 matrix for view transformation
|
||||
cameraprojectiontype_t type;
|
||||
|
||||
union {
|
||||
struct {
|
||||
float_t fov;
|
||||
} perspective;
|
||||
|
||||
struct {
|
||||
float_t left;
|
||||
float_t right;
|
||||
float_t top;
|
||||
float_t bottom;
|
||||
} orthographic;
|
||||
};
|
||||
|
||||
float_t nearClip;
|
||||
float_t farClip;
|
||||
color_t clearColor;
|
||||
} camera_t;
|
||||
|
||||
extern camera_t CAMERA_DATA[ECS_ENTITY_COUNT_MAX];
|
||||
extern ecscomponent_t CAMERA_COMPONENT;
|
||||
extern ecsid_t CAMERA_MAIN;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the camera component.
|
||||
*
|
||||
* @param id The ID of the entity to initialize the camera for.
|
||||
*/
|
||||
#define cameraAdd(id) ((camera_t*)ecsComponentDataAdd(&CAMERA_COMPONENT, id))
|
||||
|
||||
/**
|
||||
* Gets the camera component data for a specific entity.
|
||||
*
|
||||
* @param id The ID of the entity to get the camera data for.
|
||||
* @return Pointer to the camera data for the entity.
|
||||
*/
|
||||
#define cameraGet(id) ((camera_t*)ecsComponentDataGet(&CAMERA_COMPONENT, id))
|
||||
|
||||
/**
|
||||
* Checks if the camera component has data for a specific entity.
|
||||
*
|
||||
* @param id The ID of the entity to check.
|
||||
* @return True if the camera component has data for the entity, false otherwise.
|
||||
*/
|
||||
#define cameraHas(id) ecsComponentDataHas(&CAMERA_COMPONENT, id)
|
||||
#define cameraRemove(id) ecsComponentDataRemove(&CAMERA_COMPONENT, id)
|
||||
|
||||
/**
|
||||
* Removes the camera component data for a specific entity.
|
||||
* 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 entity to remove the camera data for.
|
||||
* @param id The ID of the newly added entity.
|
||||
*/
|
||||
#define cameraRemove(id) ecsComponentDataRemove(&CAMERA_COMPONENT, id)
|
||||
void cameraEntityAdded(const ecsid_t id);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Pops the camera's view matrix off the matrix stack.
|
||||
*/
|
||||
void cameraPop(void);
|
||||
Reference in New Issue
Block a user