X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fsnode.cc;h=2484e6eed4b2d60fb7c947358e5fe8d3f2f82d46;hp=fb2877df435c7f6a90b511e96e2fea0130e0f487;hb=e5c3a6764a288f04cffbf02164fec7a2c2d80dea;hpb=405378c467bd3b73532bb6a0ea45ff6bf712f539 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(); }