diff options
author | 2018-12-05 19:45:08 +0100 | |
---|---|---|
committer | 2018-12-05 19:45:08 +0100 | |
commit | 0bd02131b644b61088789f52f31b750c9aecaa6d (patch) | |
tree | 811c679a1bba8b24fc7967cdfe73640254d64156 /3rdparty/bgfx/examples/06-bump/bump.cpp | |
parent | 9a81ec7eaf00d73a23db5c003dc45b55d4b76c4a (diff) |
3rdparty: Updated bgfx, bimg, and bx to latest upstream. [Ryan Holtz]
Diffstat (limited to '3rdparty/bgfx/examples/06-bump/bump.cpp')
-rw-r--r-- | 3rdparty/bgfx/examples/06-bump/bump.cpp | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/3rdparty/bgfx/examples/06-bump/bump.cpp b/3rdparty/bgfx/examples/06-bump/bump.cpp index e60fb042fba..2f299161926 100644 --- a/3rdparty/bgfx/examples/06-bump/bump.cpp +++ b/3rdparty/bgfx/examples/06-bump/bump.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -99,8 +99,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -206,24 +211,10 @@ public: float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() )); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -7.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -7.0f }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); @@ -239,8 +230,8 @@ public: float lightPosRadius[4][4]; for (uint32_t ii = 0; ii < m_numLights; ++ii) { - lightPosRadius[ii][0] = bx::fsin( (time*(0.1f + ii*0.17f) + ii*bx::kPiHalf*1.37f ) )*3.0f; - lightPosRadius[ii][1] = bx::fcos( (time*(0.2f + ii*0.29f) + ii*bx::kPiHalf*1.49f ) )*3.0f; + lightPosRadius[ii][0] = bx::sin( (time*(0.1f + ii*0.17f) + ii*bx::kPiHalf*1.37f ) )*3.0f; + lightPosRadius[ii][1] = bx::cos( (time*(0.2f + ii*0.29f) + ii*bx::kPiHalf*1.49f ) )*3.0f; lightPosRadius[ii][2] = -2.5f; lightPosRadius[ii][3] = 3.0f; } @@ -284,7 +275,7 @@ public: } // Set instance data buffer. - bgfx::setInstanceDataBuffer(&idb, numInstances); + bgfx::setInstanceDataBuffer(&idb, 0, numInstances); // Set vertex and index buffer. bgfx::setVertexBuffer(0, m_vbh); @@ -296,9 +287,9 @@ public: // Set render states. bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_MSAA ); @@ -333,9 +324,9 @@ public: // Set render states. bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_MSAA ); |