From 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 13:23:58 +0200 Subject: 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. --- scene/3d/decal.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'scene/3d/decal.cpp') diff --git a/scene/3d/decal.cpp b/scene/3d/decal.cpp index 4c824aedc4..b97859f44a 100644 --- a/scene/3d/decal.cpp +++ b/scene/3d/decal.cpp @@ -134,19 +134,16 @@ uint32_t Decal::get_cull_mask() const { } AABB Decal::get_aabb() const { - AABB aabb; aabb.position = -extents; aabb.size = extents * 2.0; return aabb; } Vector Decal::get_faces(uint32_t p_usage_flags) const { - return Vector(); } void Decal::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_extents", "extents"), &Decal::set_extents); ClassDB::bind_method(D_METHOD("get_extents"), &Decal::get_extents); @@ -212,7 +209,6 @@ void Decal::_bind_methods() { } Decal::Decal() { - extents = Vector3(1, 1, 1); emission_energy = 1.0; modulate = Color(1, 1, 1, 1); @@ -230,6 +226,5 @@ Decal::Decal() { } Decal::~Decal() { - RS::get_singleton()->free(decal); } -- cgit v1.2.3 From 07bc4e2f96f8f47991339654ff4ab16acc19d44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 14:29:06 +0200 Subject: Style: Enforce separation line between function definitions I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027. --- scene/3d/decal.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'scene/3d/decal.cpp') diff --git a/scene/3d/decal.cpp b/scene/3d/decal.cpp index b97859f44a..fb72e10171 100644 --- a/scene/3d/decal.cpp +++ b/scene/3d/decal.cpp @@ -47,6 +47,7 @@ void Decal::set_texture(DecalTexture p_type, const Ref &p_texture) { RID texture_rid = p_texture.is_valid() ? p_texture->get_rid() : RID(); RS::get_singleton()->decal_set_texture(decal, RS::DecalTexture(p_type), texture_rid); } + Ref Decal::get_texture(DecalTexture p_type) const { ERR_FAIL_INDEX_V(p_type, TEXTURE_MAX, Ref()); return textures[p_type]; @@ -56,6 +57,7 @@ void Decal::set_emission_energy(float p_energy) { emission_energy = p_energy; RS::get_singleton()->decal_set_emission_energy(decal, emission_energy); } + float Decal::get_emission_energy() const { return emission_energy; } @@ -64,6 +66,7 @@ void Decal::set_albedo_mix(float p_mix) { albedo_mix = p_mix; RS::get_singleton()->decal_set_albedo_mix(decal, albedo_mix); } + float Decal::get_albedo_mix() const { return albedo_mix; } @@ -72,6 +75,7 @@ void Decal::set_upper_fade(float p_fade) { upper_fade = p_fade; RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade); } + float Decal::get_upper_fade() const { return upper_fade; } @@ -80,6 +84,7 @@ void Decal::set_lower_fade(float p_fade) { lower_fade = p_fade; RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade); } + float Decal::get_lower_fade() const { return lower_fade; } @@ -88,6 +93,7 @@ void Decal::set_normal_fade(float p_fade) { normal_fade = p_fade; RS::get_singleton()->decal_set_normal_fade(decal, normal_fade); } + float Decal::get_normal_fade() const { return normal_fade; } @@ -105,6 +111,7 @@ void Decal::set_enable_distance_fade(bool p_enable) { distance_fade_enabled = p_enable; RS::get_singleton()->decal_set_distance_fade(decal, distance_fade_enabled, distance_fade_begin, distance_fade_length); } + bool Decal::is_distance_fade_enabled() const { return distance_fade_enabled; } @@ -113,6 +120,7 @@ void Decal::set_distance_fade_begin(float p_distance) { distance_fade_begin = p_distance; RS::get_singleton()->decal_set_distance_fade(decal, distance_fade_enabled, distance_fade_begin, distance_fade_length); } + float Decal::get_distance_fade_begin() const { return distance_fade_begin; } @@ -121,6 +129,7 @@ void Decal::set_distance_fade_length(float p_length) { distance_fade_length = p_length; RS::get_singleton()->decal_set_distance_fade(decal, distance_fade_enabled, distance_fade_begin, distance_fade_length); } + float Decal::get_distance_fade_length() const { return distance_fade_length; } @@ -129,6 +138,7 @@ void Decal::set_cull_mask(uint32_t p_layers) { cull_mask = p_layers; RS::get_singleton()->decal_set_cull_mask(decal, cull_mask); } + uint32_t Decal::get_cull_mask() const { return cull_mask; } @@ -139,6 +149,7 @@ AABB Decal::get_aabb() const { aabb.size = extents * 2.0; return aabb; } + Vector Decal::get_faces(uint32_t p_usage_flags) const { return Vector(); } -- cgit v1.2.3