mirror of https://github.com/bkaradzic/bgfx
Cleanup.
This commit is contained in:
parent
be9f93473d
commit
ea613785e4
|
@ -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::Caps* caps = bgfx::getCaps();
|
||||
s_texelHalf = bgfx::RendererType::Direct3D9 == caps->rendererType ? 0.5f : 0.0f;
|
||||
s_originBottomLeft = caps->originBottomLeft;
|
||||
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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue