diff options
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/cpu_particles_2d.cpp | 34 | ||||
-rw-r--r-- | scene/2d/line_builder.cpp | 10 | ||||
-rw-r--r-- | scene/2d/path_2d.cpp | 12 |
3 files changed, 28 insertions, 28 deletions
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index dfe2ce0ec3..58e357ab5f 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -719,17 +719,17 @@ void CPUParticles2D::_particles_process(double p_delta) { /*real_t tex_linear_velocity = 0; if (curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid()) { - tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->interpolate(0); + tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->sample(0); }*/ real_t tex_angle = 0.0; if (curve_parameters[PARAM_ANGLE].is_valid()) { - tex_angle = curve_parameters[PARAM_ANGLE]->interpolate(tv); + tex_angle = curve_parameters[PARAM_ANGLE]->sample(tv); } real_t tex_anim_offset = 0.0; if (curve_parameters[PARAM_ANGLE].is_valid()) { - tex_anim_offset = curve_parameters[PARAM_ANGLE]->interpolate(tv); + tex_anim_offset = curve_parameters[PARAM_ANGLE]->sample(tv); } p.seed = Math::rand(); @@ -825,51 +825,51 @@ void CPUParticles2D::_particles_process(double p_delta) { real_t tex_linear_velocity = 1.0; if (curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid()) { - tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->interpolate(tv); + tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->sample(tv); } real_t tex_orbit_velocity = 1.0; if (curve_parameters[PARAM_ORBIT_VELOCITY].is_valid()) { - tex_orbit_velocity = curve_parameters[PARAM_ORBIT_VELOCITY]->interpolate(tv); + tex_orbit_velocity = curve_parameters[PARAM_ORBIT_VELOCITY]->sample(tv); } real_t tex_angular_velocity = 1.0; if (curve_parameters[PARAM_ANGULAR_VELOCITY].is_valid()) { - tex_angular_velocity = curve_parameters[PARAM_ANGULAR_VELOCITY]->interpolate(tv); + tex_angular_velocity = curve_parameters[PARAM_ANGULAR_VELOCITY]->sample(tv); } real_t tex_linear_accel = 1.0; if (curve_parameters[PARAM_LINEAR_ACCEL].is_valid()) { - tex_linear_accel = curve_parameters[PARAM_LINEAR_ACCEL]->interpolate(tv); + tex_linear_accel = curve_parameters[PARAM_LINEAR_ACCEL]->sample(tv); } real_t tex_tangential_accel = 1.0; if (curve_parameters[PARAM_TANGENTIAL_ACCEL].is_valid()) { - tex_tangential_accel = curve_parameters[PARAM_TANGENTIAL_ACCEL]->interpolate(tv); + tex_tangential_accel = curve_parameters[PARAM_TANGENTIAL_ACCEL]->sample(tv); } real_t tex_radial_accel = 1.0; if (curve_parameters[PARAM_RADIAL_ACCEL].is_valid()) { - tex_radial_accel = curve_parameters[PARAM_RADIAL_ACCEL]->interpolate(tv); + tex_radial_accel = curve_parameters[PARAM_RADIAL_ACCEL]->sample(tv); } real_t tex_damping = 1.0; if (curve_parameters[PARAM_DAMPING].is_valid()) { - tex_damping = curve_parameters[PARAM_DAMPING]->interpolate(tv); + tex_damping = curve_parameters[PARAM_DAMPING]->sample(tv); } real_t tex_angle = 1.0; if (curve_parameters[PARAM_ANGLE].is_valid()) { - tex_angle = curve_parameters[PARAM_ANGLE]->interpolate(tv); + tex_angle = curve_parameters[PARAM_ANGLE]->sample(tv); } real_t tex_anim_speed = 1.0; if (curve_parameters[PARAM_ANIM_SPEED].is_valid()) { - tex_anim_speed = curve_parameters[PARAM_ANIM_SPEED]->interpolate(tv); + tex_anim_speed = curve_parameters[PARAM_ANIM_SPEED]->sample(tv); } real_t tex_anim_offset = 1.0; if (curve_parameters[PARAM_ANIM_OFFSET].is_valid()) { - tex_anim_offset = curve_parameters[PARAM_ANIM_OFFSET]->interpolate(tv); + tex_anim_offset = curve_parameters[PARAM_ANIM_OFFSET]->sample(tv); } Vector2 force = gravity; @@ -921,18 +921,18 @@ void CPUParticles2D::_particles_process(double p_delta) { Vector2 tex_scale = Vector2(1.0, 1.0); if (split_scale) { if (scale_curve_x.is_valid()) { - tex_scale.x = scale_curve_x->interpolate(tv); + tex_scale.x = scale_curve_x->sample(tv); } else { tex_scale.x = 1.0; } if (scale_curve_y.is_valid()) { - tex_scale.y = scale_curve_y->interpolate(tv); + tex_scale.y = scale_curve_y->sample(tv); } else { tex_scale.y = 1.0; } } else { if (curve_parameters[PARAM_SCALE].is_valid()) { - real_t tmp_scale = curve_parameters[PARAM_SCALE]->interpolate(tv); + real_t tmp_scale = curve_parameters[PARAM_SCALE]->sample(tv); tex_scale.x = tmp_scale; tex_scale.y = tmp_scale; } @@ -940,7 +940,7 @@ void CPUParticles2D::_particles_process(double p_delta) { real_t tex_hue_variation = 0.0; if (curve_parameters[PARAM_HUE_VARIATION].is_valid()) { - tex_hue_variation = curve_parameters[PARAM_HUE_VARIATION]->interpolate(tv); + tex_hue_variation = curve_parameters[PARAM_HUE_VARIATION]->sample(tv); } real_t hue_rot_angle = (tex_hue_variation)*Math_TAU * Math::lerp(parameters_min[PARAM_HUE_VARIATION], parameters_max[PARAM_HUE_VARIATION], p.hue_rot_rand); diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp index 25eb9b9851..2bbe88b0e0 100644 --- a/scene/2d/line_builder.cpp +++ b/scene/2d/line_builder.cpp @@ -137,14 +137,14 @@ void LineBuilder::build() { // The line's outer length will be a little higher due to begin and end caps if (begin_cap_mode == Line2D::LINE_CAP_BOX || begin_cap_mode == Line2D::LINE_CAP_ROUND) { if (retrieve_curve) { - total_distance += width * curve->interpolate_baked(0.f) * 0.5f; + total_distance += width * curve->sample_baked(0.f) * 0.5f; } else { total_distance += width * 0.5f; } } if (end_cap_mode == Line2D::LINE_CAP_BOX || end_cap_mode == Line2D::LINE_CAP_ROUND) { if (retrieve_curve) { - total_distance += width * curve->interpolate_baked(1.f) * 0.5f; + total_distance += width * curve->sample_baked(1.f) * 0.5f; } else { total_distance += width * 0.5f; } @@ -160,7 +160,7 @@ void LineBuilder::build() { float uvx1 = 0.f; if (retrieve_curve) { - width_factor = curve->interpolate_baked(0.f); + width_factor = curve->sample_baked(0.f); } pos_up0 += u0 * hw * width_factor; @@ -219,7 +219,7 @@ void LineBuilder::build() { color1 = gradient->get_color_at_offset(current_distance1 / total_distance); } if (retrieve_curve) { - width_factor = curve->interpolate_baked(current_distance1 / total_distance); + width_factor = curve->sample_baked(current_distance1 / total_distance); } Vector2 inner_normal0, inner_normal1; @@ -383,7 +383,7 @@ void LineBuilder::build() { color1 = gradient->get_color(gradient->get_points_count() - 1); } if (retrieve_curve) { - width_factor = curve->interpolate_baked(1.f); + width_factor = curve->sample_baked(1.f); } Vector2 pos_up1 = pos1 + u0 * hw * width_factor; diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index b883d14a41..be17299f07 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -47,7 +47,7 @@ Rect2 Path2D::_edit_get_rect() const { for (int i = 0; i < curve->get_point_count(); i++) { for (int j = 0; j <= 8; j++) { real_t frac = j / 8.0; - Vector2 p = curve->interpolate(i, frac); + Vector2 p = curve->sample(i, frac); aabb.expand_to(p); } } @@ -70,7 +70,7 @@ bool Path2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc for (int j = 1; j <= 8; j++) { real_t frac = j / 8.0; - s[1] = curve->interpolate(i, frac); + s[1] = curve->sample(i, frac); Vector2 p = Geometry2D::get_closest_point_to_segment(p_point, s); if (p.distance_to(p_point) <= p_tolerance) { @@ -112,7 +112,7 @@ void Path2D::_notification(int p_what) { for (int i = 0; i < curve->get_point_count(); i++) { for (int j = 0; j < 8; j++) { real_t frac = j * (1.0 / 8.0); - Vector2 p = curve->interpolate(i, frac); + Vector2 p = curve->sample(i, frac); _cached_draw_pts.set(count++, p); } } @@ -175,7 +175,7 @@ void PathFollow2D::_update_transform() { if (path_length == 0) { return; } - Vector2 pos = c->interpolate_baked(progress, cubic); + Vector2 pos = c->sample_baked(progress, cubic); if (rotates) { real_t ahead = progress + lookahead; @@ -195,14 +195,14 @@ void PathFollow2D::_update_transform() { } } - Vector2 ahead_pos = c->interpolate_baked(ahead, cubic); + Vector2 ahead_pos = c->sample_baked(ahead, cubic); Vector2 tangent_to_curve; if (ahead_pos == pos) { // This will happen at the end of non-looping or non-closed paths. // We'll try a look behind instead, in order to get a meaningful angle. tangent_to_curve = - (pos - c->interpolate_baked(progress - lookahead, cubic)).normalized(); + (pos - c->sample_baked(progress - lookahead, cubic)).normalized(); } else { tangent_to_curve = (ahead_pos - pos).normalized(); } |