annotate Renderer/test_render/scene_graph_pack.h @ 299:3cb2530b4ca4 draft

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