reflection geometry finally correct
authorJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 19 Mar 2018 07:57:29 +0000 (09:57 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 19 Mar 2018 07:57:29 +0000 (09:57 +0200)
src/app.cc
src/metascene.cc
src/renderer.cc
src/snode.cc

index fcf5fe0..ee9b5e6 100644 (file)
@@ -406,7 +406,7 @@ void app_display()
                ImGui::GetIOPtr()->DeltaTime = dt;
                ImGui::NewFrame();
 
-               ImGui::ShowTestWindow();
+               //ImGui::ShowTestWindow();
        }
 
        glClearColor(1, 1, 1, 1);
index a45bfec..eef5e65 100644 (file)
@@ -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;
                }
        }
index deff1b9..b9e5884 100644 (file)
@@ -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);
index fb2877d..2484e6e 100644 (file)
@@ -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();
                }