diff --git a/examples/24-nbody/nbody.cpp b/examples/24-nbody/nbody.cpp index b241ba35..1c5a6403 100644 --- a/examples/24-nbody/nbody.cpp +++ b/examples/24-nbody/nbody.cpp @@ -249,7 +249,6 @@ int _main_(int /*_argc*/, char** /*_argv*/) bx::swap(currPositionBuffer0, currPositionBuffer1); bx::swap(prevPositionBuffer0, prevPositionBuffer1); - float eye[3] = { 0.0f, 0.0f, -35.0f }; float view[16]; // Update camera. @@ -260,13 +259,17 @@ int _main_(int /*_argc*/, char** /*_argv*/) const bgfx::HMD* hmd = bgfx::getHMD(); if (NULL != hmd) { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); + float viewHead[16]; + float eye[3] = {}; + bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye); + + float tmp[16]; + bx::mtxMul(tmp, view, viewHead); float proj[16]; bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 10000.0f); - bgfx::setViewTransform(0, view, proj); + bgfx::setViewTransform(0, tmp, proj); // Set view 0 default viewport. // diff --git a/src/ovr.cpp b/src/ovr.cpp index 11b63b67..4108f7f7 100644 --- a/src/ovr.cpp +++ b/src/ovr.cpp @@ -35,11 +35,6 @@ namespace bgfx bool OVR::postReset(void* _nwh, ovrRenderAPIConfig* _config, bool _debug) { - if (!m_initialized) - { - return false; - } - if (_debug) { switch (_config->Header.API) @@ -92,6 +87,11 @@ namespace bgfx return false; } + if (!m_initialized) + { + return false; + } + if (!_debug) { m_hmd = ovrHmd_Create(0); diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index a9b8deff..2e6f1e3d 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -3249,6 +3249,8 @@ namespace bgfx continue; } + bool resetState = viewChanged || wasCompute; + if (wasCompute) { wasCompute = false; @@ -3269,7 +3271,7 @@ namespace bgfx uint64_t changedStencil = currentState.m_stencil ^ draw.m_stencil; currentState.m_stencil = newStencil; - if (viewChanged) + if (resetState) { currentState.clear(); currentState.m_scissor = !draw.m_scissor;