summaryrefslogtreecommitdiffstats
path: root/scene/3d
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-10 12:56:01 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-10 13:12:16 +0200
commite956e80c1fa1cc8aefcb1533e5acf5cf3c8ffdd9 (patch)
tree8f162f9162ca0dfa35841a9c734a0529764cb458 /scene/3d
parent03b13e0c695bb63043c3ca8665083bae1960aca4 (diff)
downloadredot-engine-e956e80c1fa1cc8aefcb1533e5acf5cf3c8ffdd9.tar.gz
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/cpu_particles_3d.cpp6
-rw-r--r--scene/3d/gpu_particles_3d.cpp3
-rw-r--r--scene/3d/navigation_agent_3d.cpp9
-rw-r--r--scene/3d/physics_body_3d.cpp3
-rw-r--r--scene/3d/voxelizer.cpp45
5 files changed, 44 insertions, 22 deletions
diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp
index 4c25f55f0b..414dc6f97b 100644
--- a/scene/3d/cpu_particles_3d.cpp
+++ b/scene/3d/cpu_particles_3d.cpp
@@ -1004,7 +1004,8 @@ void CPUParticles3D::_particles_process(float p_delta) {
//scale by scale
float base_scale = tex_scale * Math::lerp(parameters[PARAM_SCALE], 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
- if (base_scale < 0.000001) base_scale = 0.000001;
+ if (base_scale < 0.000001)
+ base_scale = 0.000001;
p.transform.basis.scale(Vector3(1, 1, 1) * base_scale);
@@ -1253,7 +1254,8 @@ void CPUParticles3D::convert_from_particles(Node *p_particles) {
set_param(m_param, material->get_param(ParticlesMaterial::m_param)); \
{ \
Ref<CurveTexture> ctex = material->get_param_texture(ParticlesMaterial::m_param); \
- if (ctex.is_valid()) set_param_curve(m_param, ctex->get_curve()); \
+ if (ctex.is_valid()) \
+ set_param_curve(m_param, ctex->get_curve()); \
} \
set_param_randomness(m_param, material->get_param_randomness(ParticlesMaterial::m_param));
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp
index 7744c477cb..01886a730f 100644
--- a/scene/3d/gpu_particles_3d.cpp
+++ b/scene/3d/gpu_particles_3d.cpp
@@ -257,7 +257,8 @@ String GPUParticles3D::get_configuration_warning() const {
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(draw_passes[i]->surface_get_material(j).ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
}
- if (anim_material_found) break;
+ if (anim_material_found)
+ break;
}
}
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 0449ab15b7..e672ed9a54 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -306,9 +306,12 @@ String NavigationAgent3D::get_configuration_warning() const {
void NavigationAgent3D::update_navigation() {
- if (agent_parent == nullptr) return;
- if (navigation == nullptr) return;
- if (update_frame_id == Engine::get_singleton()->get_physics_frames()) return;
+ if (agent_parent == nullptr)
+ return;
+ if (navigation == nullptr)
+ return;
+ if (update_frame_id == Engine::get_singleton()->get_physics_frames())
+ return;
update_frame_id = Engine::get_singleton()->get_physics_frames();
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 3991efc7c0..280bab5d45 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -1346,7 +1346,8 @@ Vector3 KinematicCollision3D::get_remainder() const {
return collision.remainder;
}
Object *KinematicCollision3D::get_local_shape() const {
- if (!owner) return nullptr;
+ if (!owner)
+ return nullptr;
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
return owner->shape_owner_get_owner(ownerid);
}
diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp
index f30c58be55..a2d305f3cb 100644
--- a/scene/3d/voxelizer.cpp
+++ b/scene/3d/voxelizer.cpp
@@ -36,10 +36,14 @@
#define FINDMINMAX(x0, x1, x2, min, max) \
min = max = x0; \
- if (x1 < min) min = x1; \
- if (x1 > max) max = x1; \
- if (x2 < min) min = x2; \
- if (x2 > max) max = x2;
+ if (x1 < min) \
+ min = x1; \
+ if (x1 > max) \
+ max = x1; \
+ if (x2 < min) \
+ min = x2; \
+ if (x2 > max) \
+ max = x2;
static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
int q;
@@ -53,8 +57,10 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
vmax[q] = -maxbox[q];
}
}
- if (normal.dot(vmin) + d > 0.0f) return false;
- if (normal.dot(vmax) + d >= 0.0f) return true;
+ if (normal.dot(vmin) + d > 0.0f)
+ return false;
+ if (normal.dot(vmax) + d >= 0.0f)
+ return true;
return false;
}
@@ -71,7 +77,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.y + fb * boxhalfsize.z; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
#define AXISTEST_X2(a, b, fa, fb) \
p0 = a * v0.y - b * v0.z; \
@@ -84,7 +91,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.y + fb * boxhalfsize.z; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
/*======================== Y-tests ========================*/
#define AXISTEST_Y02(a, b, fa, fb) \
@@ -98,7 +106,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
#define AXISTEST_Y1(a, b, fa, fb) \
p0 = -a * v0.x + b * v0.z; \
@@ -111,7 +120,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
/*======================== Z-tests ========================*/
@@ -126,7 +136,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p2; \
} \
rad = fa * boxhalfsize.x + fb * boxhalfsize.y; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
#define AXISTEST_Z0(a, b, fa, fb) \
p0 = a * v0.x - b * v0.y; \
@@ -139,7 +150,8 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) {
max = p0; \
} \
rad = fa * boxhalfsize.x + fb * boxhalfsize.y; \
- if (min > rad || max < -rad) return false;
+ if (min > rad || max < -rad) \
+ return false;
static bool fast_tri_box_overlap(const Vector3 &boxcenter, const Vector3 boxhalfsize, const Vector3 *triverts) {
@@ -197,15 +209,18 @@ static bool fast_tri_box_overlap(const Vector3 &boxcenter, const Vector3 boxhalf
/* test in X-direction */
FINDMINMAX(v0.x, v1.x, v2.x, min, max);
- if (min > boxhalfsize.x || max < -boxhalfsize.x) return false;
+ if (min > boxhalfsize.x || max < -boxhalfsize.x)
+ return false;
/* test in Y-direction */
FINDMINMAX(v0.y, v1.y, v2.y, min, max);
- if (min > boxhalfsize.y || max < -boxhalfsize.y) return false;
+ if (min > boxhalfsize.y || max < -boxhalfsize.y)
+ return false;
/* test in Z-direction */
FINDMINMAX(v0.z, v1.z, v2.z, min, max);
- if (min > boxhalfsize.z || max < -boxhalfsize.z) return false;
+ if (min > boxhalfsize.z || max < -boxhalfsize.z)
+ return false;
/* Bullet 2: */
/* test if the box intersects the plane of the triangle */