// // Created by martin on 16.11.21. // #include "LockTranslationNode.h" #include #include "ozz/base/maths/soa_transform.h" void LockTranslationNode::Evaluate( ozz::vector* local_matrices) { m_input->Evaluate(local_matrices); ozz::math::SoaFloat3 translation = (*local_matrices)[m_locked_bone_index].translation; float x[4]; float y[4]; float z[4]; _mm_store_ps(x, translation.x); _mm_store_ps(y, translation.y); _mm_store_ps(z, translation.z); if (m_lock_x) { x[0] = 0.f; } if (m_lock_y) { y[0] = 0.f; } if (m_lock_z) { z[0] = 0.f; } translation.x = _mm_load_ps(x); translation.y = _mm_load_ps(y); translation.z = _mm_load_ps(z); //translation = ozz::math::SoaFloat3::zero(); // ozz::math::SetX(translation, 0.f); // ozz::math::SetZ(translation, 0.f); (*local_matrices)[m_locked_bone_index].translation = translation; } void LockTranslationNode::DrawDebugUi() { const ozz::animation::Skeleton& skeleton = m_animation_controller->m_skinned_mesh->m_skeleton; ozz::span joint_names = skeleton.joint_names(); const char* items[255] = {0}; int item_current = 0; for (int i = 0; i < joint_names.size(); i++) { items[i] = joint_names[i]; } ImGui::Combo("Bone", &m_locked_bone_index, items, joint_names.size()); ImGui::Checkbox("Lock X", &m_lock_x); ImGui::Checkbox("Lock Y", &m_lock_y); ImGui::Checkbox("Lock Z", &m_lock_z); }