summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp')
-rw-r--r--3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp b/3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp
index 4d467b95e61..f0950a205d5 100644
--- a/3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp
+++ b/3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp
@@ -65,9 +65,6 @@ class DebugDrawApp : 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);
-
int64_t now = bx::getHPCounter() - m_timeOffset;
static int64_t last = now;
const int64_t frameTime = now - last;
@@ -89,9 +86,24 @@ class DebugDrawApp : public entry::AppI
cameraGetViewMtx(view);
float proj[16];
- bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
- bgfx::setViewTransform(0, view, proj);
+ // Set view and projection matrix for view 0.
+ const bgfx::HMD* hmd = bgfx::getHMD();
+ if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
+ {
+ float eye[3];
+ cameraGetPosition(eye);
+ bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye);
+ bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection);
+ bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height);
+ }
+ else
+ {
+ bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
+
+ bgfx::setViewTransform(0, view, proj);
+ bgfx::setViewRect(0, 0, 0, m_width, m_height);
+ }
float zero[3] = {};
@@ -174,6 +186,21 @@ class DebugDrawApp : public entry::AppI
ddDrawCircle(Axis::Z, -8.0f, 0.0f, 0.0f, 1.25f, 2.0f);
ddPop();
+ ddPush();
+ ddSetLod(UINT8_MAX);
+ {
+ float from[3] = { -11.0f, 4.0f, 0.0f };
+ float to[3] = { -13.0f, 6.0f, 1.0f };
+ ddDrawCone(from, to, 1.0f );
+ }
+
+ {
+ float from[3] = { -9.0f, 2.0f, -1.0f };
+ float to[3] = { -11.0f, 4.0f, 0.0f };
+ ddDrawCylinder(from, to, 0.5f );
+ }
+ ddPop();
+
ddDrawOrb(-11.0f, 0.0f, 0.0f, 1.0f);
ddEnd();