annotate TaskManager/Test/test_render/Tapestry.h @ 222:0351818cf0fe draft

fix
author gongo@localhost.localdomain
date Tue, 10 Feb 2009 13:09:52 +0900
parents e75f9eb97180
children a314d8cd2082
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
117
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 #ifndef INCLUDED_TAPESTRY
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 #define INCLUDED_TAPESTRY
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
4 #ifndef INCLUDED_TYPES
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
5 # include "types.h"
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
6 #endif
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
7
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
8 #ifndef INCLUDED_VIEWER_TYPES
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
9 # include "viewer_types.h"
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
10 #endif
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
11
117
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12 /**
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
13 * image file name と tapestry DB の binary tree
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
15 * // PPE
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
16 * main memory の tapestry DB (Array)
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
17 * tapestry DB への accessor
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
18 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
19 * TapestryPtr getTapestry(int TapestryID);
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
20 * TilePtr getTile(TapestryPtr tapsetry, int tx, int ty, int scale);
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
21 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
22 * SPE が生成する tapestry List (in CreateSpan)
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
23 * (no texture image)
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
24 * @in TapestryDBPtr, Tapestry ID, x, y, tx, ty, px, py
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 * x, y : polygon の中の平面座標
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
26 * tx, ty : texture の座標
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
27 * px, py : texture の分割数
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
28 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
29 * @out (TilePtr, tix1, tiy1, tix2, tiy2)*
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
30 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
31 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32 * SPE に渡す tapestry List
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
33 * @in Tile
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
34 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35 * // SPE
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36 * SPE 内部での tapestry DB (Hash)
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37 * TapestryID, scale, TilePtr, Tile
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
38 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
39 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
40 * SPE 内部での tapestry DB への accessor
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
41 * TileEntryPtr getTile(int TapestryID, int tx, int ty, int scale);
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
42 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
43 * if (TileEntry == NULL) {
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
44 * DMA read
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
45 * }
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
46 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
47 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
48 * Rendering
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
49 * 1pass Zbuffer と Texture の有無の判定
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
50 * if (zbuffer ok) {
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
51 * if (texture ある) {
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
52 * zbuffer 、linebunf に書き込む
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
53 * } else {
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
54 * texture の load list に加える
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
55 * zbuffer だけ更新しておく
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
56 * }
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
57 * } else {
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
58 * 無視
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
59 * }
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
60 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
61 * 1pass で texture が一杯になったら、中断して
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
62 * ここまでのを書き込んどけ
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
63 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
64 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
65 * 2pass rgb の書き込み
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
66 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
67 * if (zbuffer の値が自分と一緒) {
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
68 * read した texture みて
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
69 * 書き込め!
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
70 * }
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
71 *
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
72 */
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
73 struct texture_block {
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
74
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
75 };
118
62d76597d6a2 fix Makefile
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 117
diff changeset
76 #if 0
117
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
77 struct TileList {
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
78 TilePtr tile;
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
79 int tix1, tiy1, tix2, tiy2;
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
80 };
11433ea016f5 add Tapestry.h
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
81 #endif
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
82
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
83 typedef struct {
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
84 uint32 pixel[TEXTURE_BLOCK_SIZE]; // 8*8
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
85 uint32 *texture_addr;
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
86 int pad[3];
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
87 } Tile, *TilePtr;
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
88
193
gongo@localhost.localdomain
parents: 186
diff changeset
89 #define MAX_TILE 128
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
90
176
gongo@localhost.localdomain
parents: 173
diff changeset
91 /**
gongo@localhost.localdomain
parents: 173
diff changeset
92 * TileList 中の Tile の追い出しは、現在 FIFO で実装している
gongo@localhost.localdomain
parents: 173
diff changeset
93 */
173
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
94 class TileList {
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
95 public:
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
96 int curIndex;
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
97 int pad[3];
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
98 Tile tile[MAX_TILE];
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
99
173
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
100 TileList(void) {
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
101 curIndex = 0;
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
102 }
173
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
103
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
104 /**
176
gongo@localhost.localdomain
parents: 173
diff changeset
105 * 次に扱う tile を取得する
gongo@localhost.localdomain
parents: 173
diff changeset
106 *
gongo@localhost.localdomain
parents: 173
diff changeset
107 * @return tile
gongo@localhost.localdomain
parents: 173
diff changeset
108 *
173
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
109 * tile[] をリングバスっぽく扱うことで
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
110 * FIFO を実現することに。
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
111 */
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
112 TilePtr nextTile(void) {
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
113 TilePtr t = &tile[curIndex];
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
114 curIndex = (curIndex + 1) % MAX_TILE;
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
115 return t;
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
116 }
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
117
176
gongo@localhost.localdomain
parents: 173
diff changeset
118 /**
gongo@localhost.localdomain
parents: 173
diff changeset
119 * TileList のクリア
210
e75f9eb97180 fix DrawSpan
gongo@localhost.localdomain
parents: 193
diff changeset
120 * //tile 自体は clear する必要は無い
e75f9eb97180 fix DrawSpan
gongo@localhost.localdomain
parents: 193
diff changeset
121 * あるかもしれない
176
gongo@localhost.localdomain
parents: 173
diff changeset
122 */
173
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
123 void clear(void) {
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
124 curIndex = 0;
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
125 }
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
126 };
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
127
1e62bd02f820 add scale
gongo@localhost.localdomain
parents: 167
diff changeset
128 typedef TileList* TileListPtr;
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 118
diff changeset
129
118
62d76597d6a2 fix Makefile
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 117
diff changeset
130 #endif