22 #ifndef FREESCAPE_GFX_H 23 #define FREESCAPE_GFX_H 25 #include "common/hashmap.h" 26 #include "common/rendermode.h" 27 #include "common/rect.h" 29 #include "graphics/pixelformat.h" 30 #include "graphics/managed_surface.h" 31 #include "graphics/renderer.h" 32 #include "math/frustum.h" 33 #include "math/vector3d.h" 37 #define kVertexArraySize 128 38 #define kCoordsArraySize 4 49 Texture(){ _width = 0; _height = 0; };
67 bool _authenticGraphics;
69 virtual void init() = 0;
76 virtual void useColor(uint8 r, uint8 g, uint8 b) = 0;
77 virtual void depthTesting(
bool enabled) {};
78 virtual void polygonOffset(
bool enabled) = 0;
83 virtual void freeTexture(
Texture *texture) = 0;
86 virtual void renderSensorShoot(byte color,
const Math::Vector3d sensor,
const Math::Vector3d player,
const Common::Rect &viewPort) = 0;
87 virtual void renderPlayerShootBall(byte color,
const Common::Point &position,
int frame,
const Common::Rect &viewPort) = 0;
90 virtual void renderCrossair(
const Common::Point &crossairPosition) = 0;
98 void setColorRemaps(ColorReMap *colorRemaps);
99 virtual void clear(uint8 r, uint8 g, uint8 b,
bool ignoreViewport =
false) = 0;
100 virtual void drawFloor(uint8 color) = 0;
101 virtual void drawBackground(uint8 color);
103 void drawEclipse(uint8 color1, uint8 color2,
float difference);
104 virtual void drawSkybox(
Texture *texture, Math::Vector3d camera) {};
105 virtual void drawThunder(
Texture *texture, Math::Vector3d camera,
float size) {};
106 virtual void drawCelestialBody(Math::Vector3d position,
float radius, uint8 color) {};
112 void readFromPalette(uint8 index, uint8 &r, uint8 &g, uint8 &b);
113 void setPaletteValue(uint8 index, uint8 r, uint8 g, uint8 b);
114 uint8 indexFromColor(uint8 r, uint8 g, uint8 b);
115 uint8 mapEGAColor(uint8 index);
117 bool getRGBAt(uint8 index, uint8 ecolor, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2, byte *&stipple);
118 bool getRGBAtC64(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2, byte *&stipple);
119 bool getRGBAtCGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2, byte *&stipple);
120 bool getRGBAtCPC(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2, byte *&stipple);
121 bool getRGBAtEGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2);
122 bool getRGBAtZX(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2, byte *&stipple);
123 bool getRGBAtHercules(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2, byte *&stipple);
124 void extractCPCIndexes(uint8 cm1, uint8 cm2, uint8 &i1, uint8 &i2);
125 void extractC64Indexes(uint8 cm1, uint8 cm2, uint8 &i1, uint8 &i2);
127 void selectColorFromFourColorPalette(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1);
130 virtual void setStippleData(byte *data) {};
131 virtual void useStipple(
bool enabled) {};
132 void scaleStipplePattern(byte originalPattern[128], byte newPattern[128]);
134 byte _defaultStippleArray[128] = {
135 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
136 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
137 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
138 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
139 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
140 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
141 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
142 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
143 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
144 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
145 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
146 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
147 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
148 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
149 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
150 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
153 byte *_variableStippleArray;
155 float _skyNormals[16][3] = {
174 float _skyUvs1008[16][2] = {
196 float _skyUvs128[16][2] = {
218 float _skyVertices[16][3] = {
219 { -81280.0, 8128.0, 81280.0 },
220 { -81280.0, -8128.0, 81280.0 },
221 { 81280.0, -8128.0, 81280.0 },
222 { 81280.0, 8128.0, 81280.0 },
224 { 81280.0f, -8128.0f, -81280.0f },
225 { -81280.0f, -8128.0f, -81280.0f },
226 { -81280.0f, 8128.0f, -81280.0f },
227 { 81280.0f, 8128.0f, -81280.0f },
229 { -81280.0f, 8128.0f, 81280.0f },
230 { -81280.0f, 8128.0f, -81280.0f },
231 { -81280.0f, -8128.0f, -81280.0f },
232 { -81280.0f, -8128.0f, 81280.0f },
234 { 81280.0f, 8128.0f, -81280.0f },
235 { 81280.0f, 8128.0f, 81280.0f },
236 { 81280.0f, -8128.0f, 81280.0f },
237 { 81280.0f, -8128.0f, -81280.0f },
240 unsigned int _skyIndices[24] = {
255 void setColorMap(ColorMap *colorMap_);
257 ColorReMap *_colorRemaps;
258 void clearColorPairArray();
259 void fillColorPairArray();
264 int _underFireBackgroundColor;
266 byte _stipples[16][128];
276 virtual void positionCamera(
const Math::Vector3d &pos,
const Math::Vector3d &interest,
float rollAngle = 0.0f) = 0;
277 virtual void updateProjectionMatrix(
float fov,
float aspectRatio,
float nearClipPlane,
float farClipPlane) = 0;
279 Math::Matrix4 getMvpMatrix()
const {
return _mvpMatrix; }
287 bool computeScreenViewport();
294 Math::Matrix4 _projectionMatrix;
295 Math::Matrix4 _modelViewMatrix;
296 Math::Matrix4 _mvpMatrix;
298 Math::Frustum _frustum;
300 Math::Matrix4 makeProjectionMatrix(
float fov,
float nearClipPlane,
float farClipPlane)
const;
311 #endif // FREESCAPE_GFX_H Definition: managed_surface.h:51
virtual void flipBuffer()
Definition: gfx.h:75
RendererType
Definition: renderer.h:45
RenderMode
Definition: rendermode.h:48