[Scummvm-git-logs] scummvm master -> 7aab5698827928edd956e2f420256cc6168da8dd
aquadran
aquadran at gmail.com
Wed Oct 20 20:24:18 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7aab569882 STARK: Separated texture usage for 2D or 3D
Commit: 7aab5698827928edd956e2f420256cc6168da8dd
https://github.com/scummvm/scummvm/commit/7aab5698827928edd956e2f420256cc6168da8dd
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2021-10-20T22:24:14+02:00
Commit Message:
STARK: Separated texture usage for 2D or 3D
Changed paths:
engines/stark/gfx/driver.h
engines/stark/gfx/opengl.cpp
engines/stark/gfx/opengl.h
engines/stark/gfx/openglactor.cpp
engines/stark/gfx/openglprop.cpp
engines/stark/gfx/opengls.cpp
engines/stark/gfx/opengls.h
engines/stark/ui/dialogbox.cpp
engines/stark/ui/menu/saveloadmenu.cpp
engines/stark/ui/world/fmvscreen.cpp
engines/stark/visual/effects/effect.cpp
engines/stark/visual/explodingimage.cpp
engines/stark/visual/flashingimage.cpp
engines/stark/visual/image.cpp
engines/stark/visual/smacker.cpp
engines/stark/visual/text.cpp
diff --git a/engines/stark/gfx/driver.h b/engines/stark/gfx/driver.h
index 922ead3920..6f68b188ef 100644
--- a/engines/stark/gfx/driver.h
+++ b/engines/stark/gfx/driver.h
@@ -63,13 +63,21 @@ public:
virtual void flipBuffer() = 0;
/**
- * Create a new texture
+ * Create a new texture for 3D
*
* The caller is responsible for freeing it.
*
*/
virtual Texture *createTexture(const Graphics::Surface *surface = nullptr, const byte *palette = nullptr) = 0;
+ /**
+ * Create a new texture for 2D
+ *
+ * The caller is responsible for freeing it.
+ *
+ */
+ virtual Texture *createBitmap(const Graphics::Surface *surface = nullptr, const byte *palette = nullptr) = 0;
+
/**
* Create a new actor renderer
*
diff --git a/engines/stark/gfx/opengl.cpp b/engines/stark/gfx/opengl.cpp
index 89811b9969..87ddbfff73 100644
--- a/engines/stark/gfx/opengl.cpp
+++ b/engines/stark/gfx/opengl.cpp
@@ -205,6 +205,10 @@ Texture *OpenGLDriver::createTexture(const Graphics::Surface *surface, const byt
return texture;
}
+Texture *OpenGLDriver::createBitmap(const Graphics::Surface *surface, const byte *palette) {
+ return createTexture(surface, palette);
+}
+
VisualActor *OpenGLDriver::createActorRenderer() {
return new OpenGLActorRenderer(this);
}
diff --git a/engines/stark/gfx/opengl.h b/engines/stark/gfx/opengl.h
index 28eb3353cf..bb9c68794e 100644
--- a/engines/stark/gfx/opengl.h
+++ b/engines/stark/gfx/opengl.h
@@ -50,6 +50,7 @@ public:
void flipBuffer() override;
Texture *createTexture(const Graphics::Surface *surface = nullptr, const byte *palette = nullptr) override;
+ Texture *createBitmap(const Graphics::Surface *surface = nullptr, const byte *palette = nullptr) override;
VisualActor *createActorRenderer() override;
VisualProp *createPropRenderer() override;
SurfaceRenderer *createSurfaceRenderer() override;
diff --git a/engines/stark/gfx/openglactor.cpp b/engines/stark/gfx/openglactor.cpp
index ed78f111f6..8116ad4d2e 100644
--- a/engines/stark/gfx/openglactor.cpp
+++ b/engines/stark/gfx/openglactor.cpp
@@ -276,7 +276,6 @@ void OpenGLActorRenderer::render(const Math::Vector3d &position, float direction
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
-
}
if (!_gfx->computeLightsEnabled())
glDisable(GL_COLOR_MATERIAL);
diff --git a/engines/stark/gfx/openglprop.cpp b/engines/stark/gfx/openglprop.cpp
index de945f851a..ba9539f2f7 100644
--- a/engines/stark/gfx/openglprop.cpp
+++ b/engines/stark/gfx/openglprop.cpp
@@ -204,7 +204,6 @@ void OpenGLPropRenderer::render(const Math::Vector3d &position, float direction,
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
-
}
if (!_gfx->computeLightsEnabled())
glDisable(GL_COLOR_MATERIAL);
diff --git a/engines/stark/gfx/opengls.cpp b/engines/stark/gfx/opengls.cpp
index 2362b06154..84e87d4e1c 100644
--- a/engines/stark/gfx/opengls.cpp
+++ b/engines/stark/gfx/opengls.cpp
@@ -142,6 +142,10 @@ Texture *OpenGLSDriver::createTexture(const Graphics::Surface *surface, const by
return texture;
}
+Texture *OpenGLSDriver::createBitmap(const Graphics::Surface *surface, const byte *palette) {
+ return createTexture(surface, palette);
+}
+
VisualActor *OpenGLSDriver::createActorRenderer() {
return new OpenGLSActorRenderer(this);
}
diff --git a/engines/stark/gfx/opengls.h b/engines/stark/gfx/opengls.h
index 7aaf107217..6925b582f6 100644
--- a/engines/stark/gfx/opengls.h
+++ b/engines/stark/gfx/opengls.h
@@ -52,6 +52,7 @@ public:
void flipBuffer() override;
Texture *createTexture(const Graphics::Surface *surface = nullptr, const byte *palette = nullptr) override;
+ Texture *createBitmap(const Graphics::Surface *surface = nullptr, const byte *palette = nullptr) override;
VisualActor *createActorRenderer() override;
VisualProp *createPropRenderer() override;
SurfaceRenderer *createSurfaceRenderer() override;
diff --git a/engines/stark/ui/dialogbox.cpp b/engines/stark/ui/dialogbox.cpp
index b475ba8b1f..15c10d852d 100644
--- a/engines/stark/ui/dialogbox.cpp
+++ b/engines/stark/ui/dialogbox.cpp
@@ -62,7 +62,7 @@ DialogBox::DialogBox(StarkEngine *vm, Gfx::Driver *gfx, Cursor *cursor) :
uint32 blue = background->format.RGBToColor(26, 28, 57);
background->fillRect(Common::Rect(256, 256), blue);
}
- _backgroundTexture = gfx->createTexture(background);
+ _backgroundTexture = gfx->createBitmap(background);
_backgroundTexture->setSamplingFilter(Gfx::Texture::kLinear);
background->free();
@@ -168,7 +168,7 @@ void DialogBox::recomputeLayout() {
drawBevel(&foreground, _confirmButtonRect);
drawBevel(&foreground, _cancelButtonRect);
- _foregroundTexture = _gfx->createTexture(&foreground);
+ _foregroundTexture = _gfx->createBitmap(&foreground);
_foregroundTexture->setSamplingFilter(Gfx::Texture::kLinear);
foreground.free();
diff --git a/engines/stark/ui/menu/saveloadmenu.cpp b/engines/stark/ui/menu/saveloadmenu.cpp
index d3da8e205d..4d57063106 100644
--- a/engines/stark/ui/menu/saveloadmenu.cpp
+++ b/engines/stark/ui/menu/saveloadmenu.cpp
@@ -246,8 +246,8 @@ SaveDataWidget::SaveDataWidget(int slot, Gfx::Driver *gfx, SaveLoadMenuScreen *s
_screen(screen),
_thumbWidth(kThumbnailWidth),
_thumbHeight(kThumbnailHeight),
- _texture(gfx->createTexture()),
- _outline(gfx->createTexture()),
+ _texture(gfx->createBitmap()),
+ _outline(gfx->createBitmap()),
_surfaceRenderer(gfx->createSurfaceRenderer()),
_textDesc(gfx),
_textTime(gfx),
diff --git a/engines/stark/ui/world/fmvscreen.cpp b/engines/stark/ui/world/fmvscreen.cpp
index 4a2ac66749..a93ee9933e 100644
--- a/engines/stark/ui/world/fmvscreen.cpp
+++ b/engines/stark/ui/world/fmvscreen.cpp
@@ -44,7 +44,7 @@ FMVScreen::FMVScreen(Gfx::Driver *gfx, Cursor *cursor) :
_decoder->setDefaultHighColorFormat(Gfx::Driver::getRGBAPixelFormat());
_decoder->setSoundType(Audio::Mixer::kSFXSoundType);
- _texture = _gfx->createTexture();
+ _texture = _gfx->createBitmap();
_texture->setSamplingFilter(StarkSettings->getImageSamplingFilter());
_surfaceRenderer = _gfx->createSurfaceRenderer();
diff --git a/engines/stark/visual/effects/effect.cpp b/engines/stark/visual/effects/effect.cpp
index 6db6f830e9..9e449f5144 100644
--- a/engines/stark/visual/effects/effect.cpp
+++ b/engines/stark/visual/effects/effect.cpp
@@ -41,7 +41,7 @@ VisualEffect::VisualEffect(VisualType type, const Common::Point &size, Gfx::Driv
_surface = new Graphics::Surface();
_surface->create(size.x, size.y, Gfx::Driver::getRGBAPixelFormat());
- _texture = _gfx->createTexture(_surface);
+ _texture = _gfx->createBitmap(_surface);
_texture->setSamplingFilter(StarkSettings->getImageSamplingFilter());
_surfaceRenderer = _gfx->createSurfaceRenderer();
diff --git a/engines/stark/visual/explodingimage.cpp b/engines/stark/visual/explodingimage.cpp
index ca44437e1e..496d710437 100644
--- a/engines/stark/visual/explodingimage.cpp
+++ b/engines/stark/visual/explodingimage.cpp
@@ -62,7 +62,7 @@ void VisualExplodingImage::initFromSurface(const Graphics::Surface *surface, uin
_originalWidth = originalWidth;
_originalHeight = originalHeight;
- _texture = _gfx->createTexture(_surface);
+ _texture = _gfx->createBitmap(_surface);
_texture->setSamplingFilter(StarkSettings->getImageSamplingFilter());
// Create an explosion unit for each pixel in the surface
diff --git a/engines/stark/visual/flashingimage.cpp b/engines/stark/visual/flashingimage.cpp
index 77b9c36fad..883752216f 100644
--- a/engines/stark/visual/flashingimage.cpp
+++ b/engines/stark/visual/flashingimage.cpp
@@ -60,7 +60,7 @@ void VisualFlashingImage::initFromSurface(const Graphics::Surface *surface, uint
_originalWidth = originalWidth;
_originalHeight = originalHeight;
- _texture = _gfx->createTexture(surface);
+ _texture = _gfx->createBitmap(surface);
_texture->setSamplingFilter(StarkSettings->getImageSamplingFilter());
}
diff --git a/engines/stark/visual/image.cpp b/engines/stark/visual/image.cpp
index 71b3734eb3..ba6b5d6ddd 100644
--- a/engines/stark/visual/image.cpp
+++ b/engines/stark/visual/image.cpp
@@ -62,7 +62,7 @@ void VisualImageXMG::load(Common::ReadStream *stream) {
// Decode the XMG
_surface = Formats::XMGDecoder::decode(stream);
- _texture = _gfx->createTexture(_surface);
+ _texture = _gfx->createBitmap(_surface);
_texture->setSamplingFilter(StarkSettings->getImageSamplingFilter());
_originalWidth = _surface->w;
@@ -95,7 +95,7 @@ bool VisualImageXMG::loadPNG(Common::SeekableReadStream *stream) {
_surface = pngDecoder.getSurface()->convertTo(Gfx::Driver::getRGBAPixelFormat());
}
- _texture = _gfx->createTexture(_surface);
+ _texture = _gfx->createBitmap(_surface);
_texture->setSamplingFilter(StarkSettings->getImageSamplingFilter());
return true;
diff --git a/engines/stark/visual/smacker.cpp b/engines/stark/visual/smacker.cpp
index ee553dce10..7f8347a495 100644
--- a/engines/stark/visual/smacker.cpp
+++ b/engines/stark/visual/smacker.cpp
@@ -85,7 +85,7 @@ void VisualSmacker::init() {
rewind();
- _texture = _gfx->createTexture();
+ _texture = _gfx->createBitmap();
_texture->setSamplingFilter(StarkSettings->getImageSamplingFilter());
update();
diff --git a/engines/stark/visual/text.cpp b/engines/stark/visual/text.cpp
index 169e79bc6b..edc40df2df 100644
--- a/engines/stark/visual/text.cpp
+++ b/engines/stark/visual/text.cpp
@@ -294,7 +294,7 @@ void VisualText::createTexture() {
multiplyColorWithAlpha(&surface);
// Create a texture from the surface
- _texture = _gfx->createTexture(&surface);
+ _texture = _gfx->createBitmap(&surface);
_texture->setSamplingFilter(Gfx::Texture::kNearest);
surface.free();
@@ -310,7 +310,7 @@ void VisualText::createTexture() {
surface.fillRect(Common::Rect(surface.w, surface.h), bgColor);
multiplyColorWithAlpha(&surface);
- _bgTexture = _gfx->createTexture(&surface);
+ _bgTexture = _gfx->createBitmap(&surface);
surface.free();
}
More information about the Scummvm-git-logs
mailing list