| 82 | |
| 83 | template <typename _Track> |
| 84 | inline bool Optimize(float _tolerance, const _Track& _input, _Track* _output) { |
| 85 | if (!_output) { |
| 86 | return false; |
| 87 | } |
| 88 | // Reset output animation to default. |
| 89 | *_output = _Track(); |
| 90 | |
| 91 | // Validate animation. |
| 92 | if (!_input.Validate()) { |
| 93 | return false; |
| 94 | } |
| 95 | |
| 96 | // Copy name |
| 97 | _output->name = _input.name; |
| 98 | |
| 99 | // Optimizes. |
| 100 | const Adapter<typename _Track::Keyframe> adapter; |
| 101 | Decimate(_input.keyframes, adapter, _tolerance, &_output->keyframes); |
| 102 | |
| 103 | // Output animation is always valid though. |
| 104 | return _output->Validate(); |
| 105 | } |
| 106 | } // namespace |
| 107 | |
| 108 | bool TrackOptimizer::operator()(const RawFloatTrack& _input, |
no test coverage detected