From 608d42d3cdce307b585534adfdae9c9af7304436 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 20 Nov 2018 19:21:15 +0100 Subject: [PATCH] fix ViewProjMatrix::getProjectionMatrix --- src/Base/ViewProj.cpp | 11 +++++++++++ src/Base/ViewProj.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Base/ViewProj.cpp b/src/Base/ViewProj.cpp index 36383df116..b8d5096508 100644 --- a/src/Base/ViewProj.cpp +++ b/src/Base/ViewProj.cpp @@ -54,6 +54,17 @@ ViewProjMatrix::~ViewProjMatrix() { } +Matrix4D ViewProjMatrix::getProjectionMatrix (void) const +{ + // Return the same matrix as passed to the constructor + Matrix4D mat(_clMtx); + if (isOrthographic) { + mat.move(-0.5, -0.5, -0.5); + mat.scale(2.0, 2.0, 2.0); + } + return mat; +} + template void perspectiveTransform(const Base::Matrix4D& mat, Vec& pnt) { diff --git a/src/Base/ViewProj.h b/src/Base/ViewProj.h index 7a31c2429f..306c2f6ece 100644 --- a/src/Base/ViewProj.h +++ b/src/Base/ViewProj.h @@ -68,7 +68,7 @@ public: Vector3f inverse (const Vector3f &rclPt) const; Vector3d inverse (const Vector3d &rclPt) const; - Matrix4D getProjectionMatrix (void) const { return _clMtx; } + Matrix4D getProjectionMatrix (void) const; protected: bool isOrthographic;