About to break scene tree.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
target_sources(${DUSK_TARGET_NAME}
|
||||
PRIVATE
|
||||
display.c
|
||||
camera.c
|
||||
)
|
||||
|
||||
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
||||
|
11
src/display/camera.c
Normal file
11
src/display/camera.c
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "camera.h"
|
||||
|
||||
camera_t CAMERA_DATA[ECS_ENTITY_COUNT_MAX] = { 0 };
|
||||
ecscomponent_t CAMERA_COMPONENT = ecsComponentInit(CAMERA_DATA);
|
46
src/display/camera.h
Normal file
46
src/display/camera.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "ecs/ecscomponent.h"
|
||||
|
||||
typedef struct {
|
||||
float_t view[16]; // 4x4 matrix for view transformation
|
||||
} camera_t;
|
||||
|
||||
extern camera_t CAMERA_DATA[ECS_ENTITY_COUNT_MAX];
|
||||
extern ecscomponent_t CAMERA_COMPONENT;
|
||||
|
||||
/**
|
||||
* Initializes the camera component.
|
||||
*
|
||||
* @param id The ID of the entity to initialize the camera for.
|
||||
*/
|
||||
#define cameraAdd(id) 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) 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)
|
||||
|
||||
/**
|
||||
* Removes the camera component data for a specific entity.
|
||||
*
|
||||
* @param id The ID of the entity to remove the camera data for.
|
||||
*/
|
||||
#define cameraRemove(id) ecsComponentDataRemove(&CAMERA_COMPONENT, id)
|
Reference in New Issue
Block a user