22 #ifndef GRIM_GFX_BASE_H 23 #define GRIM_GFX_BASE_H 25 #include "math/vector3d.h" 26 #include "math/quat.h" 28 #include "common/str.h" 29 #include "common/rect.h" 31 #include "graphics/pixelformat.h" 32 #include "graphics/renderer.h" 34 #include "engines/grim/material.h" 50 class PrimitiveObject;
73 virtual void setupScreen(
int screenW,
int screenH) = 0;
80 virtual bool isHardwareAccelerated() = 0;
86 virtual bool supportsShaders() = 0;
88 virtual uint getScreenWidth() {
return _screenWidth; }
89 virtual uint getScreenHeight() {
return _screenHeight; }
91 virtual void setupCameraFrustum(
float fov,
float nclip,
float fclip) = 0;
92 virtual void positionCamera(
const Math::Vector3d &pos,
const Math::Vector3d &interest,
float roll) = 0;
93 virtual void positionCamera(
const Math::Vector3d &pos,
const Math::Matrix4 &rot) = 0;
95 virtual Math::Matrix4 getModelView() = 0;
96 virtual Math::Matrix4 getProjection() = 0;
98 virtual void clearScreen() = 0;
99 virtual void clearDepthBuffer() = 0;
106 virtual void flipBuffer(
bool opportunistic =
false) = 0;
112 virtual void getScreenBoundingBox(
const Mesh *mesh,
int *x1,
int *y1,
int *x2,
int *y2) = 0;
113 virtual void getScreenBoundingBox(
const EMIModel *mesh,
int *x1,
int *y1,
int *x2,
int *y2) = 0;
115 virtual void startActorDraw(
const Actor *act) = 0;
116 virtual void finishActorDraw() = 0;
117 virtual void setShadow(
Shadow *shadow) = 0;
118 virtual void drawShadowPlanes() = 0;
119 virtual void setShadowMode();
120 virtual void clearShadowMode();
121 virtual bool isShadowModeActive();
122 virtual void setShadowColor(byte r, byte g, byte b) = 0;
123 virtual void getShadowColor(byte *r, byte *g, byte *b) = 0;
124 virtual void destroyShadow(
Shadow *shadow) {}
126 virtual void set3DMode() = 0;
128 virtual void translateViewpointStart() = 0;
129 virtual void translateViewpoint(
const Math::Vector3d &vec) = 0;
130 virtual void rotateViewpoint(
const Math::Angle &angle,
const Math::Vector3d &axis) = 0;
131 virtual void rotateViewpoint(
const Math::Matrix4 &rot) = 0;
132 virtual void translateViewpointFinish() = 0;
135 virtual void drawModelFace(
const Mesh *mesh,
const MeshFace *face) = 0;
136 virtual void drawSprite(
const Sprite *sprite) = 0;
137 virtual void drawMesh(
const Mesh *mesh);
139 virtual void drawOverlay(
const Overlay *overlay) { };
141 virtual void enableLights() = 0;
142 virtual void disableLights() = 0;
143 virtual void setupLight(
Light *light,
int lightId) = 0;
144 virtual void turnOffLight(
int lightId) = 0;
146 virtual void createTexture(
Texture *texture,
const uint8 *data,
const CMap *cmap,
bool clamp) = 0;
147 virtual void selectTexture(
const Texture *texture) = 0;
148 virtual void destroyTexture(
Texture *texture) = 0;
163 virtual void createBitmap(
BitmapData *bitmap) = 0;
173 virtual void drawBitmap(
const Bitmap *bitmap,
int x,
int y, uint32 layer = 0) = 0;
184 virtual void destroyBitmap(
BitmapData *bitmap) = 0;
186 virtual void createFont(
Font *font) = 0;
187 virtual void destroyFont(
Font *font) = 0;
189 virtual void createTextObject(
TextObject *text) = 0;
190 virtual void drawTextObject(
const TextObject *text) = 0;
191 virtual void destroyTextObject(
TextObject *text) = 0;
193 virtual Bitmap *getScreenshot(
int w,
int h,
bool useStored) = 0;
194 virtual void storeDisplay() = 0;
195 virtual void copyStoredToDisplay() = 0;
202 virtual void dimScreen() = 0;
203 virtual void dimRegion(
int x,
int y,
int w,
int h,
float level) = 0;
204 virtual void setDimLevel(
float dimLevel) { _dimLevel = dimLevel; }
214 virtual void irisAroundRegion(
int x1,
int y1,
int x2,
int y2) = 0;
216 virtual void drawEmergString(
int x,
int y,
const char *text,
const Color &fgColor) = 0;
217 virtual void loadEmergFont() = 0;
222 virtual void drawDimPlane() {};
238 virtual void drawMovieFrame(
int offsetX,
int offsetY) = 0;
246 virtual void releaseMovieFrame() = 0;
248 virtual const char *getVideoDeviceName() = 0;
250 virtual void saveState(
SaveGame *state);
251 virtual void restoreState(
SaveGame *state);
253 virtual void renderBitmaps(
bool render);
254 virtual void renderZBitmaps(
bool render);
256 virtual void makeScreenTextures();
258 virtual void createMesh(
Mesh *mesh) {}
259 virtual void destroyMesh(
const Mesh *mesh) {}
260 virtual void createEMIModel(
EMIModel *model) {}
261 virtual void updateEMIModel(
const EMIModel *model) {}
262 virtual void destroyEMIModel(
EMIModel *model) {}
264 virtual void createSpecialtyTexture(uint
id,
const uint8 *data,
int width,
int height);
265 virtual void createSpecialtyTextureFromScreen(uint
id, uint8 *data,
int x,
int y,
int width,
int height) = 0;
269 static Math::Matrix4 makeLookMatrix(
const Math::Vector3d& pos,
const Math::Vector3d& interest,
const Math::Vector3d& up);
270 static Math::Matrix4 makeProjMatrix(
float fov,
float nclip,
float fclip);
271 Texture *getSpecialtyTexturePtr(uint
id) {
if (
id >= _numSpecialtyTextures)
return nullptr;
return &_specialtyTextures[id]; };
274 virtual void setBlendMode(
bool additive) = 0;
277 static const unsigned int _numSpecialtyTextures = 22;
278 Texture _specialtyTextures[_numSpecialtyTextures];
279 static const int _gameHeight = 480;
280 static const int _gameWidth = 640;
281 static const int _globalHeight = 1080;
282 static const int _globalWidth = 1920;
283 float _scaleW, _scaleH;
284 float _globalScaleW = 1.0f, _globalScaleH = 1.0f;
285 int _screenWidth, _screenHeight;
286 Shadow *_currentShadowArray;
287 unsigned char _shadowColorR;
288 unsigned char _shadowColorG;
289 unsigned char _shadowColorB;
291 bool _renderZBitmaps;
292 bool _shadowModeActive;
293 Math::Vector3d _currentPos;
294 Math::Matrix4 _currentRot;
301 GfxBase *CreateGfxOpenGLShader();
RendererType
Definition: renderer.h:45
Definition: modelemi.h:82
Definition: savegame.h:33
Definition: textobject.h:84
Definition: gfx_base.h:62
Definition: formatinfo.h:28
Definition: modelemi.h:55
Definition: colormap.h:35
Definition: primitives.h:34
Definition: default_display_client.h:65
Actor represents a 3D character on screen.
Definition: actor.h:72
Definition: material.h:31