Skip to content

Instantly share code, notes, and snippets.

@alanhaugen
Created August 30, 2020 17:35
Show Gist options
  • Save alanhaugen/5e81a6ed6ce72c58565079a796ef2c0a to your computer and use it in GitHub Desktop.
Save alanhaugen/5e81a6ed6ce72c58565079a796ef2c0a to your computer and use it in GitHub Desktop.
#include "joint.h"
Joint::Joint(int _id, String _jointName, glm::mat4 _bindTransform)
{
id = _id;
name = _jointName;
worldBindTransform = _bindTransform;
}
void Joint::CalculateInverseTransform(glm::mat4 parentWorldTransform)
{
glm::mat4 localBindTransform = glm::inverse(parentWorldTransform) * worldBindTransform;
glm::mat4 bindTransform = parentWorldTransform * localBindTransform;
inverseBindTransform = glm::inverse(bindTransform);
for (unsigned int i = 0; i < children.Size(); i++)
{
children[i]->CalculateInverseTransform(bindTransform);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment