rev |
line source |
nuclear@1
|
1 #ifndef CHUNK_H_
|
nuclear@1
|
2 #define CHUNK_H_
|
nuclear@1
|
3
|
nuclear@9
|
4 #include <stdint.h>
|
nuclear@9
|
5
|
nuclear@1
|
6 enum {
|
nuclear@1
|
7 CNK_INVALID, // this shouldn't appear in files
|
nuclear@1
|
8 CNK_SCENE, // the root chunk
|
nuclear@1
|
9
|
nuclear@1
|
10 // general purpose chunks
|
nuclear@1
|
11 CNK_INT,
|
nuclear@2
|
12 CNK_INT4,
|
nuclear@1
|
13 CNK_FLOAT,
|
nuclear@2
|
14 CNK_FLOAT3,
|
nuclear@2
|
15 CNK_FLOAT4,
|
nuclear@1
|
16 CNK_STRING,
|
nuclear@1
|
17
|
nuclear@1
|
18 // --- first level chunks ---
|
nuclear@1
|
19 // children of CNK_SCENE
|
nuclear@1
|
20 CNK_ENV, // environmental parameters
|
nuclear@1
|
21 CNK_MTL_LIST, // material library
|
nuclear@1
|
22 CNK_MESH_LIST, // all the meshes hang under this chunk
|
nuclear@1
|
23 CNK_LIGHT_LIST, // likewise for lights
|
nuclear@1
|
24 CNK_CAMERA_LIST, // likewise for cameras
|
nuclear@1
|
25 CNK_NODE_LIST, // likewise for nodes
|
nuclear@1
|
26
|
nuclear@1
|
27 // --- second level chunks ---
|
nuclear@1
|
28 // children of CNK_ENV
|
nuclear@2
|
29 CNK_ENV_AMBIENT, // ambient color, contains a single CNK_FLOAT3
|
nuclear@1
|
30 CNK_ENV_FOG,
|
nuclear@1
|
31
|
nuclear@1
|
32 // children of CNK_*_LIST
|
nuclear@1
|
33 CNK_MTL,
|
nuclear@1
|
34 CNK_MESH,
|
nuclear@1
|
35 CNK_LIGHT,
|
nuclear@1
|
36 CNK_CAMERA,
|
nuclear@1
|
37 CNK_NODE,
|
nuclear@1
|
38
|
nuclear@1
|
39 // --- third level chunks ---
|
nuclear@1
|
40 // children of CNK_FOG
|
nuclear@2
|
41 CNK_FOG_COLOR, // fog color, contains a single CNK_FLOAT3
|
nuclear@1
|
42 CNK_FOG_EXP, // fog exponent, contains a single CNK_REAL
|
nuclear@1
|
43
|
nuclear@1
|
44 // children of CNK_MTL
|
nuclear@1
|
45 CNK_MTL_ATTR, // material attribute, has a CNK_STRING for its name,
|
nuclear@1
|
46 // a CNK_MTL_ATTR_VAL, and optionally a CNK_MTL_ATTR_MAP
|
nuclear@1
|
47 // children of CNK_MTL_ATTR
|
nuclear@2
|
48 CNK_MTL_ATTR_VAL, // can have a single CNK_FLOAT, CNK_FLOAT3, or CNK_FLOAT4
|
nuclear@1
|
49 CNK_MTL_ATTR_MAP, // has a single CNK_STRING
|
nuclear@1
|
50
|
nuclear@1
|
51 // children of CNK_MESH
|
nuclear@2
|
52 CNK_MESH_NAME, // has a single CNK_STRING
|
nuclear@2
|
53 CNK_MESH_MATERIAL, // has one of CNK_STRING or CNK_INT to identify the material
|
nuclear@2
|
54 CNK_MESH_VERTEX_LIST, // has a series of CNK_FLOAT3 chunks
|
nuclear@2
|
55 CNK_MESH_NORMAL_LIST, // has a series of CNK_FLOAT3 chunks
|
nuclear@2
|
56 CNK_MESH_TANGENT_LIST, // has a series of CNK_FLOAT3 chunks
|
nuclear@2
|
57 CNK_MESH_TEXCOORD_LIST, // has a series of CNK_FLOAT3 chunks
|
nuclear@2
|
58 CNK_MESH_SKINWEIGHT_LIST, // has a series of CNK_FLOAT4 chunks (4 skin weights)
|
nuclear@2
|
59 CNK_MESH_SKINMATRIX_LIST, // has a series of CNK_INT4 chunks (4 matrix indices)
|
nuclear@2
|
60 CNK_MESH_COLOR_LIST, // has a series of CNK_FLOAT4 chunks
|
nuclear@2
|
61 CNK_MESH_BONES_LIST, // has a series of CNK_INT or CNK_STRING chunks identifying the bone nodes
|
nuclear@8
|
62 CNK_MESH_FACE_LIST, // has a series of CNK_FACE chunks
|
nuclear@8
|
63
|
nuclear@8
|
64 // child of CNK_MESH_FACE_LIST
|
nuclear@8
|
65 CNK_MESH_FACE, // has three CNK_INT chunks
|
nuclear@2
|
66
|
nuclear@2
|
67 // children of CNK_LIGHT
|
nuclear@2
|
68 CNK_LIGHT_NAME, // has a single CNK_STRING
|
nuclear@2
|
69 CNK_LIGHT_POS, // has a single CNK_FLOAT3
|
nuclear@2
|
70 CNK_LIGHT_COLOR, // has a single CNK_FLOAT3
|
nuclear@2
|
71 CNK_LIGHT_ATTEN, // has a single CNK_FLOAT3 (constant, linear, squared attenuation)
|
nuclear@2
|
72 CNK_LIGHT_DISTANCE, // has a single CNK_FLOAT
|
nuclear@2
|
73 CNK_LIGHT_DIR, // a single CNK_FLOAT3 (for spotlights and dir-lights)
|
nuclear@2
|
74 CNK_LIGHT_CONE_INNER, // single CNK_FLOAT, inner cone angle (for spotlights)
|
nuclear@2
|
75 CNK_LIGHT_CONE_OUTER, // single CNK_FLOAT, outer cone angle (for spotlights)
|
nuclear@2
|
76
|
nuclear@2
|
77 // children of CNK_CAMERA
|
nuclear@2
|
78 CNK_CAMERA_NAME, // has a single CNK_STRING
|
nuclear@2
|
79 CNK_CAMERA_POS, // single CNK_FLOAT3
|
nuclear@2
|
80 CNK_CAMERA_TARGET, // single CNK_FLOAT3
|
nuclear@2
|
81 CNK_CAMERA_FOV, // single CNK_FLOAT (field of view in radians)
|
nuclear@2
|
82 CNK_CAMERA_NEARCLIP, // single CNK_FLOAT (near clipping plane distance)
|
nuclear@2
|
83 CNK_CAMERA_FARCLIP, // signle CNK_FLOAT (far clipping plane distance)
|
nuclear@2
|
84
|
nuclear@2
|
85 // children of CNK_NODE
|
nuclear@2
|
86 CNK_NODE_NAME, // node name, a single CNK_STRING
|
nuclear@2
|
87 CNK_NODE_PARENT, // it can have a CNK_INT or a CNK_STRING to identify the parent node
|
nuclear@2
|
88
|
nuclear@2
|
89 CNK_NODE_MESH, // it can have a CNK_INT or a CNK_STRING to identify this node's mesh
|
nuclear@2
|
90 CNK_NODE_LIGHT, // same as CNK_NODE_MESH
|
nuclear@2
|
91 CNK_NODE_CAMERA, // same as CNK_NODE_MESH
|
nuclear@2
|
92
|
nuclear@2
|
93 CNK_NODE_POS, // has a CNK_VEC3, position vector
|
nuclear@2
|
94 CNK_NODE_ROT, // has a CNK_VEC4, rotation quaternion (x, y, z imaginary, w real)
|
nuclear@2
|
95 CNK_NODE_SCALE, // has a CNK_VEC3, scaling
|
nuclear@2
|
96 CNK_NODE_PIVOT, // has a CNK_VEC3, pivot point
|
nuclear@2
|
97
|
nuclear@2
|
98 CNK_NODE_MATRIX0, // has a CNK_VEC4, first matrix row (4x3)
|
nuclear@2
|
99 CNK_NODE_MATRXI1, // has a CNK_VEC4, second matrix row (4x3)
|
nuclear@2
|
100 CNK_NODE_MATRIX2, // has a CNK_VEC4, third matrix row (4x3)
|
nuclear@2
|
101
|
nuclear@2
|
102 MAX_NUM_CHUNKS
|
nuclear@1
|
103 };
|
nuclear@1
|
104
|
nuclear@9
|
105 #define UNKNOWN_SIZE ((uint32_t)0xbaadf00d)
|
nuclear@9
|
106
|
nuclear@1
|
107 struct ChunkHeader {
|
nuclear@1
|
108 uint32_t id;
|
nuclear@1
|
109 uint32_t size;
|
nuclear@1
|
110 };
|
nuclear@1
|
111
|
nuclear@1
|
112 struct Chunk {
|
nuclear@1
|
113 ChunkHeader hdr;
|
nuclear@1
|
114 char data[1];
|
nuclear@1
|
115 };
|
nuclear@1
|
116
|
nuclear@9
|
117
|
nuclear@9
|
118
|
nuclear@1
|
119 #endif // CHUNK_H_
|