diff --git a/README.md b/README.md index dab0e9a61..358267d64 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,18 @@ Use a single distance field font to render text of various size. ### 12-lod Mesh LOD transitions. +![example-12-lod](https://github.com/bkaradzic/bgfx/raw/master/examples/12-lod/screenshot.png) + ### 13-stencil Stencil reflections and shadows. +![example-13-stencil](https://github.com/bkaradzic/bgfx/raw/master/examples/13-stencil/screenshot.png) + ### 14-shadowvolumes Shadow volumes. +![example-14-shadowvolumes](https://github.com/bkaradzic/bgfx/raw/master/examples/14-shadowvolumes/screenshot.png) + Dependencies ------------ diff --git a/examples/01-cubes/screenshot.png b/examples/01-cubes/screenshot.png index e3f51664a..0e80d2cb0 100644 Binary files a/examples/01-cubes/screenshot.png and b/examples/01-cubes/screenshot.png differ diff --git a/examples/02-metaballs/screenshot.png b/examples/02-metaballs/screenshot.png index ddcf002dc..6bb03b3ad 100644 Binary files a/examples/02-metaballs/screenshot.png and b/examples/02-metaballs/screenshot.png differ diff --git a/examples/03-raymarch/screenshot.png b/examples/03-raymarch/screenshot.png index c18758814..792db03b7 100644 Binary files a/examples/03-raymarch/screenshot.png and b/examples/03-raymarch/screenshot.png differ diff --git a/examples/04-mesh/screenshot.png b/examples/04-mesh/screenshot.png index b96bcebc3..fbbc0fe8f 100644 Binary files a/examples/04-mesh/screenshot.png and b/examples/04-mesh/screenshot.png differ diff --git a/examples/05-instancing/screenshot.png b/examples/05-instancing/screenshot.png index 837122bcb..e2ff9fe28 100644 Binary files a/examples/05-instancing/screenshot.png and b/examples/05-instancing/screenshot.png differ diff --git a/examples/06-bump/screenshot.png b/examples/06-bump/screenshot.png index 541f4cae6..9cfe6e4e4 100644 Binary files a/examples/06-bump/screenshot.png and b/examples/06-bump/screenshot.png differ diff --git a/examples/09-hdr/screenshot.png b/examples/09-hdr/screenshot.png index 2934c69d8..832b2f484 100644 Binary files a/examples/09-hdr/screenshot.png and b/examples/09-hdr/screenshot.png differ diff --git a/examples/10-font/screenshot.png b/examples/10-font/screenshot.png index 77b8d8e89..b548ef9a3 100644 Binary files a/examples/10-font/screenshot.png and b/examples/10-font/screenshot.png differ diff --git a/examples/11-fontsdf/screenshot.png b/examples/11-fontsdf/screenshot.png index 471d09715..010dc34eb 100644 Binary files a/examples/11-fontsdf/screenshot.png and b/examples/11-fontsdf/screenshot.png differ diff --git a/examples/12-lod/screenshot.png b/examples/12-lod/screenshot.png new file mode 100644 index 000000000..970d7eaf9 Binary files /dev/null and b/examples/12-lod/screenshot.png differ diff --git a/examples/13-stencil/screenshot.png b/examples/13-stencil/screenshot.png new file mode 100644 index 000000000..2b3b6138d Binary files /dev/null and b/examples/13-stencil/screenshot.png differ diff --git a/examples/14-shadowvolumes/screenshot.png b/examples/14-shadowvolumes/screenshot.png new file mode 100644 index 000000000..0b139f3e3 Binary files /dev/null and b/examples/14-shadowvolumes/screenshot.png differ diff --git a/examples/common/entry/entry.cpp b/examples/common/entry/entry.cpp index 33ed84fe4..59dbefb42 100644 --- a/examples/common/entry/entry.cpp +++ b/examples/common/entry/entry.cpp @@ -6,6 +6,8 @@ #include #include +#include + #include "entry_p.h" #include "cmd.h" #include "input.h" @@ -72,6 +74,24 @@ namespace entry bgfx::setDebug(s_debug); return 0; } + else if (0 == strcmp(_argv[1], "screenshot") ) + { + if (_argc > 2) + { + bgfx::saveScreenShot(_argv[2]); + } + else + { + time_t tt; + time(&tt); + + char filePath[256]; + bx::snprintf(filePath, sizeof(filePath), "temp/screenshot-%d", tt); + bgfx::saveScreenShot(filePath); + } + + return 0; + } } return 1; @@ -85,12 +105,13 @@ namespace entry static const InputBinding s_bindings[] = { - { entry::Key::KeyQ, entry::Modifier::LeftCtrl, 1, cmd, "exit" }, - { entry::Key::F1, entry::Modifier::None, 1, cmd, "graphics stats" }, - { entry::Key::F1, entry::Modifier::LeftShift, 1, cmd, "graphics stats 0\ngraphics text 0" }, - { entry::Key::F3, entry::Modifier::None, 1, cmd, "graphics wireframe" }, - { entry::Key::F7, entry::Modifier::None, 1, cmd, "graphics vsync" }, - { entry::Key::F8, entry::Modifier::None, 1, cmd, "graphics msaa" }, + { entry::Key::KeyQ, entry::Modifier::LeftCtrl, 1, cmd, "exit" }, + { entry::Key::F1, entry::Modifier::None, 1, cmd, "graphics stats" }, + { entry::Key::F1, entry::Modifier::LeftShift, 1, cmd, "graphics stats 0\ngraphics text 0" }, + { entry::Key::F3, entry::Modifier::None, 1, cmd, "graphics wireframe" }, + { entry::Key::F7, entry::Modifier::None, 1, cmd, "graphics vsync" }, + { entry::Key::F8, entry::Modifier::None, 1, cmd, "graphics msaa" }, + { entry::Key::Print, entry::Modifier::None, 1, cmd, "graphics screenshot" }, INPUT_BINDING_END }; @@ -176,9 +197,10 @@ namespace entry break; } } - } while (NULL != ev); - inputProcess(); + inputProcess(); + + } while (NULL != ev); if (_reset != s_reset) { diff --git a/examples/common/entry/entry_windows.cpp b/examples/common/entry/entry_windows.cpp index 8f7ba20c9..c59cd3e2c 100644 --- a/examples/common/entry/entry_windows.cpp +++ b/examples/common/entry/entry_windows.cpp @@ -415,6 +415,17 @@ namespace entry { uint8_t modifiers = translateKeyModifiers(); Key::Enum key = translateKey(_wparam); + + if (Key::Print == key + && 0x3 == (_lparam>>30) ) + { + // VK_SNAPSHOT doesn't generate keydown event. Fire on down event when previous + // key state bit is set to 1 and transition state bit is set to 1. + // + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms646280%28v=vs.85%29.aspx + m_eventQueue.postKeyEvent(key, modifiers, true); + } + m_eventQueue.postKeyEvent(key, modifiers, _id == WM_KEYDOWN || _id == WM_SYSKEYDOWN); } break;