void Skeleton::Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation) { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Skeleton not created"); return; } if (!skeletonA.IsValid()) { NazaraError("Skeleton A is invalid"); return; } if (!skeletonB.IsValid()) { NazaraError("Skeleton B is invalid"); return; } if (skeletonA.GetJointCount() != skeletonB.GetJointCount() || m_impl->joints.size() != skeletonA.GetJointCount()) { NazaraError("Skeletons must have the same joint count"); return; } #endif Joint* jointsA = &skeletonA.m_impl->joints[0]; Joint* jointsB = &skeletonB.m_impl->joints[0]; for (std::size_t i = 0; i < m_impl->joints.size(); ++i) m_impl->joints[i].Interpolate(jointsA[i], jointsB[i], interpolation, CoordSys_Local); InvalidateJoints(); }
void Skeleton::Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation, UInt32* indices, UInt32 indiceCount) { #if NAZARA_UTILITY_SAFE if (!m_impl) { NazaraError("Skeleton not created"); return; } if (!skeletonA.IsValid()) { NazaraError("Skeleton A is invalid"); return; } if (!skeletonB.IsValid()) { NazaraError("Skeleton B is invalid"); return; } if (skeletonA.GetJointCount() != skeletonB.GetJointCount() || m_impl->joints.size() != skeletonA.GetJointCount()) { NazaraError("Skeletons must have the same joint count"); return; } #endif const Joint* jointsA = &skeletonA.m_impl->joints[0]; const Joint* jointsB = &skeletonB.m_impl->joints[0]; for (UInt32 i = 0; i < indiceCount; ++i) { UInt32 index = indices[i]; #if NAZARA_UTILITY_SAFE if (index >= m_impl->joints.size()) { NazaraError("Index #" + String::Number(i) + " out of range (" + String::Number(index) + " >= " + String::Number(m_impl->joints.size()) + ')'); return; } #endif m_impl->joints[index].Interpolate(jointsA[index], jointsB[index], interpolation, CoordSys_Local); } InvalidateJoints(); }