summaryrefslogtreecommitdiffstats
path: root/scene/3d/gpu_particles_3d.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /scene/3d/gpu_particles_3d.cpp
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
downloadredot-engine-0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a.tar.gz
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'scene/3d/gpu_particles_3d.cpp')
-rw-r--r--scene/3d/gpu_particles_3d.cpp42
1 files changed, 0 insertions, 42 deletions
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp
index 01886a730f..1ce25f1e6e 100644
--- a/scene/3d/gpu_particles_3d.cpp
+++ b/scene/3d/gpu_particles_3d.cpp
@@ -36,16 +36,13 @@
#include "servers/rendering_server.h"
AABB GPUParticles3D::get_aabb() const {
-
return AABB();
}
Vector<Face3> GPUParticles3D::get_faces(uint32_t p_usage_flags) const {
-
return Vector<Face3>();
}
void GPUParticles3D::set_emitting(bool p_emitting) {
-
RS::get_singleton()->particles_set_emitting(particles, p_emitting);
if (p_emitting && one_shot) {
@@ -56,25 +53,21 @@ void GPUParticles3D::set_emitting(bool p_emitting) {
}
void GPUParticles3D::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 GPUParticles3D::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 GPUParticles3D::set_one_shot(bool p_one_shot) {
-
one_shot = p_one_shot;
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);
@@ -85,34 +78,28 @@ void GPUParticles3D::set_one_shot(bool p_one_shot) {
}
void GPUParticles3D::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 GPUParticles3D::set_explosiveness_ratio(float p_ratio) {
-
explosiveness_ratio = p_ratio;
RS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
}
void GPUParticles3D::set_randomness_ratio(float p_ratio) {
-
randomness_ratio = p_ratio;
RS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
}
void GPUParticles3D::set_visibility_aabb(const AABB &p_aabb) {
-
visibility_aabb = p_aabb;
RS::get_singleton()->particles_set_custom_aabb(particles, visibility_aabb);
update_gizmo();
_change_notify("visibility_aabb");
}
void GPUParticles3D::set_use_local_coordinates(bool p_enable) {
-
local_coords = p_enable;
RS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords);
}
void GPUParticles3D::set_process_material(const Ref<Material> &p_material) {
-
process_material = p_material;
RID material_rid;
if (process_material.is_valid())
@@ -123,83 +110,66 @@ void GPUParticles3D::set_process_material(const Ref<Material> &p_material) {
}
void GPUParticles3D::set_speed_scale(float p_scale) {
-
speed_scale = p_scale;
RS::get_singleton()->particles_set_speed_scale(particles, p_scale);
}
bool GPUParticles3D::is_emitting() const {
-
return RS::get_singleton()->particles_get_emitting(particles);
}
int GPUParticles3D::get_amount() const {
-
return amount;
}
float GPUParticles3D::get_lifetime() const {
-
return lifetime;
}
bool GPUParticles3D::get_one_shot() const {
-
return one_shot;
}
float GPUParticles3D::get_pre_process_time() const {
-
return pre_process_time;
}
float GPUParticles3D::get_explosiveness_ratio() const {
-
return explosiveness_ratio;
}
float GPUParticles3D::get_randomness_ratio() const {
-
return randomness_ratio;
}
AABB GPUParticles3D::get_visibility_aabb() const {
-
return visibility_aabb;
}
bool GPUParticles3D::get_use_local_coordinates() const {
-
return local_coords;
}
Ref<Material> GPUParticles3D::get_process_material() const {
-
return process_material;
}
float GPUParticles3D::get_speed_scale() const {
-
return speed_scale;
}
void GPUParticles3D::set_draw_order(DrawOrder p_order) {
-
draw_order = p_order;
RS::get_singleton()->particles_set_draw_order(particles, RS::ParticlesDrawOrder(p_order));
}
GPUParticles3D::DrawOrder GPUParticles3D::get_draw_order() const {
-
return draw_order;
}
void GPUParticles3D::set_draw_passes(int p_count) {
-
ERR_FAIL_COND(p_count < 1);
draw_passes.resize(p_count);
RS::get_singleton()->particles_set_draw_passes(particles, p_count);
_change_notify();
}
int GPUParticles3D::get_draw_passes() const {
-
return draw_passes.size();
}
void GPUParticles3D::set_draw_pass_mesh(int p_pass, const Ref<Mesh> &p_mesh) {
-
ERR_FAIL_INDEX(p_pass, draw_passes.size());
draw_passes.write[p_pass] = p_mesh;
@@ -214,7 +184,6 @@ void GPUParticles3D::set_draw_pass_mesh(int p_pass, const Ref<Mesh> &p_mesh) {
}
Ref<Mesh> GPUParticles3D::get_draw_pass_mesh(int p_pass) const {
-
ERR_FAIL_INDEX_V(p_pass, draw_passes.size(), Ref<Mesh>());
return draw_passes[p_pass];
@@ -239,7 +208,6 @@ bool GPUParticles3D::get_fractional_delta() const {
}
String GPUParticles3D::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 CPUParticles3D node instead. You can use the \"Convert to CPUParticles3D\" option for this purpose.");
}
@@ -291,18 +259,15 @@ String GPUParticles3D::get_configuration_warning() const {
}
void GPUParticles3D::restart() {
-
RenderingServer::get_singleton()->particles_restart(particles);
RenderingServer::get_singleton()->particles_set_emitting(particles, true);
}
AABB GPUParticles3D::capture_aabb() const {
-
return RS::get_singleton()->particles_get_current_aabb(particles);
}
void GPUParticles3D::_validate_property(PropertyInfo &property) const {
-
if (property.name.begins_with("draw_pass_")) {
int index = property.name.get_slicec('_', 2).to_int() - 1;
if (index >= draw_passes.size()) {
@@ -313,12 +278,10 @@ void GPUParticles3D::_validate_property(PropertyInfo &property) const {
}
void GPUParticles3D::_notification(int p_what) {
-
if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) {
if (can_process()) {
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
} else {
-
RS::get_singleton()->particles_set_speed_scale(particles, 0);
}
}
@@ -326,7 +289,6 @@ void GPUParticles3D::_notification(int p_what) {
// Use internal process when emitting and one_shot are on so that when
// the shot ends the editor can properly update
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
-
if (one_shot && !is_emitting()) {
_change_notify();
set_process_internal(false);
@@ -342,7 +304,6 @@ void GPUParticles3D::_notification(int p_what) {
}
void GPUParticles3D::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &GPUParticles3D::set_emitting);
ClassDB::bind_method(D_METHOD("set_amount", "amount"), &GPUParticles3D::set_amount);
ClassDB::bind_method(D_METHOD("set_lifetime", "secs"), &GPUParticles3D::set_lifetime);
@@ -404,7 +365,6 @@ void GPUParticles3D::_bind_methods() {
ADD_GROUP("Draw Passes", "draw_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_passes", PROPERTY_HINT_RANGE, "0," + itos(MAX_DRAW_PASSES) + ",1"), "set_draw_passes", "get_draw_passes");
for (int i = 0; i < MAX_DRAW_PASSES; i++) {
-
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "draw_pass_" + itos(i + 1), PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_draw_pass_mesh", "get_draw_pass_mesh", i);
}
@@ -416,7 +376,6 @@ void GPUParticles3D::_bind_methods() {
}
GPUParticles3D::GPUParticles3D() {
-
particles = RS::get_singleton()->particles_create();
set_base(particles);
one_shot = false; // Needed so that set_emitting doesn't access uninitialized values
@@ -437,6 +396,5 @@ GPUParticles3D::GPUParticles3D() {
}
GPUParticles3D::~GPUParticles3D() {
-
RS::get_singleton()->free(particles);
}