diff options
author | 2016-04-04 13:52:25 +0200 | |
---|---|---|
committer | 2016-04-04 13:52:25 +0200 | |
commit | e63f379a0ef420cf720b7655ea63e19330954eb8 (patch) | |
tree | 1c51de36d7fbd9f5218b165b71f3ec9aa1bcfe36 /3rdparty/bgfx/examples/09-hdr/hdr.cpp | |
parent | 9496a5b24d7fb14dcb38bd16ec8ca528ebdfee1b (diff) |
Update BGFX to latest (nw)
Diffstat (limited to '3rdparty/bgfx/examples/09-hdr/hdr.cpp')
-rw-r--r-- | 3rdparty/bgfx/examples/09-hdr/hdr.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/3rdparty/bgfx/examples/09-hdr/hdr.cpp b/3rdparty/bgfx/examples/09-hdr/hdr.cpp index bee42aed2bf..dfe6f7dd390 100644 --- a/3rdparty/bgfx/examples/09-hdr/hdr.cpp +++ b/3rdparty/bgfx/examples/09-hdr/hdr.cpp @@ -8,7 +8,6 @@ #include "imgui/imgui.h" static float s_texelHalf = 0.0f; -static bool s_originBottomLeft = false; struct PosColorTexCoord0Vertex { @@ -230,9 +229,8 @@ class ExampleHDR : public entry::AppI // Imgui. imguiCreate(); - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - s_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; - s_originBottomLeft = bgfx::RendererType::OpenGL == renderer || bgfx::RendererType::OpenGLES == renderer; + m_caps = bgfx::getCaps(); + s_texelHalf = bgfx::RendererType::Direct3D9 == m_caps->rendererType ? 0.5f : 0.0f; m_oldWidth = 0; m_oldHeight = 0; @@ -441,35 +439,35 @@ class ExampleHDR : public entry::AppI setOffsets2x2Lum(u_offset, 128, 128); bgfx::setTexture(0, s_texColor, m_fbtextures[0]); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); - screenSpaceQuad(128.0f, 128.0f, s_originBottomLeft); + screenSpaceQuad(128.0f, 128.0f, m_caps->originBottomLeft); bgfx::submit(2, m_lumProgram); // Downscale luminance 0. setOffsets4x4Lum(u_offset, 128, 128); bgfx::setTexture(0, s_texColor, m_lum[0]); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); - screenSpaceQuad(64.0f, 64.0f, s_originBottomLeft); + screenSpaceQuad(64.0f, 64.0f, m_caps->originBottomLeft); bgfx::submit(3, m_lumAvgProgram); // Downscale luminance 1. setOffsets4x4Lum(u_offset, 64, 64); bgfx::setTexture(0, s_texColor, m_lum[1]); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); - screenSpaceQuad(16.0f, 16.0f, s_originBottomLeft); + screenSpaceQuad(16.0f, 16.0f, m_caps->originBottomLeft); bgfx::submit(4, m_lumAvgProgram); // Downscale luminance 2. setOffsets4x4Lum(u_offset, 16, 16); bgfx::setTexture(0, s_texColor, m_lum[2]); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); - screenSpaceQuad(4.0f, 4.0f, s_originBottomLeft); + screenSpaceQuad(4.0f, 4.0f, m_caps->originBottomLeft); bgfx::submit(5, m_lumAvgProgram); // Downscale luminance 3. setOffsets4x4Lum(u_offset, 4, 4); bgfx::setTexture(0, s_texColor, m_lum[3]); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); - screenSpaceQuad(1.0f, 1.0f, s_originBottomLeft); + screenSpaceQuad(1.0f, 1.0f, m_caps->originBottomLeft); bgfx::submit(6, m_lumAvgProgram); float tonemap[4] = { m_middleGray, square(m_white), m_threshold, m_time }; @@ -480,13 +478,13 @@ class ExampleHDR : public entry::AppI bgfx::setTexture(0, s_texColor, m_fbtextures[0]); bgfx::setTexture(1, s_texLum, m_lum[4]); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); - screenSpaceQuad( (float)m_width/2.0f, (float)m_height/2.0f, s_originBottomLeft); + screenSpaceQuad( (float)m_width/2.0f, (float)m_height/2.0f, m_caps->originBottomLeft); bgfx::submit(7, m_brightProgram); // m_blur m_bright pass vertically. bgfx::setTexture(0, s_texColor, m_bright); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); - screenSpaceQuad( (float)m_width/8.0f, (float)m_height/8.0f, s_originBottomLeft); + screenSpaceQuad( (float)m_width/8.0f, (float)m_height/8.0f, m_caps->originBottomLeft); bgfx::submit(8, m_blurProgram); // m_blur m_bright pass horizontally, do tonemaping and combine. @@ -494,7 +492,7 @@ class ExampleHDR : public entry::AppI bgfx::setTexture(1, s_texLum, m_lum[4]); bgfx::setTexture(2, s_texBlur, m_blur); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); - screenSpaceQuad( (float)m_width, (float)m_height, s_originBottomLeft); + screenSpaceQuad( (float)m_width, (float)m_height, m_caps->originBottomLeft); bgfx::submit(9, m_tonemapProgram); if (bgfx::isValid(m_rb) ) @@ -558,6 +556,7 @@ class ExampleHDR : public entry::AppI int32_t m_scrollArea; + const bgfx::Caps* m_caps; float m_time; }; |