Merge pull request #55271 from RPicster/particles-texture-animation-speed
This commit is contained in:
commit
bb3f0a9d58
3 changed files with 13 additions and 13 deletions
|
@ -890,7 +890,7 @@ void CPUParticles2D::_particles_process(double p_delta) {
|
|||
real_t base_angle = (tex_angle)*Math::lerp(parameters_min[PARAM_ANGLE], parameters_max[PARAM_ANGLE], p.angle_rand);
|
||||
base_angle += p.custom[1] * lifetime * tex_angular_velocity * Math::lerp(parameters_min[PARAM_ANGULAR_VELOCITY], parameters_max[PARAM_ANGULAR_VELOCITY], rand_from_seed(alt_seed));
|
||||
p.rotation = Math::deg2rad(base_angle); //angle
|
||||
p.custom[2] = tex_anim_offset * Math::lerp(parameters_min[PARAM_ANIM_OFFSET], parameters_max[PARAM_ANIM_OFFSET], p.anim_offset_rand) + p.custom[1] * tex_anim_speed * Math::lerp(parameters_min[PARAM_ANIM_SPEED], parameters_max[PARAM_ANIM_SPEED], rand_from_seed(alt_seed));
|
||||
p.custom[2] = tex_anim_offset * Math::lerp(parameters_min[PARAM_ANIM_OFFSET], parameters_max[PARAM_ANIM_OFFSET], p.anim_offset_rand) + tv * tex_anim_speed * Math::lerp(parameters_min[PARAM_ANIM_SPEED], parameters_max[PARAM_ANIM_SPEED], rand_from_seed(alt_seed));
|
||||
}
|
||||
//apply color
|
||||
//apply hue rotation
|
||||
|
|
|
@ -881,53 +881,53 @@ void CPUParticles3D::_particles_process(double p_delta) {
|
|||
p.custom[1] = p.time / lifetime;
|
||||
tv = p.time / p.lifetime;
|
||||
|
||||
real_t tex_linear_velocity = 0.0;
|
||||
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);
|
||||
}
|
||||
|
||||
real_t tex_orbit_velocity = 0.0;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
real_t tex_angular_velocity = 0.0;
|
||||
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);
|
||||
}
|
||||
|
||||
real_t tex_linear_accel = 0.0;
|
||||
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);
|
||||
}
|
||||
|
||||
real_t tex_tangential_accel = 0.0;
|
||||
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);
|
||||
}
|
||||
|
||||
real_t tex_radial_accel = 0.0;
|
||||
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);
|
||||
}
|
||||
|
||||
real_t tex_damping = 0.0;
|
||||
real_t tex_damping = 1.0;
|
||||
if (curve_parameters[PARAM_DAMPING].is_valid()) {
|
||||
tex_damping = curve_parameters[PARAM_DAMPING]->interpolate(tv);
|
||||
}
|
||||
|
||||
real_t tex_angle = 0.0;
|
||||
real_t tex_angle = 1.0;
|
||||
if (curve_parameters[PARAM_ANGLE].is_valid()) {
|
||||
tex_angle = curve_parameters[PARAM_ANGLE]->interpolate(tv);
|
||||
}
|
||||
real_t tex_anim_speed = 0.0;
|
||||
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);
|
||||
}
|
||||
|
||||
real_t tex_anim_offset = 0.0;
|
||||
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);
|
||||
}
|
||||
|
@ -984,7 +984,7 @@ void CPUParticles3D::_particles_process(double p_delta) {
|
|||
real_t base_angle = (tex_angle)*Math::lerp(parameters_min[PARAM_ANGLE], parameters_max[PARAM_ANGLE], p.angle_rand);
|
||||
base_angle += p.custom[1] * lifetime * tex_angular_velocity * Math::lerp(parameters_min[PARAM_ANGULAR_VELOCITY], parameters_max[PARAM_ANGULAR_VELOCITY], rand_from_seed(alt_seed));
|
||||
p.custom[0] = Math::deg2rad(base_angle); //angle
|
||||
p.custom[2] = tex_anim_offset * Math::lerp(parameters_min[PARAM_ANIM_OFFSET], parameters_max[PARAM_ANIM_OFFSET], p.anim_offset_rand) + p.custom[1] * tex_anim_speed * Math::lerp(parameters_min[PARAM_ANIM_SPEED], parameters_max[PARAM_ANIM_SPEED], rand_from_seed(alt_seed)); //angle
|
||||
p.custom[2] = tex_anim_offset * Math::lerp(parameters_min[PARAM_ANIM_OFFSET], parameters_max[PARAM_ANIM_OFFSET], p.anim_offset_rand) + tv * tex_anim_speed * Math::lerp(parameters_min[PARAM_ANIM_SPEED], parameters_max[PARAM_ANIM_SPEED], rand_from_seed(alt_seed)); //angle
|
||||
}
|
||||
//apply color
|
||||
//apply hue rotation
|
||||
|
|
|
@ -584,7 +584,7 @@ void ParticlesMaterial::_update_shader() {
|
|||
code += " float base_angle = (tex_angle) * mix(initial_angle_min, initial_angle_max, rand_from_seed(alt_seed));\n";
|
||||
code += " base_angle += CUSTOM.y * LIFETIME * (tex_angular_velocity) * mix(angular_velocity_min,angular_velocity_max, rand_from_seed(alt_seed));\n";
|
||||
code += " CUSTOM.x = base_angle * degree_to_rad;\n"; // angle
|
||||
code += " CUSTOM.z = (tex_anim_offset) * mix(anim_offset_min, anim_offset_max, rand_from_seed(alt_seed)) + CUSTOM.y * tex_anim_speed * mix(anim_speed_min, anim_speed_max, rand_from_seed(alt_seed));\n"; // angle
|
||||
code += " CUSTOM.z = (tex_anim_offset) * mix(anim_offset_min, anim_offset_max, rand_from_seed(alt_seed)) + tv * tex_anim_speed * mix(anim_speed_min, anim_speed_max, rand_from_seed(alt_seed));\n"; // angle
|
||||
|
||||
// apply color
|
||||
// apply hue rotation
|
||||
|
|
Loading…
Reference in a new issue