Changed Animation and BoneAttachment "Name" field to "AnimationName" and "BoneName"
This commit is contained in:
@@ -15,7 +15,7 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
||||
|
||||
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["Name"]);
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["AnimationName"]);
|
||||
|
||||
if(animation != nullptr) {
|
||||
double animationSpeed = (double)animationComponent["Speed"];
|
||||
@@ -29,7 +29,7 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
||||
(double&)animationComponent["Speed"] = 0.0;
|
||||
Events::AnimationComplete e;
|
||||
e.Entity = entity;
|
||||
e.Name = (std::string)animationComponent["Name"];
|
||||
e.Name = (std::string)animationComponent["AnimationName"];
|
||||
m_EventBroker->Publish(e);
|
||||
} else {
|
||||
if (glm::abs(nextTime) > animation->Duration) {
|
||||
|
||||
@@ -20,13 +20,13 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
|
||||
|
||||
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(parent["Animation"]["Name"]);
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(parent["Animation"]["AnimationName"]);
|
||||
|
||||
if (!animation) {
|
||||
return;
|
||||
}
|
||||
|
||||
int id = skeleton->GetBoneID(entity["BoneAttachment"]["Name"]);
|
||||
int id = skeleton->GetBoneID(entity["BoneAttachment"]["BoneName"]);
|
||||
|
||||
if(id == -1) {
|
||||
return;
|
||||
|
||||
@@ -156,17 +156,9 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
||||
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
|
||||
}*/
|
||||
|
||||
//TODO: Fixa så att modelsJobs kan spela upp olika animationer och så att den kan få in en tid istället för 1.0f - Hälsningar Johan och Andreas :)
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
if (modelJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
|
||||
// std::vector<glm::mat4> frameBones2 = modelJob->Skeleton->GetFrameBones(*modelJob->Skeleton->GetAnimation("Walk"), modelJob->AnimationTime);
|
||||
//
|
||||
//
|
||||
// for (int i = 0; i < frameBones.size(); i++) {
|
||||
// frameBones[i] = frameBones[i] * glm::mat4(glm::quat(glm::vec3(0.f, 0.f, 0.f)));//* frameBones2[i];
|
||||
// }
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user