283
|
1 #ifndef INCLUDED_SCENE_GRAPH_PACK
|
|
2 #define INCLUDED_SCENE_GRAPH_PACK
|
|
3
|
539
|
4 #include "SceneGraph.h"
|
283
|
5
|
539
|
6 #include "types.h"
|
283
|
7
|
|
8 #define MAX_NODE 16
|
|
9 #define MAX_POLYGON 36
|
|
10
|
|
11 typedef struct SceneGraphNode {
|
|
12 int size; // この Node で使ってるポリゴンの数、でいいのかな
|
|
13 float vertex[MAX_POLYGON*3];
|
|
14 float texture[MAX_POLYGON*2];
|
|
15 float obj_pos[4];
|
|
16 float angle[4];
|
|
17 float translation[16];
|
|
18 uint32 *tex_addr;
|
|
19 int tex_width, tex_height;
|
|
20 int id;
|
|
21 int move, interaction;
|
|
22 int pn; // parent number?
|
|
23 SceneGraphNode *next;
|
|
24 int pad[3];
|
|
25 SceneGraphPtr self;
|
|
26 SceneGraphPtr tree;
|
|
27
|
|
28 void init(void) {
|
|
29 size = 0;
|
|
30 next = 0;
|
|
31 }
|
|
32
|
|
33 void finish(void) {
|
|
34 SceneGraphNode *p = this->next, *p1;
|
|
35
|
|
36 while (p) {
|
|
37 p1 = p->next;
|
|
38 free(p);
|
|
39 p = p1;
|
|
40 }
|
|
41 }
|
|
42 }SceneGraphNode, *SceneGraphNodePtr;
|
|
43
|
|
44 typedef struct SceneGraphInfo {
|
|
45 int size;
|
|
46 int pad[2];
|
|
47 }SceneGraphInfo;
|
|
48
|
|
49 typedef struct SceneGraphPack {
|
|
50 SceneGraphInfo info;
|
|
51 SceneGraphNode node[MAX_NODE];
|
|
52 SceneGraphPack *next;
|
|
53
|
|
54 void init(void){
|
|
55 next = 0;
|
|
56 info.size = 0;
|
|
57
|
|
58 for (int i = 0; i < MAX_NODE; i++) {
|
|
59 node[i].size = 0;
|
|
60 }
|
|
61 }
|
|
62
|
|
63 void finish(void) {
|
|
64 for (int i = 0; i < info.size; i++) {
|
|
65 node[i].finish();
|
|
66 }
|
|
67
|
|
68 next = 0;
|
|
69 info.size = 0;
|
|
70 }
|
|
71 } SceneGraphPack, *SceneGraphPackPtr;
|
|
72
|
|
73 #endif
|