mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Fixed projection matrix.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
13
src/bgfx_p.h
13
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user