cool beans
This commit is contained in:
@@ -15,7 +15,9 @@ SceneGraphNode *getSceneGraphNode(Scene *s, uint32 sceneGraphNodeHandle) {
|
||||
|
||||
uint32 createSceneGraphNode(Arena *arena, Scene *s) {
|
||||
AppendList(&s->graphNodes, (SceneGraphNode){0});
|
||||
s->graphNodes.data[s->graphNodes.length - 1].children = PushList(arena, HandleList, 64);
|
||||
SceneGraphNode *node = &s->graphNodes.data[s->graphNodes.length - 1];
|
||||
node->children = PushList(arena, HandleList, 1000);
|
||||
initGraphNode(node);
|
||||
return (uint32)s->graphNodes.length;
|
||||
}
|
||||
|
||||
@@ -26,7 +28,6 @@ uint32 createEntity(Arena *arena, Scene *s) {
|
||||
getSceneGraphNode(s, graphNodeId)->entityHandle = (uint32)s->entities.length;
|
||||
uint32 handle = (uint32)s->entities.length;
|
||||
uint32 graphNodeHandle = (uint32)s->graphNodes.length;
|
||||
initGraphNode(getSceneGraphNode(s, graphNodeHandle));
|
||||
return handle;
|
||||
}
|
||||
|
||||
@@ -44,8 +45,8 @@ void recalcGraphNode(SceneGraphNode *n) {
|
||||
|
||||
Scene createScene(Arena *arena) {
|
||||
Scene result = {};
|
||||
result.entities = PushList(arena, EntityList, 1024);
|
||||
result.graphNodes = PushList(arena, SceneGraphNodeList, 1024);
|
||||
result.entities = PushList(arena, EntityList, 100000);
|
||||
result.graphNodes = PushList(arena, SceneGraphNodeList, 100000);
|
||||
result.sceneRoot = createSceneGraphNode(arena, &result);
|
||||
return result;
|
||||
}
|
||||
@@ -90,3 +91,8 @@ void sceneNodeAddEntity(Scene *s, uint32 graphNodeHandle, uint32 entityHandle) {
|
||||
HandleList *childList = &getSceneGraphNode(s, graphNodeHandle)->children;
|
||||
AppendList(childList, getEntity(s, entityHandle)->graphNodeHandle);
|
||||
}
|
||||
|
||||
void sceneNodeAddNode(Scene *s, uint32 recipientNodeHandle, uint32 graphNodeHandle) {
|
||||
HandleList *childList = &getSceneGraphNode(s, recipientNodeHandle)->children;
|
||||
AppendList(childList, graphNodeHandle);
|
||||
}
|
||||
|
||||
@@ -11,10 +11,11 @@ enum EntityFlags {
|
||||
|
||||
typedef struct Entity Entity;
|
||||
struct Entity {
|
||||
Mesh *mesh;
|
||||
Texture *tex;
|
||||
uint32 graphNodeHandle;
|
||||
uint64 flags;
|
||||
RLVector4 color;
|
||||
Mesh *mesh;
|
||||
Texture *tex;
|
||||
};
|
||||
DefineList(Entity, Entity);
|
||||
|
||||
@@ -48,5 +49,6 @@ void recalcGraphNode(SceneGraphNode *n);
|
||||
void recalcSceneGraphNode(Scene *s, uint32 parentHandle);
|
||||
void recalcScene(Scene *s);
|
||||
void removeEntity(Scene *s, uint32 entityHandle);
|
||||
void sceneNodeAddNode(Scene *s, uint32 recipientNodeHandle, uint32 graphNodeHandle);
|
||||
void sceneNodeAddEntity(Scene *s, uint32 graphNodeHandle, uint32 entityHandle);
|
||||
SceneGraphNode *getSceneGraphNodeForEntity(Scene *s, uint32 entityHandle);
|
||||
|
||||
Reference in New Issue
Block a user