summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/32-particles/particles.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/32-particles/particles.cpp')
-rw-r--r--3rdparty/bgfx/examples/32-particles/particles.cpp28
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"