diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-08-10 22:21:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-10 22:21:44 -0700 |
| commit | 56d8a752d84e984afab20de5980edf10fe6c06f5 (patch) | |
| tree | eb1491b940daebc6afd200202347191d77f76112 /tools/gfx/gui.cpp | |
| parent | 73ff6907d723003d30e400f661876e7960de574f (diff) | |
Improve model-viewer support for lights (#626)
* Improve model-viewer support for lights
The main visible change here is that the model-viewer example supports
multiple light sources, with a basic UI for adding new light sources to
the scene, and for manipulating the ones that are there.
Along the way I also refactored the `IMaterial` decomposition to be a
bit less naive, while still only including a completely naive
Blinn-Phong implementation.
I also went ahead and spruced up the `cube.obj` file so that it has
multiple materials, although it is still a completely uninteresting
asset.
* Fixup: Windows SDK version
Diffstat (limited to 'tools/gfx/gui.cpp')
| -rw-r--r-- | tools/gfx/gui.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/gfx/gui.cpp b/tools/gfx/gui.cpp index 85a080526..cefb132fb 100644 --- a/tools/gfx/gui.cpp +++ b/tools/gfx/gui.cpp @@ -13,7 +13,24 @@ namespace gfx { #ifdef _WIN32 LRESULT CALLBACK guiWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - return ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam); + LRESULT handled = ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam); + if(handled) return handled; + ImGuiIO& io = ImGui::GetIO(); + + switch( msg ) + { + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + if(io.WantCaptureMouse) handled = 1; + break; + + case WM_KEYDOWN: + case WM_KEYUP: + if(io.WantCaptureKeyboard) handled = 1; + break; + } + + return handled; } void setNativeWindowHook(Window* window, WNDPROC proc); #endif @@ -314,7 +331,7 @@ void GUI::endFrame() viewport.extentX = draw_data->DisplaySize.x; viewport.extentY = draw_data->DisplaySize.y; viewport.minZ = 0; - viewport.maxZ = 0; + viewport.maxZ = 1; renderer->setViewport(viewport); |
