annotate TaskManager/Test/test_render/task/CreatePolygonFromSceneGraph.cpp @ 354:81b25e5d5379

add example/get_segment and change spe/DrawSpan.cpp
author koba
date Wed, 15 Jul 2009 17:39:51 +0900
parents e1d24c951408
children b89ba1d96fff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 /**
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 * SceneGraph が増えてくると動かなくなるかもしれない。
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3 * 一応 mainMem とかで動くようになるとは思うけど。
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
4 * だめだったら、そこら辺が怪しいと思うべき
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
5 */
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
6
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
7 #include "CreatePolygonFromSceneGraph.h"
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
8 #include "polygon_pack.h"
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
9 #include "scene_graph_pack.h"
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
10
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
11 SchedDefineTask(CreatePolygonFromSceneGraph);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
13 #define SG_PACK_LOAD 10
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14 #define SG_NODE_LOAD 11
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
15 #define PP_LOAD 12
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
16 #define PP_STORE 13
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
17
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
18 /**
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
19 * ベクトルに行列を乗算する
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
20 * @param[out] v vector (float[4])
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
21 * @param[in] m matrix (float[16])
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
22 */
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
23 static void
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
24 ApplyMatrix(float *v, float *m)
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 {
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
26 float t[4];
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
27
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
28 t[0] = v[0];
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
29 t[1] = v[1];
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
30 t[2] = v[2];
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
31 t[3] = v[3];
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
33 for (int i = 0; i < 4; i++) {
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
34 v[i] = t[0]*m[i] + t[1]*m[i+4] + t[2]*m[i+8] + t[3]*m[i+12];
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37
354
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
38 static void
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
39 ApplyNormalMatrix(float *v, float *m)
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
40 {
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
41 float t[4];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
42
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
43 t[0] = v[0];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
44 t[1] = v[1];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
45 t[2] = v[2];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
46
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
47 for (int i = 0; i < 3; i++) {
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
48 v[i] = t[0]*m[i] + t[1]*m[i+4] + t[2]*m[i+8];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
49 }
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
50 }
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
51
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
52
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
53 /**
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
54 * 行列の積
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
55 *
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
56 * @param[out] m0 output matrix
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
57 * @param[in] m1 input left matrix
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
58 * @param[in] m2 input right matrix
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
59 */
238
e1d24c951408 warning clean
admin@mcbk.cr.ie.u-ryukyu.ac.jp
parents: 228
diff changeset
60 /*
200
10ad99550ee8 fix run_draw
gongo@localhost.localdomain
parents: 176
diff changeset
61 static void
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
62 MulMatrix(float *m0, float *m1, float *m2) //xyz[16]
200
10ad99550ee8 fix run_draw
gongo@localhost.localdomain
parents: 176
diff changeset
63 {
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
64 for(int t = 0; t < 16; t += 4) {
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
65 for (int i = 0; i < 4; i++) {
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
66 m0[t+i] =
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
67 m1[t+0]*m2[ i ] + m1[t+1]*m2[i+ 4] +
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
68 m1[t+2]*m2[i+8] + m1[t+3]*m2[i+12];
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
69 }
200
10ad99550ee8 fix run_draw
gongo@localhost.localdomain
parents: 176
diff changeset
70 }
10ad99550ee8 fix run_draw
gongo@localhost.localdomain
parents: 176
diff changeset
71 }
238
e1d24c951408 warning clean
admin@mcbk.cr.ie.u-ryukyu.ac.jp
parents: 228
diff changeset
72 */
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
73 int
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
74 CreatePolygonFromSceneGraph::run(void *rbuf, void *wbuf)
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
75 {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
76 float xyz1[4], xyz2[4], xyz3[4];
354
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
77 /*
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
78 *頂点毎に法線ベクトルがある
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
79 *面毎じゃない
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
80 *なにかに使うのかな?わからないから、一応とっておく。
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
81 *by yutaka
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
82 */
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
83 float normal1[4],normal2[4],normal3[4];
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
84
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
85 SceneGraphPtr sg_top = (SceneGraphPtr)smanager->get_param(0);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
86 SceneGraphPtr sg = sg_top;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
87
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
88 PolygonPackPtr pp
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
89 = (PolygonPackPtr)smanager->allocate(sizeof(PolygonPack));
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
90 PolygonPackPtr send_pp
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
91 = (PolygonPackPtr)smanager->allocate(sizeof(PolygonPack));
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
92 PolygonPackPtr pp_addr = (PolygonPackPtr)smanager->get_param(1);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
93 PolygonPackPtr tmp_pp;
205
gongo@localhost.localdomain
parents: 203
diff changeset
94
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
95 pp->init();
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
96 send_pp->init();
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
97
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
98 while (sg) {
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
99 if (sg->flag_drawable) { // sg->isDrawable() とかの方がよくね?
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
100 for (int i = 0; i < sg->size; i += 3) {
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
101 if (pp->info.size >= MAX_SIZE_TRIANGLE) {
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
102 PolygonPackPtr next;
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
103
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
104 smanager->mainMem_alloc(0, sizeof(PolygonPack));
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
105 smanager->mainMem_wait();
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
106 next = (PolygonPackPtr)smanager->mainMem_get(0);
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
107
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
108 pp->next = next;
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
109
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
110 tmp_pp = pp;
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
111 pp = send_pp;
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
112 send_pp = tmp_pp;
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
113
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
114 smanager->dma_wait(PP_STORE);
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
115 smanager->dma_store(send_pp, (uint32)pp_addr,
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
116 sizeof(PolygonPack), PP_STORE);
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
117
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
118 pp_addr = next;
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
119
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
120 smanager->dma_wait(PP_LOAD);
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
121 smanager->dma_load(pp, (uint32)pp_addr,
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
122 sizeof(PolygonPack), PP_LOAD);
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
123 smanager->dma_wait(PP_LOAD);
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
124 pp->init();
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
125 }
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
126
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
127 TrianglePack *triangle = &pp->tri[pp->info.size++];
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
128
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
129 xyz1[0] = sg->coord_xyz[(i+0)*3];
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
130 xyz1[1] = sg->coord_xyz[(i+0)*3+1];
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
131 xyz1[2] = sg->coord_xyz[(i+0)*3+2]*-1.0f;
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
132 xyz1[3] = 1.0f;
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
133
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
134 xyz2[0] = sg->coord_xyz[(i+1)*3];
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
135 xyz2[1] = sg->coord_xyz[(i+1)*3+1];
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
136 xyz2[2] = sg->coord_xyz[(i+1)*3+2]*-1.0f;
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
137 xyz2[3] = 1.0f;
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
138
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
139 xyz3[0] = sg->coord_xyz[(i+2)*3];
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
140 xyz3[1] = sg->coord_xyz[(i+2)*3+1];
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
141 xyz3[2] = sg->coord_xyz[(i+2)*3+2]*-1.0f;
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
142 xyz3[3] = 1.0f;
200
10ad99550ee8 fix run_draw
gongo@localhost.localdomain
parents: 176
diff changeset
143
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
144 // sg->matrix = 回転行列*透視変換行列
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
145 ApplyMatrix(xyz1, sg->matrix);
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
146 ApplyMatrix(xyz2, sg->matrix);
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
147 ApplyMatrix(xyz3, sg->matrix);
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
148
212
gongo@localhost.localdomain
parents: 206
diff changeset
149 xyz1[0] /= xyz1[2];
gongo@localhost.localdomain
parents: 206
diff changeset
150 xyz1[1] /= xyz1[2];
gongo@localhost.localdomain
parents: 206
diff changeset
151 xyz2[0] /= xyz2[2];
gongo@localhost.localdomain
parents: 206
diff changeset
152 xyz2[1] /= xyz2[2];
gongo@localhost.localdomain
parents: 206
diff changeset
153 xyz3[0] /= xyz3[2];
gongo@localhost.localdomain
parents: 206
diff changeset
154 xyz3[1] /= xyz3[2];
gongo@localhost.localdomain
parents: 206
diff changeset
155
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
156 triangle->ver1.x = xyz1[0];
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
157 triangle->ver1.y = xyz1[1];
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
158 triangle->ver1.z = xyz1[2];
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
159 triangle->ver1.tex_x = sg->coord_tex[(i+0)*3];
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
160 triangle->ver1.tex_y = sg->coord_tex[(i+0)*3+1];
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
161
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
162 triangle->ver2.x = xyz2[0];
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
163 triangle->ver2.y = xyz2[1];
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
164 triangle->ver2.z = xyz2[2];
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
165 triangle->ver2.tex_x = sg->coord_tex[(i+1)*3];
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
166 triangle->ver2.tex_y = sg->coord_tex[(i+1)*3+1];
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
167
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
168 triangle->ver3.x = xyz3[0];
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
169 triangle->ver3.y = xyz3[1];
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
170 triangle->ver3.z = xyz3[2];
228
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
171 triangle->ver3.tex_x = sg->coord_tex[(i+2)*3];
c254a2bd1b34 remove SceneGraph::data, add SceneGraph::coord_xyz, coord_tex, normal
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 221
diff changeset
172 triangle->ver3.tex_y = sg->coord_tex[(i+2)*3+1];
354
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
173
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
174 //法線もApplyMatrixとかするのかな?一応値をとっておくby yutaka
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
175
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
176 normal1[0] = sg->normal[(i+0)*3];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
177 normal1[1] = sg->normal[(i+0)*3+1];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
178 normal1[2] = sg->normal[(i+0)*3+2]*-1.0f;
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
179 normal1[3] = 1.0f;
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
180
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
181 normal2[0] = sg->normal[(i+1)*3];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
182 normal2[1] = sg->normal[(i+1)*3+1];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
183 normal2[2] = sg->normal[(i+1)*3+2]*-1.0f;
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
184 normal2[3] = 1.0f;
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
185
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
186 normal3[0] = sg->normal[(i+2)*3];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
187 normal3[1] = sg->normal[(i+2)*3+1];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
188 normal3[2] = sg->normal[(i+2)*3+2]*-1.0f;
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
189 normal3[3] = 1.0f;
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
190
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
191 ApplyNormalMatrix(normal1,sg->matrix);
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
192
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
193 //ここでpolygonに法線ベクトルの情報がわたったby yutaka
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
194
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
195 triangle->normal1.x = normal1[0];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
196 triangle->normal1.y = normal1[1];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
197 triangle->normal1.z = normal1[2];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
198
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
199 triangle->normal2.x = normal2[0];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
200 triangle->normal2.y = normal2[1];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
201 triangle->normal2.z = normal2[2];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
202
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
203 triangle->normal3.x = normal3[0];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
204 triangle->normal3.y = normal3[1];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
205 triangle->normal3.z = normal3[2];
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
206
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents: 238
diff changeset
207
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
208
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
209 triangle->tex_info.addr = sg->texture_info.pixels;
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
210 triangle->tex_info.width = sg->texture_info.t_w;
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
211 triangle->tex_info.height = sg->texture_info.t_h;
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
212 triangle->tex_info.scale_max = sg->texture_info.scale_max;
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 200
diff changeset
213 }
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
214 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
215
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
216 if (sg->children != NULL) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
217 sg = sg->children;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
218 } else if (sg->brother != NULL) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
219 sg = sg->brother;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
220 } else {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
221 while (sg) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
222 if (sg->brother != NULL) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
223 sg = sg->brother;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
224 break;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
225 } else {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
226 if (sg->parent == NULL) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
227 sg = NULL;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
228 break;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
229 } else {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
230 sg = sg->parent;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
231 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
232 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
233 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
234 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
235 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
236
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
237 smanager->dma_wait(PP_STORE);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
238 smanager->dma_store(pp, (uint32)pp_addr,
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
239 sizeof(PolygonPack), PP_STORE);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
240 smanager->dma_wait(PP_STORE);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
241
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
242 free(pp);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
243 free(send_pp);
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
244
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
245 return 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
246 }