[Scummvm-git-logs] scummvm master -> bd50209179c5578e0bc2856e743e578a41268764
neuromancer
noreply at scummvm.org
Sat Nov 16 07:28:11 UTC 2024
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
539f208ee8 FREESCAPE: added commented code for drawCelestialBody in TinyGL for fixing it later
c5f7d07010 FREESCAPE: added missing stipple code in shader renderer
b008700211 FREESCAPE: added missing stipple code in tinygl renderer
99c902be06 FREESCAPE: correct crossair for TinyGL
bd50209179 FREESCAPE: added commented code for renderPlayerShootBall in TinyGL for fixing it later
Commit: 539f208ee8a9bb5c0e1e06a0880bdfeff0410577
https://github.com/scummvm/scummvm/commit/539f208ee8a9bb5c0e1e06a0880bdfeff0410577
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-16T08:27:34+01:00
Commit Message:
FREESCAPE: added commented code for drawCelestialBody in TinyGL for fixing it later
Changed paths:
engines/freescape/gfx_tinygl.cpp
engines/freescape/gfx_tinygl.h
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index e858018ec58..06d277f0736 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -277,6 +277,78 @@ void TinyGLRenderer::renderFace(const Common::Array<Math::Vector3d> &vertices) {
tglDisableClientState(TGL_VERTEX_ARRAY);
}
+void TinyGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, byte color) {
+ /*uint8 r1, g1, b1, r2, g2, b2;
+ byte *stipple = nullptr;
+ getRGBAt(color, 0, r1, g1, b1, r2, g2, b2, stipple);
+
+ int triangleAmount = 20;
+ float twicePi = (float)(2.0 * M_PI);*/
+
+ // Quick billboard effect inspired from this code:
+ // http://www.lighthouse3d.com/opengl/billboarding/index.php?billCheat
+ /*glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ GLfloat m[16];
+ glGetFloatv(GL_MODELVIEW_MATRIX, m);
+ for(int i = 1; i < 4; i++)
+ for(int j = 0; j < 4; j++ ) {
+ if (i == 2)
+ continue;
+ if (i == j)
+ m[i*4 + j] = 1.0;
+ else
+ m[i*4 + j] = 0.0;
+ }
+
+ glLoadMatrixf(m);*/
+ /*tglDisable(TGL_DEPTH_TEST);
+ tglDepthMask(TGL_FALSE);
+
+ setStippleData(stipple);
+ useColor(r1, g1, b1);
+
+ tglEnableClientState(TGL_VERTEX_ARRAY);
+ copyToVertexArray(0, position);
+ float adj = 1.25; // Perspective correction
+
+ for(int i = 0; i <= triangleAmount; i++) {
+ copyToVertexArray(i + 1,
+ Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
+ position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
+ );
+ }
+
+ tglVertexPointer(3, TGL_FLOAT, 0, _verts);
+ tglDrawArrays(TGL_TRIANGLE_FAN, 0, triangleAmount + 2);
+ tglDisableClientState(TGL_VERTEX_ARRAY);
+
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+
+ tglEnableClientState(TGL_VERTEX_ARRAY);
+ copyToVertexArray(0, position);
+
+ for(int i = 0; i <= triangleAmount; i++) {
+ copyToVertexArray(i + 1,
+ Math::Vector3d(position.x(), position.y() + (radius * cos(i * twicePi / triangleAmount)),
+ position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
+ );
+ }
+
+ tglVertexPointer(3, TGL_FLOAT, 0, _verts);
+ tglDrawArrays(TGL_TRIANGLE_FAN, 0, triangleAmount + 2);
+ tglDisableClientState(TGL_VERTEX_ARRAY);
+
+ useStipple(false);
+ }
+
+ tglEnable(TGL_DEPTH_TEST);
+ tglDepthMask(TGL_TRUE);
+ //tglPopMatrix();*/
+}
+
void TinyGLRenderer::depthTesting(bool enabled) {
if (enabled) {
tglClear(TGL_DEPTH_BUFFER_BIT);
diff --git a/engines/freescape/gfx_tinygl.h b/engines/freescape/gfx_tinygl.h
index 297d5505694..7a97f6776c2 100644
--- a/engines/freescape/gfx_tinygl.h
+++ b/engines/freescape/gfx_tinygl.h
@@ -71,6 +71,8 @@ public:
virtual void renderFace(const Common::Array<Math::Vector3d> &vertices) override;
+ void drawCelestialBody(Math::Vector3d position, float radius, byte color) override;
+
virtual void flipBuffer() override;
virtual void drawFloor(uint8 color) override;
virtual Graphics::Surface *getScreenshot() override;
Commit: c5f7d07010ed45cb7beba26d7678aa98262e0bac
https://github.com/scummvm/scummvm/commit/c5f7d07010ed45cb7beba26d7678aa98262e0bac
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-16T08:27:34+01:00
Commit Message:
FREESCAPE: added missing stipple code in shader renderer
Changed paths:
engines/freescape/gfx.h
engines/freescape/gfx_opengl.h
engines/freescape/gfx_opengl_shaders.cpp
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index ea14b7b6072..e54713f575b 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -127,10 +127,32 @@ public:
void selectColorFromFourColorPalette(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1);
+ // Stipple
virtual void setStippleData(byte *data) {};
virtual void useStipple(bool enabled) {};
void scaleStipplePattern(byte originalPattern[128], byte newPattern[128]);
+ byte _defaultStippleArray[128] = {
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ };
+
+ byte *_variableStippleArray;
+
byte *_palette;
void setColorMap(ColorMap *colorMap_);
ColorMap *_colorMap;
diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index bcfa171f010..43d8c1c30b8 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -62,27 +62,6 @@ public:
_coords[idx].x = src.getValue(0); _coords[idx].y = src.getValue(1);
}
- GLubyte _defaultStippleArray[128] = {
- 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
- 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
- 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
- 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
- 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
- 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
- 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
- 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
- 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
- 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
- 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
- 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
- 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
- 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
- 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
- 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
- };
-
- GLubyte *_variableStippleArray;
-
virtual void init() override;
virtual void clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport = false) override;
virtual void setViewport(const Common::Rect &rect) override;
diff --git a/engines/freescape/gfx_opengl_shaders.cpp b/engines/freescape/gfx_opengl_shaders.cpp
index 5c59865d17c..7ff7e38df9d 100644
--- a/engines/freescape/gfx_opengl_shaders.cpp
+++ b/engines/freescape/gfx_opengl_shaders.cpp
@@ -465,14 +465,22 @@ void OpenGLShaderRenderer::setStippleData(byte *data) {
void OpenGLShaderRenderer::useStipple(bool enabled) {
_triangleShader->use();
if (enabled) {
+ GLfloat factor = 0;
+ glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &factor);
glEnable(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset(0.0f, -1.0f);
- _triangleShader->setUniform("useStipple", true);
+ glPolygonOffset(factor - 1.0f, -1.0f);
+ if (_renderMode == Common::kRenderZX ||
+ _renderMode == Common::kRenderCPC ||
+ _renderMode == Common::kRenderCGA ||
+ _renderMode == Common::kRenderHercG)
+ setStippleData((byte *)_variableStippleArray);
+ else
+ setStippleData(_defaultStippleArray);
} else {
glPolygonOffset(0, 0);
glDisable(GL_POLYGON_OFFSET_FILL);
- _triangleShader->setUniform("useStipple", false);
}
+ _triangleShader->setUniform("useStipple", enabled);
}
void OpenGLShaderRenderer::useColor(uint8 r, uint8 g, uint8 b) {
Commit: b00870021123a3270cecec9f681d6a5e6fe899bf
https://github.com/scummvm/scummvm/commit/b00870021123a3270cecec9f681d6a5e6fe899bf
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-16T08:27:34+01:00
Commit Message:
FREESCAPE: added missing stipple code in tinygl renderer
Changed paths:
engines/freescape/gfx.h
engines/freescape/gfx_tinygl.cpp
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index e54713f575b..25a14a3527e 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -151,6 +151,25 @@ public:
0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
};
+ byte _defaultStippleArraySmall[128] = {
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ };
+
byte *_variableStippleArray;
byte *_palette;
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index 06d277f0736..f7b7c72ee8f 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -235,8 +235,8 @@ void TinyGLRenderer::useStipple(bool enabled) {
_renderMode == Common::kRenderCPC ||
_renderMode == Common::kRenderCGA)
tglPolygonStipple(_variableStippleArray);
- /*else
- tglPolygonStipple(_defaultStippleArray);*/
+ else
+ tglPolygonStipple(_defaultStippleArraySmall);
} else {
tglPolygonOffset(0, 0);
tglDisable(TGL_POLYGON_OFFSET_FILL);
Commit: 99c902be06f16336c5c5be0ddd46044c58f15864
https://github.com/scummvm/scummvm/commit/99c902be06f16336c5c5be0ddd46044c58f15864
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-16T08:27:34+01:00
Commit Message:
FREESCAPE: correct crossair for TinyGL
Changed paths:
engines/freescape/gfx_tinygl.cpp
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index f7b7c72ee8f..765d7974857 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -197,14 +197,14 @@ void TinyGLRenderer::renderCrossair(const Common::Point crossairPosition) {
copyToVertexArray(0, Math::Vector3d(crossairPosition.x - 3, crossairPosition.y, 0));
copyToVertexArray(1, Math::Vector3d(crossairPosition.x - 1, crossairPosition.y, 0));
- copyToVertexArray(2, Math::Vector3d(crossairPosition.x + 1, crossairPosition.y, 0));
- copyToVertexArray(3, Math::Vector3d(crossairPosition.x + 3, crossairPosition.y, 0));
+ copyToVertexArray(2, Math::Vector3d(crossairPosition.x + 2, crossairPosition.y, 0));
+ copyToVertexArray(3, Math::Vector3d(crossairPosition.x + 4, crossairPosition.y, 0));
copyToVertexArray(4, Math::Vector3d(crossairPosition.x, crossairPosition.y - 3, 0));
copyToVertexArray(5, Math::Vector3d(crossairPosition.x, crossairPosition.y - 1, 0));
- copyToVertexArray(6, Math::Vector3d(crossairPosition.x, crossairPosition.y + 1, 0));
- copyToVertexArray(7, Math::Vector3d(crossairPosition.x, crossairPosition.y + 3, 0));
+ copyToVertexArray(6, Math::Vector3d(crossairPosition.x, crossairPosition.y + 2, 0));
+ copyToVertexArray(7, Math::Vector3d(crossairPosition.x, crossairPosition.y + 4, 0));
tglVertexPointer(3, TGL_FLOAT, 0, _verts);
tglDrawArrays(TGL_LINES, 0, 8);
Commit: bd50209179c5578e0bc2856e743e578a41268764
https://github.com/scummvm/scummvm/commit/bd50209179c5578e0bc2856e743e578a41268764
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-16T08:27:34+01:00
Commit Message:
FREESCAPE: added commented code for renderPlayerShootBall in TinyGL for fixing it later
Changed paths:
engines/freescape/gfx_tinygl.cpp
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index 765d7974857..434da92facf 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -130,7 +130,51 @@ void TinyGLRenderer::renderSensorShoot(byte color, const Math::Vector3d sensor,
polygonOffset(false);
}
-void TinyGLRenderer::renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewArea) {}
+void TinyGLRenderer::renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewArea) {
+ /*uint8 r, g, b;
+
+ tglMatrixMode(TGL_PROJECTION);
+ tglLoadIdentity();
+ tglOrtho(0, _screenW, _screenH, 0, 0, 1);
+ tglMatrixMode(TGL_MODELVIEW);
+ tglLoadIdentity();
+ if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
+ r = g = b = 255;
+ } else {
+ r = g = b = 255;
+ tglEnable(TGL_BLEND);
+ tglBlendFunc(TGL_ONE_MINUS_DST_COLOR, TGL_ZERO);
+ }
+
+ tglDisable(TGL_DEPTH_TEST);
+ tglDepthMask(TGL_FALSE);
+
+ tglColor3ub(r, g, b);
+ int triangleAmount = 20;
+ float twicePi = (float)(2.0 * M_PI);
+ float coef = (9 - frame) / 9.0;
+ float radius = (1 - coef) * 4.0;
+
+ Common::Point initial_position(viewArea.left + viewArea.width() / 2 + 2, viewArea.height() + viewArea.top);
+ Common::Point ball_position = coef * position + (1 - coef) * initial_position;
+
+ tglEnableClientState(TGL_VERTEX_ARRAY);
+ copyToVertexArray(0, Math::Vector3d(ball_position.x, ball_position.y, 0));
+
+ for(int i = 0; i <= triangleAmount; i++) {
+ float x = ball_position.x + (radius * cos(i * twicePi / triangleAmount));
+ float y = ball_position.y + (radius * sin(i * twicePi / triangleAmount));
+ copyToVertexArray(i + 1, Math::Vector3d(x, y, 0));
+ }
+
+ tglVertexPointer(3, TGL_FLOAT, 0, _verts);
+ tglDrawArrays(TGL_TRIANGLE_FAN, 0, triangleAmount + 2);
+ tglDisableClientState(TGL_VERTEX_ARRAY);
+
+ tglDisable(TGL_BLEND);
+ tglEnable(TGL_DEPTH_TEST);
+ tglDepthMask(TGL_TRUE);*/
+}
void TinyGLRenderer::renderPlayerShootRay(byte color, const Common::Point position, const Common::Rect viewArea) {
More information about the Scummvm-git-logs
mailing list