/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/RendererCore/AnimationSystem/AnimGraph/Implementation/AnimGraphInstance.cpp
58 строк
3 KB
Ingrater
Clang-format fixes and update to 18.1.1 (#1234)
10 мар 2024, 15:51
Не верифицирован
10 мар 2024, 15:51
2f16acf
Код
Авторство
О чём код?
#include <RendererCore/RendererCorePCH.h> #include <Core/World/GameObject.h> #include <RendererCore/AnimationSystem/AnimGraph/AnimGraph.h> #include <RendererCore/AnimationSystem/AnimGraph/AnimGraphInstance.h> #include <RendererCore/AnimationSystem/AnimGraph/AnimGraphResource.h> #include <RendererCore/AnimationSystem/SkeletonResource.h> #include <ozz/animation/runtime/skeleton.h> ezAnimGraphInstance::ezAnimGraphInstance() = default; ezAnimGraphInstance::~ezAnimGraphInstance() { if (m_pAnimGraph) { m_pAnimGraph->GetInstanceDataAlloator().DestructAndDeallocate(m_InstanceData); } } void ezAnimGraphInstance::Configure(const ezAnimGraph& animGraph) { m_pAnimGraph = &animGraph; m_InstanceData = m_pAnimGraph->GetInstanceDataAlloator().AllocateAndConstruct(); // EXTEND THIS if a new type is introduced m_pTriggerInputPinStates = (ezInt8*)ezInstanceDataAllocator::GetInstanceData(m_InstanceData.GetByteBlobPtr(), m_pAnimGraph->m_uiPinInstanceDataOffset[ezAnimGraphPin::Type::Trigger]); m_pNumberInputPinStates = (double*)ezInstanceDataAllocator::GetInstanceData(m_InstanceData.GetByteBlobPtr(), m_pAnimGraph->m_uiPinInstanceDataOffset[ezAnimGraphPin::Type::Number]); m_pBoolInputPinStates = (bool*)ezInstanceDataAllocator::GetInstanceData(m_InstanceData.GetByteBlobPtr(), m_pAnimGraph->m_uiPinInstanceDataOffset[ezAnimGraphPin::Type::Bool]); m_pBoneWeightInputPinStates = (ezUInt16*)ezInstanceDataAllocator::GetInstanceData(m_InstanceData.GetByteBlobPtr(), m_pAnimGraph->m_uiPinInstanceDataOffset[ezAnimGraphPin::Type::BoneWeights]); m_pModelPoseInputPinStates = (ezUInt16*)ezInstanceDataAllocator::GetInstanceData(m_InstanceData.GetByteBlobPtr(), m_pAnimGraph->m_uiPinInstanceDataOffset[ezAnimGraphPin::Type::ModelPose]); m_LocalPoseInputPinStates.SetCount(animGraph.m_uiInputPinCounts[ezAnimGraphPin::Type::LocalPose]); } void ezAnimGraphInstance::Update(ezAnimController& ref_controller, ezTime diff, ezGameObject* pTarget, const ezSkeletonResource* pSekeltonResource) { // reset all pin states { // EXTEND THIS if a new type is introduced ezMemoryUtils::ZeroFill(m_pTriggerInputPinStates, m_pAnimGraph->m_uiInputPinCounts[ezAnimGraphPin::Type::Trigger]); ezMemoryUtils::ZeroFill(m_pNumberInputPinStates, m_pAnimGraph->m_uiInputPinCounts[ezAnimGraphPin::Type::Number]); ezMemoryUtils::ZeroFill(m_pBoolInputPinStates, m_pAnimGraph->m_uiInputPinCounts[ezAnimGraphPin::Type::Bool]); ezMemoryUtils::ZeroFill(m_pBoneWeightInputPinStates, m_pAnimGraph->m_uiInputPinCounts[ezAnimGraphPin::Type::BoneWeights]); ezMemoryUtils::PatternFill(m_pModelPoseInputPinStates, 0xFF, m_pAnimGraph->m_uiInputPinCounts[ezAnimGraphPin::Type::ModelPose]); for (auto& pins : m_LocalPoseInputPinStates) { pins.Clear(); } } for (const auto& pNode : m_pAnimGraph->GetNodes()) { pNode->Step(ref_controller, *this, diff, pSekeltonResource, pTarget); } }