This commit is contained in:
Branimir Karadžić 2016-04-05 19:31:53 -07:00
parent 17aaf3abca
commit 6f3acfcedd
2 changed files with 22 additions and 10 deletions

View File

@ -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] = {};

View File

@ -1431,16 +1431,16 @@ namespace bgfx
m_indexBufferHandle.free(_frame->m_freeIndexBufferHandle[ii].idx);
}
for (uint16_t ii = 0, num = _frame->m_numFreeVertexDeclHandles; ii < num; ++ii)
{
m_vertexDeclHandle.free(_frame->m_freeVertexDeclHandle[ii].idx);
}
for (uint16_t ii = 0, num = _frame->m_numFreeVertexBufferHandles; ii < num; ++ii)
{
destroyVertexBufferInternal(_frame->m_freeVertexBufferHandle[ii]);
}
for (uint16_t ii = 0, num = _frame->m_numFreeVertexDeclHandles; ii < num; ++ii)
{
m_vertexDeclHandle.free(_frame->m_freeVertexDeclHandle[ii].idx);
}
for (uint16_t ii = 0, num = _frame->m_numFreeShaderHandles; ii < num; ++ii)
{
m_shaderHandle.free(_frame->m_freeShaderHandle[ii].idx);