annotate TaskManager/Test/test_render/spe/CreateSpan.cpp @ 147:3ecf43bd1a35

fix
author gongo@charles.cr.ie.u-ryukyu.ac.jp
date Tue, 02 Dec 2008 15:47:25 +0900
parents 2284efc89f63
children 9642aeef298d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #include "CreateSpan.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #include "viewer_types.h"
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4 static const int SPAN_PACK_LOAD = 5;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5 static const int SPAN_PACK_STORE = 6;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
6 static const int POLYGON_PACK_LOAD = 7;
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
7 static const int TILE_ALLOCATE = 8;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
8 static const int TILE_LOAD = 9;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
9 static const int TILE_STORE = 10;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
11 static SpanPackPtr spack = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12 static SpanPackPtr send_spack = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13 static int prev_index = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
15 SchedDefineTask(CreateSpan);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
16
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
17 static float
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18 calc(float f1, float f2,int i, float base)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
20 float ans;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21 ans = f1/f2*i + base;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
22 return ans;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
23 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
24
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
25
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
26 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
27 * TrianglePack から、vMin, vMid, vMax を求める
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
28 *
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29 * @param [triPack] TrianglePack
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
30 * @param [vMin] [vMid] [vMax]
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
32 static void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
33 make_vertex(TrianglePack *triPack,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34 VertexPackPtr *vMin, VertexPackPtr *vMid, VertexPackPtr *vMax)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
35 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36 if (triPack->ver1.y <= triPack->ver2.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 if (triPack->ver2.y <= triPack->ver3.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38 *vMin = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
39 *vMid = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
40 *vMax = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41 } else if (triPack->ver3.y <= triPack->ver1.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
42 *vMin = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
43 *vMid = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
44 *vMax = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
45 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
46 *vMin = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
47 *vMid = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
48 *vMax = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
49 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
50 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
51 if (triPack->ver1.y <= triPack->ver3.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
52 *vMin = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
53 *vMid = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
54 *vMax = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
55 } else if (triPack->ver3.y <= triPack->ver2.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
56 *vMin = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
57 *vMid = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
58 *vMax = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
59 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
60 *vMin = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
61 *vMid = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
62 *vMax = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
63 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
64 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
65 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
66
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
67 static void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
68 make_vMid10(VertexPack *v, VertexPack *vMin,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
69 VertexPack *vMid, VertexPack *vMax)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
70 {
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
71 //int d, d1;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
72 float d;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
73 int d1;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
74
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
75 d = vMax->y - vMin->y;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
76 d1 = (int)(vMid->y - vMin->y);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
77
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
78 v->tex_x = calc(vMax->tex_x - vMin->tex_x, d, d1, vMin->tex_x);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
79 v->tex_y = calc(vMax->tex_y - vMin->tex_y, d, d1, vMin->tex_y);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
80 v->x = calc(vMax->x - vMin->x, d, d1, vMin->x);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
81 v->y = vMid->y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
82 v->z = calc(vMax->z - vMin->z, d, d1, vMin->z);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
83 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
84
133
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
85
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
86 /**
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
87 * Span の1ドットずつ、必要なテクスチャのブロック(Tile)を求めていく
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
88 *
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
89 */
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
90 void
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
91 CreateSpan::setTile(SpanPtr span)
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
92 {
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
93 TileInfoListPtr tilelist =
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
94 (TileInfoListPtr)smanager->allocate(sizeof(TileInfoList));
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
95 TileInfoListPtr send_tilelist =
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
96 (TileInfoListPtr)smanager->allocate(sizeof(TileInfoList));
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
97 TileInfoListPtr tilelist_addr;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
98 TileInfoListPtr send_tilelist_addr;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
99 TileInfoPtr tile;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
100
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
101 int cur_x = 0;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
102 int len = 0;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
103
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
104 smanager->mainMem_wait();
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
105 tilelist_addr = (TileInfoListPtr)smanager->mainMem_get(TILE_ALLOCATE);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
106 span->tilelist = tilelist_addr;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
107
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
108 float tex1 = span->tex_x1;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
109 float tex2 = span->tex_x2;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
110 float tey1 = span->tex_y1;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
111 float tey2 = span->tex_y2;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
112 int tex_xpos;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
113 int tex_ypos;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
114 int end = span->length_x;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
115
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
116 if (span->length_x == 1) {
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
117 tilelist->init();
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
118 tile = &tilelist->tileinfo[tilelist->size++];
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
119
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
120 tex_xpos = (int)((span->tex_width-1) * tex1);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
121 tex_ypos = (int)((span->tex_height-1) * tey1);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
122
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
123 tile->tix = tex_xpos;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
124 tile->tiy = tex_ypos;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
125 } else {
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
126 while (cur_x < span->length_x) {
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
127 if (cur_x + MAX_TILE_LIST < span->length_x) {
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
128 len = MAX_TILE_LIST;
147
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 146
diff changeset
129 smanager->mainMem_alloc(TILE_ALLOCATE, sizeof(TileInfoList));
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
130 } else {
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
131 len = span->length_x - cur_x;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
132 }
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
133
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
134 float tex_x, tex_y;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
135
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
136 tilelist->init();
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
137
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
138 for (int i = cur_x; i < cur_x + len; i++) {
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
139 tile = &tilelist->tileinfo[tilelist->size++];
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
140
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
141 tex_x = tex1*(end-1-i)/(end-1) + tex2*i/(end-1);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
142 tex_y = tey1*(end-1-i)/(end-1) + tey2*i/(end-1);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
143 if (tex_x > 1) tex_x = 1;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
144 if (tex_y > 1) tex_y = 1;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
145 tex_xpos = (int)((span->tex_height-1) * tex_x);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
146 tex_ypos = (int)((span->tex_width-1) * tex_y);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
147
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
148 tile->tix = tex_xpos;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
149 tile->tiy = tex_ypos;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
150 }
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
151
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
152 if (cur_x + MAX_TILE_LIST < span->length_x) {
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
153 TileInfoListPtr tmp = tilelist;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
154 tilelist = send_tilelist;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
155 send_tilelist = tmp;
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
156
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
157 send_tilelist_addr = tilelist_addr;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
158
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
159 smanager->mainMem_wait();
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
160 tilelist_addr =
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
161 (TileInfoListPtr)smanager->mainMem_get(TILE_ALLOCATE);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
162
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
163 send_tilelist->next = tilelist_addr;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
164
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
165 smanager->dma_wait(TILE_STORE);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
166 smanager->dma_store(send_tilelist, (uint32)send_tilelist_addr,
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
167 sizeof(TileInfoList), TILE_STORE);
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
168
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
169 tilelist->init();
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
170 }
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
171
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
172 cur_x += MAX_TILE_LIST;
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
173 }
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
174 }
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
175
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
176 smanager->dma_wait(TILE_STORE);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
177 tilelist->next = 0; // ?
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
178 smanager->dma_store(tilelist, (uint32)tilelist_addr,
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
179 sizeof(TileInfoList), TILE_STORE);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
180 free(send_tilelist);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
181
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
182 smanager->dma_wait(TILE_STORE);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
183
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
184 free(tilelist);
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
185 }
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
186
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
187 /**
133
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
188 * x軸に水平な辺を持つ三角形ポリゴンから、
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
189 * Span を抜き出す
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
190 */
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
191 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
192 CreateSpan::half_triangle(SpanPackPtr *spackList,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
193 int charge_y_top, int charge_y_end,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
194 long *tex_addr, long tex_width, long tex_height,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
195 VertexPack *vMin,VertexPack *vMid,VertexPack *vMid10)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
196 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
197 float tmp_z,tmp_tex1, tmp_tex2 ,tmp_tey1,tmp_tey2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
198 float tmp_xpos,tmp_end,tmp_zpos;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
199 float start_z, end_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
200 float start_tex_x, end_tex_x, start_tex_y, end_tex_y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
201 int x, y, length;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
202
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
203 #if 1
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
204 // これじゃないと
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
205 // テクスチャの貼りに微妙に隙間が。謎だ
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
206 int start_y = (int)vMid->y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
207 int end_y = (int)vMin->y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
208 #else
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
209 float start_y = vMid->y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
210 float end_y = vMin->y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
211 #endif
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
212 float div_y = start_y - end_y;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
213 int k = 0;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
214 int l = 1;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
215
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
216 SpanPackPtr tmp_spack;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
217
135
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
218 /**
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
219 * 三角形ポリゴンをx軸に水平に二つに分けようとして
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
220 * ある一辺がすでに水平だった場合、つまり
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
221 * (環境によっては、back slash が 円マークかも)
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
222 *
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
223 * |\
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
224 * | \
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
225 * | \
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
226 * -----
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
227 *
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
228 *
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
229 * 上のようなポリゴンだった場合は、本来なら上の部分の三角形にだけ
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
230 * half_triangle の処理をするべきだが、現在の処理だと
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
231 * この half_triangle に「上の部分の三角形」と、
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
232 * 「『下の部分の三角形と判断してしまった』直線」が来てしまう。
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
233 * 直線の部分が来ると、calc() で 0 除算とかで、値不定で暴走するので
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
234 * 現在はこれで代用。
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
235 * half_triangle 呼ぶ前にこれを判断できれば良いかもしれない。
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
236 * てかこんなんでいいのかよ。。。
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
237 *
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
238 */
137
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
239 #if 1
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
240 if ((int)div_y == 0) {
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
241 return;
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
242 }
6cf991f28c6c SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 135
diff changeset
243 #else
135
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
244 if (vMid10->x == vMin->x && vMid10->y == vMin->y) {
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
245 return;
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
246 }
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
247 #endif
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
248
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
249 if (div_y < 0) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
250 div_y = -div_y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
251 k = 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
252 l = -1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
253 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
254
135
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
255 for (int i = k; i < (int)div_y+1; i++) {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
256 y = (int)vMin->y + i*l;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
257
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
258 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
259 * 担当 y 範囲内
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
260 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
261 if (charge_y_top <= y && y <= charge_y_end) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
262 // 1..8 を index0, 9..16 を index1 にするために y を -1
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
263 int index = (y-1) / split_screen_h;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
264
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
265 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
266 * 違う SpanPack を扱う場合、
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
267 * 現在の SpanPack をメインメモリに送り、
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
268 * 新しい SpanPack を取ってくる
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
269 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
270 if (index != prev_index) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
271 tmp_spack = spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
272 spack = send_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
273 send_spack = tmp_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
274
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
275 smanager->dma_wait(SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
276 smanager->dma_store(send_spack, (uint32)spackList[prev_index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
277 sizeof(SpanPack), SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
278
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
279 smanager->dma_load(spack, (uint32)spackList[index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
280 sizeof(SpanPack), SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
281 prev_index = index;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
282 smanager->dma_wait(SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
283 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
284
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
285 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
286 * 書き込む SpanPack が満杯だったら
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
287 * メインメモリで allocate した領域 (next) を持ってきて
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
288 * 現在の spack->next につなぎ、next を次の spack とする。
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
289 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
290 if (spack->info.size >= MAX_SIZE_SPAN) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
291 SpanPackPtr next;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
292
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
293 smanager->mainMem_alloc(0, sizeof(SpanPack));
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
294 smanager->mainMem_wait();
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
295 next = (SpanPackPtr)smanager->mainMem_get(0);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
296
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
297 spack->next = next;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
298
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
299 tmp_spack = spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
300 spack = send_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
301 send_spack = tmp_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
302
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
303 smanager->dma_wait(SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
304 smanager->dma_store(send_spack, (uint32)spackList[index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
305 sizeof(SpanPack), SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
306
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
307 spackList[index] = next;
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
308
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
309 smanager->dma_load(spack, (uint32)spackList[index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
310 sizeof(SpanPack), SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
311 smanager->dma_wait(SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
312 spack->init((index+1)*split_screen_h);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
313 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
314 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
315 /**
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
316 * 担当範囲外だったら無視
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
317 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
318 continue;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
319 }
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
320
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
321 tmp_xpos = calc(vMid10->x - vMin->x ,div_y, i, vMin->x);
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
322 tmp_end = calc(vMid->x - vMin->x ,div_y, i, vMin->x);
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
323 tmp_z = calc(vMid10->z - vMin->z ,div_y, i, vMin->z);
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
324 tmp_zpos = calc(vMid->z - vMin->z ,div_y, i, vMin->z);
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
325
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
326 length = (tmp_xpos > tmp_end)
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
327 ? (int)tmp_xpos - (int)tmp_end : (int)tmp_end - (int)tmp_xpos;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
328 if (length == 0) {
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
329 continue;
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
330 }
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
331
141
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
332 /**
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
333 * メインメモリに、Tile 用の領域確保をここで指定しておく
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
334 */
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
335 // ちと仕様変更によりここでは使わない
fc314f28b66e TileList を作ろうとしたがに動かない。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 137
diff changeset
336 // 予めやっておいて、その間に処理、だとちょっと動作が怪しいらしい
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
337 smanager->mainMem_alloc(TILE_ALLOCATE, sizeof(TileInfoList));
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
338
135
c65aee1528ef remove xml file
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
339
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
340 tmp_tex1 =((i/(div_y)) * vMid10->tex_x) +
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
341 ( ((div_y - i)/(div_y)) * vMin->tex_x);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
342 tmp_tex2 =( (i/(div_y)) * vMid->tex_x) +
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
343 ( ((div_y - i)/(div_y)) * vMin->tex_x);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
344
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
345 tmp_tey1 =( (i/(div_y)) * vMid10->tex_y) +
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
346 ( ((div_y - i)/(div_y)) * vMin->tex_y);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
347 tmp_tey2 =( (i/(div_y)) * vMid->tex_y) +
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
348 ( ((div_y - i)/(div_y)) * vMin->tex_y);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
349
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
350 if (tmp_xpos > tmp_end) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
351 x = (int)tmp_end;
133
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
352 /**
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
353 * +1 は要らない気がする・・・
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
354 */
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
355 //length = (int)(tmp_xpos)-(int)(tmp_end)+1;
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
356 length = (int)(tmp_xpos)-(int)(tmp_end);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
357 start_z = tmp_zpos;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
358 end_z = tmp_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
359 start_tex_x = tmp_tex2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
360 end_tex_x = tmp_tex1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
361 start_tex_y = tmp_tey2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
362 end_tex_y = tmp_tey1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
363 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
364 x = (int)tmp_xpos;
133
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
365 //length = (int)(tmp_end)-(int)(tmp_xpos)+1;
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
366 length = (int)(tmp_end)-(int)(tmp_xpos);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
367 start_z = tmp_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
368 end_z = tmp_zpos;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
369 start_tex_x = tmp_tex1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
370 end_tex_x = tmp_tex2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
371 start_tex_y = tmp_tey1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
372 end_tex_y = tmp_tey2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
373 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
374
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
375 smanager->dma_wait(SPAN_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
376
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
377 Span *span = &spack->span[spack->info.size++];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
378
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
379 span->tex_addr = tex_addr;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
380 span->tex_width = tex_width;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
381 span->tex_height = tex_height;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
382 span->x = x;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
383 span->y = y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
384 span->length_x = length;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
385 span->start_z = start_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
386 span->end_z = end_z;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
387 span->tex_x1 = start_tex_x;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
388 span->tex_x2 = end_tex_x;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
389 span->tex_y1 = start_tex_y;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
390 span->tex_y2 = end_tex_y;
113
6ba88fa28df6 Define New Texture Data Structure
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
391
6ba88fa28df6 Define New Texture Data Structure
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
392 // TilePtr の計算
6ba88fa28df6 Define New Texture Data Structure
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
393 // tix, tiy (Tile 内での x, y)
6ba88fa28df6 Define New Texture Data Structure
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
394 //
147
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 146
diff changeset
395 //smanager->mainMem_wait();
146
2284efc89f63 TileList の生成の修正
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 141
diff changeset
396 setTile(span);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
397 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
398 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
399
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
400
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
401 int
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
402 CreateSpan::run(void *rbuf, void *wbuf)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
403 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
404 PolygonPack *pp = (PolygonPack*)smanager->get_input(0);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
405 PolygonPack *next_pp =
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
406 (PolygonPack*)smanager->allocate(sizeof(PolygonPack));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
407 PolygonPack *free_pp = next_pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
408 PolygonPack *tmp_pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
409
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
410 TrianglePackPtr triPack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
411 VertexPackPtr vMin, vMid, vMax;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
412 VertexPackPtr vMid10
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
413 = (VertexPackPtr)smanager->allocate(sizeof(VertexPack));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
414
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
415 SpanPackPtr *spackList = (SpanPackPtr*)smanager->get_input(1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
416 spack = (SpanPackPtr)smanager->get_input(2);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
417 send_spack = (SpanPackPtr)smanager->allocate(sizeof(SpanPack));
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
418 prev_index = get_param(0);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
419
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
420 // spack と send_spack は swap しながら DMA を繰り返すので
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
421 // 自分で allocate した send_spack を覚えてないといけない
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
422 SpanPackPtr free_spack = send_spack;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
423
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
424 int charge_y_top = get_param(1);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
425 int charge_y_end = get_param(2);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
426
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
427 do {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
428 if (pp->next != NULL) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
429 smanager->dma_load(next_pp, (uint32)pp->next,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
430 sizeof(PolygonPack), POLYGON_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
431 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
432 next_pp = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
433 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
434
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
435 for (int i = 0; i < pp->info.size; i++) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
436 triPack = &pp->tri[i];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
437
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
438 #if 0
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
439 make_vertex(triPack, &vMin, &vMid, &vMax);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
440 #else
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
441 if (triPack->ver1.y <= triPack->ver2.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
442 if (triPack->ver2.y <= triPack->ver3.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
443 vMin = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
444 vMid = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
445 vMax = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
446 } else if (triPack->ver3.y <= triPack->ver1.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
447 vMin = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
448 vMid = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
449 vMax = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
450 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
451 vMin = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
452 vMid = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
453 vMax = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
454 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
455 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
456 if (triPack->ver1.y <= triPack->ver3.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
457 vMin = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
458 vMid = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
459 vMax = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
460 } else if (triPack->ver3.y <= triPack->ver2.y) {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
461 vMin = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
462 vMid = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
463 vMax = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
464 } else {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
465 vMin = &triPack->ver2;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
466 vMid = &triPack->ver3;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
467 vMax = &triPack->ver1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
468 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
469 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
470 #endif
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
471 make_vMid10(vMid10, vMin, vMid, vMax);
133
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
472
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
473 /**
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
474 * ポリゴンを、x軸に水平に分割して二つの三角形を作り、
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
475 * それぞれから Span を求める
435e0d24db39 DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 113
diff changeset
476 */
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
477 half_triangle(spackList, charge_y_top, charge_y_end,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
478 triPack->tex_addr, triPack->tex_width,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
479 triPack->tex_height, vMin, vMid, vMid10);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
480 half_triangle(spackList, charge_y_top, charge_y_end,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
481 pp->tri[0].tex_addr, pp->tri[0].tex_width,
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
482 pp->tri[0].tex_height, vMax, vMid, vMid10);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
483 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
484
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
485 smanager->dma_wait(POLYGON_PACK_LOAD);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
486
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
487 tmp_pp = pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
488 pp = next_pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
489 next_pp = tmp_pp;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
490 } while (pp);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
491
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
492 smanager->dma_wait(SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
493 smanager->dma_store(spack, (uint32)spackList[prev_index],
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
494 sizeof(SpanPack), SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
495 smanager->dma_wait(SPAN_PACK_STORE);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
496
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
497 free(free_pp);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
498 free(free_spack);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
499 free(vMid10);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
500
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
501 return 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
502 }