From 56d8a752d84e984afab20de5980edf10fe6c06f5 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 10 Aug 2018 22:21:44 -0700 Subject: 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 --- tools/gfx/gui.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'tools/gfx/gui.cpp') 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); -- cgit v1.2.3