About to break scene tree.

This commit is contained in:
2025-08-21 16:21:01 -05:00
parent 4688358d6a
commit 9f5894cdcb
17 changed files with 317 additions and 83 deletions

View File

@@ -6,14 +6,14 @@
*/
#pragma once
#include "ecs/ecs.h"
#include "ecs/ecsentity.h"
#define SCENE_ITEM_CHILD_MAX 16
typedef struct {
ecsentityid_t children[SCENE_ITEM_CHILD_MAX];
ecsid_t children[SCENE_ITEM_CHILD_MAX];
uint8_t childCount;
ecsentityid_t parent;
ecsid_t parent;
} scenetreenode_t;
typedef struct scene_s {
@@ -35,7 +35,7 @@ void sceneTreeInit(void);
*
* @return The ID of the newly created scene item.
*/
ecsentityid_t sceneTreeCreate(void);
ecsid_t sceneTreeCreate(void);
/**
* Get the parent of a given scene item.
@@ -43,7 +43,7 @@ ecsentityid_t sceneTreeCreate(void);
* @param id The ID of the scene item.
* @return The ID of the parent scene item, or -1 if it has no parent.
*/
ecsentityid_t sceneTreeParentGet(const ecsentityid_t child);
ecsid_t sceneTreeParentGet(const ecsid_t child);
/**
* Get the children of a given scene item. If children is NULL only the count
@@ -53,7 +53,7 @@ ecsentityid_t sceneTreeParentGet(const ecsentityid_t child);
* @param children Pointer to an array where the children IDs will be stored.
* @return The number of children found.
*/
uint8_t sceneTreeChildGetAll(const ecsentityid_t id, ecsentityid_t *children);
uint8_t sceneTreeChildGetAll(const ecsid_t id, ecsid_t *children);
/**
* Add a child to a parent in the scene tree.
@@ -61,7 +61,7 @@ uint8_t sceneTreeChildGetAll(const ecsentityid_t id, ecsentityid_t *children);
* @param parent The ID of the parent scene item.
* @param child The ID of the child scene item to add.
*/
void sceneTreeChildAdd(const ecsentityid_t parent, const ecsentityid_t child);
void sceneTreeChildAdd(const ecsid_t parent, const ecsid_t child);
/**
* Remove a child from a parent in the scene tree.
@@ -69,14 +69,14 @@ void sceneTreeChildAdd(const ecsentityid_t parent, const ecsentityid_t child);
* @param prnt The ID of the parent scene item.
* @param child The ID of the child scene item to remove.
*/
void sceneTreeChildRemove(const ecsentityid_t prnt, const ecsentityid_t child);
void sceneTreeChildRemove(const ecsid_t prnt, const ecsid_t child);
/**
* Remove all children from a parent in the scene tree.
*
* @param parent The ID of the parent scene item.
*/
void sceneTreeChildRemoveAll(const ecsentityid_t parent);
void sceneTreeChildRemoveAll(const ecsid_t parent);
/**
* Returns true if the child is within the parent's children, recursively.
@@ -85,7 +85,4 @@ void sceneTreeChildRemoveAll(const ecsentityid_t parent);
* @param child The ID of the child scene item to check.
* @return True if the child is in the parent's children, false otherwise.
*/
bool_t sceneTreeChildInTree(
const ecsentityid_t parent,
const ecsentityid_t child
);
bool_t sceneTreeChildInTree(const ecsid_t parent, const ecsid_t child);