X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fsnode.cc;h=fb2877df435c7f6a90b511e96e2fea0130e0f487;hp=b171f3583f0c2eba16075e888238f67f5583c376;hb=9480e20f4de41693ebd1f22e63d3bcecde878f70;hpb=82367657a8ac442b29c1dad51c91e64a48e0671d diff --git a/src/snode.cc b/src/snode.cc index b171f35..fb2877d 100644 --- a/src/snode.cc +++ b/src/snode.cc @@ -164,17 +164,17 @@ const Vec3 &SceneNode::get_node_scaling() const Vec3 SceneNode::get_position() const { - return xform * Vec3(0, 0, 0); + return xform.get_translation(); } Quat SceneNode::get_rotation() const { - return rot; // TODO + return xform.get_rotation(); } Vec3 SceneNode::get_scaling() const { - return scale; // TODO + return xform.get_scaling(); } const Mat4 &SceneNode::get_matrix() const @@ -220,6 +220,36 @@ void SceneNode::update(float dt) ImGui::NextColumn(); ImGui::Checkbox("##vis", &visible); + ImGui::SameLine(); + if(ImGui::Button("xform")) { + ImGui::OpenPopup("xform_popup"); + } + if(ImGui::BeginPopup("xform_popup")) { + ImGui::Text("Local transform"); + Vec3 p = get_node_position(); + ImGui::BulletText("P: %g %g %g", p.x, p.y, p.z); + Quat q = get_node_rotation(); + ImGui::BulletText("R: %g %g %g %g", q.x, q.y, q.z, q.w); + Vec3 s = get_node_scaling(); + ImGui::BulletText("S: %g %g %g", s.x, s.y, s.z); + + ImGui::Separator(); + ImGui::Text("Global transform"); + p = get_position(); + ImGui::BulletText("P: %g %g %g", p.x, p.y, p.z); + q = get_rotation(); + ImGui::BulletText("R: %g %g %g %g", q.x, q.y, q.z, q.w); + s = get_scaling(); + ImGui::BulletText("S: %g %g %g", s.x, s.y, s.z); + + const Mat4 &mat = get_matrix(); + ImGui::BulletText("| %3.3f %3.3f %3.3f %3.3f |", mat[0][0], mat[0][1], mat[0][2], mat[0][3]); + ImGui::BulletText("| %3.3f %3.3f %3.3f %3.3f |", mat[1][0], mat[1][1], mat[1][2], mat[1][3]); + ImGui::BulletText("| %3.3f %3.3f %3.3f %3.3f |", mat[2][0], mat[2][1], mat[2][2], mat[2][3]); + ImGui::BulletText("| %3.3f %3.3f %3.3f %3.3f |", mat[3][0], mat[3][1], mat[3][2], mat[3][3]); + + ImGui::EndPopup(); + } ImGui::NextColumn(); ImGui::PopID(); }