| 121 | } |
| 122 | |
| 123 | float Model::play(uint32_t index, bool loop) { |
| 124 | Model::stop(); |
| 125 | if (index == Animation::None || index >= _animationGroups.size()) { |
| 126 | return 0; |
| 127 | } |
| 128 | _loop = loop; |
| 129 | _isPlaying = true; |
| 130 | _currentAnimation = index; |
| 131 | if (_recoveryTime > 0.0f) { |
| 132 | _isRecovering = true; |
| 133 | _resetAnimation.run(_recoveryTime / std::max(_speed, FLT_EPSILON), _currentAnimation); |
| 134 | } else { |
| 135 | Model::resetActions(); |
| 136 | Model::onResetAnimationEnd(); |
| 137 | } |
| 138 | return (_animationGroups[_currentAnimation]->duration + _recoveryTime) / std::max(_speed, FLT_EPSILON); |
| 139 | } |
| 140 | |
| 141 | float Model::play(String name, bool loop) { |
| 142 | int index = _modelDef->getAnimationIndexByName(name); |
no test coverage detected