MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / Optimize

Function Optimize

modules/tools/animation_tool/src/track_optimizer.cc:84–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82
83template <typename _Track>
84inline 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
108bool TrackOptimizer::operator()(const RawFloatTrack& _input,

Callers 1

operator()Method · 0.85

Calls 2

DecimateFunction · 0.85
ValidateMethod · 0.45

Tested by

no test coverage detected