summaryrefslogtreecommitdiff
path: root/common/tr.h
blob: f1394c6aa2457cf2f8dc18a10e106e4cca2dea4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// TR.h: interface for the TiledRender class.
//
//////////////////////////////////////////////////////////////////////

#ifndef _TR_H_
#define _TR_H_

typedef enum {
	TR_TILE_WIDTH = 100,
	TR_TILE_HEIGHT,
	TR_TILE_BORDER,
	TR_IMAGE_WIDTH,
	TR_IMAGE_HEIGHT,
	TR_ROWS,
	TR_COLUMNS,
	TR_CURRENT_ROW,
	TR_CURRENT_COLUMN,
	TR_CURRENT_TILE_WIDTH,
	TR_CURRENT_TILE_HEIGHT,
	TR_ROW_ORDER,
	TR_TOP_TO_BOTTOM,
	TR_BOTTOM_TO_TOP
} TRenum;

class TiledRender
{
public:
	TiledRender();
	virtual ~TiledRender();

	void TileSize(int width, int height, int border);
	void TileBuffer(TRenum format, TRenum type, void *image);
	void ImageSize(int width, int height);
	void ImageBuffer(TRenum format, TRenum type, void *image);
	void RowOrder(TRenum order);
	void Ortho(double left, double right, double bottom, double top, double zNear, double zFar);
	void Frustum(double left, double right, double bottom, double top, double zNear, double zFar);
	void Perspective(double fovy, double aspect, double zNear, double zFar );
	void RasterPos3f(float x, float y, float z);
	int Get(TRenum param);
	int EndTile();
	void BeginTile();

	// Final image parameters
	int m_ImageWidth, m_ImageHeight;
	TRenum m_ImageFormat, m_ImageType;
	void *m_ImageBuffer;

	// Tile parameters
	int m_TileWidth, m_TileHeight;
	int m_TileWidthNB, m_TileHeightNB;
	int m_TileBorder;
	TRenum m_TileFormat, m_TileType;
	void *m_TileBuffer;

	// Projection parameters
	bool m_Perspective;
	double m_Left;
	double m_Right;
	double m_Bottom;
	double m_Top;
	double m_Near;
	double m_Far;

	// Misc
	TRenum m_RowOrder;
	int m_Rows, m_Columns;
	int m_CurrentTile;
	int m_CurrentTileWidth, m_CurrentTileHeight;
	int m_CurrentRow, m_CurrentColumn;

	GLint m_ViewportSave[4];
};

#endif // _TR_H_