Mercurial > hg > Members > kono > Cerium
comparison Renderer/Engine/Tapestry.h @ 507:735f76483bb2
Reorganization..
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Oct 2009 09:39:35 +0900 |
parents | Renderer/test_render/Tapestry.h@55ea4465b1a2 |
children | 32a7260fad2f |
comparison
equal
deleted
inserted
replaced
506:1d4a8a86f26b | 507:735f76483bb2 |
---|---|
1 #ifndef INCLUDED_TAPESTRY | |
2 #define INCLUDED_TAPESTRY | |
3 | |
4 #include "types.h" | |
5 #include "viewer_types.h" | |
6 #include "MemorySegment.h" | |
7 #include "MemList.h" | |
8 | |
9 /** | |
10 * image file name と tapestry DB の binary tree | |
11 * | |
12 * // PPE | |
13 * main memory の tapestry DB (Array) | |
14 * tapestry DB への accessor | |
15 * | |
16 * TapestryPtr getTapestry(int TapestryID); | |
17 * TilePtr getTile(TapestryPtr tapsetry, int tx, int ty, int scale); | |
18 * | |
19 * SPE が生成する tapestry List (in CreateSpan) | |
20 * (no texture image) | |
21 * @in TapestryDBPtr, Tapestry ID, x, y, tx, ty, px, py | |
22 * x, y : polygon の中の平面座標 | |
23 * tx, ty : texture の座標 | |
24 * px, py : texture の分割数 | |
25 * | |
26 * @out (TilePtr, tix1, tiy1, tix2, tiy2)* | |
27 * | |
28 * | |
29 * SPE に渡す tapestry List | |
30 * @in Tile | |
31 * | |
32 * // SPE | |
33 * SPE 内部での tapestry DB (Hash) | |
34 * TapestryID, scale, TilePtr, Tile | |
35 * | |
36 * | |
37 * SPE 内部での tapestry DB への accessor | |
38 * TileEntryPtr getTile(int TapestryID, int tx, int ty, int scale); | |
39 * | |
40 * if (TileEntry == NULL) { | |
41 * DMA read | |
42 * } | |
43 * | |
44 * | |
45 * Rendering | |
46 * 1pass Zbuffer と Texture の有無の判定 | |
47 * if (zbuffer ok) { | |
48 * if (texture ある) { | |
49 * zbuffer 、linebunf に書き込む | |
50 * } else { | |
51 * texture の load list に加える | |
52 * zbuffer だけ更新しておく | |
53 * } | |
54 * } else { | |
55 * 無視 | |
56 * } | |
57 * | |
58 * 1pass で texture が一杯になったら、中断して | |
59 * ここまでのを書き込んどけ | |
60 * | |
61 * | |
62 * 2pass rgb の書き込み | |
63 * | |
64 * if (zbuffer の値が自分と一緒) { | |
65 * read した texture みて | |
66 * 書き込め! | |
67 * } | |
68 * | |
69 */ | |
70 struct texture_block { | |
71 | |
72 }; | |
73 | |
74 #ifdef USE_MEMLIST | |
75 typedef MemorySegment Tile, *TilePtr; | |
76 #else | |
77 typedef struct { | |
78 uint32 data[TEXTURE_BLOCK_SIZE]; // 8*8 | |
79 uint32 *address; | |
80 int pad[3]; | |
81 } Tile, *TilePtr; | |
82 #endif | |
83 | |
84 #define MAX_TILE 128 | |
85 | |
86 /** | |
87 * TileList 中の Tile の追い出しは、現在 FIFO で実装している | |
88 * これは汎用のサイズ別 freelist に置き換える | |
89 * freelist は double linked list で、LRU をサポートする | |
90 */ | |
91 #ifdef USE_MEMLIST | |
92 class TileList : public MemList { | |
93 TileList(MemorySegment* ms) : MemList(ms) {} | |
94 | |
95 /*! | |
96 中身は同じ | |
97 */ | |
98 }; | |
99 #else | |
100 class TileList { | |
101 public: | |
102 int curIndex; | |
103 int pad[3]; | |
104 Tile tile[MAX_TILE]; | |
105 | |
106 TileList(void) { | |
107 curIndex = 0; | |
108 } | |
109 | |
110 /** | |
111 * 次に扱う tile を取得する | |
112 * | |
113 * @return tile | |
114 * | |
115 * tile[] をリングバスっぽく扱うことで | |
116 * FIFO を実現することに。 | |
117 */ | |
118 TilePtr nextTile(void) { | |
119 TilePtr t = &tile[curIndex]; | |
120 curIndex = (curIndex + 1) % MAX_TILE; | |
121 return t; | |
122 } | |
123 | |
124 /** | |
125 * TileList のクリア | |
126 * //tile 自体は clear する必要は無い | |
127 * あるかもしれない | |
128 */ | |
129 void clear(void) { | |
130 curIndex = 0; | |
131 } | |
132 }; | |
133 #endif | |
134 | |
135 typedef TileList* TileListPtr; | |
136 | |
137 #endif |