|
|
|
@ -44,10 +44,11 @@ public record Color(double r, double g, double b) implements Texture {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static @NotNull Color average(@NotNull Color current, @NotNull Color next, int index) {
|
|
|
|
|
var factor = 1d / index;
|
|
|
|
|
return new Color(
|
|
|
|
|
current.r() + (next.r() - current.r()) / index,
|
|
|
|
|
current.g() + (next.g() - current.g()) / index,
|
|
|
|
|
current.b() + (next.b() - current.b()) / index
|
|
|
|
|
Math.fma(factor, next.r() - current.r(), current.r()),
|
|
|
|
|
Math.fma(factor, next.g() - current.g(), current.g()),
|
|
|
|
|
Math.fma(factor, next.b() - current.b(), current.b())
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|