Mercurial > hg > Game > Cerium
annotate TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.cpp @ 203:1eba8570808c draft
fix CreateSpan::run
author | gongo@localhost.localdomain |
---|---|
date | Mon, 26 Jan 2009 18:30:35 +0900 |
parents | 76bf19f9e305 |
children | de235e3ef9d3 |
rev | line source |
---|---|
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
1 /** |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
2 * SceneGraph が増えてくると動かなくなるかもしれない。 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
3 * 一応 mainMem とかで動くようになるとは思うけど。 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
4 * だめだったら、そこら辺が怪しいと思うべき |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
5 */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
6 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
7 #include "CreatePolygonFromSceneGraph.h" |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
8 #include "polygon_pack.h" |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
9 #include "scene_graph_pack.h" |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
10 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
11 SchedDefineTask(CreatePolygonFromSceneGraph); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
12 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
13 #define SG_PACK_LOAD 10 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
14 #define SG_NODE_LOAD 11 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
15 #define PP_LOAD 12 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
16 #define PP_STORE 13 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
17 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
18 /** |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
19 * あとで直す |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
20 */ |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
21 static void |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
22 rotate(float *xyz, float *matrix) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
23 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
24 float abc[4]; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
25 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
26 abc[0] = xyz[0]; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
27 abc[1] = xyz[1]; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
28 abc[2] = xyz[2]; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
29 abc[3] = xyz[3]; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
30 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
31 for(int i=0; i<4; i++) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
32 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
33 xyz[i] = abc[0]*matrix[i] + abc[1]*matrix[i+4] + abc[2]*matrix[i+8] + abc[3]*matrix[i+12]; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
34 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
35 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
36 |
200 | 37 static void |
38 apply_matrix(float *xyz, float *mat) | |
39 { | |
40 float tmp[4]; | |
41 | |
42 tmp[0] = xyz[0]; | |
43 tmp[1] = xyz[1]; | |
44 tmp[2] = xyz[2]; | |
45 tmp[3] = xyz[3]; | |
46 | |
47 for (int i = 0; i < 4; i++) { | |
48 xyz[i] = tmp[0]*mat[i*4+0] + tmp[1]*mat[i*4+1] | |
49 + tmp[2]*mat[i*4+2] + tmp[3]*mat[i*4+3]; | |
50 } | |
51 } | |
52 | |
53 float fx = 1.0f; | |
54 float fy = 1.0f; | |
55 float fz = 0.9f; | |
56 float fd = 0.05f; | |
57 | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
58 int |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
59 CreatePolygonFromSceneGraph::run(void *rbuf, void *wbuf) |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
60 { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
61 float xyz1[4], xyz2[4], xyz3[4]; |
200 | 62 float mat[16] = {fx, 0, 0, 0, 0, fy, 0, 0, 0, 0, 1.0f, 1.0f, 20.0f, 30.0f, 0, 0}; |
63 | |
64 //fx -= fd; | |
65 //fy -= fd; | |
66 | |
67 if (fx < 0.0f) { | |
68 fx = 0.0f; | |
69 fy = 0.0f; | |
70 fd = -fd; | |
71 } else if (fx > 1.0f) { | |
72 fx = 1.0f; | |
73 fy = 1.0f; | |
74 fd = -fd; | |
75 } | |
76 | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
77 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
78 SceneGraphPtr sg_top = (SceneGraphPtr)smanager->get_param(0); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
79 SceneGraphPtr sg = sg_top; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
80 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
81 PolygonPackPtr pp |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
82 = (PolygonPackPtr)smanager->allocate(sizeof(PolygonPack)); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
83 PolygonPackPtr send_pp |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
84 = (PolygonPackPtr)smanager->allocate(sizeof(PolygonPack)); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
85 PolygonPackPtr pp_addr = (PolygonPackPtr)smanager->get_param(1); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
86 PolygonPackPtr tmp_pp; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
87 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
88 pp->init(); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
89 send_pp->init(); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
90 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
91 while (sg) { |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
92 if (sg->flag_drawable) { // sg->isDrawable() とかの方がよくね? |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
93 for (int i = 0; i < sg->size; i += 3) { |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
94 if (pp->info.size >= MAX_SIZE_TRIANGLE) { |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
95 PolygonPackPtr next; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
96 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
97 smanager->mainMem_alloc(0, sizeof(PolygonPack)); |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
98 smanager->mainMem_wait(); |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
99 next = (PolygonPackPtr)smanager->mainMem_get(0); |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
100 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
101 pp->next = next; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
102 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
103 tmp_pp = pp; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
104 pp = send_pp; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
105 send_pp = tmp_pp; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
106 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
107 smanager->dma_wait(PP_STORE); |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
108 smanager->dma_store(send_pp, (uint32)pp_addr, |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
109 sizeof(PolygonPack), PP_STORE); |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
110 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
111 pp_addr = next; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
112 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
113 smanager->dma_wait(PP_LOAD); |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
114 smanager->dma_load(pp, (uint32)pp_addr, |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
115 sizeof(PolygonPack), PP_LOAD); |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
116 smanager->dma_wait(PP_LOAD); |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
117 pp->init(); |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
118 } |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
119 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
120 TrianglePack *triangle = &pp->tri[pp->info.size++]; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
121 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
122 xyz1[0] = sg->data[(i+0)*3]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
123 xyz1[1] = sg->data[(i+0)*3+1]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
124 xyz1[2] = sg->data[(i+0)*3+2]*-1; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
125 xyz1[3] = 1; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
126 xyz2[0] = sg->data[(i+1)*3]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
127 xyz2[1] = sg->data[(i+1)*3+1]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
128 xyz2[2] = sg->data[(i+1)*3+2]*-1; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
129 xyz2[3] = 1; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
130 xyz3[0] = sg->data[(i+2)*3]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
131 xyz3[1] = sg->data[(i+2)*3+1]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
132 xyz3[2] = sg->data[(i+2)*3+2]*-1; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
133 xyz3[3] = 1; |
176 | 134 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
135 rotate(xyz1, sg->matrix); |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
136 rotate(xyz2, sg->matrix); |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
137 rotate(xyz3, sg->matrix); |
200 | 138 |
203 | 139 //apply_matrix(xyz1, mat); |
140 //apply_matrix(xyz2, mat); | |
141 //apply_matrix(xyz3, mat); | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
142 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
143 triangle->ver1.x = xyz1[0]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
144 triangle->ver1.y = xyz1[1]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
145 triangle->ver1.z = xyz1[2]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
146 triangle->ver1.tex_x = sg->data[(i+0)*3 + sg->size*6]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
147 triangle->ver1.tex_y = sg->data[(i+0)*3 + sg->size*6+1]; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
148 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
149 triangle->ver2.x = xyz2[0]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
150 triangle->ver2.y = xyz2[1]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
151 triangle->ver2.z = xyz2[2]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
152 triangle->ver2.tex_x = sg->data[(i+1)*3 + sg->size*6]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
153 triangle->ver2.tex_y = sg->data[(i+1)*3 + sg->size*6+1]; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
154 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
155 triangle->ver3.x = xyz3[0]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
156 triangle->ver3.y = xyz3[1]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
157 triangle->ver3.z = xyz3[2]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
158 triangle->ver3.tex_x = sg->data[(i+2)*3 + sg->size*6]; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
159 triangle->ver3.tex_y = sg->data[(i+2)*3 + sg->size*6+1]; |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
160 |
202
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
161 triangle->tex_info.addr = sg->texture_info.pixels; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
162 triangle->tex_info.width = sg->texture_info.t_w; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
163 triangle->tex_info.height = sg->texture_info.t_h; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
164 triangle->tex_info.scale_max = sg->texture_info.scale_max; |
76bf19f9e305
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
200
diff
changeset
|
165 } |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
166 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
167 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
168 if (sg->children != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
169 sg = sg->children; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
170 } else if (sg->brother != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
171 sg = sg->brother; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
172 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
173 while (sg) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
174 if (sg->brother != NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
175 sg = sg->brother; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
176 break; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
177 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
178 if (sg->parent == NULL) { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
179 sg = NULL; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
180 break; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
181 } else { |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
182 sg = sg->parent; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
183 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
184 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
185 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
186 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
187 } |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
188 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
189 smanager->dma_wait(PP_STORE); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
190 smanager->dma_store(pp, (uint32)pp_addr, |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
191 sizeof(PolygonPack), PP_STORE); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
192 smanager->dma_wait(PP_STORE); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
193 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
194 free(pp); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
195 free(send_pp); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
196 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
197 return 0; |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff
changeset
|
198 } |