summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/07-callback/callback.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/07-callback/callback.cpp
parent9a81ec7eaf00d73a23db5c003dc45b55d4b76c4a (diff)
3rdparty: Updated bgfx, bimg, and bx to latest upstream. [Ryan Holtz]
Diffstat (limited to '3rdparty/bgfx/examples/07-callback/callback.cpp')
-rw-r--r--3rdparty/bgfx/examples/07-callback/callback.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/3rdparty/bgfx/examples/07-callback/callback.cpp b/3rdparty/bgfx/examples/07-callback/callback.cpp
index 6c92e297782..987c51761ac 100644
--- a/3rdparty/bgfx/examples/07-callback/callback.cpp
+++ b/3rdparty/bgfx/examples/07-callback/callback.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
*/
@@ -69,13 +69,13 @@ static const uint16_t s_cubeIndices[36] =
6, 3, 7,
};
-void savePng(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip)
+void savePng(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bimg::TextureFormat::Enum _format, bool _yflip)
{
bx::FileWriter writer;
bx::Error err;
if (bx::open(&writer, _filePath, false, &err) )
{
- bimg::imageWritePng(&writer, _width, _height, _srcPitch, _src, _grayscale, _yflip, &err);
+ bimg::imageWritePng(&writer, _width, _height, _srcPitch, _src, _format, _yflip, &err);
bx::close(&writer);
}
}
@@ -97,8 +97,10 @@ struct BgfxCallback : public bgfx::CallbackI
{
}
- virtual void fatal(bgfx::Fatal::Enum _code, const char* _str) override
+ virtual void fatal(const char* _filePath, uint16_t _line, bgfx::Fatal::Enum _code, const char* _str) override
{
+ BX_UNUSED(_filePath, _line);
+
// Something unexpected happened, inform user and bail out.
bx::debugPrintf("Fatal error: 0x%08x: %s", _code, _str);
@@ -188,7 +190,7 @@ struct BgfxCallback : public bgfx::CallbackI
// Save screen shot as PNG.
bx::snprintf(temp, BX_COUNTOF(temp), "%s.png", _filePath);
- savePng(temp, _width, _height, _pitch, _data, false, _yflip);
+ savePng(temp, _width, _height, _pitch, _data, bimg::TextureFormat::BGRA8, _yflip);
// Save screen shot as TGA.
bx::snprintf(temp, BX_COUNTOF(temp), "%s.tga", _filePath);
@@ -323,14 +325,15 @@ public:
| BGFX_RESET_MSAA_X16
;
- bgfx::init(
- args.m_type
- , args.m_pciId
- , 0
- , &m_callback // custom callback handler
- , &m_allocator // custom allocator
- );
- 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;
+ init.callback = &m_callback; // custom callback handler
+ init.allocator = &m_allocator; // custom allocator
+ bgfx::init(init);
// Enable debug text.
bgfx::setDebug(m_debug);
@@ -420,8 +423,8 @@ public:
// if no other draw calls are submitted to view 0.
bgfx::touch(0);
- 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 };
float view[16];
float proj[16];