Fixed projection matrix.

This commit is contained in:
Branimir Karadžić
2017-02-22 22:17:44 -08:00
parent 0827c42dc6
commit 2e3bdc619e
6 changed files with 7 additions and 16 deletions

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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;
}