You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +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:
@@ -58,7 +58,8 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) {
|
||||
int sr_limit = (sampling_rate / 2) + 512;
|
||||
|
||||
double final_cutoff = (cutoff > sr_limit) ? sr_limit : cutoff;
|
||||
if (final_cutoff < 1) final_cutoff = 1; //don't allow less than this
|
||||
if (final_cutoff < 1)
|
||||
final_cutoff = 1; //don't allow less than this
|
||||
|
||||
double omega = 2.0 * Math_PI * final_cutoff / sampling_rate;
|
||||
|
||||
|
||||
@@ -99,7 +99,8 @@ class AudioEffectLowPassFilter : public AudioEffectFilter {
|
||||
GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter);
|
||||
|
||||
void _validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "gain") property.usage = 0;
|
||||
if (property.name == "gain")
|
||||
property.usage = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -110,7 +111,8 @@ public:
|
||||
class AudioEffectHighPassFilter : public AudioEffectFilter {
|
||||
GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter);
|
||||
void _validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "gain") property.usage = 0;
|
||||
if (property.name == "gain")
|
||||
property.usage = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -121,7 +123,8 @@ public:
|
||||
class AudioEffectBandPassFilter : public AudioEffectFilter {
|
||||
GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter);
|
||||
void _validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "gain") property.usage = 0;
|
||||
if (property.name == "gain")
|
||||
property.usage = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -50,7 +50,8 @@ static void smbFft(float *fftBuffer, long fftFrameSize, long sign)
|
||||
|
||||
for (i = 2; i < 2 * fftFrameSize - 2; i += 2) {
|
||||
for (bitm = 2, j = 0; bitm < 2 * fftFrameSize; bitm <<= 1) {
|
||||
if (i & bitm) j++;
|
||||
if (i & bitm)
|
||||
j++;
|
||||
j <<= 1;
|
||||
}
|
||||
if (i < j) {
|
||||
|
||||
@@ -158,7 +158,8 @@ public:
|
||||
_FORCE_INLINE_ void set_max_contacts_reported(int p_size) {
|
||||
contacts.resize(p_size);
|
||||
contact_count = 0;
|
||||
if (mode == PhysicsServer2D::BODY_MODE_KINEMATIC && p_size) set_active(true);
|
||||
if (mode == PhysicsServer2D::BODY_MODE_KINEMATIC && p_size)
|
||||
set_active(true);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int get_max_contacts_reported() const { return contacts.size(); }
|
||||
|
||||
@@ -192,7 +192,8 @@ public:
|
||||
void set_debug_contacts(int p_amount) { contact_debug.resize(p_amount); }
|
||||
_FORCE_INLINE_ bool is_debugging_contacts() const { return !contact_debug.empty(); }
|
||||
_FORCE_INLINE_ void add_debug_contact(const Vector2 &p_contact) {
|
||||
if (contact_debug_count < contact_debug.size()) contact_debug.write[contact_debug_count++] = p_contact;
|
||||
if (contact_debug_count < contact_debug.size())
|
||||
contact_debug.write[contact_debug_count++] = p_contact;
|
||||
}
|
||||
_FORCE_INLINE_ Vector<Vector2> get_debug_contacts() { return contact_debug; }
|
||||
_FORCE_INLINE_ int get_debug_contact_count() { return contact_debug_count; }
|
||||
|
||||
@@ -175,7 +175,8 @@ public:
|
||||
_FORCE_INLINE_ void set_max_contacts_reported(int p_size) {
|
||||
contacts.resize(p_size);
|
||||
contact_count = 0;
|
||||
if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC && p_size) set_active(true);
|
||||
if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC && p_size)
|
||||
set_active(true);
|
||||
}
|
||||
_FORCE_INLINE_ int get_max_contacts_reported() const { return contacts.size(); }
|
||||
|
||||
|
||||
@@ -92,7 +92,8 @@ protected:
|
||||
#endif
|
||||
|
||||
transform = p_transform;
|
||||
if (p_update_shapes) _update_shapes();
|
||||
if (p_update_shapes)
|
||||
_update_shapes();
|
||||
}
|
||||
_FORCE_INLINE_ void _set_inv_transform(const Transform &p_transform) { inv_transform = p_transform; }
|
||||
void _set_static(bool p_static);
|
||||
|
||||
@@ -83,7 +83,8 @@ int G6DOFRotationalLimitMotor3DSW::testLimitValue(real_t test_value) {
|
||||
real_t G6DOFRotationalLimitMotor3DSW::solveAngularLimits(
|
||||
real_t timeStep, Vector3 &axis, real_t jacDiagABInv,
|
||||
Body3DSW *body0, Body3DSW *body1) {
|
||||
if (!needApplyTorques()) return 0.0f;
|
||||
if (!needApplyTorques())
|
||||
return 0.0f;
|
||||
|
||||
real_t target_velocity = m_targetVelocity;
|
||||
real_t maxMotorForce = m_maxMotorForce;
|
||||
@@ -137,7 +138,8 @@ real_t G6DOFRotationalLimitMotor3DSW::solveAngularLimits(
|
||||
Vector3 motorImp = clippedMotorImpulse * axis;
|
||||
|
||||
body0->apply_torque_impulse(motorImp);
|
||||
if (body1) body1->apply_torque_impulse(-motorImp);
|
||||
if (body1)
|
||||
body1->apply_torque_impulse(-motorImp);
|
||||
|
||||
return clippedMotorImpulse;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,8 @@ public:
|
||||
void set_debug_contacts(int p_amount) { contact_debug.resize(p_amount); }
|
||||
_FORCE_INLINE_ bool is_debugging_contacts() const { return !contact_debug.empty(); }
|
||||
_FORCE_INLINE_ void add_debug_contact(const Vector3 &p_contact) {
|
||||
if (contact_debug_count < contact_debug.size()) contact_debug.write[contact_debug_count++] = p_contact;
|
||||
if (contact_debug_count < contact_debug.size())
|
||||
contact_debug.write[contact_debug_count++] = p_contact;
|
||||
}
|
||||
_FORCE_INLINE_ Vector<Vector3> get_debug_contacts() { return contact_debug; }
|
||||
_FORCE_INLINE_ int get_debug_contact_count() { return contact_debug_count; }
|
||||
|
||||
@@ -721,14 +721,16 @@ public:
|
||||
Color get_default_clear_color() const {
|
||||
return default_clear_color;
|
||||
}
|
||||
#define TIMESTAMP_BEGIN() \
|
||||
{ \
|
||||
if (RSG::storage->capturing_timestamps) RSG::storage->capture_timestamps_begin(); \
|
||||
#define TIMESTAMP_BEGIN() \
|
||||
{ \
|
||||
if (RSG::storage->capturing_timestamps) \
|
||||
RSG::storage->capture_timestamps_begin(); \
|
||||
}
|
||||
|
||||
#define RENDER_TIMESTAMP(m_text) \
|
||||
{ \
|
||||
if (RSG::storage->capturing_timestamps) RSG::storage->capture_timestamp(m_text); \
|
||||
#define RENDER_TIMESTAMP(m_text) \
|
||||
{ \
|
||||
if (RSG::storage->capturing_timestamps) \
|
||||
RSG::storage->capture_timestamp(m_text); \
|
||||
}
|
||||
|
||||
bool capturing_timestamps = false;
|
||||
@@ -857,7 +859,8 @@ public:
|
||||
|
||||
_FORCE_INLINE_ TextureBinding() { binding_id = 0; }
|
||||
_FORCE_INLINE_ ~TextureBinding() {
|
||||
if (binding_id) singleton->free_texture_binding(binding_id);
|
||||
if (binding_id)
|
||||
singleton->free_texture_binding(binding_id);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -886,7 +889,8 @@ public:
|
||||
|
||||
_FORCE_INLINE_ Polygon() { polygon_id = 0; }
|
||||
_FORCE_INLINE_ ~Polygon() {
|
||||
if (polygon_id) singleton->free_polygon(polygon_id);
|
||||
if (polygon_id)
|
||||
singleton->free_polygon(polygon_id);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1288,7 +1292,8 @@ public:
|
||||
for (int i = 0; i < blocks.size(); i++) {
|
||||
memfree(blocks[i].memory);
|
||||
}
|
||||
if (copy_back_buffer) memdelete(copy_back_buffer);
|
||||
if (copy_back_buffer)
|
||||
memdelete(copy_back_buffer);
|
||||
if (custom_data) {
|
||||
memdelete(custom_data);
|
||||
}
|
||||
|
||||
@@ -184,22 +184,38 @@ void main() {
|
||||
int index = x + y * 4;
|
||||
float limit = 0.0;
|
||||
if (x < 8) {
|
||||
if (index == 0) limit = 0.0625;
|
||||
if (index == 1) limit = 0.5625;
|
||||
if (index == 2) limit = 0.1875;
|
||||
if (index == 3) limit = 0.6875;
|
||||
if (index == 4) limit = 0.8125;
|
||||
if (index == 5) limit = 0.3125;
|
||||
if (index == 6) limit = 0.9375;
|
||||
if (index == 7) limit = 0.4375;
|
||||
if (index == 8) limit = 0.25;
|
||||
if (index == 9) limit = 0.75;
|
||||
if (index == 10) limit = 0.125;
|
||||
if (index == 11) limit = 0.625;
|
||||
if (index == 12) limit = 1.0;
|
||||
if (index == 13) limit = 0.5;
|
||||
if (index == 14) limit = 0.875;
|
||||
if (index == 15) limit = 0.375;
|
||||
if (index == 0)
|
||||
limit = 0.0625;
|
||||
if (index == 1)
|
||||
limit = 0.5625;
|
||||
if (index == 2)
|
||||
limit = 0.1875;
|
||||
if (index == 3)
|
||||
limit = 0.6875;
|
||||
if (index == 4)
|
||||
limit = 0.8125;
|
||||
if (index == 5)
|
||||
limit = 0.3125;
|
||||
if (index == 6)
|
||||
limit = 0.9375;
|
||||
if (index == 7)
|
||||
limit = 0.4375;
|
||||
if (index == 8)
|
||||
limit = 0.25;
|
||||
if (index == 9)
|
||||
limit = 0.75;
|
||||
if (index == 10)
|
||||
limit = 0.125;
|
||||
if (index == 11)
|
||||
limit = 0.625;
|
||||
if (index == 12)
|
||||
limit = 1.0;
|
||||
if (index == 13)
|
||||
limit = 0.5;
|
||||
if (index == 14)
|
||||
limit = 0.875;
|
||||
if (index == 15)
|
||||
limit = 0.375;
|
||||
}
|
||||
if (frag_color.a < limit) {
|
||||
discard;
|
||||
|
||||
@@ -420,7 +420,8 @@ float SchlickFresnel(float u) {
|
||||
}
|
||||
|
||||
float GTR1(float NdotH, float a) {
|
||||
if (a >= 1.0) return 1.0 / M_PI;
|
||||
if (a >= 1.0)
|
||||
return 1.0 / M_PI;
|
||||
float a2 = a * a;
|
||||
float t = 1.0 + (a2 - 1.0) * NdotH * NdotH;
|
||||
return (a2 - 1.0) / (M_PI * log(a2) * t);
|
||||
|
||||
@@ -6688,7 +6688,8 @@ static int _get_first_ident_pos(const String &p_code) {
|
||||
if (GETCHAR(0) == '/' && GETCHAR(1) == '/') {
|
||||
idx += 2;
|
||||
while (true) {
|
||||
if (GETCHAR(0) == 0) return 0;
|
||||
if (GETCHAR(0) == 0)
|
||||
return 0;
|
||||
if (GETCHAR(0) == '\n') {
|
||||
idx++;
|
||||
break; // loop
|
||||
@@ -6698,7 +6699,8 @@ static int _get_first_ident_pos(const String &p_code) {
|
||||
} else if (GETCHAR(0) == '/' && GETCHAR(1) == '*') {
|
||||
idx += 2;
|
||||
while (true) {
|
||||
if (GETCHAR(0) == 0) return 0;
|
||||
if (GETCHAR(0) == 0)
|
||||
return 0;
|
||||
if (GETCHAR(0) == '*' && GETCHAR(1) == '/') {
|
||||
idx += 2;
|
||||
break; // loop
|
||||
|
||||
Reference in New Issue
Block a user