mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
21 lines
493 B
C++
21 lines
493 B
C++
|
|
#include "editor_brush.hpp"
|
||
|
|
#include <algorithm>
|
||
|
|
#include <cmath>
|
||
|
|
|
||
|
|
namespace wowee {
|
||
|
|
namespace editor {
|
||
|
|
|
||
|
|
float EditorBrush::getInfluence(float distance) const {
|
||
|
|
if (distance >= settings_.radius) return 0.0f;
|
||
|
|
|
||
|
|
float t = distance / settings_.radius;
|
||
|
|
float innerRadius = 1.0f - settings_.falloff;
|
||
|
|
if (t <= innerRadius) return 1.0f;
|
||
|
|
|
||
|
|
float falloffT = (t - innerRadius) / settings_.falloff;
|
||
|
|
return 1.0f - (falloffT * falloffT);
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace editor
|
||
|
|
} // namespace wowee
|