3
*************************************************************************
5
ArmageTron -- Just another Tron Lightcycle Game in 3D.
6
Copyright (C) 2000 Manuel Moos (manuel@moosnet.de)
8
**************************************************************************
10
This program is free software; you can redistribute it and/or
11
modify it under the terms of the GNU General Public License
12
as published by the Free Software Foundation; either version 2
13
of the License, or (at your option) any later version.
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
***************************************************************************
28
#ifndef ArmageTron_RENDER_H
29
#define ArmageTron_RENDER_H
35
#define glBegin #error glBegin disabled
36
#define glEnd #error glEnd disabled
37
#define glMatrixMode #error glEnd disabled
45
virtual void Vertex(REAL x, REAL y) = 0;
46
virtual void Vertex(REAL x, REAL y, REAL z) = 0;
47
virtual void Vertex3(REAL *x) = 0;
48
virtual void Vertex(REAL x, REAL y, REAL z, REAL w) = 0;
50
virtual void TexCoord(REAL u, REAL v) = 0;
51
virtual void TexCoord(REAL u, REAL v, REAL w) = 0;
52
virtual void TexCoord(REAL u, REAL v, REAL w, REAL t) = 0;
54
virtual void TexVertex(REAL x, REAL y, REAL z,
57
virtual void Color(REAL r, REAL g, REAL b) = 0;
58
virtual void Color(REAL r, REAL g, REAL b,REAL a) = 0;
60
virtual void End(bool force=false) = 0;
62
virtual void BeginLines() = 0;
63
virtual void BeginTriangles() = 0;
64
virtual void BeginQuads() = 0;
66
virtual void BeginLineStrip() = 0;
67
virtual void BeginTriangleStrip() = 0;
68
virtual void BeginQuadStrip() = 0;
70
virtual void IsEdge(bool ie) = 0;
72
virtual void BeginTriangleFan() = 0;
73
virtual void BeginLineLoop() = 0;
75
virtual void Line(REAL x1, REAL y1, REAL z1,
76
REAL x2, REAL y2, REAL z2);
79
virtual void ProjMatrix() = 0;
80
virtual void ModelMatrix() = 0;
81
virtual void TexMatrix() = 0;
83
virtual void PushMatrix() = 0;
84
virtual void PopMatrix() = 0;
85
virtual void MultMatrix(REAL mdata[4][4]) = 0;
87
virtual void IdentityMatrix() = 0;
88
virtual void ScaleMatrix(REAL f) = 0;
89
virtual void ScaleMatrix(REAL f1, REAL f2, REAL f3) = 0;
91
virtual void TranslateMatrix(REAL x1, REAL x2, REAL x3) = 0;
94
typedef enum {BACKFACE_CULL=0, ALPHA_BLEND, ALPHA_TEST, DEPTH_TEST,
95
SMOOTH_SHADE, Z_OFFSET,
100
void SetFlag(flag f, bool c);
103
virtual void ReallySetFlag(flag f, bool c) = 0;
104
void ChangeFlags(int before, int after) const;
106
#define STACK_DEPTH 100
108
int flagstack[STACK_DEPTH];
112
extern rRenderer *renderer;
114
inline void Vertex(REAL x, REAL y){
115
renderer->Vertex(x,y);
118
inline void Vertex(REAL x, REAL y, REAL z){
119
renderer->Vertex(x,y,z);
122
inline void Vertex3(REAL *x){
123
renderer->Vertex3(x);
126
inline void Vertex(REAL x, REAL y, REAL z, REAL w){
127
renderer->Vertex(x,y,z,w);
130
inline void TexCoord(REAL u, REAL v){
131
renderer->TexCoord(u,v);
134
inline void TexCoord(REAL u, REAL v, REAL w){
135
renderer->TexCoord(u,v,w);
138
inline void TexCoord(REAL u, REAL v, REAL w, REAL t){
139
renderer->TexCoord(u,v,w,t);
142
inline void TexVertex(REAL x, REAL y, REAL z,
144
renderer->TexVertex(x,y,z,u,v);
147
inline void Color(REAL r, REAL g, REAL b){
148
renderer->Color(r,g,b);
151
inline void Color(REAL r, REAL g, REAL b,REAL a){
152
renderer->Color(r,g,b,a);
155
inline void RenderEnd(bool force=false){
156
renderer->End(force);
159
inline void BeginLines(){
160
renderer->BeginLines();
163
inline void BeginTriangles(){
164
renderer->BeginTriangles();
167
inline void BeginQuads(){
168
renderer->BeginQuads();
171
inline void BeginLineStrip(){
172
renderer->BeginLineStrip();
175
inline void BeginLineLoop(){
176
renderer->BeginLineLoop();
179
inline void BeginTriangleStrip(){
180
renderer->BeginTriangleStrip();
183
inline void BeginQuadStrip(){
184
renderer->BeginQuadStrip();
188
inline void IsEdge(bool ie){
189
renderer->IsEdge(ie);
193
inline void BeginTriangleFan(){
194
renderer->BeginTriangleFan();
198
inline void Line(REAL x1, REAL y1, REAL z1,
199
REAL x2, REAL y2, REAL z2){
200
renderer->Line(x1,y1,z1,x2,y2,z2);
205
inline void ProjMatrix(){
206
renderer->ProjMatrix();
209
inline void ModelMatrix(){
210
renderer->ModelMatrix();
213
inline void TexMatrix(){
214
renderer->TexMatrix();
218
inline void PushMatrix(){
219
renderer->PushMatrix();
222
inline void PopMatrix(){
223
renderer->PopMatrix();
227
inline void MultMatrix(REAL mdata[4][4]){
228
renderer->MultMatrix(mdata);
232
inline void IdentityMatrix(){
233
renderer->IdentityMatrix();
236
inline void ScaleMatrix(REAL f){
237
renderer->ScaleMatrix(f);
240
inline void ScaleMatrix(REAL f1, REAL f2, REAL f3){
241
renderer->ScaleMatrix(f1,f2,f3);
245
inline void TranslateMatrix(REAL x1, REAL x2, REAL x3){
246
renderer->TranslateMatrix(x1,x2,x3);
249
void sr_RendererCleanup();
250
void sr_glRendererInit();