comparison Renderer/test_render/Tapestry.h @ 283:15bfacccde99 draft

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