goat3d

view src/chunk.h @ 2:f358b482d286

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