Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change curve range for particle multipliers #91556

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 14 additions & 31 deletions scene/2d/cpu_particles_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,42 +342,25 @@ void CPUParticles2D::set_param_curve(Parameter p_param, const Ref<Curve> &p_curv
curve_parameters[p_param] = p_curve;

switch (p_param) {
case PARAM_INITIAL_LINEAR_VELOCITY: {
//do none for this one
} break;
case PARAM_ANGULAR_VELOCITY: {
_adjust_curve_range(p_curve, -360, 360);
} break;
case PARAM_ORBIT_VELOCITY: {
_adjust_curve_range(p_curve, -500, 500);
} break;
case PARAM_LINEAR_ACCEL: {
_adjust_curve_range(p_curve, -200, 200);
} break;
case PARAM_RADIAL_ACCEL: {
_adjust_curve_range(p_curve, -200, 200);
} break;
case PARAM_TANGENTIAL_ACCEL: {
_adjust_curve_range(p_curve, -200, 200);
} break;
case PARAM_DAMPING: {
_adjust_curve_range(p_curve, 0, 100);
} break;
case PARAM_ANGLE: {
_adjust_curve_range(p_curve, -360, 360);
} break;
case PARAM_SCALE: {
} break;
case PARAM_ANGULAR_VELOCITY:
case PARAM_ORBIT_VELOCITY:
case PARAM_LINEAR_ACCEL:
case PARAM_RADIAL_ACCEL:
case PARAM_TANGENTIAL_ACCEL:
case PARAM_ANGLE:
case PARAM_HUE_VARIATION: {
_adjust_curve_range(p_curve, -1, 1);
} break;
case PARAM_ANIM_SPEED: {
_adjust_curve_range(p_curve, 0, 200);
} break;
case PARAM_DAMPING:
case PARAM_SCALE:
case PARAM_ANIM_SPEED:
case PARAM_ANIM_OFFSET: {
_adjust_curve_range(p_curve, 0, 1);
} break;
case PARAM_INITIAL_LINEAR_VELOCITY:
case PARAM_MAX: {
// No curve available.
} break;
default: {
}
}

update_configuration_warnings();
Expand Down
45 changes: 14 additions & 31 deletions scene/3d/cpu_particles_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,42 +324,25 @@ void CPUParticles3D::set_param_curve(Parameter p_param, const Ref<Curve> &p_curv
curve_parameters[p_param] = p_curve;

switch (p_param) {
case PARAM_INITIAL_LINEAR_VELOCITY: {
//do none for this one
} break;
case PARAM_ANGULAR_VELOCITY: {
_adjust_curve_range(p_curve, -360, 360);
} break;
case PARAM_ORBIT_VELOCITY: {
_adjust_curve_range(p_curve, -500, 500);
} break;
case PARAM_LINEAR_ACCEL: {
_adjust_curve_range(p_curve, -200, 200);
} break;
case PARAM_RADIAL_ACCEL: {
_adjust_curve_range(p_curve, -200, 200);
} break;
case PARAM_TANGENTIAL_ACCEL: {
_adjust_curve_range(p_curve, -200, 200);
} break;
case PARAM_DAMPING: {
_adjust_curve_range(p_curve, 0, 100);
} break;
case PARAM_ANGLE: {
_adjust_curve_range(p_curve, -360, 360);
} break;
case PARAM_SCALE: {
} break;
case PARAM_ANGULAR_VELOCITY:
case PARAM_ORBIT_VELOCITY:
case PARAM_LINEAR_ACCEL:
case PARAM_RADIAL_ACCEL:
case PARAM_TANGENTIAL_ACCEL:
case PARAM_ANGLE:
case PARAM_HUE_VARIATION: {
_adjust_curve_range(p_curve, -1, 1);
} break;
case PARAM_ANIM_SPEED: {
_adjust_curve_range(p_curve, 0, 200);
} break;
case PARAM_DAMPING:
case PARAM_SCALE:
case PARAM_ANIM_SPEED:
case PARAM_ANIM_OFFSET: {
_adjust_curve_range(p_curve, 0, 1);
} break;
case PARAM_INITIAL_LINEAR_VELOCITY:
case PARAM_MAX: {
// No curve available.
} break;
default: {
}
}

update_configuration_warnings();
Expand Down
38 changes: 18 additions & 20 deletions scene/resources/particle_process_material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,37 +1407,34 @@ void ParticleProcessMaterial::set_param_texture(Parameter p_param, const Ref<Tex
Variant tex_rid = p_texture.is_valid() ? Variant(p_texture->get_rid()) : Variant();

switch (p_param) {
case PARAM_INITIAL_LINEAR_VELOCITY: {
//do none for this one
} break;
case PARAM_ANGULAR_VELOCITY: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_texture, tex_rid);
_adjust_curve_range(p_texture, -360, 360);
_adjust_curve_range(p_texture, -1, 1);
} break;
case PARAM_ORBIT_VELOCITY: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_texture, tex_rid);
_adjust_curve_range(p_texture, -2, 2);
_adjust_curve_range(p_texture, -1, 1);
notify_property_list_changed();
} break;
case PARAM_LINEAR_ACCEL: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_texture, tex_rid);
_adjust_curve_range(p_texture, -200, 200);
_adjust_curve_range(p_texture, -1, 1);
} break;
case PARAM_RADIAL_ACCEL: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_texture, tex_rid);
_adjust_curve_range(p_texture, -200, 200);
_adjust_curve_range(p_texture, -1, 1);
} break;
case PARAM_TANGENTIAL_ACCEL: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_texture, tex_rid);
_adjust_curve_range(p_texture, -200, 200);
_adjust_curve_range(p_texture, -1, 1);
} break;
case PARAM_DAMPING: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_texture, tex_rid);
_adjust_curve_range(p_texture, 0, 100);
_adjust_curve_range(p_texture, 0, 1);
} break;
case PARAM_ANGLE: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angle_texture, tex_rid);
_adjust_curve_range(p_texture, -360, 360);
_adjust_curve_range(p_texture, -1, 1);
} break;
case PARAM_SCALE: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_texture, tex_rid);
Expand All @@ -1449,35 +1446,36 @@ void ParticleProcessMaterial::set_param_texture(Parameter p_param, const Ref<Tex
} break;
case PARAM_ANIM_SPEED: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_texture, tex_rid);
_adjust_curve_range(p_texture, 0, 200);
_adjust_curve_range(p_texture, 0, 1);
} break;
case PARAM_ANIM_OFFSET: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_texture, tex_rid);
_adjust_curve_range(p_texture, 0, 1);
} break;
case PARAM_TURB_INFLUENCE_OVER_LIFE: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->turbulence_influence_over_life, tex_rid);
_adjust_curve_range(p_texture, 0, 1);
} break;
case PARAM_TURB_VEL_INFLUENCE: {
// Can't happen, but silences warning
} break;
case PARAM_TURB_INIT_DISPLACEMENT: {
// Can't happen, but silences warning
} break;
case PARAM_RADIAL_VELOCITY: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_velocity_texture, tex_rid);
_adjust_curve_range(p_texture, 0, 1);
} break;
case PARAM_SCALE_OVER_VELOCITY: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_over_velocity_texture, tex_rid);
_adjust_curve_range(p_texture, 0, 3);
_adjust_curve_range(p_texture, 0, 1);
notify_property_list_changed();
} break;
case PARAM_DIRECTIONAL_VELOCITY: {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->directional_velocity_texture, tex_rid);
_adjust_curve_range(p_texture, 0, 1);
notify_property_list_changed();
} break;
case PARAM_MAX:
break; // Can't happen, but silences warning
case PARAM_INITIAL_LINEAR_VELOCITY:
case PARAM_TURB_VEL_INFLUENCE:
case PARAM_TURB_INIT_DISPLACEMENT:
case PARAM_MAX: {
// No curve available.
} break;
}

_queue_shader_change();
Expand Down