5 #ifndef SCENE_RESOURCES_COLOR_RAMP_H_ 6 #define SCENE_RESOURCES_COLOR_RAMP_H_ 19 bool operator<(
const Point& p_ponit)
const {
20 return offset<p_ponit.offset;
29 static void _bind_methods();
35 void add_point(
float p_offset,
const Color& p_color);
36 void remove_point(
int p_index);
41 void set_offset(
int pos,
const float offset);
42 float get_offset(
int pos)
const;
44 void set_color(
int pos,
const Color& color);
45 Color get_color(
int pos)
const;
53 _FORCE_INLINE_
Color get_color_at_offset(
float p_offset) {
56 return Color(0,0,0,1);
66 int high = points.size() -1;
71 middle = ( low + high ) / 2;
72 Point& point = points[middle];
73 if( point.offset > p_offset ) {
75 }
else if ( point.offset < p_offset) {
83 if (points[middle].offset>p_offset)
89 if(second>=points.size())
90 return points[points.size()-1].color;
92 return points[0].color;
93 Point& pointFirst = points[first];
94 Point& pointSecond = points[second];
95 return pointFirst.color.linear_interpolate(pointSecond.color, (p_offset-pointFirst.offset)/(pointSecond.offset - pointFirst.offset));
98 int get_points_count()
const;
Definition: resource.h:89
Definition: color_ramp.h:15
Definition: color_ramp.h:10