Fixing projection matrix in examples.

This commit is contained in:
Branimir Karadžić
2017-02-22 22:26:39 -08:00
parent 2e3bdc619e
commit d96225a1f0
20 changed files with 23 additions and 23 deletions

View File

@@ -403,7 +403,7 @@ int _main_(int _argc, char** _argv)
float view[16];
float proj[16];
bx::mtxLookAt(view, eye, at);
bx::mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
// Set view and projection matrix for view 0.
bgfx::setViewTransform(0, view, proj);

View File

@@ -452,7 +452,7 @@ public:
float view[16];
float proj[16];
bx::mtxLookAt(view, eye, at);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
// Set view and projection matrix for view 0.
bgfx::setViewTransform(0, view, proj);

View File

@@ -437,7 +437,7 @@ class ExampleHDR : public entry::AppI
float view[16];
bx::mtxLookAt(view, temp, at);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
// Set view and projection matrix for view hdrMesh.
bgfx::setViewTransform(hdrMesh, view, proj);

View File

@@ -215,7 +215,7 @@ int _main_(int _argc, char** _argv)
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float proj[16];
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f);
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
static float time = 0.0f;
time += 0.05f;
@@ -234,7 +234,7 @@ int _main_(int _argc, char** _argv)
else
{
float ortho[16];
bx::mtxOrtho(ortho, centering, width + centering, height + centering, centering, -1.0f, 1.0f);
bx::mtxOrtho(ortho, centering, width + centering, height + centering, centering, -1.0f, 1.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, view, ortho);
bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) );
}

View File

@@ -173,7 +173,7 @@ int _main_(int _argc, char** _argv)
if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) )
{
float proj[16];
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f);
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
static float time = 0.0f;
time += 0.05f;

View File

@@ -188,7 +188,7 @@ class ExampleLod : public entry::AppI
bx::mtxLookAt(view, eye, at);
float proj[16];
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, view, proj);
// Set view 0 default viewport.

View File

@@ -200,7 +200,7 @@ int _main_(int _argc, char** _argv)
bx::mtxLookAt(view, eye, at);
const float aspect = float(int32_t(width) ) / float(int32_t(height) );
bx::mtxProj(proj, 60.0f, aspect, 0.1f, 1000.0f, flipV);
bx::mtxProj(proj, 60.0f, aspect, 0.1f, 1000.0f, bgfx::getCaps()->homogeneousDepth);
// Time acumulators.
float timeAccumulatorLight = 0.0f;

View File

@@ -1958,7 +1958,7 @@ int _main_(int _argc, char** _argv)
const float camFar = 2000.0f;
const float projHeight = 1.0f/bx::ftan(bx::toRad(camFovy)*0.5f);
const float projWidth = projHeight * camAspect;
bx::mtxProj(viewState.m_proj, camFovy, camAspect, camNear, camFar);
bx::mtxProj(viewState.m_proj, camFovy, camAspect, camNear, camFar, bgfx::getCaps()->homogeneousDepth);
cameraGetViewMtx(viewState.m_view);
float timeAccumulatorLight = 0.0f;

View File

@@ -728,7 +728,7 @@ int _main_(int _argc, char** _argv)
// View Transform 1.
camera.mtxLookAt(view);
bx::mtxProj(proj, 45.0f, float(width)/float(height), 0.1f, 100.0f);
bx::mtxProj(proj, 45.0f, float(width)/float(height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(1, view, proj);
// View rect.

View File

@@ -204,7 +204,7 @@ public:
bx::mtxLookAt(view, eye, at);
float proj[16];
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, view, proj);
bgfx::setViewRect(0, 0, 0, m_width, m_height);

View File

@@ -77,7 +77,7 @@ int _main_(int _argc, char** _argv)
float view[16];
float proj[16];
bx::mtxLookAt(view, eye, at);
bx::mtxProj(proj, 60.0f, float(width) / float(height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(width) / float(height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
// Set view and projection matrix for view 0.
bgfx::setViewTransform(0, view, proj);

View File

@@ -316,7 +316,7 @@ int _main_(int _argc, char** _argv)
else
{
float proj[16];
bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f);
bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, view, proj);
// Set view 0 default viewport.

View File

@@ -190,7 +190,7 @@ class ExampleOcclusion : public entry::AppI
else
{
float proj[16];
bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f);
bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, view, proj);
bgfx::setViewRect(0, 0, 0, width, height);

View File

@@ -458,7 +458,7 @@ class ExampleTerrain : public entry::AppI
bgfx::setViewRect(0, 0, 0, m_width, m_height);
cameraGetViewMtx(m_viewMtx);
bx::mtxProj(m_projMtx, 60.0f, float(m_width) / float(m_height), 0.1f, 2000.0f);
bx::mtxProj(m_projMtx, 60.0f, float(m_width) / float(m_height), 0.1f, 2000.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, m_viewMtx, m_projMtx);
bgfx::setTransform(m_terrain.m_transform);

View File

@@ -497,7 +497,7 @@ class ExampleWireframe : public entry::AppI
m_camera.update(deltaTimeSec);
bx::memCopy(m_uniforms.m_camPos, m_camera.m_pos.curr, 3*sizeof(float));
m_camera.mtxLookAt(view);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, view, proj);
m_uniforms.m_drawEdges = (DrawMode::WireframeShaded == m_drawMode) ? 1.0f : 0.0f;

View File

@@ -118,7 +118,7 @@ class DebugDrawApp : public entry::AppI
}
else
{
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, view, proj);
bgfx::setViewRect(0, 0, 0, m_width, m_height);
@@ -129,7 +129,7 @@ class DebugDrawApp : public entry::AppI
float mvp[16];
float eye[] = { 5.0f, 10.0f, 5.0f };
bx::mtxLookAt(view, eye, zero);
bx::mtxProj(proj, 45.0f, float(m_width)/float(m_height), 1.0f, 15.0f);
bx::mtxProj(proj, 45.0f, float(m_width)/float(m_height), 1.0f, 15.0f, bgfx::getCaps()->homogeneousDepth);
bx::mtxMul(mvp, view, proj);
ddBegin(0);

View File

@@ -207,7 +207,7 @@ class ExamplePicking : public entry::AppI
bx::mtxLookAt(view, eye, at);
float proj[16];
bx::mtxProj(proj, 60.0f, float(m_width) / float(m_height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(m_width) / float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
// Set up view rect and transform for the shaded pass
bgfx::setViewRect(RENDER_PASS_SHADING, 0, 0, uint16_t(m_width), uint16_t(m_height) );
@@ -238,7 +238,7 @@ class ExamplePicking : public entry::AppI
// Tight FOV is best for picking
float pickProj[16];
bx::mtxProj(pickProj, m_fov, 1, 0.1f, 100.0f);
bx::mtxProj(pickProj, m_fov, 1, 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
// View rect and transforms for picking pass
bgfx::setViewRect(RENDER_PASS_ID, 0, 0, ID_DIM, ID_DIM);

View File

@@ -454,7 +454,7 @@ public:
cameraGetViewMtx(view);
float proj[16];
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewRect(RENDER_PASS_GBUFFER, 0, 0, uint16_t(m_width), uint16_t(m_height));
bgfx::setViewTransform(RENDER_PASS_GBUFFER, view, proj);

View File

@@ -329,7 +329,7 @@ class Particles : public entry::AppI
}
else
{
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f);
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, view, proj);
bgfx::setViewRect(0, 0, 0, m_width, m_height);

View File

@@ -812,7 +812,7 @@ struct Imgui
m_surfaceWidth = _surfaceWidth / 2;
float proj[16];
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f);
bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth);
static float time = 0.0f;
time += 0.05f;