[Scummvm-git-logs] scummvm master -> 946ee0a6391966391afc93d2ea1c1a3cce0f3b09

aquadran noreply at scummvm.org
Sat Dec 4 09:16:47 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:
946ee0a639 PLAYGROUND3D: Added more pixel formats for bitmap test


Commit: 946ee0a6391966391afc93d2ea1c1a3cce0f3b09
    https://github.com/scummvm/scummvm/commit/946ee0a6391966391afc93d2ea1c1a3cce0f3b09
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-12-04T10:16:43+01:00

Commit Message:
PLAYGROUND3D: Added more pixel formats for bitmap test

Changed paths:
    engines/playground3d/gfx.h
    engines/playground3d/gfx_opengl.cpp
    engines/playground3d/gfx_opengl.h
    engines/playground3d/gfx_opengl_shaders.cpp
    engines/playground3d/gfx_opengl_shaders.h
    engines/playground3d/gfx_tinygl.cpp
    engines/playground3d/gfx_tinygl.h
    engines/playground3d/playground3d.cpp
    engines/playground3d/playground3d.h


diff --git a/engines/playground3d/gfx.h b/engines/playground3d/gfx.h
index 568171c0bd..8279a48db2 100644
--- a/engines/playground3d/gfx.h
+++ b/engines/playground3d/gfx.h
@@ -61,6 +61,9 @@ public:
 	virtual void setupViewport(int x, int y, int width, int height) = 0;
 	virtual void loadTextureRGBA(Graphics::Surface *texture) = 0;
 	virtual void loadTextureRGB(Graphics::Surface *texture) = 0;
+	virtual void loadTextureRGB565(Graphics::Surface *texture) = 0;
+	virtual void loadTextureRGBA5551(Graphics::Surface *texture) = 0;
+	virtual void loadTextureRGBA4444(Graphics::Surface *texture) = 0;
 	virtual void drawCube(const Math::Vector3d &pos, const Math::Vector3d &roll) = 0;
 	virtual void drawPolyOffsetTest(const Math::Vector3d &pos, const Math::Vector3d &roll) = 0;
 	virtual void dimRegionInOut(float fade) = 0;
diff --git a/engines/playground3d/gfx_opengl.cpp b/engines/playground3d/gfx_opengl.cpp
index e34f2454a3..a1f662089c 100644
--- a/engines/playground3d/gfx_opengl.cpp
+++ b/engines/playground3d/gfx_opengl.cpp
@@ -96,13 +96,19 @@ void OpenGLRenderer::init() {
 	glDisable(GL_LIGHTING);
 	glEnable(GL_DEPTH_TEST);
 
-	glGenTextures(10, _textureRgbaId);
-	glGenTextures(10, _textureRgbId);
+	glGenTextures(5, _textureRgbaId);
+	glGenTextures(5, _textureRgbId);
+	glGenTextures(2, _textureRgb565Id);
+	glGenTextures(2, _textureRgba5551Id);
+	glGenTextures(2, _textureRgba4444Id);
 }
 
 void OpenGLRenderer::deinit() {
-	glDeleteTextures(10, _textureRgbaId);
-	glDeleteTextures(10, _textureRgbId);
+	glDeleteTextures(5, _textureRgbaId);
+	glDeleteTextures(5, _textureRgbId);
+	glDeleteTextures(2, _textureRgb565Id);
+	glDeleteTextures(2, _textureRgba5551Id);
+	glDeleteTextures(2, _textureRgba4444Id);
 }
 
 void OpenGLRenderer::clear(const Math::Vector4d &clearColor) {
@@ -128,6 +134,27 @@ void OpenGLRenderer::loadTextureRGB(Graphics::Surface *texture) {
 	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, texture->getPixels());
 }
 
+void OpenGLRenderer::loadTextureRGB565(Graphics::Surface *texture) {
+	glBindTexture(GL_TEXTURE_2D, _textureRgb565Id[0]);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, texture->getPixels());
+}
+
+void OpenGLRenderer::loadTextureRGBA5551(Graphics::Surface *texture) {
+	glBindTexture(GL_TEXTURE_2D, _textureRgba5551Id[0]);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, texture->getPixels());
+}
+
+void OpenGLRenderer::loadTextureRGBA4444(Graphics::Surface *texture) {
+	glBindTexture(GL_TEXTURE_2D, _textureRgba4444Id[0]);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, texture->getPixels());
+}
+
 void OpenGLRenderer::setupViewport(int x, int y, int width, int height) {
 	glViewport(x, y, width, height);
 }
@@ -317,6 +344,39 @@ void OpenGLRenderer::drawRgbaTexture() {
 	glDisableClientState(GL_VERTEX_ARRAY);
 	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 
+	glTranslatef(0.5, 0, 0);
+
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+	glVertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), bitmapVertices);
+	glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), textCords);
+	glBindTexture(GL_TEXTURE_2D, _textureRgb565Id[0]);
+	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+	glDisableClientState(GL_VERTEX_ARRAY);
+	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+
+	glTranslatef(-1.5, -0.5, 0);
+
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+	glVertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), bitmapVertices);
+	glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), textCords);
+	glBindTexture(GL_TEXTURE_2D, _textureRgba5551Id[0]);
+	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+	glDisableClientState(GL_VERTEX_ARRAY);
+	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+
+	glTranslatef(0.5, 0, 0);
+
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+	glVertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), bitmapVertices);
+	glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), textCords);
+	glBindTexture(GL_TEXTURE_2D, _textureRgba4444Id[0]);
+	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+	glDisableClientState(GL_VERTEX_ARRAY);
+	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+
 	glMatrixMode(GL_MODELVIEW);
 	glPopMatrix();
 
diff --git a/engines/playground3d/gfx_opengl.h b/engines/playground3d/gfx_opengl.h
index 4be560f262..f3cffb556d 100644
--- a/engines/playground3d/gfx_opengl.h
+++ b/engines/playground3d/gfx_opengl.h
@@ -45,6 +45,9 @@ public:
 	void clear(const Math::Vector4d &clearColor) override;
 	void loadTextureRGBA(Graphics::Surface *texture) override;
 	void loadTextureRGB(Graphics::Surface *texture) override;
+	void loadTextureRGB565(Graphics::Surface *texture) override;
+	void loadTextureRGBA5551(Graphics::Surface *texture) override;
+	void loadTextureRGBA4444(Graphics::Surface *texture) override;
 
 	void setupViewport(int x, int y, int width, int height) override;
 	void drawCube(const Math::Vector3d &pos, const Math::Vector3d &roll) override;
@@ -55,8 +58,11 @@ public:
 
 private:
 	Math::Vector3d _pos;
-	GLuint _textureRgbaId[10];
-	GLuint _textureRgbId[10];
+	GLuint _textureRgbaId[5];
+	GLuint _textureRgbId[5];
+	GLuint _textureRgb565Id[2];
+	GLuint _textureRgba5551Id[2];
+	GLuint _textureRgba4444Id[2];
 
 	void drawFace(uint face);
 };
diff --git a/engines/playground3d/gfx_opengl_shaders.cpp b/engines/playground3d/gfx_opengl_shaders.cpp
index bb74344631..3405915fde 100644
--- a/engines/playground3d/gfx_opengl_shaders.cpp
+++ b/engines/playground3d/gfx_opengl_shaders.cpp
@@ -105,13 +105,19 @@ void ShaderRenderer::init() {
 	_bitmapShader->enableVertexAttribute("position", _bitmapVBO, 2, GL_FLOAT, GL_TRUE, 4 * sizeof(float), 0);
 	_bitmapShader->enableVertexAttribute("texcoord", _bitmapVBO, 2, GL_FLOAT, GL_TRUE, 4 * sizeof(float), 8);
 
-	glGenTextures(10, _textureRgbaId);
-	glGenTextures(10, _textureRgbId);
+	glGenTextures(5, _textureRgbaId);
+	glGenTextures(5, _textureRgbId);
+	glGenTextures(2, _textureRgb565Id);
+	glGenTextures(2, _textureRgba5551Id);
+	glGenTextures(2, _textureRgba4444Id);
 }
 
 void ShaderRenderer::deinit() {
-	glDeleteTextures(10, _textureRgbaId);
-	glDeleteTextures(10, _textureRgbId);
+	glDeleteTextures(5, _textureRgbaId);
+	glDeleteTextures(5, _textureRgbId);
+	glDeleteTextures(2, _textureRgb565Id);
+	glDeleteTextures(2, _textureRgba5551Id);
+	glDeleteTextures(2, _textureRgba4444Id);
 }
 
 void ShaderRenderer::clear(const Math::Vector4d &clearColor) {
@@ -137,6 +143,27 @@ void ShaderRenderer::loadTextureRGB(Graphics::Surface *texture) {
 	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, texture->getPixels());
 }
 
+void ShaderRenderer::loadTextureRGB565(Graphics::Surface *texture) {
+	glBindTexture(GL_TEXTURE_2D, _textureRgb565Id[0]);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, texture->getPixels());
+}
+
+void ShaderRenderer::loadTextureRGBA5551(Graphics::Surface *texture) {
+	glBindTexture(GL_TEXTURE_2D, _textureRgba5551Id[0]);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, texture->getPixels());
+}
+
+void ShaderRenderer::loadTextureRGBA4444(Graphics::Surface *texture) {
+	glBindTexture(GL_TEXTURE_2D, _textureRgba4444Id[0]);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, texture->getPixels());
+}
+
 void ShaderRenderer::setupViewport(int x, int y, int width, int height) {
 	glViewport(x, y, width, height);
 }
@@ -204,6 +231,24 @@ void ShaderRenderer::drawRgbaTexture() {
 	glBindTexture(GL_TEXTURE_2D, _textureRgbId[0]);
 	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
+	offset.setX(0.7);
+	offset.setY(0.8);
+	_bitmapShader->setUniform("offsetXY", offset);
+	glBindTexture(GL_TEXTURE_2D, _textureRgb565Id[0]);
+	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+	offset.setX(-0.8);
+	offset.setY(0.2);
+	_bitmapShader->setUniform("offsetXY", offset);
+	glBindTexture(GL_TEXTURE_2D, _textureRgba5551Id[0]);
+	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+	offset.setX(-0.3);
+	offset.setY(0.2);
+	_bitmapShader->setUniform("offsetXY", offset);
+	glBindTexture(GL_TEXTURE_2D, _textureRgba4444Id[0]);
+	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
 	_bitmapShader->unbind();
 }
 
diff --git a/engines/playground3d/gfx_opengl_shaders.h b/engines/playground3d/gfx_opengl_shaders.h
index 171f2d4d57..9012516fbf 100644
--- a/engines/playground3d/gfx_opengl_shaders.h
+++ b/engines/playground3d/gfx_opengl_shaders.h
@@ -45,6 +45,9 @@ public:
 	void clear(const Math::Vector4d &clearColor) override;
 	void loadTextureRGBA(Graphics::Surface *texture) override;
 	void loadTextureRGB(Graphics::Surface *texture) override;
+	void loadTextureRGB565(Graphics::Surface *texture) override;
+	void loadTextureRGBA5551(Graphics::Surface *texture) override;
+	void loadTextureRGBA4444(Graphics::Surface *texture) override;
 
 	void setupViewport(int x, int y, int width, int height) override;
 	void drawCube(const Math::Vector3d &pos, const Math::Vector3d &roll) override;
@@ -63,8 +66,11 @@ private:
 	GLuint _bitmapVBO;
 
 	Common::Rect _currentViewport;
-	GLuint _textureRgbaId[10];
-	GLuint _textureRgbId[10];
+	GLuint _textureRgbaId[5];
+	GLuint _textureRgbId[5];
+	GLuint _textureRgb565Id[2];
+	GLuint _textureRgba5551Id[2];
+	GLuint _textureRgba4444Id[2];
 };
 
 } // End of namespace Playground3d
diff --git a/engines/playground3d/gfx_tinygl.cpp b/engines/playground3d/gfx_tinygl.cpp
index b8e57352b8..6797f371db 100644
--- a/engines/playground3d/gfx_tinygl.cpp
+++ b/engines/playground3d/gfx_tinygl.cpp
@@ -101,13 +101,19 @@ void TinyGLRenderer::init() {
 	tglDisable(TGL_LIGHTING);
 	tglEnable(TGL_DEPTH_TEST);
 
-	tglGenTextures(10, _textureRgbaId);
-	tglGenTextures(10, _textureRgbId);
+	tglGenTextures(5, _textureRgbaId);
+	tglGenTextures(5, _textureRgbId);
+	tglGenTextures(2, _textureRgb565Id);
+	tglGenTextures(2, _textureRgba5551Id);
+	tglGenTextures(2, _textureRgba4444Id);
 }
 
 void TinyGLRenderer::deinit() {
-	//tglDeleteTextures(10, &_textureRgbaId);
-	//tglDeleteTextures(10, &_textureRgbId);
+	//tglDeleteTextures(5, _textureRgbaId);
+	//tglDeleteTextures(5, _textureRgbId);
+	//tglDeleteTextures(2, _textureRgb565Id);
+	//tglDeleteTextures(2, _textureRgba5551Id);
+	//tglDeleteTextures(2, _textureRgba4444Id);
 }
 
 void TinyGLRenderer::loadTextureRGBA(Graphics::Surface *texture) {
@@ -128,6 +134,27 @@ void TinyGLRenderer::loadTextureRGB(Graphics::Surface *texture) {
 	tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, texture->w, texture->h, 0, TGL_RGB, TGL_UNSIGNED_BYTE, texture->getPixels());
 }
 
+void TinyGLRenderer::loadTextureRGB565(Graphics::Surface *texture) {
+	tglBindTexture(TGL_TEXTURE_2D, _textureRgb565Id[0]);
+	tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MIN_FILTER, TGL_NEAREST);
+	tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MAG_FILTER, TGL_NEAREST);
+	tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, texture->w, texture->h, 0, TGL_RGB, TGL_UNSIGNED_SHORT_5_6_5, texture->getPixels());
+}
+
+void TinyGLRenderer::loadTextureRGBA5551(Graphics::Surface *texture) {
+	tglBindTexture(TGL_TEXTURE_2D, _textureRgba5551Id[0]);
+	tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MIN_FILTER, TGL_NEAREST);
+	tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MAG_FILTER, TGL_NEAREST);
+	tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, texture->w, texture->h, 0, TGL_RGBA, TGL_UNSIGNED_SHORT_5_5_5_1, texture->getPixels());
+}
+
+void TinyGLRenderer::loadTextureRGBA4444(Graphics::Surface *texture) {
+	tglBindTexture(TGL_TEXTURE_2D, _textureRgba4444Id[0]);
+	tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MIN_FILTER, TGL_NEAREST);
+	tglTexParameteri(TGL_TEXTURE_2D, TGL_TEXTURE_MAG_FILTER, TGL_NEAREST);
+	tglTexImage2D(TGL_TEXTURE_2D, 0, TGL_RGBA, texture->w, texture->h, 0, TGL_RGBA, TGL_UNSIGNED_SHORT_4_4_4_4, texture->getPixels());
+}
+
 void TinyGLRenderer::clear(const Math::Vector4d &clearColor) {
 	tglClearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
 	tglClear(TGL_COLOR_BUFFER_BIT | TGL_DEPTH_BUFFER_BIT);
@@ -328,6 +355,39 @@ void TinyGLRenderer::drawRgbaTexture() {
 	tglDisableClientState(TGL_VERTEX_ARRAY);
 	tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
 
+	tglTranslatef(0.5, 0, 0);
+
+	tglEnableClientState(TGL_VERTEX_ARRAY);
+	tglEnableClientState(TGL_TEXTURE_COORD_ARRAY);
+	tglVertexPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), bitmapVertices);
+	tglTexCoordPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), textCords);
+	tglBindTexture(TGL_TEXTURE_2D, _textureRgb565Id[0]);
+	tglDrawArrays(TGL_TRIANGLE_STRIP, 0, 4);
+	tglDisableClientState(TGL_VERTEX_ARRAY);
+	tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
+
+	tglTranslatef(-1.5, -0.5, 0);
+
+	tglEnableClientState(TGL_VERTEX_ARRAY);
+	tglEnableClientState(TGL_TEXTURE_COORD_ARRAY);
+	tglVertexPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), bitmapVertices);
+	tglTexCoordPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), textCords);
+	tglBindTexture(TGL_TEXTURE_2D, _textureRgba5551Id[0]);
+	tglDrawArrays(TGL_TRIANGLE_STRIP, 0, 4);
+	tglDisableClientState(TGL_VERTEX_ARRAY);
+	tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
+
+	tglTranslatef(0.5, 0, 0);
+
+	tglEnableClientState(TGL_VERTEX_ARRAY);
+	tglEnableClientState(TGL_TEXTURE_COORD_ARRAY);
+	tglVertexPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), bitmapVertices);
+	tglTexCoordPointer(2, TGL_FLOAT, 2 * sizeof(TGLfloat), textCords);
+	tglBindTexture(TGL_TEXTURE_2D, _textureRgba4444Id[0]);
+	tglDrawArrays(TGL_TRIANGLE_STRIP, 0, 4);
+	tglDisableClientState(TGL_VERTEX_ARRAY);
+	tglDisableClientState(TGL_TEXTURE_COORD_ARRAY);
+
 	tglMatrixMode(TGL_MODELVIEW);
 	tglPopMatrix();
 
diff --git a/engines/playground3d/gfx_tinygl.h b/engines/playground3d/gfx_tinygl.h
index 36fb146171..a3edd07444 100644
--- a/engines/playground3d/gfx_tinygl.h
+++ b/engines/playground3d/gfx_tinygl.h
@@ -45,6 +45,9 @@ public:
 	void clear(const Math::Vector4d &clearColor) override;
 	void loadTextureRGB(Graphics::Surface *texture) override;
 	void loadTextureRGBA(Graphics::Surface *texture) override;
+	void loadTextureRGB565(Graphics::Surface *texture) override;
+	void loadTextureRGBA5551(Graphics::Surface *texture) override;
+	void loadTextureRGBA4444(Graphics::Surface *texture) override;
 
 	void setupViewport(int x, int y, int width, int height) override;
 	void drawCube(const Math::Vector3d &pos, const Math::Vector3d &roll) override;
@@ -58,8 +61,11 @@ public:
 private:
 	TinyGL::FrameBuffer *_fb;
 	Math::Vector3d _pos;
-	TGLuint _textureRgbaId[10];
-	TGLuint _textureRgbId[10];
+	TGLuint _textureRgbaId[5];
+	TGLuint _textureRgbId[5];
+	TGLuint _textureRgb565Id[2];
+	TGLuint _textureRgba5551Id[2];
+	TGLuint _textureRgba4444Id[2];
 
 	void drawFace(uint face);
 };
diff --git a/engines/playground3d/playground3d.cpp b/engines/playground3d/playground3d.cpp
index 1a5be72fe3..fa59074d40 100644
--- a/engines/playground3d/playground3d.cpp
+++ b/engines/playground3d/playground3d.cpp
@@ -47,7 +47,9 @@ bool Playground3dEngine::hasFeature(EngineFeature f) const {
 Playground3dEngine::Playground3dEngine(OSystem *syst)
 		: Engine(syst), _system(syst), _frameLimiter(nullptr),
 		_rotateAngleX(0), _rotateAngleY(0), _rotateAngleZ(0),
-		_clearColor(0.0f, 0.0f, 0.0f, 1.0f), _fade(1.0f), _fadeIn(false) {
+		_clearColor(0.0f, 0.0f, 0.0f, 1.0f), _fade(1.0f), _fadeIn(false),
+		_rgbaTexture(nullptr), _rgbTexture(nullptr), _rgb565Texture(nullptr),
+		_rgba5551Texture(nullptr), _rgba4444Texture(nullptr) {
 }
 
 Playground3dEngine::~Playground3dEngine() {
@@ -93,8 +95,14 @@ Common::Error Playground3dEngine::run() {
 			Graphics::PixelFormat pixelFormatRGBA(4, 8, 8, 8, 8, 24, 16, 8, 0);
 			Graphics::PixelFormat pixelFormatRGB(3, 8, 8, 8, 0, 0, 8, 16, 0);
 #endif
+			Graphics::PixelFormat pixelFormatRGB565(2, 5, 6, 5, 0, 11, 5, 0, 0);
+			Graphics::PixelFormat pixelFormatRGB5551(2, 5, 5, 5, 1, 11, 6, 1, 0);
+			Graphics::PixelFormat pixelFormatRGB4444(2, 4, 4, 4, 4, 12, 8, 4, 0);
 			_rgbaTexture = generateRgbaTexture(120, 120, pixelFormatRGBA);
 			_rgbTexture = _rgbaTexture->convertTo(pixelFormatRGB);
+			_rgb565Texture = generateRgbaTexture(120, 120, pixelFormatRGB565);
+			_rgba5551Texture = generateRgbaTexture(120, 120, pixelFormatRGB5551);
+			_rgba4444Texture = generateRgbaTexture(120, 120, pixelFormatRGB4444);
 			break;
 		}
 		default:
@@ -108,6 +116,9 @@ Common::Error Playground3dEngine::run() {
 
 	delete _rgbaTexture;
 	delete _rgbTexture;
+	delete _rgb565Texture;
+	delete _rgba5551Texture;
+	delete _rgba4444Texture;
 	_gfx->deinit();
 	_system->showMouse(false);
 
@@ -219,6 +230,9 @@ void Playground3dEngine::drawFrame(int testId) {
 		case 5:
 			_gfx->loadTextureRGBA(_rgbaTexture);
 			_gfx->loadTextureRGB(_rgbTexture);
+			_gfx->loadTextureRGB565(_rgb565Texture);
+			_gfx->loadTextureRGBA5551(_rgba5551Texture);
+			_gfx->loadTextureRGBA4444(_rgba4444Texture);
 			drawRgbaTexture();
 			break;
 		default:
diff --git a/engines/playground3d/playground3d.h b/engines/playground3d/playground3d.h
index 13667860d2..63c05ff92f 100644
--- a/engines/playground3d/playground3d.h
+++ b/engines/playground3d/playground3d.h
@@ -55,6 +55,9 @@ private:
 	bool _fadeIn;
 	Graphics::Surface *_rgbaTexture;
 	Graphics::Surface *_rgbTexture;
+	Graphics::Surface *_rgb565Texture;
+	Graphics::Surface *_rgba5551Texture;
+	Graphics::Surface *_rgba4444Texture;
 
 	float _rotateAngleX, _rotateAngleY, _rotateAngleZ;
 




More information about the Scummvm-git-logs mailing list