summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/05-instancing/instancing.cpp
diff options
context:
space:
mode:
author mooglyguy <therealmogminer@gmail.com>2018-12-05 19:45:08 +0100
committer mooglyguy <therealmogminer@gmail.com>2018-12-05 19:45:08 +0100
commit0bd02131b644b61088789f52f31b750c9aecaa6d (patch)
tree811c679a1bba8b24fc7967cdfe73640254d64156 /3rdparty/bgfx/examples/05-instancing/instancing.cpp
parent9a81ec7eaf00d73a23db5c003dc45b55d4b76c4a (diff)
3rdparty: Updated bgfx, bimg, and bx to latest upstream. [Ryan Holtz]
Diffstat (limited to '3rdparty/bgfx/examples/05-instancing/instancing.cpp')
-rw-r--r--3rdparty/bgfx/examples/05-instancing/instancing.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/3rdparty/bgfx/examples/05-instancing/instancing.cpp b/3rdparty/bgfx/examples/05-instancing/instancing.cpp
index c295a9813c5..d471efb87fd 100644
--- a/3rdparty/bgfx/examples/05-instancing/instancing.cpp
+++ b/3rdparty/bgfx/examples/05-instancing/instancing.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
*/
@@ -73,11 +73,16 @@ public:
m_width = _width;
m_height = _height;
- m_debug = BGFX_DEBUG_NONE;
+ m_debug = BGFX_DEBUG_TEXT;
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);
@@ -163,28 +168,14 @@ public:
// When instancing is not supported by GPU, implement alternative
// code path that doesn't use instancing.
bool blink = uint32_t(time*3.0f)&1;
- bgfx::dbgTextPrintf(0, 0, blink ? 0x1f : 0x01, " Instancing is not supported by GPU. ");
+ bgfx::dbgTextPrintf(0, 0, blink ? 0x4f : 0x04, " Instancing is not supported by GPU. ");
}
else
{
- float at[3] = { 0.0f, 0.0f, 0.0f };
- float eye[3] = { 0.0f, 0.0f, -35.0f };
+ const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
+ const bx::Vec3 eye = { 0.0f, 0.0f, -35.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);
@@ -221,9 +212,9 @@ public:
mtx[14] = 0.0f;
float* color = (float*)&data[64];
- color[0] = bx::fsin(time+float(xx)/11.0f)*0.5f+0.5f;
- color[1] = bx::fcos(time+float(yy)/11.0f)*0.5f+0.5f;
- color[2] = bx::fsin(time*3.0f)*0.5f+0.5f;
+ color[0] = bx::sin(time+float(xx)/11.0f)*0.5f+0.5f;
+ color[1] = bx::cos(time+float(yy)/11.0f)*0.5f+0.5f;
+ color[2] = bx::sin(time*3.0f)*0.5f+0.5f;
color[3] = 1.0f;
data += instanceStride;