From e5c3a6764a288f04cffbf02164fec7a2c2d80dea Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Mon, 19 Mar 2018 09:57:29 +0200 Subject: [PATCH] reflection geometry finally correct --- src/app.cc | 2 +- src/metascene.cc | 2 +- src/renderer.cc | 2 +- src/snode.cc | 26 ++++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/app.cc b/src/app.cc index fcf5fe0..ee9b5e6 100644 --- a/src/app.cc +++ b/src/app.cc @@ -406,7 +406,7 @@ void app_display() ImGui::GetIOPtr()->DeltaTime = dt; ImGui::NewFrame(); - ImGui::ShowTestWindow(); + //ImGui::ShowTestWindow(); } glClearColor(1, 1, 1, 1); diff --git a/src/metascene.cc b/src/metascene.cc index a45bfec..eef5e65 100644 --- a/src/metascene.cc +++ b/src/metascene.cc @@ -108,7 +108,7 @@ void MetaScene::update(float dt) static bool once; if(!once) { float x = ImGui::GetColumnOffset(1); - ImGui::SetColumnOffset(1, x * 1.7); + ImGui::SetColumnOffset(1, x * 1.55); once = true; } } diff --git a/src/renderer.cc b/src/renderer.cc index deff1b9..b9e5884 100644 --- a/src/renderer.cc +++ b/src/renderer.cc @@ -166,7 +166,7 @@ void Renderer::draw_mirror(FlatMirror *mir) const // TODO update mirror plane for movable mirrors? Mat4 mirmat; - mirmat.mirror(mir->wplane.normal, dot(mir->wplane.normal, mir->wplane.pt)); + mirmat.mirror(mir->wplane.normal, -dot(mir->wplane.normal, mir->wplane.pt)); glMultMatrixf(mirmat[0]); glFrontFace(GL_CW); diff --git a/src/snode.cc b/src/snode.cc index fb2877d..2484e6e 100644 --- a/src/snode.cc +++ b/src/snode.cc @@ -224,6 +224,10 @@ void SceneNode::update(float dt) if(ImGui::Button("xform")) { ImGui::OpenPopup("xform_popup"); } + ImGui::SameLine(); + if(ImGui::Button("bbox")) { + ImGui::OpenPopup("bbox_popup"); + } if(ImGui::BeginPopup("xform_popup")) { ImGui::Text("Local transform"); Vec3 p = get_node_position(); @@ -250,6 +254,28 @@ void SceneNode::update(float dt) ImGui::EndPopup(); } + if(ImGui::BeginPopup("bbox_popup")) { + AABox bloc = get_local_bounds(); + ImGui::Text("Local bounds:"); + if(bloc.max.x < bloc.min.x || bloc.max.y < bloc.min.y || bloc.max.z < bloc.min.z) { + ImGui::BulletText("invalid"); + } else { + ImGui::BulletText("X: %f - %f", bloc.min.x, bloc.max.x); + ImGui::BulletText("Y: %f - %f", bloc.min.y, bloc.max.y); + ImGui::BulletText("Z: %f - %f", bloc.min.z, bloc.max.z); + } + ImGui::Separator(); + AABox bbox = get_bounds(); + ImGui::Text("Global bounds:"); + if(bbox.max.x < bbox.min.x || bbox.max.y < bbox.min.y || bbox.max.z < bbox.min.z) { + ImGui::BulletText("invalid"); + } else { + ImGui::BulletText("X: %f - %f", bbox.min.x, bbox.max.x); + ImGui::BulletText("Y: %f - %f", bbox.min.y, bbox.max.y); + ImGui::BulletText("Z: %f - %f", bbox.min.z, bbox.max.z); + } + ImGui::EndPopup(); + } ImGui::NextColumn(); ImGui::PopID(); } -- 1.7.10.4