mirror of https://github.com/bkaradzic/bgfx
Cleanup.
This commit is contained in:
parent
a60095c1b6
commit
7c16314f6f
|
@ -93,7 +93,7 @@ static const uint16_t s_m_cubeIndices[36] =
|
|||
21, 22, 23,
|
||||
};
|
||||
|
||||
static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _side, uint32_t _x, uint32_t _y, uint32_t _width, uint32_t _height, uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 0xff)
|
||||
static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _side, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 0xff)
|
||||
{
|
||||
bgfx::TextureInfo ti;
|
||||
bgfx::calcTextureSize(ti, _width, _height, 1, false, false, 1, bgfx::TextureFormat::BGRA8);
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
{
|
||||
const uint32_t offset = ( (zz*32+yy)*32+xx);
|
||||
const uint32_t val = xx ^ yy ^ zz;
|
||||
mem8->data[offset] = val<<3;
|
||||
mem8->data[offset] = uint8_t(val<<3);
|
||||
*(uint16_t*)&mem16f->data[offset*2] = bx::halfFromFloat( (float)val/32.0f);
|
||||
*(float*)&mem32f->data[offset*4] = (float)val/32.0f;
|
||||
}
|
||||
|
@ -346,8 +346,8 @@ public:
|
|||
bgfx::setPaletteColor(1, borderColor);
|
||||
|
||||
// Set view 0 and 1 viewport.
|
||||
bgfx::setViewRect(0, 0, 0, m_width, m_height);
|
||||
bgfx::setViewRect(1, 0, 0, m_width, m_height);
|
||||
bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) );
|
||||
bgfx::setViewRect(1, 0, 0, uint16_t(m_width), uint16_t(m_height) );
|
||||
|
||||
// This dummy draw call is here to make sure that view 0 is cleared
|
||||
// if no other draw calls are submitted to view 0.
|
||||
|
@ -372,8 +372,8 @@ public:
|
|||
{
|
||||
PackCube face;
|
||||
|
||||
uint32_t bw = bx::uint16_max(1, rand()%(textureside/4) );
|
||||
uint32_t bh = bx::uint16_max(1, rand()%(textureside/4) );
|
||||
uint16_t bw = bx::uint16_max(1, rand()%(textureside/4) );
|
||||
uint16_t bh = bx::uint16_max(1, rand()%(textureside/4) );
|
||||
|
||||
if (m_cube.find(bw, bh, face) )
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ void setOffsets2x2Lum(bgfx::UniformHandle _handle, uint32_t _width, uint32_t _he
|
|||
float du = 1.0f/_width;
|
||||
float dv = 1.0f/_height;
|
||||
|
||||
uint32_t num = 0;
|
||||
uint16_t num = 0;
|
||||
for (uint32_t yy = 0; yy < 3; ++yy)
|
||||
{
|
||||
for (uint32_t xx = 0; xx < 3; ++xx)
|
||||
|
@ -184,8 +184,8 @@ class ExampleHDR : public entry::AppI
|
|||
|
||||
m_mesh = meshLoad("meshes/bunny.bin");
|
||||
|
||||
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
|
||||
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
|
||||
m_fbtextures[0] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT | BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP);
|
||||
m_fbtextures[1] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
|
||||
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
|
||||
|
||||
m_lum[0] = bgfx::createFrameBuffer(128, 128, bgfx::TextureFormat::BGRA8);
|
||||
|
@ -286,8 +286,8 @@ class ExampleHDR : public entry::AppI
|
|||
|
||||
bgfx::destroyFrameBuffer(m_fbh);
|
||||
|
||||
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, ( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT)|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
|
||||
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
|
||||
m_fbtextures[0] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::BGRA8, ((msaa + 1) << BGFX_TEXTURE_RT_MSAA_SHIFT) | BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP);
|
||||
m_fbtextures[1] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
|
||||
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
|
||||
}
|
||||
|
||||
|
@ -297,8 +297,8 @@ class ExampleHDR : public entry::AppI
|
|||
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||
| (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||
, m_mouseState.m_mz
|
||||
, m_width
|
||||
, m_height
|
||||
, uint16_t(m_width)
|
||||
, uint16_t(m_height)
|
||||
);
|
||||
|
||||
imguiBeginScrollArea("Settings", m_width - m_width / 5 - 10, 10, m_width / 5, m_height / 2, &m_scrollArea);
|
||||
|
@ -418,7 +418,7 @@ class ExampleHDR : public entry::AppI
|
|||
bgfx::setViewOrder(0, BX_COUNTOF(order), order);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(order); ++ii)
|
||||
for (uint8_t ii = 0; ii < BX_COUNTOF(order); ++ii)
|
||||
{
|
||||
bgfx::setViewTransform(ii, NULL, proj);
|
||||
}
|
||||
|
|
|
@ -102,9 +102,9 @@ int _main_(int _argc, char** _argv)
|
|||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||
, mouseState.m_mz
|
||||
, width
|
||||
, height
|
||||
);
|
||||
, uint16_t(width)
|
||||
, uint16_t(height)
|
||||
);
|
||||
|
||||
imguiBeginScrollArea("Text Area"
|
||||
, width - guiPanelWidth - 10
|
||||
|
@ -141,7 +141,7 @@ int _main_(int _argc, char** _argv)
|
|||
imguiEndFrame();
|
||||
|
||||
// Set view 0 default viewport.
|
||||
bgfx::setViewRect(0, 0, 0, width, height);
|
||||
bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) );
|
||||
|
||||
// This dummy draw call is here to make sure that view 0 is cleared
|
||||
// if no other draw calls are submitted to view 0.
|
||||
|
@ -195,7 +195,7 @@ int _main_(int _argc, char** _argv)
|
|||
float ortho[16];
|
||||
bx::mtxOrtho(ortho, centering, width + centering, height + centering, centering, -1.0f, 1.0f);
|
||||
bgfx::setViewTransform(0, view, ortho);
|
||||
bgfx::setViewRect(0, 0, 0, width, height);
|
||||
bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) );
|
||||
}
|
||||
|
||||
//very crude approximation :(
|
||||
|
|
|
@ -60,7 +60,7 @@ class ExampleLod : public entry::AppI
|
|||
const bgfx::Memory* stippleTex = bgfx::alloc(8*4);
|
||||
bx::memSet(stippleTex->data, 0, stippleTex->size);
|
||||
|
||||
for (uint32_t ii = 0; ii < 32; ++ii)
|
||||
for (uint8_t ii = 0; ii < 32; ++ii)
|
||||
{
|
||||
stippleTex->data[knightTour[ii].m_y * 8 + knightTour[ii].m_x] = ii*4;
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ class ExampleLod : public entry::AppI
|
|||
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||
| (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||
, m_mouseState.m_mz
|
||||
, m_width
|
||||
, m_height
|
||||
);
|
||||
, uint16_t(m_width)
|
||||
, uint16_t(m_height)
|
||||
);
|
||||
|
||||
imguiBeginScrollArea("Toggle transitions", m_width - m_width / 5 - 10, 10, m_width / 5, m_height / 6, &m_scrollArea);
|
||||
imguiSeparatorLine();
|
||||
|
@ -192,7 +192,7 @@ class ExampleLod : public entry::AppI
|
|||
bgfx::setViewTransform(0, view, proj);
|
||||
|
||||
// Set view 0 default viewport.
|
||||
bgfx::setViewRect(0, 0, 0, m_width, m_height);
|
||||
bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) );
|
||||
}
|
||||
|
||||
float mtx[16];
|
||||
|
|
|
@ -937,8 +937,8 @@ int _main_(int _argc, char** _argv)
|
|||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||
, mouseState.m_mz
|
||||
, viewState.m_width
|
||||
, viewState.m_height
|
||||
, uint16_t(viewState.m_width)
|
||||
, uint16_t(viewState.m_height)
|
||||
);
|
||||
|
||||
static int32_t scrollArea = 0;
|
||||
|
@ -1358,7 +1358,7 @@ int _main_(int _argc, char** _argv)
|
|||
);
|
||||
|
||||
// Setup view rect and transform for all used views.
|
||||
setViewRectMask(s_viewMask, 0, 0, viewState.m_width, viewState.m_height);
|
||||
setViewRectMask(s_viewMask, 0, 0, uint16_t(viewState.m_width), uint16_t(viewState.m_height) );
|
||||
setViewTransformMask(s_viewMask, viewState.m_view, viewState.m_proj);
|
||||
s_viewMask = 0;
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ int _main_(int _argc, char** _argv)
|
|||
bgfx::setViewFrameBuffer(RENDER_SHADOW_PASS_ID, shadowMapFB);
|
||||
bgfx::setViewTransform(RENDER_SHADOW_PASS_ID, lightView, lightProj);
|
||||
|
||||
bgfx::setViewRect(RENDER_SCENE_PASS_ID, 0, 0, width, height);
|
||||
bgfx::setViewRect(RENDER_SCENE_PASS_ID, 0, 0, uint16_t(width), uint16_t(height) );
|
||||
bgfx::setViewTransform(RENDER_SCENE_PASS_ID, view, proj);
|
||||
|
||||
// Clear backbuffer and shadowmap framebuffer at beginning.
|
||||
|
|
Loading…
Reference in New Issue