1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

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.
This commit is contained in:
Rémi Verschelde
2020-05-10 12:56:01 +02:00
parent 03b13e0c69
commit e956e80c1f
130 changed files with 967 additions and 511 deletions

View File

@@ -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));

View File

@@ -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;
}
}

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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 */