Browse Source

Fixed projection matrix.

Branimir Karadžić 8 years ago
parent
commit
2e3bdc619e

+ 1 - 1
examples/01-cubes/cubes.cpp

@@ -175,7 +175,7 @@ class ExampleCubes : public entry::AppI
 				bx::mtxLookAt(view, eye, at);
 
 				float proj[16];
-				bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
+				bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
 				bgfx::setViewTransform(0, view, proj);
 
 				// Set view 0 default viewport.

+ 1 - 1
examples/02-metaballs/metaballs.cpp

@@ -576,7 +576,7 @@ class ExampleMetaballs : public entry::AppI
 				bx::mtxLookAt(view, eye, at);
 
 				float proj[16];
-				bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
+				bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
 				bgfx::setViewTransform(0, view, proj);
 
 				// Set view 0 default viewport.

+ 1 - 1
examples/04-mesh/mesh.cpp

@@ -105,7 +105,7 @@ class ExampleMesh : public entry::AppI
 				bx::mtxLookAt(view, eye, at);
 
 				float proj[16];
-				bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
+				bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
 				bgfx::setViewTransform(0, view, proj);
 
 				// Set view 0 default viewport.

+ 1 - 1
examples/05-instancing/instancing.cpp

@@ -174,7 +174,7 @@ class ExampleInstancing : public entry::AppI
 					bx::mtxLookAt(view, eye, at);
 
 					float proj[16];
-					bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
+					bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
 					bgfx::setViewTransform(0, view, proj);
 
 					// Set view 0 default viewport.

+ 1 - 1
examples/06-bump/bump.cpp

@@ -239,7 +239,7 @@ class ExampleBump : public entry::AppI
 				bx::mtxLookAt(view, eye, at);
 
 				float proj[16];
-				bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
+				bx::mtxProj(proj, 60.0f, float(m_width) / float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
 				bgfx::setViewTransform(0, view, proj);
 
 				// Set view 0 default viewport.

+ 2 - 11
src/bgfx_p.h

@@ -369,15 +369,6 @@ namespace bgfx
 		return un.ui;
 	}
 
-	inline float fixupDepthClear(float _depth)
-	{
-		// BK - makes consitent depth clear value between GL and DX (and other APIs).
-		return g_caps.homogeneousDepth
-			? _depth*0.5f + 0.5f
-			: _depth
-			;
-	}
-
 	inline uint64_t packStencil(uint32_t _fstencil, uint32_t _bstencil)
 	{
 		return (uint64_t(_bstencil)<<32)|uint64_t(_fstencil);
@@ -3692,7 +3683,7 @@ namespace bgfx
 			clear.m_index[1] = uint8_t(_rgba>>16);
 			clear.m_index[2] = uint8_t(_rgba>> 8);
 			clear.m_index[3] = uint8_t(_rgba>> 0);
-			clear.m_depth    = fixupDepthClear(_depth);
+			clear.m_depth    = _depth;
 			clear.m_stencil  = _stencil;
 		}
 
@@ -3715,7 +3706,7 @@ namespace bgfx
 			clear.m_index[5] = _5;
 			clear.m_index[6] = _6;
 			clear.m_index[7] = _7;
-			clear.m_depth    = fixupDepthClear(_depth);
+			clear.m_depth    = _depth;
 			clear.m_stencil  = _stencil;
 		}