#include "stdafx.h" #include "DiffuseMaterial_Skinned.h" DiffuseMaterial_Skinned::DiffuseMaterial_Skinned(): Material(L"Effects/PosNormTex3D_Skinned.fx") { } void DiffuseMaterial_Skinned::SetDiffuseTexture(const std::wstring& assetFile) { m_pDiffuseTexture = ContentManager::Load(assetFile); SetVariable_Texture(L"gDiffuseMap", m_pDiffuseTexture); } void DiffuseMaterial_Skinned::InitializeEffectVariables() { } void DiffuseMaterial_Skinned::OnUpdateModelVariables(const SceneContext& sceneContext, const ModelComponent* pModel) const { //Update the Light Direction (retrieve the direction from the LightManager > sceneContext) XMFLOAT4 lightDir = sceneContext.pLights->GetDirectionalLight().direction; SetVariable_Vector(L"gLightDirection", XMFLOAT3{ lightDir.x, lightDir.y, lightDir.z }); //Retrieve The Animator from the ModelComponent ModelAnimator* pAnimator = pModel->GetAnimator(); //Make sure the animator is not NULL (ASSERT_NULL_) ASSERT_NULL_(pAnimator); //Retrieve the BoneTransforms from the Animator std::vector boneTransforms = pAnimator->GetBoneTransforms(); //Set the 'gBones' variable of the effect (MatrixArray) > BoneTransforms SetVariable_MatrixArray(L"gBones", reinterpret_cast(boneTransforms.data()), UINT(boneTransforms.size())); }