From 9898271cf7ba11bc960da9b6cc9627a17b5dff06 Mon Sep 17 00:00:00 2001 From: Lunkhound Date: Fri, 15 Jan 2016 14:46:57 -0800 Subject: [PATCH] mtxOrtho: add option for creating OpenGL style orthographic projections --- include/bx/fpumath.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/bx/fpumath.h b/include/bx/fpumath.h index bd208a9..95d4021 100644 --- a/include/bx/fpumath.h +++ b/include/bx/fpumath.h @@ -715,14 +715,14 @@ namespace bx mtxProjRh(_result, _fovy, _aspect, _near, _far, _oglNdc); } - inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f) + inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) { const float aa = 2.0f/(_right - _left); const float bb = 2.0f/(_top - _bottom); - const float cc = 1.0f/(_far - _near); + const float cc = _oglNdc ? 2.0f/(_far - _near) : 1.0f/(_far - _near); const float dd = (_left + _right)/(_left - _right); const float ee = (_top + _bottom)/(_bottom - _top); - const float ff = _near / (_near - _far); + const float ff = _oglNdc ? (_near + _far)/(_near - _far) : _near/(_near - _far); memset(_result, 0, sizeof(float)*16); _result[ 0] = aa;