void Tutorial9_Animation::onUpdate(float a_deltaTime) { // update our camera matrix using the keyboard/mouse Utility::freeMovement(m_cameraMatrix, a_deltaTime, 10); // clear all gizmos from last frame Gizmos::clear(); // add an identity matrix gizmo Gizmos::addTransform(glm::mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)); // add a 20x20 grid on the XZ-plane for (int i = 0; i < 21; ++i) { Gizmos::addLine(glm::vec3(-10 + i, 0, 10), glm::vec3(-10 + i, 0, -10), i == 10 ? glm::vec4(1, 1, 1, 1) : glm::vec4(0, 0, 0, 1)); Gizmos::addLine(glm::vec3(10, 0, -10 + i), glm::vec3(-10, 0, -10 + i), i == 10 ? glm::vec4(1, 1, 1, 1) : glm::vec4(0, 0, 0, 1)); } // quit our application when escape is pressed if (glfwGetKey(m_window, GLFW_KEY_ESCAPE) == GLFW_PRESS) quit(); // grab the skeleton and animation we want to use FBXSkeleton* skeleton = m_fbx->getSkeletonByIndex(0); FBXAnimation* animation = m_fbx->getAnimationByIndex(0); // evaluate the animation to update bones skeleton->evaluate(animation, Utility::getTotalTime()); UpdateFBXSceneResource(m_fbx); }
void FBXObject::Update(float deltaTime) { FBXSkeleton* skeleton = m_fbx->getSkeletonByIndex(0); FBXAnimation* animation = m_fbx->getAnimationByIndex(0); m_timer += deltaTime; skeleton->evaluate(animation, m_timer); for (unsigned int bone_index = 0; bone_index < skeleton->m_boneCount; ++bone_index) { skeleton->m_nodes[bone_index]->updateGlobalTransform(); } }
void APP_Animation::Update(float a_dt) { GameCam->Update(a_dt); //update camera // if (m_timer > 5) // m_timer = 0; m_timer += a_dt; // grab the skeleton and animation we want to use FBXSkeleton* skeleton = m_fbx->getSkeletonByIndex(0); FBXAnimation* animation = m_fbx->getAnimationByIndex(0); // evaluate the animation to update bones skeleton->evaluate(animation, m_timer); for (unsigned int bone_index = 0; bone_index < skeleton->m_boneCount; ++bone_index) { skeleton->m_nodes[bone_index]->updateGlobalTransform(); } }
void FBXObject::Update(float dT) { if (m_animated) { // grab the skeleton and animation we want to use FBXSkeleton* skeleton = m_fbx->getSkeletonByIndex(0); m_timer += dT * 2; FBXAnimation* animation = m_fbx->getAnimationByIndex(0); // evaluate the animation to update bones skeleton->evaluate(animation, m_timer); for (unsigned int bone_index = 0; bone_index < skeleton->m_boneCount; ++bone_index) { skeleton->m_nodes[bone_index]->updateGlobalTransform(); } } }