MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
mgdl-scene.h
1#pragma once
2/* This file contains types that represent a 3D scene
3 *
4 */
5#include <mgdl/mgdl-types.h>
6#include <mgdl/mgdl-opengl.h>
7#include <mgdl/mgdl-texture.h>
8#include <mgdl/mgdl-mesh.h>
9#include <mgdl/mgdl-material.h>
10#include <mgdl/mgdl-node.h>
11#include <mgdl/mgdl-gui.h>
12#include <mgdl/mgdl-vectorfunctions.h>
13
14enum Scene_DebugFlag : u32
15{
16 Index = 1,
17 UniqueId = 2,
18 Position = 4,
19 Rotation = 8
20};
21struct DynamicArray;
22struct Scene
23{
24 Node* rootNode;
25 // Multiple nodes can refer to same material
26 struct DynamicArray* materials;
27 // Multiple nodes can refer to same mesh
28 struct DynamicArray* meshes;
29 struct DynamicArray* lights;
30
31};
32typedef struct Scene Scene;
33#ifdef __cplusplus
34extern "C"
35{
36#endif
37
38 Scene* Scene_CreateEmpty(void);
39 void Scene_Init(Scene* scene);
40
41 void Scene_Draw(Scene* scene);
42 void Scene_DrawNode(Node* node);
43 void Scene_DebugDraw(Scene* scene, Menu* menu, short x, short y, u32 debugFlags);
44 void Scene_AddChildNode(Scene* scene, Node* parent, Node* child);
45 void Scene_AddMaterial(Scene* scene, Material* material);
46 void Scene_SetMaterialTexture(Scene* scene, const char* materialName, Texture* texture);
47 void Scene_SetAllMaterialTextures(Scene* scene, Texture* texture);
48
49 Node* Scene_GetRootNode(Scene* scene);
50 Node* Scene_GetNode(Scene* scene, const char* name);
51 Node* Scene_GetNodeByIndex(Scene* scene, short index);
52 Material* Scene_GetMaterial(Scene* scene, const char* materialName);
53
54 V3f Scene_GetNodePosition(Scene* scene, Node* node);
55 bool Scene_GetNodeModelMatrix(Scene* scene, Node* node, MTX4x4 modelOut);
56
57 void _Scene_DebugDrawNode (Node* node, short depth, short* index, u32 drawFlags );
58
59 Node* Scene_FindChildNode(Node* node, const char* nodeName);
60 Node* Scene_FindChildNodeByIndex(Node* parent, short targetIndex, short index);
61 Material* Scene_FindNodeMaterial(Scene* scene, Node* node, const char* materialName);
62
63 bool Scene_CalculateNodePosition(Node* parent, Node* target, MTX4x4 world, V3f* posOut);
64 bool Scene_CalculateNodeModelMatrix(Node* parent, Node* target, MTX4x4 model);
65
66
67#ifdef __cplusplus
68}
69#endif
MenuCreator class for simple Immediate Mode Gui.
Texture handling module header.
Library types, macros, defines and enums header.
Definition mgdl-dynamic_array.h:13
Material used by a node.
Definition mgdl-material.h:13
Struct for holding the state of immeadiate mode gui menu.
Definition mgdl-gui.h:19
Definition mgdl-node.h:11
Definition mgdl-scene.h:23
Abstract class for cross platform PNG image loading.
Definition mgdl-texture.h:13