Rename Curve/Curve2D/Curve3D/Gradient interpolate() to sample()
"sampling" is a more accurate term than "interpolating" for what's happening when using that function.
This commit is contained in:
parent
de5f13e935
commit
ae18928748
21 changed files with 199 additions and 198 deletions
|
|
@ -739,17 +739,17 @@ void CPUParticles3D::_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();
|
||||
|
|
@ -907,53 +907,53 @@ void CPUParticles3D::_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 (particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
|
||||
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);
|
||||
}
|
||||
|
||||
Vector3 force = gravity;
|
||||
|
|
@ -1016,23 +1016,23 @@ void CPUParticles3D::_particles_process(double p_delta) {
|
|||
Vector3 tex_scale = Vector3(1.0, 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;
|
||||
}
|
||||
if (scale_curve_z.is_valid()) {
|
||||
tex_scale.z = scale_curve_z->interpolate(tv);
|
||||
tex_scale.z = scale_curve_z->sample(tv);
|
||||
} else {
|
||||
tex_scale.z = 1.0;
|
||||
}
|
||||
} else {
|
||||
if (curve_parameters[PARAM_SCALE].is_valid()) {
|
||||
float tmp_scale = curve_parameters[PARAM_SCALE]->interpolate(tv);
|
||||
float tmp_scale = curve_parameters[PARAM_SCALE]->sample(tv);
|
||||
tex_scale.x = tmp_scale;
|
||||
tex_scale.y = tmp_scale;
|
||||
tex_scale.z = tmp_scale;
|
||||
|
|
@ -1041,7 +1041,7 @@ void CPUParticles3D::_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);
|
||||
|
|
|
|||
|
|
@ -198,17 +198,17 @@ void PathFollow3D::_update_transform(bool p_update_xyz_rot) {
|
|||
}
|
||||
}
|
||||
|
||||
Vector3 pos = c->interpolate_baked(progress, cubic);
|
||||
Vector3 pos = c->sample_baked(progress, cubic);
|
||||
Transform3D t = get_transform();
|
||||
// Vector3 pos_offset = Vector3(h_offset, v_offset, 0); not used in all cases
|
||||
// will be replaced by "Vector3(h_offset, v_offset, 0)" where it was formerly used
|
||||
|
||||
if (rotation_mode == ROTATION_ORIENTED) {
|
||||
Vector3 forward = c->interpolate_baked(o_next, cubic) - pos;
|
||||
Vector3 forward = c->sample_baked(o_next, cubic) - pos;
|
||||
|
||||
// Try with the previous position
|
||||
if (forward.length_squared() < CMP_EPSILON2) {
|
||||
forward = pos - c->interpolate_baked(o_prev, cubic);
|
||||
forward = pos - c->sample_baked(o_prev, cubic);
|
||||
}
|
||||
|
||||
if (forward.length_squared() < CMP_EPSILON2) {
|
||||
|
|
@ -217,10 +217,10 @@ void PathFollow3D::_update_transform(bool p_update_xyz_rot) {
|
|||
forward.normalize();
|
||||
}
|
||||
|
||||
Vector3 up = c->interpolate_baked_up_vector(progress, true);
|
||||
Vector3 up = c->sample_baked_up_vector(progress, true);
|
||||
|
||||
if (o_next < progress) {
|
||||
Vector3 up1 = c->interpolate_baked_up_vector(o_next, true);
|
||||
Vector3 up1 = c->sample_baked_up_vector(o_next, true);
|
||||
Vector3 axis = up.cross(up1);
|
||||
|
||||
if (axis.length_squared() < CMP_EPSILON2) {
|
||||
|
|
@ -249,10 +249,10 @@ void PathFollow3D::_update_transform(bool p_update_xyz_rot) {
|
|||
t.origin = pos;
|
||||
if (p_update_xyz_rot && prev_offset != progress) { // Only update rotation if some parameter has changed - i.e. not on addition to scene tree.
|
||||
real_t sample_distance = bi * 0.01;
|
||||
Vector3 t_prev_pos_a = c->interpolate_baked(prev_offset - sample_distance, cubic);
|
||||
Vector3 t_prev_pos_b = c->interpolate_baked(prev_offset + sample_distance, cubic);
|
||||
Vector3 t_cur_pos_a = c->interpolate_baked(progress - sample_distance, cubic);
|
||||
Vector3 t_cur_pos_b = c->interpolate_baked(progress + sample_distance, cubic);
|
||||
Vector3 t_prev_pos_a = c->sample_baked(prev_offset - sample_distance, cubic);
|
||||
Vector3 t_prev_pos_b = c->sample_baked(prev_offset + sample_distance, cubic);
|
||||
Vector3 t_cur_pos_a = c->sample_baked(progress - sample_distance, cubic);
|
||||
Vector3 t_cur_pos_b = c->sample_baked(progress + sample_distance, cubic);
|
||||
Vector3 t_prev = (t_prev_pos_a - t_prev_pos_b).normalized();
|
||||
Vector3 t_cur = (t_cur_pos_a - t_cur_pos_b).normalized();
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ void PathFollow3D::_update_transform(bool p_update_xyz_rot) {
|
|||
}
|
||||
|
||||
// do the additional tilting
|
||||
real_t tilt_angle = c->interpolate_baked_tilt(progress);
|
||||
real_t tilt_angle = c->sample_baked_tilt(progress);
|
||||
Vector3 tilt_axis = t_cur; // not sure what tilt is supposed to do, is this correct??
|
||||
|
||||
if (likely(!Math::is_zero_approx(Math::abs(tilt_angle)))) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue