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.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/3rdparty/bgfx/examples/32-particles/particles.cpp b/3rdparty/bgfx/examples/32-particles/particles.cpp
index 4736a5da095..b9815ea7ea1 100644
--- a/3rdparty/bgfx/examples/32-particles/particles.cpp
+++ b/3rdparty/bgfx/examples/32-particles/particles.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
- * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
+ * Copyright 2011-2022 Branimir Karadzic. All rights reserved.
+ * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#include "common.h"
@@ -229,8 +229,8 @@ struct Emitter
class ExampleParticles : public entry::AppI
{
public:
- ExampleParticles(const char* _name, const char* _description)
- : entry::AppI(_name, _description)
+ ExampleParticles(const char* _name, const char* _description, const char* _url)
+ : entry::AppI(_name, _description, _url)
{
}
@@ -246,6 +246,9 @@ public:
bgfx::Init init;
init.type = args.m_type;
init.vendorId = args.m_pciId;
+ init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
+ init.platformData.ndt = entry::getNativeDisplayHandle();
+ init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
init.resolution.width = m_width;
init.resolution.height = m_height;
init.resolution.reset = m_reset;
@@ -290,8 +293,7 @@ public:
cameraCreate();
- const float initialPos[3] = { 0.0f, 2.0f, -12.0f };
- cameraSetPosition(initialPos);
+ cameraSetPosition({ 0.0f, 2.0f, -12.0f });
cameraSetVerticalAngle(0.0f);
m_timeOffset = bx::getHPCounter();
@@ -334,7 +336,7 @@ public:
const double freq = double(bx::getHPFrequency() );
const float deltaTime = float(frameTime/freq);
- cameraUpdate(deltaTime, m_mouseState);
+ cameraUpdate(deltaTime, m_mouseState, ImGui::MouseOverArea() );
float view[16];
cameraGetViewMtx(view);
@@ -407,20 +409,18 @@ public:
DebugDrawEncoder dde;
dde.begin(0);
- float center[3] = { 0.0f, 0.0f, 0.0f };
- dde.drawGrid(Axis::Y, center);
+ dde.drawGrid(Axis::Y, { 0.0f, 0.0f, 0.0f });
- float eye[3];
- cameraGetPosition(eye);
+ const bx::Vec3 eye = cameraGetPosition();
m_emitter[currentEmitter].update();
psUpdate(deltaTime * timeScale);
- psRender(0, view, bx::load(eye) );
+ psRender(0, view, eye);
if (showBounds)
{
- Aabb aabb;
+ bx::Aabb aabb;
psGetAabb(m_emitter[currentEmitter].m_handle, aabb);
dde.push();
dde.setWireframe(true);
@@ -455,4 +455,9 @@ public:
} // namespace
-ENTRY_IMPLEMENT_MAIN(ExampleParticles, "32-particles", "Particles.");
+ENTRY_IMPLEMENT_MAIN(
+ ExampleParticles
+ , "32-particles"
+ , "Particles."
+ , "https://bkaradzic.github.io/bgfx/examples.html#particles"
+ );