GRIM: Drop side textures feature from backend.

This commit is contained in:
Pawel Kolodziejski 2020-10-05 19:09:58 +02:00
parent 4f8f566299
commit c4b9f966b6
12 changed files with 0 additions and 154 deletions

View file

@ -114,7 +114,6 @@ public:
// ResidualVM specific methods: // ResidualVM specific methods:
virtual Graphics::PixelBuffer getScreenPixelBuffer() { return Graphics::PixelBuffer(); } virtual Graphics::PixelBuffer getScreenPixelBuffer() { return Graphics::PixelBuffer(); }
virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) {}
virtual void saveScreenshot() {} virtual void saveScreenshot() {}
virtual bool lockMouse(bool lock) { return false; } virtual bool lockMouse(bool lock) { return false; }
}; };

View file

@ -64,8 +64,6 @@ OpenGLSdlGraphics3dManager::OpenGLSdlGraphics3dManager(SdlEventSource *eventSour
ConfMan.registerDefault("antialiasing", 0); ConfMan.registerDefault("antialiasing", 0);
ConfMan.registerDefault("aspect_ratio", true); ConfMan.registerDefault("aspect_ratio", true);
_sideTextures[0] = _sideTextures[1] = nullptr;
// Don't start at zero so that the value is never the same as the surface graphics manager // Don't start at zero so that the value is never the same as the surface graphics manager
_screenChangeCount = 1 << (sizeof(int) * 5 - 2); _screenChangeCount = 1 << (sizeof(int) * 5 - 2);
} }
@ -539,27 +537,6 @@ void OpenGLSdlGraphics3dManager::drawOverlay() {
_surfaceRenderer->restorePreviousState(); _surfaceRenderer->restorePreviousState();
} }
void OpenGLSdlGraphics3dManager::drawSideTextures() {
if (_fullscreen && _lockAspectRatio) {
_surfaceRenderer->setFlipY(true);
const Math::Vector2d nudge(1.0 / float(_overlayScreen->getWidth()), 0);
if (_sideTextures[0] != nullptr) {
float left = _gameRect.getBottomLeft().getX() - (float(_overlayScreen->getHeight()) / float(_sideTextures[0]->getHeight())) * _sideTextures[0]->getWidth() / float(_overlayScreen->getWidth());
Math::Rect2d leftRect(Math::Vector2d(left, 0.0), _gameRect.getBottomLeft() + nudge);
_surfaceRenderer->render(_sideTextures[0], leftRect);
}
if (_sideTextures[1] != nullptr) {
float right = _gameRect.getTopRight().getX() + (float(_overlayScreen->getHeight()) / float(_sideTextures[1]->getHeight())) * _sideTextures[1]->getWidth() / float(_overlayScreen->getWidth());
Math::Rect2d rightRect(_gameRect.getTopRight() - nudge, Math::Vector2d(right, 1.0));
_surfaceRenderer->render(_sideTextures[1], rightRect);
}
_surfaceRenderer->setFlipY(false);
}
}
#ifndef AMIGAOS #ifndef AMIGAOS
OpenGL::FrameBuffer *OpenGLSdlGraphics3dManager::createFramebuffer(uint width, uint height) { OpenGL::FrameBuffer *OpenGLSdlGraphics3dManager::createFramebuffer(uint width, uint height) {
#if !defined(USE_GLES2) #if !defined(USE_GLES2)
@ -579,7 +556,6 @@ void OpenGLSdlGraphics3dManager::updateScreen() {
glViewport(0, 0, _overlayScreen->getWidth(), _overlayScreen->getHeight()); glViewport(0, 0, _overlayScreen->getWidth(), _overlayScreen->getHeight());
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);
_surfaceRenderer->prepareState(); _surfaceRenderer->prepareState();
drawSideTextures();
_surfaceRenderer->render(_frameBuffer, _gameRect); _surfaceRenderer->render(_frameBuffer, _gameRect);
_surfaceRenderer->restorePreviousState(); _surfaceRenderer->restorePreviousState();
} }
@ -625,19 +601,6 @@ int16 OpenGLSdlGraphics3dManager::getWidth() const {
#pragma mark --- Overlays --- #pragma mark --- Overlays ---
#pragma mark - #pragma mark -
void OpenGLSdlGraphics3dManager::suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) {
delete _sideTextures[0];
_sideTextures[0] = nullptr;
delete _sideTextures[1];
_sideTextures[1] = nullptr;
if (left) {
_sideTextures[0] = new OpenGL::TextureGL(*left);
}
if (right) {
_sideTextures[1] = new OpenGL::TextureGL(*right);
}
}
void OpenGLSdlGraphics3dManager::showOverlay() { void OpenGLSdlGraphics3dManager::showOverlay() {
if (_overlayVisible) { if (_overlayVisible) {
return; return;
@ -691,10 +654,6 @@ void OpenGLSdlGraphics3dManager::grabOverlay(void *buf, int pitch) const {
} }
void OpenGLSdlGraphics3dManager::closeOverlay() { void OpenGLSdlGraphics3dManager::closeOverlay() {
delete _sideTextures[0];
delete _sideTextures[1];
_sideTextures[0] = _sideTextures[1] = nullptr;
if (_overlayScreen) { if (_overlayScreen) {
delete _overlayScreen; delete _overlayScreen;
_overlayScreen = nullptr; _overlayScreen = nullptr;

View file

@ -94,12 +94,6 @@ public:
int16 getOverlayHeight() const override; int16 getOverlayHeight() const override;
virtual bool isOverlayVisible() const override { return _overlayVisible; } virtual bool isOverlayVisible() const override { return _overlayVisible; }
/* Render the passed Surfaces besides the game texture.
* This is used for widescreen support in the Grim engine.
* Note: we must copy the Surfaces, as they are free()d after this call.
*/
virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) override;
// GraphicsManager API - Mouse // GraphicsManager API - Mouse
virtual void warpMouse(int x, int y) override; virtual void warpMouse(int x, int y) override;
@ -158,7 +152,6 @@ protected:
OpenGL::TiledSurface *_overlayScreen; OpenGL::TiledSurface *_overlayScreen;
OpenGL::TiledSurface *_overlayBackground; OpenGL::TiledSurface *_overlayBackground;
OpenGL::TextureGL *_sideTextures[2];
OpenGL::SurfaceRenderer *_surfaceRenderer; OpenGL::SurfaceRenderer *_surfaceRenderer;
Graphics::PixelFormat _overlayFormat; Graphics::PixelFormat _overlayFormat;
@ -168,7 +161,6 @@ protected:
void initializeOpenGLContext() const; void initializeOpenGLContext() const;
void drawOverlay(); void drawOverlay();
void drawSideTextures();
void closeOverlay(); void closeOverlay();
OpenGL::FrameBuffer *_frameBuffer; OpenGL::FrameBuffer *_frameBuffer;

View file

@ -59,8 +59,6 @@ SurfaceSdlGraphics3dManager::SurfaceSdlGraphics3dManager(SdlEventSource *sdlEven
_engineRequestedHeight(0), _engineRequestedHeight(0),
_transactionMode(kTransactionNone) { _transactionMode(kTransactionNone) {
ConfMan.registerDefault("aspect_ratio", true); ConfMan.registerDefault("aspect_ratio", true);
_sideSurfaces[0] = _sideSurfaces[1] = nullptr;
} }
SurfaceSdlGraphics3dManager::~SurfaceSdlGraphics3dManager() { SurfaceSdlGraphics3dManager::~SurfaceSdlGraphics3dManager() {
@ -240,27 +238,6 @@ Graphics::PixelBuffer SurfaceSdlGraphics3dManager::getScreenPixelBuffer() {
return Graphics::PixelBuffer(_screenFormat, (byte *)_subScreen->pixels); return Graphics::PixelBuffer(_screenFormat, (byte *)_subScreen->pixels);
} }
void SurfaceSdlGraphics3dManager::drawSideTextures() {
if (_fullscreen && _lockAspectRatio) {
if (_sideSurfaces[0]) {
SDL_Rect dstrect;
dstrect.x = _gameRect.getTopLeft().getX() - _sideSurfaces[0]->w;
dstrect.y = _gameRect.getTopLeft().getY();
dstrect.w = _sideSurfaces[0]->w;
dstrect.h = _sideSurfaces[0]->h;
SDL_BlitSurface(_sideSurfaces[0], NULL, _screen, &dstrect);
}
if (_sideSurfaces[1]) {
SDL_Rect dstrect;
dstrect.x = _gameRect.getTopRight().getX();
dstrect.y = _gameRect.getTopLeft().getY();
dstrect.w = _sideSurfaces[1]->w;
dstrect.h = _sideSurfaces[1]->h;
SDL_BlitSurface(_sideSurfaces[1], NULL, _screen, &dstrect);
}
}
}
void SurfaceSdlGraphics3dManager::drawOverlay() { void SurfaceSdlGraphics3dManager::drawOverlay() {
if (!_overlayscreen) if (!_overlayscreen)
return; return;
@ -279,7 +256,6 @@ void SurfaceSdlGraphics3dManager::updateScreen() {
if (_overlayVisible) { if (_overlayVisible) {
drawOverlay(); drawOverlay();
} }
drawSideTextures();
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_UpdateTexture(_screenTexture, nullptr, _screen->pixels, _screen->pitch); SDL_UpdateTexture(_screenTexture, nullptr, _screen->pixels, _screen->pitch);
@ -318,21 +294,6 @@ void SurfaceSdlGraphics3dManager::clearOverlay() {
_overlayDirty = true; _overlayDirty = true;
} }
void SurfaceSdlGraphics3dManager::suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) {
delete _sideSurfaces[0];
_sideSurfaces[0] = nullptr;
delete _sideSurfaces[1];
_sideSurfaces[1] = nullptr;
if (left) {
_sideSurfaces[0] = SDL_CreateRGBSurface(SDL_SWSURFACE, left->w, left->h, 32, 0xff << left->format.rShift, 0xff << left->format.gShift, 0xff << left->format.bShift, 0xff << left->format.aShift);
memcpy(_sideSurfaces[0]->pixels, left->getPixels(), left->w * left->h * 4);
}
if (right) {
_sideSurfaces[1] = SDL_CreateRGBSurface(SDL_SWSURFACE, right->w, right->h, 32, 0xff << right->format.rShift, 0xff << right->format.gShift, 0xff << right->format.bShift, 0xff << right->format.aShift);
memcpy(_sideSurfaces[1]->pixels, right->getPixels(), right->w * right->h * 4);
}
}
void SurfaceSdlGraphics3dManager::showOverlay() { void SurfaceSdlGraphics3dManager::showOverlay() {
if (_overlayVisible) if (_overlayVisible)
return; return;
@ -414,9 +375,6 @@ void SurfaceSdlGraphics3dManager::copyRectToOverlay(const void *buf, int pitch,
} }
void SurfaceSdlGraphics3dManager::closeOverlay() { void SurfaceSdlGraphics3dManager::closeOverlay() {
SDL_FreeSurface(_sideSurfaces[0]);
SDL_FreeSurface(_sideSurfaces[1]);
_sideSurfaces[0] = _sideSurfaces[1] = nullptr;
if (_overlayscreen) { if (_overlayscreen) {
SDL_FreeSurface(_overlayscreen); SDL_FreeSurface(_overlayscreen);
_overlayscreen = nullptr; _overlayscreen = nullptr;

View file

@ -72,12 +72,6 @@ public:
virtual int16 getOverlayHeight() const override { return _overlayscreen->h; } virtual int16 getOverlayHeight() const override { return _overlayscreen->h; }
virtual bool isOverlayVisible() const override { return _overlayVisible; } virtual bool isOverlayVisible() const override { return _overlayVisible; }
/* Render the passed Surfaces besides the game texture.
* This is used for widescreen support in the Grim engine.
* Note: we must copy the Surfaces, as they are free()d after this call.
*/
virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) override;
// GraphicsManager API - Mouse // GraphicsManager API - Mouse
virtual void warpMouse(int x, int y) override; virtual void warpMouse(int x, int y) override;
@ -113,10 +107,7 @@ protected:
Math::Rect2d _gameRect; Math::Rect2d _gameRect;
SDL_Surface *_sideSurfaces[2];
void drawOverlay(); void drawOverlay();
void drawSideTextures();
void closeOverlay(); void closeOverlay();
virtual bool saveScreenshot(const Common::String &filename) const override; virtual bool saveScreenshot(const Common::String &filename) const override;

View file

@ -130,11 +130,6 @@ Graphics::PixelBuffer ModularGraphicsBackend::getScreenPixelBuffer() {
return _graphicsManager->getScreenPixelBuffer(); return _graphicsManager->getScreenPixelBuffer();
} }
// ResidualVM specific method
void ModularGraphicsBackend::suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) {
_graphicsManager->suggestSideTextures(left, right);
}
void ModularGraphicsBackend::initSize(uint w, uint h, const Graphics::PixelFormat *format ) { void ModularGraphicsBackend::initSize(uint w, uint h, const Graphics::PixelFormat *format ) {
_graphicsManager->initSize(w, h, format); _graphicsManager->initSize(w, h, format);
} }

View file

@ -83,7 +83,6 @@ public:
#endif #endif
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) override final; virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) override final;
virtual Graphics::PixelBuffer getScreenPixelBuffer() override; // ResidualVM specific method virtual Graphics::PixelBuffer getScreenPixelBuffer() override; // ResidualVM specific method
virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) override; // ResidualVM specific method
virtual void initSizeHint(const Graphics::ModeList &modes) override final; virtual void initSizeHint(const Graphics::ModeList &modes) override final;
virtual int getScreenChangeID() const override final; virtual int getScreenChangeID() const override final;

View file

@ -693,11 +693,6 @@ Graphics::PixelBuffer AndroidGraphicsManager::getScreenPixelBuffer() {
return _game_pbuf; return _game_pbuf;
} }
void AndroidGraphicsManager::suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) {
// TODO
}
void AndroidGraphicsManager::clipMouse(Common::Point &p) const { void AndroidGraphicsManager::clipMouse(Common::Point &p) const {
const GLESBaseTexture *tex = getActiveTexture(); const GLESBaseTexture *tex = getActiveTexture();

View file

@ -97,7 +97,6 @@ public:
// ResidualVM specific method // ResidualVM specific method
void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d, bool isGame); void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d, bool isGame);
virtual Graphics::PixelBuffer getScreenPixelBuffer() override; virtual Graphics::PixelBuffer getScreenPixelBuffer() override;
virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) override;
void updateScreenRect(); void updateScreenRect();
const GLESBaseTexture *getActiveTexture() const; const GLESBaseTexture *getActiveTexture() const;
void clipMouse(Common::Point &p) const; void clipMouse(Common::Point &p) const;

View file

@ -381,14 +381,6 @@ public:
*/ */
kFeatureOpenGL, kFeatureOpenGL,
/**
* This feature flag can be used to check if rendering side textures
* on the both sides of widescreen is supported.
*
* ResidualVM specific
*/
kFeatureSideTextures,
/** /**
* If supported, this feature flag can be used to check if * If supported, this feature flag can be used to check if
* waiting for vertical sync before refreshing the screen to reduce * waiting for vertical sync before refreshing the screen to reduce
@ -945,21 +937,6 @@ public:
*/ */
virtual Graphics::PixelBuffer getScreenPixelBuffer() { return Graphics::PixelBuffer(); } virtual Graphics::PixelBuffer getScreenPixelBuffer() { return Graphics::PixelBuffer(); }
/**
* Suggest textures to render at the side of the game window.
* This enables eg. Grim to render the game in a widescreen format.
*
* The system must take a copy of the Surfaces, as they will be free()d
* automatically.
*
* !!! ResidualVM specific method: !!!
*
* @param left Texture to be used on the left
* @param height Texture to be used on the right
*/
virtual void suggestSideTextures(Graphics::Surface *left,
Graphics::Surface *right) {};
/** /**
* Returns the currently set virtual screen height. * Returns the currently set virtual screen height.
* @see initSize * @see initSize

View file

@ -698,7 +698,6 @@ void GrimEngine::drawNormalMode() {
if (_setupChanged) { if (_setupChanged) {
cameraPostChangeHandle(_currSet->getSetup()); cameraPostChangeHandle(_currSet->getSetup());
_setupChanged = false; _setupChanged = false;
setSideTextures(_currSet->getCurrSetup()->_name.c_str());
} }
// Draw actors // Draw actors
@ -1413,21 +1412,6 @@ Graphics::Surface *loadPNG(const Common::String &filename) {
return srf; return srf;
} }
void GrimEngine::setSideTextures(const Common::String &setup) {
if (! g_system->hasFeature(OSystem::kFeatureSideTextures))
return;
Graphics::Surface *t1 = loadPNG(Common::String::format("%s_left.png", setup.c_str()));
Graphics::Surface *t2 = loadPNG(Common::String::format("%s_right.png", setup.c_str()));
g_system->suggestSideTextures(t1, t2);
if (t1)
t1->free();
if (t2)
t2->free();
delete t1;
delete t2;
}
void GrimEngine::debugLua(const Common::String &str) { void GrimEngine::debugLua(const Common::String &str) {
lua_dostring(str.c_str()); lua_dostring(str.c_str());
} }

View file

@ -174,8 +174,6 @@ public:
void debugLua(const Common::String &str); void debugLua(const Common::String &str);
void setSideTextures(const Common::String &setup);
protected: protected:
virtual void pauseEngineIntern(bool pause) override; virtual void pauseEngineIntern(bool pause) override;