summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/27-terrain/terrain.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/27-terrain/terrain.cpp')
-rw-r--r--3rdparty/bgfx/examples/27-terrain/terrain.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/3rdparty/bgfx/examples/27-terrain/terrain.cpp b/3rdparty/bgfx/examples/27-terrain/terrain.cpp
index 32686a7746e..71ab88aa128 100644
--- a/3rdparty/bgfx/examples/27-terrain/terrain.cpp
+++ b/3rdparty/bgfx/examples/27-terrain/terrain.cpp
@@ -69,7 +69,7 @@ class Terrain : public entry::AppI
m_debug = BGFX_DEBUG_TEXT;
m_reset = BGFX_RESET_VSYNC;
- bgfx::init(bgfx::RendererType::Direct3D11, args.m_pciId);
+ bgfx::init(args.m_type, args.m_pciId);
bgfx::reset(m_width, m_height, m_reset);
// Enable m_debug text.
@@ -313,11 +313,11 @@ class Terrain : public entry::AppI
// Raise/Lower and scale by brush power.
height += (bx::fclamp(brushAttn * m_brush.m_power, 0.0, m_brush.m_power) * m_brush.m_raise)
- ? 1.0
- : -1.0
+ ? 1.0f
+ : -1.0f
;
- m_terrain.m_heightMap[heightMapPos] = (uint8_t)bx::fclamp(height, 0.0, 255.0);
+ m_terrain.m_heightMap[heightMapPos] = (uint8_t)bx::fclamp(height, 0.0f, 255.0f);
m_terrain.m_dirty = true;
}
}
@@ -328,8 +328,8 @@ class Terrain : public entry::AppI
float ray_clip[4];
ray_clip[0] = ( (2.0f * m_mouseState.m_mx) / m_width - 1.0f) * -1.0f;
ray_clip[1] = ( (1.0f - (2.0f * m_mouseState.m_my) / m_height) ) * -1.0f;
- ray_clip[2] = -1.0;
- ray_clip[3] = 1.0;
+ ray_clip[2] = -1.0f;
+ ray_clip[3] = 1.0f;
float invProjMtx[16];
bx::mtxInverse(invProjMtx, m_projMtx);
@@ -436,13 +436,15 @@ class Terrain : public entry::AppI
imguiEndScrollArea();
imguiEndFrame();
- // Update camera.
- cameraUpdate(deltaTime, m_mouseState);
-
- bool leftMouseButtonDown = !!m_mouseState.m_buttons[entry::MouseButton::Left];
- if (leftMouseButtonDown)
+ if (!imguiMouseOverArea() )
{
- mousePickTerrain();
+ // Update camera.
+ cameraUpdate(deltaTime, m_mouseState);
+
+ if (!!m_mouseState.m_buttons[entry::MouseButton::Left])
+ {
+ mousePickTerrain();
+ }
}
// Update terrain.