-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene.h
67 lines (59 loc) · 1.36 KB
/
scene.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include "file.h"
#include "object.h"
#include "dlb_types.h"
#include "dlb_hash.h"
typedef enum token_type {
TOKEN_UNKNOWN,
TOKEN_EOF,
TOKEN_WHITESPACE,
TOKEN_NEWLINE,
TOKEN_INDENT,
TOKEN_COMMENT,
TOKEN_IDENTIFIER,
TOKEN_KW_NULL,
TOKEN_KW_TRUE,
TOKEN_KW_FALSE,
TOKEN_INT,
TOKEN_FLOAT,
TOKEN_STRING,
TOKEN_ARRAY_START,
TOKEN_ARRAY_END,
TOKEN_OBJECT_START,
TOKEN_OBJECT_END,
TOKEN_LIST_SEPARATOR,
} token_type;
typedef struct token {
token_type type;
size_t length;
union {
int32 as_int;
float as_float;
int32 *int_array;
float *float_array;
const char *string;
} value;
} token;
typedef struct ta_scene_s ta_scene;
typedef struct scene_ref_s {
ta_field_type type;
void *ptr;
} scene_ref;
typedef struct ta_scene_s {
const char *name;
scene_ref *refs;
dlb_hash refs_by_name;
ta_sun_light *sun_lights;
ta_point_light *point_lights;
ta_material *materials;
ta_mesh *meshes;
ta_shader *shaders;
ta_texture *textures;
ta_entity *entities;
} ta_scene;
const char *token_type_str(token_type type);
ta_scene *scene_init(const char *name);
ta_scene *scene_load(file *f);
void scene_free(ta_scene *scn);
void scene_print(ta_scene *scn, FILE *hnd);
void *scene_obj_init(ta_scene *scn, ta_field_type type);