7color
rgb_ramp_lookup(color ramp[],
float at,
int interpolate,
int extrapolate)
10 int table_size = arraylength(ramp);
12 if ((f < 0.0 || f > 1.0) && extrapolate) {
20 t0 = ramp[table_size - 1];
21 dy = t0 - ramp[table_size - 2];
24 return t0 + dy * f * (table_size - 1);
27 f =
clamp(at, 0.0, 1.0) * (table_size - 1);
34 if (
i >= table_size) {
41 if (interpolate && t > 0.0) {
51 int table_size = arraylength(ramp);
53 if ((f < 0.0 || f > 1.0) && extrapolate) {
61 t0 = ramp[table_size - 1];
62 dy = t0 - ramp[table_size - 2];
65 return t0 + dy * f * (table_size - 1);
68 f =
clamp(at, 0.0, 1.0) * (table_size - 1);
75 if (
i >= table_size) {
82 if (interpolate && t > 0.0) {