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