[Scummvm-git-logs] scummvm master -> 6695eb6f2cf6e97941a3d41be7d641bcd6a80e62
aquadran
noreply at scummvm.org
Wed Oct 16 21:58:05 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:
6695eb6f2c WINTERMUTE: Sync view matrix code in renderer
Commit: 6695eb6f2cf6e97941a3d41be7d641bcd6a80e62
https://github.com/scummvm/scummvm/commit/6695eb6f2cf6e97941a3d41be7d641bcd6a80e62
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2024-10-16T23:57:59+02:00
Commit Message:
WINTERMUTE: Sync view matrix code in renderer
Changed paths:
engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
index 58140ff8a55..4c80e9fe150 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
@@ -518,23 +518,34 @@ bool BaseRenderOpenGL3D::setup3D(Camera3D *camera, bool force) {
if (camera)
_camera = camera;
if (_camera) {
+ Math::Matrix4 viewMatrix;
+ _camera->getViewMatrix(&viewMatrix);
+
+ Math::Matrix4 cameraTranslate;
+ cameraTranslate.setPosition(-_camera->_position);
+ cameraTranslate.transpose();
+ viewMatrix = cameraTranslate * viewMatrix;
+ _lastViewMatrix = viewMatrix;
+
_fov = _camera->_fov;
if (_camera->_nearClipPlane >= 0.0f) {
_nearClipPlane = _camera->_nearClipPlane;
+ } else {
+ _nearClipPlane = DEFAULT_NEAR_PLANE;
}
if (_camera->_farClipPlane >= 0.0f) {
_farClipPlane = _camera->_farClipPlane;
+ } else {
+ _farClipPlane = DEFAULT_FAR_PLANE;
}
- Math::Matrix4 viewMatrix;
- _camera->getViewMatrix(&viewMatrix);
- glLoadMatrixf(viewMatrix.getData());
- glTranslatef(-_camera->_position.x(), -_camera->_position.y(), -_camera->_position.z());
- glGetFloatv(GL_MODELVIEW_MATRIX, _lastViewMatrix.getData());
+ glLoadMatrixf(_lastViewMatrix.getData());
} else {
glLoadMatrixf(_lastViewMatrix.getData());
+ _nearClipPlane = DEFAULT_NEAR_PLANE;
+ _farClipPlane = DEFAULT_FAR_PLANE;
}
for (int i = 0; i < getMaxActiveLights(); ++i) {
@@ -545,7 +556,6 @@ bool BaseRenderOpenGL3D::setup3D(Camera3D *camera, bool force) {
bool fogEnabled;
uint32 fogColor;
float fogStart, fogEnd;
-
_gameRef->getFogParams(&fogEnabled, &fogColor, &fogStart, &fogEnd);
if (fogEnabled) {
glEnable(GL_FOG);
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 48d1264a3b8..31c4097ee04 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
@@ -649,23 +649,28 @@ bool BaseRenderOpenGL3DShader::setup3D(Camera3D *camera, bool force) {
if (camera)
_camera = camera;
if (_camera) {
+ Math::Matrix4 viewMatrix;
+ _camera->getViewMatrix(&viewMatrix);
+ Math::Matrix4 cameraTranslate;
+ cameraTranslate.setPosition(-_camera->_position);
+ cameraTranslate.transpose();
+ viewMatrix = cameraTranslate * viewMatrix;
+ _lastViewMatrix = viewMatrix;
+
_fov = _camera->_fov;
if (_camera->_nearClipPlane >= 0.0f) {
_nearClipPlane = _camera->_nearClipPlane;
+ } else {
+ _nearClipPlane = DEFAULT_NEAR_PLANE;
}
if (_camera->_farClipPlane >= 0.0f) {
_farClipPlane = _camera->_farClipPlane;
+ } else {
+ _farClipPlane = DEFAULT_FAR_PLANE;
}
- Math::Matrix4 viewMatrix;
- _camera->getViewMatrix(&viewMatrix);
- Math::Matrix4 cameraTranslate;
- cameraTranslate.setPosition(-_camera->_position);
- cameraTranslate.transpose();
- viewMatrix = cameraTranslate * viewMatrix;
- _lastViewMatrix = viewMatrix;
}
bool fogEnabled;
More information about the Scummvm-git-logs
mailing list