diff options
Diffstat (limited to 'scene/2d/gpu_particles_2d.cpp')
-rw-r--r-- | scene/2d/gpu_particles_2d.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index de3f8fa09e..a76114a6c3 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -39,7 +39,6 @@ #endif void GPUParticles2D::set_emitting(bool p_emitting) { - RS::get_singleton()->particles_set_emitting(particles, p_emitting); if (p_emitting && one_shot) { @@ -50,25 +49,21 @@ void GPUParticles2D::set_emitting(bool p_emitting) { } void GPUParticles2D::set_amount(int p_amount) { - ERR_FAIL_COND_MSG(p_amount < 1, "Amount of particles cannot be smaller than 1."); amount = p_amount; RS::get_singleton()->particles_set_amount(particles, amount); } void GPUParticles2D::set_lifetime(float p_lifetime) { - ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0."); lifetime = p_lifetime; RS::get_singleton()->particles_set_lifetime(particles, lifetime); } void GPUParticles2D::set_one_shot(bool p_enable) { - one_shot = p_enable; RS::get_singleton()->particles_set_one_shot(particles, one_shot); if (is_emitting()) { - set_process_internal(true); if (!one_shot) RenderingServer::get_singleton()->particles_restart(particles); @@ -78,22 +73,18 @@ void GPUParticles2D::set_one_shot(bool p_enable) { set_process_internal(false); } void GPUParticles2D::set_pre_process_time(float p_time) { - pre_process_time = p_time; RS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time); } void GPUParticles2D::set_explosiveness_ratio(float p_ratio) { - explosiveness_ratio = p_ratio; RS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio); } void GPUParticles2D::set_randomness_ratio(float p_ratio) { - randomness_ratio = p_ratio; RS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio); } void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) { - visibility_rect = p_visibility_rect; AABB aabb; aabb.position.x = p_visibility_rect.position.x; @@ -107,7 +98,6 @@ void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) { update(); } void GPUParticles2D::set_use_local_coordinates(bool p_enable) { - local_coords = p_enable; RS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords); set_notify_transform(!p_enable); @@ -117,7 +107,6 @@ void GPUParticles2D::set_use_local_coordinates(bool p_enable) { } void GPUParticles2D::_update_particle_emission_transform() { - Transform2D xf2d = get_global_transform(); Transform xf; xf.basis.set_axis(0, Vector3(xf2d.get_axis(0).x, xf2d.get_axis(0).y, 0)); @@ -128,7 +117,6 @@ void GPUParticles2D::_update_particle_emission_transform() { } void GPUParticles2D::set_process_material(const Ref<Material> &p_material) { - process_material = p_material; Ref<ParticlesMaterial> pm = p_material; if (pm.is_valid() && !pm->get_flag(ParticlesMaterial::FLAG_DISABLE_Z) && pm->get_gravity() == Vector3(0, -9.8, 0)) { @@ -145,66 +133,52 @@ void GPUParticles2D::set_process_material(const Ref<Material> &p_material) { } void GPUParticles2D::set_speed_scale(float p_scale) { - speed_scale = p_scale; RS::get_singleton()->particles_set_speed_scale(particles, p_scale); } bool GPUParticles2D::is_emitting() const { - return RS::get_singleton()->particles_get_emitting(particles); } int GPUParticles2D::get_amount() const { - return amount; } float GPUParticles2D::get_lifetime() const { - return lifetime; } bool GPUParticles2D::get_one_shot() const { - return one_shot; } float GPUParticles2D::get_pre_process_time() const { - return pre_process_time; } float GPUParticles2D::get_explosiveness_ratio() const { - return explosiveness_ratio; } float GPUParticles2D::get_randomness_ratio() const { - return randomness_ratio; } Rect2 GPUParticles2D::get_visibility_rect() const { - return visibility_rect; } bool GPUParticles2D::get_use_local_coordinates() const { - return local_coords; } Ref<Material> GPUParticles2D::get_process_material() const { - return process_material; } float GPUParticles2D::get_speed_scale() const { - return speed_scale; } void GPUParticles2D::set_draw_order(DrawOrder p_order) { - draw_order = p_order; RS::get_singleton()->particles_set_draw_order(particles, RS::ParticlesDrawOrder(p_order)); } GPUParticles2D::DrawOrder GPUParticles2D::get_draw_order() const { - return draw_order; } @@ -227,7 +201,6 @@ bool GPUParticles2D::get_fractional_delta() const { } String GPUParticles2D::get_configuration_warning() const { - if (RenderingServer::get_singleton()->is_low_end()) { return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles2D\" option for this purpose."); } @@ -239,7 +212,6 @@ String GPUParticles2D::get_configuration_warning() const { warnings += "\n"; warnings += "- " + TTR("A material to process the particles is not assigned, so no behavior is imprinted."); } else { - CanvasItemMaterial *mat = Object::cast_to<CanvasItemMaterial>(get_material().ptr()); if (get_material().is_null() || (mat && !mat->get_particles_animation())) { @@ -258,7 +230,6 @@ String GPUParticles2D::get_configuration_warning() const { } Rect2 GPUParticles2D::capture_rect() const { - AABB aabb = RS::get_singleton()->particles_get_current_aabb(particles); Rect2 r; r.position.x = aabb.position.x; @@ -278,7 +249,6 @@ Ref<Texture2D> GPUParticles2D::get_texture() const { } void GPUParticles2D::set_normal_map(const Ref<Texture2D> &p_normal_map) { - normal_map = p_normal_map; update(); } @@ -296,9 +266,7 @@ void GPUParticles2D::restart() { } void GPUParticles2D::_notification(int p_what) { - if (p_what == NOTIFICATION_DRAW) { - RID texture_rid; if (texture.is_valid()) texture_rid = texture->get_rid(); @@ -310,7 +278,6 @@ void GPUParticles2D::_notification(int p_what) { #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint() && (this == get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) { - draw_rect(visibility_rect, Color(0, 0.7, 0.9, 0.4), false); } #endif @@ -320,7 +287,6 @@ void GPUParticles2D::_notification(int p_what) { if (can_process()) { RS::get_singleton()->particles_set_speed_scale(particles, speed_scale); } else { - RS::get_singleton()->particles_set_speed_scale(particles, 0); } } @@ -330,7 +296,6 @@ void GPUParticles2D::_notification(int p_what) { } if (p_what == NOTIFICATION_INTERNAL_PROCESS) { - if (one_shot && !is_emitting()) { _change_notify(); set_process_internal(false); @@ -339,7 +304,6 @@ void GPUParticles2D::_notification(int p_what) { } void GPUParticles2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &GPUParticles2D::set_emitting); ClassDB::bind_method(D_METHOD("set_amount", "amount"), &GPUParticles2D::set_amount); ClassDB::bind_method(D_METHOD("set_lifetime", "secs"), &GPUParticles2D::set_lifetime); @@ -407,7 +371,6 @@ void GPUParticles2D::_bind_methods() { } GPUParticles2D::GPUParticles2D() { - particles = RS::get_singleton()->particles_create(); one_shot = false; // Needed so that set_emitting doesn't access uninitialized values @@ -427,6 +390,5 @@ GPUParticles2D::GPUParticles2D() { } GPUParticles2D::~GPUParticles2D() { - RS::get_singleton()->free(particles); } |