| 82 | */ |
| 83 | |
| 84 | void SkeletalModel::AdvanceAnimation(float elapsedTime) |
| 85 | { |
| 86 | #if NAZARA_GRAPHICS_SAFE |
| 87 | if (!m_animation) |
| 88 | { |
| 89 | NazaraError("Model has no animation"); |
| 90 | return; |
| 91 | } |
| 92 | #endif |
| 93 | |
| 94 | m_interpolation += m_currentSequence->frameRate * elapsedTime; |
| 95 | while (m_interpolation > 1.f) |
| 96 | { |
| 97 | m_interpolation -= 1.f; |
| 98 | |
| 99 | unsigned lastFrame = m_currentSequence->firstFrame + m_currentSequence->frameCount - 1; |
| 100 | if (m_nextFrame + 1 > lastFrame) |
| 101 | { |
| 102 | if (m_animation->IsLoopPointInterpolationEnabled()) |
| 103 | { |
| 104 | m_currentFrame = m_nextFrame; |
| 105 | m_nextFrame = m_currentSequence->firstFrame; |
| 106 | } |
| 107 | else |
| 108 | { |
| 109 | m_currentFrame = m_currentSequence->firstFrame; |
| 110 | m_nextFrame = m_currentFrame + 1; |
| 111 | } |
| 112 | } |
| 113 | else |
| 114 | { |
| 115 | m_currentFrame = m_nextFrame; |
| 116 | m_nextFrame++; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | m_animation->AnimateSkeleton(&m_skeleton, m_currentFrame, m_nextFrame, m_interpolation); |
| 121 | |
| 122 | InvalidateBoundingVolume(); |
| 123 | } |
| 124 | |
| 125 | /*! |
| 126 | * \brief Clones this skeletal model |
no test coverage detected