Преглед изворни кода

Fixing off center proj mtx.

Dario Manesku пре 9 година
родитељ
комит
4b2b96641b
1 измењених фајлова са 8 додато и 8 уклоњено
  1. 8 8
      include/bx/fpumath.h

+ 8 - 8
include/bx/fpumath.h

@@ -649,10 +649,10 @@ namespace bx
 
 	inline void mtxProjRh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false)
 	{
-		const float width  = 2.0f / (_lt + _rt);
-		const float height = 2.0f / (_ut + _dt);
-		const float xx     = (_lt - _rt) * width  * 0.5f;
-		const float yy     = (_ut - _dt) * height * 0.5f;
+		const float width  = 2.0f / (_rt - _lt);
+		const float height = 2.0f / (_ut - _dt);
+		const float xx     = (_lt + _rt) * width  * 0.5f;
+		const float yy     = (_ut + _dt) * height * 0.5f;
 		mtxProjRhXYWH(_result, xx, yy, width, height, _near, _far, _oglNdc);
 	}
 
@@ -686,10 +686,10 @@ namespace bx
 
 	inline void mtxProjLh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false)
 	{
-		const float width  = 2.0f / (_lt + _rt);
-		const float height = 2.0f / (_ut + _dt);
-		const float xx     = (_lt - _rt) * width  * 0.5f;
-		const float yy     = (_ut - _dt) * height * 0.5f;
+		const float width  = 2.0f / (_rt - _lt);
+		const float height = 2.0f / (_ut - _dt);
+		const float xx     = (_lt + _rt) * width  * 0.5f;
+		const float yy     = (_ut + _dt) * height * 0.5f;
 		mtxProjLhXYWH(_result, xx, yy, width, height, _near, _far, _oglNdc);
 	}