WINTERMUTE: Apply cosmetic changes

This commit is contained in:
Gunnar Birke 2020-06-01 12:42:14 +02:00 committed by Paweł Kołodziejski
parent 40b7e9c676
commit 9311be32ca
4 changed files with 112 additions and 112 deletions

View file

@ -22,7 +22,7 @@
#include "base_render_opengl3d.h" #include "base_render_opengl3d.h"
#include "../../../../../graphics/opengl/system_headers.h" #include "graphics/opengl/system_headers.h"
#include "base_surface_opengl3d.h" #include "base_surface_opengl3d.h"
#include "math/glmath.h" #include "math/glmath.h"
@ -31,49 +31,47 @@ BaseRenderer *makeOpenGL3DRenderer(BaseGame *inGame) {
return new BaseRenderOpenGL3D(inGame); return new BaseRenderOpenGL3D(inGame);
} }
} // namespace Wintermute BaseRenderOpenGL3D::BaseRenderOpenGL3D(BaseGame *inGame)
Wintermute::BaseRenderOpenGL3D::BaseRenderOpenGL3D(Wintermute::BaseGame *inGame)
: _spriteBatchMode(false) { : _spriteBatchMode(false) {
} }
Wintermute::BaseRenderOpenGL3D::~BaseRenderOpenGL3D() { BaseRenderOpenGL3D::~BaseRenderOpenGL3D() {
} }
Wintermute::BaseImage *Wintermute::BaseRenderOpenGL3D::takeScreenshot() { BaseImage *BaseRenderOpenGL3D::takeScreenshot() {
return nullptr; return nullptr;
} }
bool Wintermute::BaseRenderOpenGL3D::saveScreenShot(const Common::String &filename, int sizeX, int sizeY) { bool BaseRenderOpenGL3D::saveScreenShot(const Common::String &filename, int sizeX, int sizeY) {
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::setViewport(int left, int top, int right, int bottom) { bool BaseRenderOpenGL3D::setViewport(int left, int top, int right, int bottom) {
_viewportRect.setRect(left, top, right, bottom); _viewportRect.setRect(left, top, right, bottom);
glViewport(left, top, right - left, bottom - top); glViewport(left, top, right - left, bottom - top);
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::setViewport(Wintermute::Rect32 *rect) { bool BaseRenderOpenGL3D::setViewport(Rect32 *rect) {
return setViewport(rect->left, rect->top, rect->right, rect->bottom); return setViewport(rect->left, rect->top, rect->right, rect->bottom);
} }
Wintermute::Rect32 Wintermute::BaseRenderOpenGL3D::getViewPort() { Rect32 BaseRenderOpenGL3D::getViewPort() {
return Rect32(0, 0, 0, 0); return Rect32(0, 0, 0, 0);
} }
void Wintermute::BaseRenderOpenGL3D::setWindowed(bool windowed) { void BaseRenderOpenGL3D::setWindowed(bool windowed) {
} }
Graphics::PixelFormat Wintermute::BaseRenderOpenGL3D::getPixelFormat() const { Graphics::PixelFormat BaseRenderOpenGL3D::getPixelFormat() const {
return OpenGL::Texture::getRGBAPixelFormat(); return OpenGL::Texture::getRGBAPixelFormat();
} }
void Wintermute::BaseRenderOpenGL3D::fade(uint16 alpha) { void BaseRenderOpenGL3D::fade(uint16 alpha) {
fadeToColor(0, 0, 0, (byte)(255 - alpha)); fadeToColor(0, 0, 0, (byte)(255 - alpha));
} }
void Wintermute::BaseRenderOpenGL3D::fadeToColor(byte r, byte g, byte b, byte a) { void BaseRenderOpenGL3D::fadeToColor(byte r, byte g, byte b, byte a) {
glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0);
setProjection2D(); setProjection2D();
@ -127,11 +125,11 @@ void Wintermute::BaseRenderOpenGL3D::fadeToColor(byte r, byte g, byte b, byte a)
setup2D(true); setup2D(true);
} }
bool Wintermute::BaseRenderOpenGL3D::drawLine(int x1, int y1, int x2, int y2, uint32 color) { bool BaseRenderOpenGL3D::drawLine(int x1, int y1, int x2, int y2, uint32 color) {
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::drawRect(int x1, int y1, int x2, int y2, uint32 color, int width) { bool BaseRenderOpenGL3D::drawRect(int x1, int y1, int x2, int y2, uint32 color, int width) {
return true; return true;
} }
@ -154,7 +152,7 @@ bool Wintermute::BaseRenderOpenGL3D::setProjection() {
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::setProjection2D() { bool BaseRenderOpenGL3D::setProjection2D() {
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
glOrtho(0, _viewportRect.width(), 0, _viewportRect.height(), -1.0, 100.0); glOrtho(0, _viewportRect.width(), 0, _viewportRect.height(), -1.0, 100.0);
@ -163,11 +161,11 @@ bool Wintermute::BaseRenderOpenGL3D::setProjection2D() {
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::windowedBlt() { bool BaseRenderOpenGL3D::windowedBlt() {
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::fill(byte r, byte g, byte b, Common::Rect *rect) { bool BaseRenderOpenGL3D::fill(byte r, byte g, byte b, Common::Rect *rect) {
glClearColor(float(r) / 255.0f, float(g) / 255.0f, float(b) / 255.0f, 1.0f); glClearColor(float(r) / 255.0f, float(g) / 255.0f, float(b) / 255.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
return true; return true;
@ -176,7 +174,7 @@ bool Wintermute::BaseRenderOpenGL3D::fill(byte r, byte g, byte b, Common::Rect *
void Wintermute::BaseRenderOpenGL3D::onWindowChange() { void Wintermute::BaseRenderOpenGL3D::onWindowChange() {
} }
bool Wintermute::BaseRenderOpenGL3D::initRenderer(int width, int height, bool windowed) { bool BaseRenderOpenGL3D::initRenderer(int width, int height, bool windowed) {
_windowed = windowed; _windowed = windowed;
_width = width; _width = width;
_height = height; _height = height;
@ -194,20 +192,20 @@ bool Wintermute::BaseRenderOpenGL3D::flip() {
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::indicatorFlip() { bool BaseRenderOpenGL3D::indicatorFlip() {
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::forcedFlip() { bool BaseRenderOpenGL3D::forcedFlip() {
return true; return true;
} }
void Wintermute::BaseRenderOpenGL3D::initLoop() { void BaseRenderOpenGL3D::initLoop() {
deleteRectList(); deleteRectList();
setup2D(); setup2D();
} }
bool Wintermute::BaseRenderOpenGL3D::setup2D(bool force) { bool BaseRenderOpenGL3D::setup2D(bool force) {
if (_state3D || force) { if (_state3D || force) {
_state3D = false; _state3D = false;
@ -248,22 +246,22 @@ bool Wintermute::BaseRenderOpenGL3D::setup2D(bool force) {
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::setup3D(bool force) { bool BaseRenderOpenGL3D::setup3D(bool force) {
return true; return true;
} }
bool Wintermute::BaseRenderOpenGL3D::setupLines() { bool BaseRenderOpenGL3D::setupLines() {
return true; return true;
} }
Wintermute::BaseSurface *Wintermute::BaseRenderOpenGL3D::createSurface() { BaseSurface *Wintermute::BaseRenderOpenGL3D::createSurface() {
return new BaseSurfaceOpenGL3D(nullptr, this); return new BaseSurfaceOpenGL3D(nullptr, this);
} }
void Wintermute::BaseRenderOpenGL3D::endSaveLoad() { void BaseRenderOpenGL3D::endSaveLoad() {
} }
bool Wintermute::BaseRenderOpenGL3D::drawSprite(const OpenGL::Texture &tex, const Wintermute::Rect32 &rect, bool BaseRenderOpenGL3D::drawSprite(const OpenGL::Texture &tex, const Wintermute::Rect32 &rect,
float zoomX, float zoomY, const Wintermute::Vector2 &pos, float zoomX, float zoomY, const Wintermute::Vector2 &pos,
uint32 color, bool alphaDisable, Graphics::TSpriteBlendMode blendMode, uint32 color, bool alphaDisable, Graphics::TSpriteBlendMode blendMode,
bool mirrorX, bool mirrorY) { bool mirrorX, bool mirrorY) {
@ -271,7 +269,7 @@ bool Wintermute::BaseRenderOpenGL3D::drawSprite(const OpenGL::Texture &tex, cons
return drawSpriteEx(tex, rect, pos, Vector2(0.0f, 0.0f), scale, 0.0f, color, alphaDisable, blendMode, mirrorX, mirrorY); return drawSpriteEx(tex, rect, pos, Vector2(0.0f, 0.0f), scale, 0.0f, color, alphaDisable, blendMode, mirrorX, mirrorY);
} }
bool Wintermute::BaseRenderOpenGL3D::drawSpriteEx(const OpenGL::Texture &tex, const Wintermute::Rect32 &rect, bool BaseRenderOpenGL3D::drawSpriteEx(const OpenGL::Texture &tex, const Wintermute::Rect32 &rect,
const Wintermute::Vector2 &pos, const Wintermute::Vector2 &rot, const Wintermute::Vector2 &scale, const Wintermute::Vector2 &pos, const Wintermute::Vector2 &rot, const Wintermute::Vector2 &scale,
float angle, uint32 color, bool alphaDisable, Graphics::TSpriteBlendMode blendMode, float angle, uint32 color, bool alphaDisable, Graphics::TSpriteBlendMode blendMode,
bool mirrorX, bool mirrorY) { bool mirrorX, bool mirrorY) {
@ -298,13 +296,9 @@ bool Wintermute::BaseRenderOpenGL3D::drawSpriteEx(const OpenGL::Texture &tex, co
if (mirrorY) { if (mirrorY) {
} }
// provide space for 3d position coords, 2d texture coords and a 32 bit colot value // provide space for 3d position coords, 2d texture coords and a 32 bit color value
int vertex_size = 24; const int vertex_size = 24;
byte vertices[vertex_size * 4]; byte vertices[vertex_size * 4] = {};
for (int i = 0; i < vertex_size * 4; ++i) {
vertices[i] = 0;
}
// texture coords // texture coords
*reinterpret_cast<float *>(vertices) = tex_left; *reinterpret_cast<float *>(vertices) = tex_left;
@ -382,3 +376,5 @@ bool Wintermute::BaseRenderOpenGL3D::drawSpriteEx(const OpenGL::Texture &tex, co
return true; return true;
} }
} // namespace Wintermute

View file

@ -38,26 +38,26 @@ public:
BaseRenderOpenGL3D(BaseGame *inGame = nullptr); BaseRenderOpenGL3D(BaseGame *inGame = nullptr);
~BaseRenderOpenGL3D() override; ~BaseRenderOpenGL3D() override;
virtual void dumpData(const char *filename) {} void dumpData(const char *filename) override {}
/** /**
* Take a screenshot of the current screenstate * Take a screenshot of the current screenstate
* *
* @return a BaseImage containing the current screen-buffer. * @return a BaseImage containing the current screen-buffer.
*/ */
virtual BaseImage *takeScreenshot(); BaseImage *takeScreenshot() override;
virtual bool saveScreenShot(const Common::String &filename, int sizeX = 0, int sizeY = 0); bool saveScreenShot(const Common::String &filename, int sizeX = 0, int sizeY = 0) override;
virtual bool setViewport(int left, int top, int right, int bottom); bool setViewport(int left, int top, int right, int bottom) override;
virtual bool setViewport(Rect32 *rect); bool setViewport(Rect32 *rect) override;
virtual Rect32 getViewPort(); Rect32 getViewPort() override;
virtual void setWindowed(bool windowed); void setWindowed(bool windowed) override;
virtual Graphics::PixelFormat getPixelFormat() const; Graphics::PixelFormat getPixelFormat() const override;
/** /**
* Fade the screen to black * Fade the screen to black
* *
* @param alpha amount to fade by (alpha value of black) * @param alpha amount to fade by (alpha value of black)
*/ */
virtual void fade(uint16 alpha); void fade(uint16 alpha) override;
/** /**
* Fade a portion of the screen to a specific color * Fade a portion of the screen to a specific color
* *
@ -67,15 +67,15 @@ public:
* @param a the alpha component to fade too. * @param a the alpha component to fade too.
* @param rect the portion of the screen to fade (if nullptr, the entire screen will be faded). * @param rect the portion of the screen to fade (if nullptr, the entire screen will be faded).
*/ */
virtual void fadeToColor(byte r, byte g, byte b, byte a); void fadeToColor(byte r, byte g, byte b, byte a) override;
virtual bool drawLine(int x1, int y1, int x2, int y2, uint32 color); // Unused outside indicator-display bool drawLine(int x1, int y1, int x2, int y2, uint32 color) override; // Unused outside indicator-display
virtual bool drawRect(int x1, int y1, int x2, int y2, uint32 color, int width = 1); // Unused outside indicator-display bool drawRect(int x1, int y1, int x2, int y2, uint32 color, int width = 1) override; // Unused outside indicator-display
virtual bool setProjection(); bool setProjection() override;
bool setProjection2D(); bool setProjection2D();
virtual bool windowedBlt(); bool windowedBlt() override;
/** /**
* Fill a portion of the screen with a specified color * Fill a portion of the screen with a specified color
* *
@ -83,46 +83,46 @@ public:
* @param g the green component to fill with. * @param g the green component to fill with.
* @param b the blue component to fill with. * @param b the blue component to fill with.
*/ */
virtual bool fill(byte r, byte g, byte b, Common::Rect *rect = nullptr); bool fill(byte r, byte g, byte b, Common::Rect *rect = nullptr) override;
virtual void onWindowChange(); void onWindowChange() override;
virtual bool initRenderer(int width, int height, bool windowed); bool initRenderer(int width, int height, bool windowed) override;
/** /**
* Flip the backbuffer onto the screen-buffer * Flip the backbuffer onto the screen-buffer
* The screen will NOT be updated before calling this function. * The screen will NOT be updated before calling this function.
* *
* @return true if successfull, false on error. * @return true if successfull, false on error.
*/ */
virtual bool flip(); bool flip() override;
/** /**
* Special flip for the indicator drawn during save/load * Special flip for the indicator drawn during save/load
* essentially, just copies the region defined by the _indicator-variables. * essentially, just copies the region defined by the _indicator-variables.
*/ */
virtual bool indicatorFlip(); bool indicatorFlip() override;
virtual bool forcedFlip(); bool forcedFlip() override;
virtual void initLoop(); void initLoop() override;
virtual bool setup2D(bool force = false); bool setup2D(bool force = false) override;
virtual bool setup3D(bool force = false); bool setup3D(bool force = false);
virtual bool setupLines(); bool setupLines() override;
/** /**
* Get the name of the current renderer * Get the name of the current renderer
* *
* @return the name of the renderer. * @return the name of the renderer.
*/ */
virtual Common::String getName() const { Common::String getName() const override {
return "OpenGL 3D renderer"; return "OpenGL 3D renderer";
}; };
virtual bool displayDebugInfo() { bool displayDebugInfo() override {
return STATUS_FAILED; return STATUS_FAILED;
}; };
virtual bool drawShaderQuad() { bool drawShaderQuad() override {
return STATUS_FAILED; return STATUS_FAILED;
} }
virtual float getScaleRatioX() const { float getScaleRatioX() const override {
return 1.0f; return 1.0f;
} }
virtual float getScaleRatioY() const { float getScaleRatioY() const override {
return 1.0f; return 1.0f;
} }
@ -134,16 +134,16 @@ public:
* *
* @return a surface that can be used with this renderer * @return a surface that can be used with this renderer
*/ */
virtual BaseSurface *createSurface(); BaseSurface *createSurface() override;
virtual bool startSpriteBatch() { bool startSpriteBatch() override {
return STATUS_OK; return STATUS_OK;
}; };
virtual bool endSpriteBatch() { bool endSpriteBatch() override {
return STATUS_OK; return STATUS_OK;
}; };
virtual void endSaveLoad(); void endSaveLoad() override;
bool drawSprite(const OpenGL::Texture& tex, const Rect32& rect, float zoomX, float zoomY, const Vector2& pos, bool drawSprite(const OpenGL::Texture& tex, const Rect32& rect, float zoomX, float zoomY, const Vector2& pos,
uint32 color, bool alphaDisable, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY); uint32 color, bool alphaDisable, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY);

View file

@ -26,59 +26,61 @@
#include "base_render_opengl3d.h" #include "base_render_opengl3d.h"
#include "graphics/transparent_surface.h" #include "graphics/transparent_surface.h"
Wintermute::BaseSurfaceOpenGL3D::BaseSurfaceOpenGL3D(Wintermute::BaseGame *game, BaseRenderOpenGL3D *renderer) namespace Wintermute {
BaseSurfaceOpenGL3D::BaseSurfaceOpenGL3D(BaseGame *game, BaseRenderOpenGL3D *renderer)
: BaseSurface(game), tex(nullptr), renderer(renderer), pixelOpReady(false) { : BaseSurface(game), tex(nullptr), renderer(renderer), pixelOpReady(false) {
} }
bool Wintermute::BaseSurfaceOpenGL3D::invalidate() { bool BaseSurfaceOpenGL3D::invalidate() {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::displayHalfTrans(int x, int y, Wintermute::Rect32 rect) { bool BaseSurfaceOpenGL3D::displayHalfTrans(int x, int y, Rect32 rect) {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::isTransparentAt(int x, int y) { bool BaseSurfaceOpenGL3D::isTransparentAt(int x, int y) {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::displayTransZoom(int x, int y, Wintermute::Rect32 rect, float zoomX, float zoomY, uint32 alpha, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { bool BaseSurfaceOpenGL3D::displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::displayTrans(int x, int y, Wintermute::Rect32 rect, uint32 alpha, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { bool BaseSurfaceOpenGL3D::displayTrans(int x, int y, Rect32 rect, uint32 alpha, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
renderer->drawSprite(*tex, rect, 100, 100, Vector2(x, y), alpha, false, blendMode, mirrorX, mirrorY); renderer->drawSprite(*tex, rect, 100, 100, Vector2(x, y), alpha, false, blendMode, mirrorX, mirrorY);
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::displayTransOffset(int x, int y, Wintermute::Rect32 rect, uint32 alpha, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { bool BaseSurfaceOpenGL3D::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::display(int x, int y, Wintermute::Rect32 rect, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { bool BaseSurfaceOpenGL3D::display(int x, int y, Rect32 rect, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
renderer->drawSprite(*tex, rect, 100, 100, Vector2(x, y), 0xFFFFFFFF, true, blendMode, mirrorX, mirrorY); renderer->drawSprite(*tex, rect, 100, 100, Vector2(x, y), 0xFFFFFFFF, true, blendMode, mirrorX, mirrorY);
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::displayTransform(int x, int y, Wintermute::Rect32 rect, Wintermute::Rect32 newRect, const Graphics::TransformStruct &transform) { bool BaseSurfaceOpenGL3D::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const Graphics::TransformStruct &transform) {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::displayZoom(int x, int y, Wintermute::Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool transparent, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { bool BaseSurfaceOpenGL3D::displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool transparent, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::displayTiled(int x, int y, Wintermute::Rect32 rect, int numTimesX, int numTimesY) { bool BaseSurfaceOpenGL3D::displayTiled(int x, int y, Rect32 rect, int numTimesX, int numTimesY) {
Vector2 scale(numTimesX, numTimesY); Vector2 scale(numTimesX, numTimesY);
renderer->drawSpriteEx(*tex, rect, Vector2(x, y), Vector2(0, 0), scale, 0, 0xFFFFFFFF, true, Graphics::BLEND_NORMAL, false, false); renderer->drawSpriteEx(*tex, rect, Vector2(x, y), Vector2(0, 0), scale, 0, 0xFFFFFFFF, true, Graphics::BLEND_NORMAL, false, false);
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::restore() { bool BaseSurfaceOpenGL3D::restore() {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
BaseImage img = BaseImage(); BaseImage img = BaseImage();
if (!img.loadFile(filename)) { if (!img.loadFile(filename)) {
return false; return false;
@ -136,35 +138,35 @@ bool Wintermute::BaseSurfaceOpenGL3D::create(const Common::String &filename, boo
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::create(int width, int height) { bool BaseSurfaceOpenGL3D::create(int width, int height) {
tex = new OpenGL::Texture(width, height); tex = new OpenGL::Texture(width, height);
_valid = true; _valid = true;
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::putPixel(int x, int y, byte r, byte g, byte b, int a) { bool BaseSurfaceOpenGL3D::putPixel(int x, int y, byte r, byte g, byte b, int a) {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) { bool BaseSurfaceOpenGL3D::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::comparePixel(int x, int y, byte r, byte g, byte b, int a) { bool BaseSurfaceOpenGL3D::comparePixel(int x, int y, byte r, byte g, byte b, int a) {
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::startPixelOp() { bool BaseSurfaceOpenGL3D::startPixelOp() {
glBindTexture(GL_TEXTURE_2D, tex->getTextureName()); glBindTexture(GL_TEXTURE_2D, tex->getTextureName());
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::endPixelOp() { bool BaseSurfaceOpenGL3D::endPixelOp() {
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
return true; return true;
} }
bool Wintermute::BaseSurfaceOpenGL3D::isTransparentAtLite(int x, int y) { bool BaseSurfaceOpenGL3D::isTransparentAtLite(int x, int y) {
if (x < 0 || y < 0 || x >= tex->getWidth() || y >= tex->getHeight()) { if (x < 0 || y < 0 || x >= tex->getWidth() || y >= tex->getHeight()) {
return false; return false;
} }
@ -182,3 +184,5 @@ bool Wintermute::BaseSurfaceOpenGL3D::isTransparentAtLite(int x, int y) {
pixel &= 0x000000FF; pixel &= 0x000000FF;
return pixel == 0; return pixel == 0;
} }
}

View file

@ -35,34 +35,34 @@ class BaseSurfaceOpenGL3D : public BaseSurface {
public: public:
BaseSurfaceOpenGL3D(BaseGame* game, BaseRenderOpenGL3D* renderer); BaseSurfaceOpenGL3D(BaseGame* game, BaseRenderOpenGL3D* renderer);
virtual bool invalidate(); bool invalidate() override;
virtual bool displayHalfTrans(int x, int y, Rect32 rect); bool displayHalfTrans(int x, int y, Rect32 rect) override;
virtual bool isTransparentAt(int x, int y); bool isTransparentAt(int x, int y) override;
virtual bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
virtual bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
virtual bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0); bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override;
virtual bool display(int x, int y, Rect32 rect, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); bool display(int x, int y, Rect32 rect, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
virtual bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const Graphics::TransformStruct &transform); bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const Graphics::TransformStruct &transform) override;
virtual bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
virtual bool displayTiled(int x, int y, Rect32 rect, int numTimesX, int numTimesY); bool displayTiled(int x, int y, Rect32 rect, int numTimesX, int numTimesY) override;
virtual bool restore(); bool restore() override;
virtual bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false); bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) override;
virtual bool create(int width, int height); bool create(int width, int height) override;
virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) { bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override {
return STATUS_FAILED; return STATUS_FAILED;
} }
virtual bool putPixel(int x, int y, byte r, byte g, byte b, int a = -1); bool putPixel(int x, int y, byte r, byte g, byte b, int a = -1) override;
virtual bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr); bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr) override;
virtual bool comparePixel(int x, int y, byte r, byte g, byte b, int a = -1); bool comparePixel(int x, int y, byte r, byte g, byte b, int a = -1) override;
virtual bool startPixelOp(); bool startPixelOp() override;
virtual bool endPixelOp(); bool endPixelOp() override;
virtual bool isTransparentAtLite(int x, int y); bool isTransparentAtLite(int x, int y) override;
virtual int getWidth() { int getWidth() override {
return tex->getWidth(); return tex->getWidth();
} }
virtual int getHeight() { int getHeight() override {
return tex->getHeight(); return tex->getHeight();
} }