[Scummvm-git-logs] scummvm master -> 4b6cbbb5ddea399223ac97d9562b9ea377c05128

aquadran noreply at scummvm.org
Sun Oct 13 21:20:55 UTC 2024


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:
4b6cbbb5dd WINTERMUTE: More sync with original code at isTransparentAt and renderer.


Commit: 4b6cbbb5ddea399223ac97d9562b9ea377c05128
    https://github.com/scummvm/scummvm/commit/4b6cbbb5ddea399223ac97d9562b9ea377c05128
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2024-10-13T23:20:51+02:00

Commit Message:
WINTERMUTE: More sync with original code at isTransparentAt and renderer.

Changed paths:
    engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
    engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
    engines/wintermute/base/gfx/xmodel.cpp


diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
index d4967eefb36..79b3cfdfcf7 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
@@ -55,6 +55,7 @@ BaseRenderOpenGL3D::BaseRenderOpenGL3D(BaseGame *inGame) : BaseRenderer3D(inGame
 }
 
 BaseRenderOpenGL3D::~BaseRenderOpenGL3D() {
+	_camera = nullptr;
 }
 
 void BaseRenderOpenGL3D::setSpriteBlendMode(Graphics::TSpriteBlendMode blendMode) {
@@ -491,21 +492,23 @@ bool BaseRenderOpenGL3D::setup3D(Camera3D *camera, bool force) {
 
 		glEnable(GL_NORMALIZE);
 
-		if (camera) {
-			_fov = camera->_fov;
+		if (camera)
+			_camera = camera;
+		if (_camera) {
+			_fov = _camera->_fov;
 
-			if (camera->_nearClipPlane >= 0.0f) {
-				_nearClipPlane = camera->_nearClipPlane;
+			if (_camera->_nearClipPlane >= 0.0f) {
+				_nearClipPlane = _camera->_nearClipPlane;
 			}
 
-			if (camera->_farClipPlane >= 0.0f) {
-				_farClipPlane = camera->_farClipPlane;
+			if (_camera->_farClipPlane >= 0.0f) {
+				_farClipPlane = _camera->_farClipPlane;
 			}
 
 			Math::Matrix4 viewMatrix;
-			camera->getViewMatrix(&viewMatrix);
+			_camera->getViewMatrix(&viewMatrix);
 			glLoadMatrixf(viewMatrix.getData());
-			glTranslatef(-camera->_position.x(), -camera->_position.y(), -camera->_position.z());
+			glTranslatef(-_camera->_position.x(), -_camera->_position.y(), -_camera->_position.z());
 			glGetFloatv(GL_MODELVIEW_MATRIX, _lastViewMatrix.getData());
 		} else {
 			glLoadMatrixf(_lastViewMatrix.getData());
diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp b/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
index 3553eac5035..98e4da43f1e 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
@@ -621,21 +621,23 @@ bool BaseRenderOpenGL3DShader::setup3D(Camera3D *camera, bool force) {
 
 		setAmbientLight();
 
-		if (camera) {
-			_fov = camera->_fov;
+		if (camera)
+			_camera = camera;
+		if (_camera) {
+			_fov = _camera->_fov;
 
-			if (camera->_nearClipPlane >= 0.0f) {
+			if (_camera->_nearClipPlane >= 0.0f) {
 				_nearClipPlane = camera->_nearClipPlane;
 			}
 
-			if (camera->_farClipPlane >= 0.0f) {
-				_farClipPlane = camera->_farClipPlane;
+			if (_camera->_farClipPlane >= 0.0f) {
+				_farClipPlane = _camera->_farClipPlane;
 			}
 
 			Math::Matrix4 viewMatrix;
-			camera->getViewMatrix(&viewMatrix);
+			_camera->getViewMatrix(&viewMatrix);
 			Math::Matrix4 cameraTranslate;
-			cameraTranslate.setPosition(-camera->_position);
+			cameraTranslate.setPosition(-_camera->_position);
 			cameraTranslate.transpose();
 			viewMatrix = cameraTranslate * viewMatrix;
 			_lastViewMatrix = viewMatrix;
diff --git a/engines/wintermute/base/gfx/xmodel.cpp b/engines/wintermute/base/gfx/xmodel.cpp
index d073a340b34..889e0ee0624 100644
--- a/engines/wintermute/base/gfx/xmodel.cpp
+++ b/engines/wintermute/base/gfx/xmodel.cpp
@@ -542,6 +542,26 @@ bool XModel::isTransparentAt(int x, int y) {
 		return false;
 	}
 
+	x += _lastOffsetX;
+	y += _lastOffsetY;
+
+	if (!_gameRef->_renderer3D->_camera)
+		return true;
+
+	float resWidth, resHeight;
+	float layerWidth, layerHeight;
+	float modWidth, modHeight;
+	bool customViewport;
+	_gameRef->_renderer3D->getProjectionParams(&resWidth, &resHeight, &layerWidth, &layerHeight, &modWidth, &modHeight, &customViewport);
+
+	x -= _drawingViewport.left + modWidth;
+	y -= _drawingViewport.top + modHeight;
+
+	if (customViewport) {
+		x += _gameRef->_renderer3D->_drawOffsetX;
+		y += _gameRef->_renderer3D->_drawOffsetY;
+	}
+
 	Math::Ray ray = _gameRef->_renderer3D->rayIntoScene(x, y);
 
 	// transform to model space




More information about the Scummvm-git-logs mailing list