adding gfx and ui stuff
This commit is contained in:
75
gfx/world/scene.h
Normal file
75
gfx/world/scene.h
Normal file
@@ -0,0 +1,75 @@
|
||||
#ifndef DJSTDLIB_GFX_SCENE_H
|
||||
#define DJSTDLIB_GFX_SCENE_H
|
||||
|
||||
#include "../../core.h"
|
||||
#include "../../vendor/raymath.h"
|
||||
#include "../Mesh.h"
|
||||
#include "../Texture.h"
|
||||
|
||||
DefineList(int32, Handle);
|
||||
|
||||
enum EntityFlags {
|
||||
EntityFlags_None=0,
|
||||
EntityFlags_Visible=1<<0,
|
||||
EntityFlags_Dead=1<<1,
|
||||
EntityFlags_Render=1<<2,
|
||||
};
|
||||
|
||||
typedef struct Entity Entity;
|
||||
struct Entity {
|
||||
int32 graphNodeHandle;
|
||||
uint64 flags;
|
||||
Vec4 color;
|
||||
Mesh *mesh;
|
||||
Texture *tex;
|
||||
|
||||
// Free list
|
||||
int32 next;
|
||||
};
|
||||
DefineList(Entity, Entity);
|
||||
|
||||
typedef struct SceneGraphNode SceneGraphNode;
|
||||
struct SceneGraphNode {
|
||||
Matrix local;
|
||||
Matrix world;
|
||||
Vec3 translation;
|
||||
Quaternion rotation;
|
||||
Vec3 scale;
|
||||
int32 entityHandle;
|
||||
int32 parentHandle;
|
||||
|
||||
/** Next free in the free list */
|
||||
int32 next;
|
||||
|
||||
/** Next child in child list in scene hierarchy */
|
||||
int32 nextSibling;
|
||||
int32 firstChild;
|
||||
};
|
||||
DefineList(SceneGraphNode, SceneGraphNode);
|
||||
|
||||
typedef struct Scene Scene;
|
||||
struct Scene {
|
||||
int32 sceneRoot;
|
||||
EntityList entities;
|
||||
int32 nextFreeEntity;
|
||||
/** @internal */
|
||||
SceneGraphNodeList graphNodes;
|
||||
int32 nextFreeNode;
|
||||
};
|
||||
|
||||
int32 createEntity(Scene *s);
|
||||
Entity *getEntity(Scene *s, int32 id);
|
||||
SceneGraphNode *getSceneGraphNode(Scene *s, int32 id);
|
||||
int32 createSceneGraphNode(Scene *s);
|
||||
Scene createScene(Arena *arena);
|
||||
void initGraphNode(SceneGraphNode *n);
|
||||
void recalcSceneGraphNode(Scene *s, int32 parentHandle);
|
||||
void recalcScene(Scene *s);
|
||||
void removeEntity(Scene *s, int32 entityHandle);
|
||||
void removeSceneGraphNode(Scene *s, int32 graphNodeHandle);
|
||||
void sceneNodeAddNode(Scene *s, int32 recipientNodeHandle, int32 graphNodeHandle);
|
||||
SceneGraphNode *getSceneGraphNodeForEntity(Scene *s, int32 entityHandle);
|
||||
void show(Scene *s, uint32 graphNodeHandle);
|
||||
void hide(Scene *s, uint32 graphNodeHandle);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user