summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp')
-rw-r--r--3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp44
1 files changed, 15 insertions, 29 deletions
diff --git a/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp
index ec0c73474e1..782e3ddeba5 100644
--- a/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp
+++ b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp
@@ -295,30 +295,14 @@ uint32_t genSphere(uint8_t _subdiv0, void* _pos0 = NULL, uint16_t _posStride0 =
bx::Vec3 getPoint(Axis::Enum _axis, float _x, float _y)
{
- bx::Vec3 result;
-
switch (_axis)
{
- case Axis::X:
- result.x = 0.0f;
- result.y = _x;
- result.z = _y;
- break;
-
- case Axis::Y:
- result.x = _y;
- result.y = 0.0f;
- result.z = _x;
- break;
-
- default:
- result.x = _x;
- result.y = _y;
- result.z = 0.0f;
- break;
+ case Axis::X: return { 0.0f, _x, _y };
+ case Axis::Y: return { _y, 0.0f, _x };
+ default: break;
}
- return result;
+ return { _x, _y, 0.0f };
}
#include "vs_debugdraw_lines.bin.h"
@@ -1664,7 +1648,7 @@ struct DebugDrawEncoderImpl
void drawFrustum(const float* _viewProj)
{
- bx::Plane planes[6];
+ bx::Plane planes[6] = { bx::init::None, bx::init::None, bx::init::None, bx::init::None, bx::init::None, bx::init::None };
buildFrustumPlanes(planes, _viewProj);
const bx::Vec3 points[8] =
@@ -1761,8 +1745,8 @@ struct DebugDrawEncoderImpl
const float step = bx::kPi * 2.0f / num;
_weight = bx::clamp(_weight, 0.0f, 2.0f);
- bx::Vec3 udir;
- bx::Vec3 vdir;
+ bx::Vec3 udir(bx::init::None);
+ bx::Vec3 vdir(bx::init::None);
bx::calcTangentFrame(udir, vdir, _normal, attrib.m_spin);
float xy0[2];
@@ -1833,7 +1817,8 @@ struct DebugDrawEncoderImpl
const Attrib& attrib = m_attrib[m_stack];
if (attrib.m_wireframe)
{
- bx::Vec3 udir, vdir;
+ bx::Vec3 udir(bx::init::None);
+ bx::Vec3 vdir(bx::init::None);
bx::calcTangentFrame(udir, vdir, _normal, attrib.m_spin);
const float halfExtent = _size*0.5f;
@@ -1874,7 +1859,8 @@ struct DebugDrawEncoderImpl
const Attrib& attrib = m_attrib[m_stack];
- bx::Vec3 udir, vdir;
+ bx::Vec3 udir(bx::init::None);
+ bx::Vec3 vdir(bx::init::None);
bx::calcTangentFrame(udir, vdir, _normal, attrib.m_spin);
const Pack2D& pack = s_dds.m_sprite.get(_handle);
@@ -1994,8 +1980,8 @@ struct DebugDrawEncoderImpl
if (_thickness > 0.0f)
{
const bx::Vec3 from = { _x, _y, _z };
- bx::Vec3 mid;
- bx::Vec3 to;
+ bx::Vec3 mid(bx::init::None);
+ bx::Vec3 to(bx::init::None);
setColor(Axis::X == _highlight ? 0xff00ffff : 0xff0000ff);
mid = { _x + _len - _thickness, _y, _z };
@@ -2037,8 +2023,8 @@ struct DebugDrawEncoderImpl
{
const Attrib& attrib = m_attrib[m_stack];
- bx::Vec3 udir;
- bx::Vec3 vdir;
+ bx::Vec3 udir(bx::init::None);
+ bx::Vec3 vdir(bx::init::None);
bx::calcTangentFrame(udir, vdir, _normal, attrib.m_spin);
udir = bx::mul(udir, _step);