WIP animation based root bone transform calculation.

This commit is contained in:
Martin Felis
2021-11-21 12:33:22 +01:00
parent 89108f4e1f
commit d4f9459060
14 changed files with 156 additions and 43 deletions
+11 -9
View File
@@ -5,12 +5,15 @@
#include "LockTranslationNode.h"
#include <imgui.h>
#include "ozz/base/maths/soa_transform.h"
void LockTranslationNode::Evaluate(
ozz::vector<ozz::math::SoaTransform>* local_matrices) {
m_input->Evaluate(local_matrices);
ozz::math::SoaFloat3 translation = (*local_matrices)[m_locked_bone_index].translation;
ozz::vector<ozz::math::SoaTransform>* local_matrices,
ozz::math::Transform* root_transform) {
m_input->Evaluate(local_matrices, root_transform);
ozz::math::SoaFloat3 translation =
(*local_matrices)[m_locked_bone_index].translation;
float x[4];
float y[4];
float z[4];
@@ -35,13 +38,14 @@ void LockTranslationNode::Evaluate(
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;
// 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;
const ozz::animation::Skeleton& skeleton =
m_animation_controller->m_skinned_mesh->m_skeleton;
ozz::span<const char* const> joint_names = skeleton.joint_names();
const char* items[255] = {0};
@@ -54,6 +58,4 @@ void LockTranslationNode::DrawDebugUi() {
ImGui::Checkbox("Lock X", &m_lock_x);
ImGui::Checkbox("Lock Y", &m_lock_y);
ImGui::Checkbox("Lock Z", &m_lock_z);
}