diff options
Diffstat (limited to 'scene/resources/particles_material.cpp')
-rw-r--r-- | scene/resources/particles_material.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index f18e8956f1..63766c1756 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -121,7 +121,7 @@ void ParticlesMaterial::_update_shader() { shader_map[current_key].users--; if (shader_map[current_key].users == 0) { //deallocate shader, as it's no longer in use - VS::get_singleton()->free(shader_map[current_key].shader); + RS::get_singleton()->free(shader_map[current_key].shader); shader_map.erase(current_key); } } @@ -130,7 +130,7 @@ void ParticlesMaterial::_update_shader() { if (shader_map.has(mk)) { - VS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader); + RS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader); shader_map[mk].users++; return; } @@ -592,14 +592,14 @@ void ParticlesMaterial::_update_shader() { code += "\n"; ShaderData shader_data; - shader_data.shader = VS::get_singleton()->shader_create(); + shader_data.shader = RS::get_singleton()->shader_create(); shader_data.users = 1; - VS::get_singleton()->shader_set_code(shader_data.shader, code); + RS::get_singleton()->shader_set_code(shader_data.shader, code); shader_map[mk] = shader_data; - VS::get_singleton()->material_set_shader(_get_material(), shader_data.shader); + RS::get_singleton()->material_set_shader(_get_material(), shader_data.shader); } void ParticlesMaterial::flush_changes() { @@ -631,7 +631,7 @@ bool ParticlesMaterial::_is_shader_dirty() const { void ParticlesMaterial::set_direction(Vector3 p_direction) { direction = p_direction; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->direction, direction); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->direction, direction); } Vector3 ParticlesMaterial::get_direction() const { @@ -642,7 +642,7 @@ Vector3 ParticlesMaterial::get_direction() const { void ParticlesMaterial::set_spread(float p_spread) { spread = p_spread; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->spread, p_spread); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->spread, p_spread); } float ParticlesMaterial::get_spread() const { @@ -653,7 +653,7 @@ float ParticlesMaterial::get_spread() const { void ParticlesMaterial::set_flatness(float p_flatness) { flatness = p_flatness; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->flatness, p_flatness); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->flatness, p_flatness); } float ParticlesMaterial::get_flatness() const { @@ -668,40 +668,40 @@ void ParticlesMaterial::set_param(Parameter p_param, float p_value) { switch (p_param) { case PARAM_INITIAL_LINEAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity, p_value); } break; case PARAM_ANGULAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity, p_value); } break; case PARAM_ORBIT_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity, p_value); } break; case PARAM_LINEAR_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel, p_value); } break; case PARAM_RADIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel, p_value); } break; case PARAM_TANGENTIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel, p_value); } break; case PARAM_DAMPING: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->damping, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->damping, p_value); } break; case PARAM_ANGLE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle, p_value); } break; case PARAM_SCALE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->scale, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->scale, p_value); } break; case PARAM_HUE_VARIATION: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation, p_value); } break; case PARAM_ANIM_SPEED: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed, p_value); } break; case PARAM_ANIM_OFFSET: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset, p_value); } break; case PARAM_MAX: break; // Can't happen, but silences warning } @@ -721,40 +721,40 @@ void ParticlesMaterial::set_param_randomness(Parameter p_param, float p_value) { switch (p_param) { case PARAM_INITIAL_LINEAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity_random, p_value); } break; case PARAM_ANGULAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_random, p_value); } break; case PARAM_ORBIT_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_random, p_value); } break; case PARAM_LINEAR_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_random, p_value); } break; case PARAM_RADIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_random, p_value); } break; case PARAM_TANGENTIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_random, p_value); } break; case PARAM_DAMPING: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_random, p_value); } break; case PARAM_ANGLE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle_random, p_value); } break; case PARAM_SCALE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_random, p_value); } break; case PARAM_HUE_VARIATION: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_random, p_value); } break; case PARAM_ANIM_SPEED: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_random, p_value); } break; case PARAM_ANIM_OFFSET: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_random, p_value); } break; case PARAM_MAX: break; // Can't happen, but silences warning } @@ -786,47 +786,47 @@ void ParticlesMaterial::set_param_texture(Parameter p_param, const Ref<Texture2D //do none for this one } break; case PARAM_ANGULAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_texture, p_texture); _adjust_curve_range(p_texture, -360, 360); } break; case PARAM_ORBIT_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_texture, p_texture); _adjust_curve_range(p_texture, -500, 500); } break; case PARAM_LINEAR_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_texture, p_texture); _adjust_curve_range(p_texture, -200, 200); } break; case PARAM_RADIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_texture, p_texture); _adjust_curve_range(p_texture, -200, 200); } break; case PARAM_TANGENTIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_texture, p_texture); _adjust_curve_range(p_texture, -200, 200); } break; case PARAM_DAMPING: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_texture, p_texture); _adjust_curve_range(p_texture, 0, 100); } break; case PARAM_ANGLE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angle_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angle_texture, p_texture); _adjust_curve_range(p_texture, -360, 360); } break; case PARAM_SCALE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_texture, p_texture); _adjust_curve_range(p_texture, 0, 1); } break; case PARAM_HUE_VARIATION: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_texture, p_texture); _adjust_curve_range(p_texture, -1, 1); } break; case PARAM_ANIM_SPEED: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_texture, p_texture); _adjust_curve_range(p_texture, 0, 200); } break; case PARAM_ANIM_OFFSET: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_texture, p_texture); } break; case PARAM_MAX: break; // Can't happen, but silences warning } @@ -842,7 +842,7 @@ Ref<Texture2D> ParticlesMaterial::get_param_texture(Parameter p_param) const { void ParticlesMaterial::set_color(const Color &p_color) { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->color, p_color); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->color, p_color); color = p_color; } @@ -854,7 +854,7 @@ Color ParticlesMaterial::get_color() const { void ParticlesMaterial::set_color_ramp(const Ref<Texture2D> &p_texture) { color_ramp = p_texture; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->color_ramp, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->color_ramp, p_texture); _queue_shader_change(); _change_notify(); } @@ -888,38 +888,38 @@ void ParticlesMaterial::set_emission_shape(EmissionShape p_shape) { void ParticlesMaterial::set_emission_sphere_radius(float p_radius) { emission_sphere_radius = p_radius; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_sphere_radius, p_radius); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_sphere_radius, p_radius); } void ParticlesMaterial::set_emission_box_extents(Vector3 p_extents) { emission_box_extents = p_extents; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_box_extents, p_extents); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_box_extents, p_extents); } void ParticlesMaterial::set_emission_point_texture(const Ref<Texture2D> &p_points) { emission_point_texture = p_points; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_points, p_points); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_points, p_points); } void ParticlesMaterial::set_emission_normal_texture(const Ref<Texture2D> &p_normals) { emission_normal_texture = p_normals; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_normal, p_normals); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_normal, p_normals); } void ParticlesMaterial::set_emission_color_texture(const Ref<Texture2D> &p_colors) { emission_color_texture = p_colors; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_color, p_colors); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_color, p_colors); _queue_shader_change(); } void ParticlesMaterial::set_emission_point_count(int p_count) { emission_point_count = p_count; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_point_count, p_count); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_point_count, p_count); } ParticlesMaterial::EmissionShape ParticlesMaterial::get_emission_shape() const { @@ -957,7 +957,7 @@ int ParticlesMaterial::get_emission_point_count() const { void ParticlesMaterial::set_trail_divisor(int p_divisor) { trail_divisor = p_divisor; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor); } int ParticlesMaterial::get_trail_divisor() const { @@ -974,7 +974,7 @@ void ParticlesMaterial::set_trail_size_modifier(const Ref<CurveTexture> &p_trail curve->ensure_default_setup(); } - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_size_modifier, curve); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_size_modifier, curve); _queue_shader_change(); } @@ -986,7 +986,7 @@ Ref<CurveTexture> ParticlesMaterial::get_trail_size_modifier() const { void ParticlesMaterial::set_trail_color_modifier(const Ref<GradientTexture> &p_trail_color_modifier) { trail_color_modifier = p_trail_color_modifier; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_color_modifier, p_trail_color_modifier); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_color_modifier, p_trail_color_modifier); _queue_shader_change(); } @@ -1002,7 +1002,7 @@ void ParticlesMaterial::set_gravity(const Vector3 &p_gravity) { if (gset == Vector3()) { gset = Vector3(0, -0.000001, 0); //as gravity is used as upvector in some calculations } - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->gravity, gset); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->gravity, gset); } Vector3 ParticlesMaterial::get_gravity() const { @@ -1013,7 +1013,7 @@ Vector3 ParticlesMaterial::get_gravity() const { void ParticlesMaterial::set_lifetime_randomness(float p_lifetime) { lifetime_randomness = p_lifetime; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->lifetime_randomness, lifetime_randomness); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->lifetime_randomness, lifetime_randomness); } float ParticlesMaterial::get_lifetime_randomness() const { @@ -1280,10 +1280,10 @@ ParticlesMaterial::~ParticlesMaterial() { shader_map[current_key].users--; if (shader_map[current_key].users == 0) { //deallocate shader, as it's no longer in use - VS::get_singleton()->free(shader_map[current_key].shader); + RS::get_singleton()->free(shader_map[current_key].shader); shader_map.erase(current_key); } - VS::get_singleton()->material_set_shader(_get_material(), RID()); + RS::get_singleton()->material_set_shader(_get_material(), RID()); } } |