diff options
author | 2017-03-29 17:09:40 +0200 | |
---|---|---|
committer | 2017-03-29 17:09:40 +0200 | |
commit | 49f7c99c7786ce257fae28dfeae2f8ee5810424c (patch) | |
tree | 1bbd30dd4dd48596186846c2fc77a8dc748215d2 /3rdparty/bgfx/examples/32-particles/particles.cpp | |
parent | 79f22e060b2c012d628d5d1d83288c1bb6e6acef (diff) |
Update BGFX and BX (nw)
Diffstat (limited to '3rdparty/bgfx/examples/32-particles/particles.cpp')
-rw-r--r-- | 3rdparty/bgfx/examples/32-particles/particles.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/3rdparty/bgfx/examples/32-particles/particles.cpp b/3rdparty/bgfx/examples/32-particles/particles.cpp index 3173a15388d..ca38efa608b 100644 --- a/3rdparty/bgfx/examples/32-particles/particles.cpp +++ b/3rdparty/bgfx/examples/32-particles/particles.cpp @@ -210,8 +210,8 @@ struct Emitter ImGuizmo::Manipulate( _view , _proj - , ImGuizmo::OPERATION::TRANSLATE - , ImGuizmo::MODE::LOCAL + , ImGuizmo::TRANSLATE + , ImGuizmo::LOCAL , mtx ); @@ -249,9 +249,23 @@ class Particles : public entry::AppI psInit(); + bgfx::ImageContainer* image = imageLoad( + "textures/particle.ktx" + , bgfx::TextureFormat::BGRA8 + ); + + EmitterSpriteHandle sprite = psCreateSprite( + uint16_t(image->m_width) + , uint16_t(image->m_height) + , image->m_data + ); + + bgfx::imageFree(image); + for (uint32_t ii = 0; ii < BX_COUNTOF(m_emitter); ++ii) { m_emitter[ii].create(); + m_emitter[ii].m_uniforms.m_handle = sprite; } imguiCreate(); @@ -291,7 +305,7 @@ class Particles : public entry::AppI if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) ) { // 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) ); bgfx::touch(0); @@ -329,10 +343,10 @@ class Particles : public entry::AppI } else { - 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); - bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); } imguiBeginFrame( @@ -342,8 +356,8 @@ class Particles : 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) ); ImGui::Begin("Properties" |