void Tutorial3_Render_Scene::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(); UpdateFBXSceneResource(m_fbx); }
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); }