diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..5978689a3e --- /dev/null +++ b/.clang-format @@ -0,0 +1,49 @@ +BasedOnStyle: WebKit + +AlignAfterOpenBracket: DontAlign +# AlignConsecutiveDeclarations: true +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 +AllowShortFunctionsOnASingleLine: All +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: AllIfsAndElse +BreakBeforeBraces: Custom +# Allman style (wrap before any brace) *except* before lambda bodies +BreakBeforeBinaryOperators: None +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: false + BeforeWhile: false + SplitEmptyFunction: false +ColumnLimit: 0 +IncludeCategories: # only used when SortIncludes is active + - Regex: '^"stdafx.h"' + Priority: -1 + - Regex: '<.*' + Priority: 1 + - Regex: '^"wi.*"' + Priority: 2 +IndentWidth: 4 +# FixNamespaceComments: true # maybe? +MaxEmptyLinesToKeep: 3 +NamespaceIndentation: All +# SpacesBeforeTrailingComments: 1 +# SeparateDefinitionBlocks: Always # maybe? +SortIncludes: Never # maybe? +SpaceInEmptyBlock: false +SpaceAfterTemplateKeyword: false +SpacesInLineCommentPrefix: + Minimum: 0 # maybe 1? + Maximum: -1 +TabWidth: 4 +UseTab: Always diff --git a/Editor/FontAwesomeV6.h b/Editor/FontAwesomeV6.h index b7d20cbca1..c0b71fa551 100644 --- a/Editor/FontAwesomeV6.h +++ b/Editor/FontAwesomeV6.h @@ -1,3 +1,4 @@ +// clang-format off const uint8_t font_awesome_v6[] = { 0,1,0,0,0,10,0,128,0,3,0,32,79,83,47,50,97,75,98,74,0,0,1,40,0,0,0,96,99,109,97,112, 85,100,88,117,0,0,23,64,0,0,72,110,103,108,121,102,15,69,38,190,0,0,117,108,0,5,45,12,104,101,97,100, diff --git a/Editor/IconDefinitions.h b/Editor/IconDefinitions.h index 589bb29332..0550323279 100644 --- a/Editor/IconDefinitions.h +++ b/Editor/IconDefinitions.h @@ -1,3 +1,4 @@ +// clang-format off #pragma once #include "IconsFontAwesome6.h" // icon descriptions, source: https://github.com/juliettef/IconFontCppHeaders diff --git a/Editor/IconsFontAwesome6.h b/Editor/IconsFontAwesome6.h index a56c5f5da8..0eb3b315b7 100644 --- a/Editor/IconsFontAwesome6.h +++ b/Editor/IconsFontAwesome6.h @@ -1,3 +1,4 @@ +// clang-format off // Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for languages C and C++ // from https://github.com/FortAwesome/Font-Awesome/raw/6.x/metadata/icons.yml // for use with https://github.com/FortAwesome/Font-Awesome/blob/6.x/webfonts/fa-regular-400.ttf, https://github.com/FortAwesome/Font-Awesome/blob/6.x/webfonts/fa-solid-900.ttf diff --git a/Editor/dummy_direction.h b/Editor/dummy_direction.h index 9ec386f1e5..4ed13d282f 100644 --- a/Editor/dummy_direction.h +++ b/Editor/dummy_direction.h @@ -1,3 +1,4 @@ +// clang-format off static const float3 vertices[609] = { float3(0.550000f,0.000000f,0.000000f), float3(0.545295f,-0.000000f,0.071789f), diff --git a/Editor/dummy_female.h b/Editor/dummy_female.h index 8f30be4165..f55e0eccaf 100644 --- a/Editor/dummy_female.h +++ b/Editor/dummy_female.h @@ -1,3 +1,4 @@ +// clang-format off static const float3 vertices[16592] = { float3(-0.027344f,1.655921f,-0.039425f), float3(-0.019501f,1.657624f,-0.034160f), diff --git a/Editor/dummy_male.h b/Editor/dummy_male.h index a19f19ee41..4c030ab52a 100644 --- a/Editor/dummy_male.h +++ b/Editor/dummy_male.h @@ -1,3 +1,4 @@ +// clang-format off static const float3 vertices[20621] = { float3(0.029937f,0.978897f,-0.081632f), float3(0.067000f,0.980649f,-0.094412f), diff --git a/Editor/dummy_pickup.h b/Editor/dummy_pickup.h index ca3ad8974f..e2e63da26b 100644 --- a/Editor/dummy_pickup.h +++ b/Editor/dummy_pickup.h @@ -1,3 +1,4 @@ +// clang-format off static const float3 vertices[2210] = { float3(0.536435f,-0.085426f,-0.086257f), float3(0.532677f,-0.133048f,-0.032462f), diff --git a/Editor/dummy_soldier.h b/Editor/dummy_soldier.h index 0b8dcd02cc..aa654d63d4 100644 --- a/Editor/dummy_soldier.h +++ b/Editor/dummy_soldier.h @@ -1,3 +1,4 @@ +// clang-format off static const float3 vertices[35319] = { float3(-0.128795f,1.239626f,-0.183225f), float3(-0.128795f,1.239832f,-0.184724f), diff --git a/Editor/dummy_waypoint.h b/Editor/dummy_waypoint.h index 3cec660e25..1d1d8d7f6c 100644 --- a/Editor/dummy_waypoint.h +++ b/Editor/dummy_waypoint.h @@ -1,3 +1,4 @@ +// clang-format off static const float3 vertices[1091] = { float3(0.000000f,-0.052334f,0.163862f), float3(0.000000f,-0.041118f,0.192681f), diff --git a/Editor/json.hpp b/Editor/json.hpp index a83971da21..12746bc41a 100644 --- a/Editor/json.hpp +++ b/Editor/json.hpp @@ -1,3 +1,4 @@ +// clang-format off /* __ _____ _____ _____ __| | __| | | | JSON for Modern C++ @@ -26,7 +27,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #ifndef INCLUDE_NLOHMANN_JSON_HPP_ #define INCLUDE_NLOHMANN_JSON_HPP_ diff --git a/Editor/resource.h b/Editor/resource.h index c3a3a30cce..cea336054b 100644 --- a/Editor/resource.h +++ b/Editor/resource.h @@ -1,3 +1,4 @@ +// clang-format off //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by Editor.rc diff --git a/Editor/tiny_gltf.h b/Editor/tiny_gltf.h index 8964be5057..48ef5f3fff 100644 --- a/Editor/tiny_gltf.h +++ b/Editor/tiny_gltf.h @@ -1,3 +1,4 @@ +// clang-format off // // Header-only tiny glTF 2.0 loader and serializer. // diff --git a/Editor/tiny_obj_loader.h b/Editor/tiny_obj_loader.h index d52e97c886..78407cfa65 100644 --- a/Editor/tiny_obj_loader.h +++ b/Editor/tiny_obj_loader.h @@ -1,3 +1,4 @@ +// clang-format off /* The MIT License (MIT) diff --git a/Editor/ufbx.c b/Editor/ufbx.c index 638c561b37..0544aba27b 100644 --- a/Editor/ufbx.c +++ b/Editor/ufbx.c @@ -1,3 +1,4 @@ +// clang-format off #ifndef UFBX_UFBX_C_INCLUDED #define UFBX_UFBX_C_INCLUDED diff --git a/Editor/ufbx.h b/Editor/ufbx.h index e394d3557b..1518ba3f31 100644 --- a/Editor/ufbx.h +++ b/Editor/ufbx.h @@ -1,3 +1,4 @@ +// clang-format off #ifndef UFBX_UFBX_H_INCLUDED #define UFBX_UFBX_H_INCLUDED diff --git a/Editor/xatlas.cpp b/Editor/xatlas.cpp index 43aec33a9f..7e3cc2e46d 100644 --- a/Editor/xatlas.cpp +++ b/Editor/xatlas.cpp @@ -1,3 +1,4 @@ +// clang-format off /* MIT License diff --git a/Editor/xatlas.h b/Editor/xatlas.h index cc47f4837e..fb8e9cee6c 100644 --- a/Editor/xatlas.h +++ b/Editor/xatlas.h @@ -1,3 +1,4 @@ +// clang-format off /* MIT License diff --git a/Example_ImGui/ImGui/.clang-format b/Example_ImGui/ImGui/.clang-format new file mode 100644 index 0000000000..fdd9df63da --- /dev/null +++ b/Example_ImGui/ImGui/.clang-format @@ -0,0 +1,3 @@ +# no formatting for vendored files +DisableFormat: true +SortIncludes: Never \ No newline at end of file diff --git a/Example_ImGui/resource.h b/Example_ImGui/resource.h index 4a8b8b1056..1d56b9e7bb 100644 --- a/Example_ImGui/resource.h +++ b/Example_ImGui/resource.h @@ -1,3 +1,4 @@ +// clang-format off //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by Tests.rc diff --git a/Example_ImGui_Docking/ImGui/.clang-format b/Example_ImGui_Docking/ImGui/.clang-format new file mode 100644 index 0000000000..fdd9df63da --- /dev/null +++ b/Example_ImGui_Docking/ImGui/.clang-format @@ -0,0 +1,3 @@ +# no formatting for vendored files +DisableFormat: true +SortIncludes: Never \ No newline at end of file diff --git a/Template_Windows/resource.h b/Template_Windows/resource.h index daec838161..0f647b797d 100644 --- a/Template_Windows/resource.h +++ b/Template_Windows/resource.h @@ -1,3 +1,4 @@ +// clang-format off //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by TemplateWindows.rc diff --git a/WickedEngine/Jolt/.clang-format b/WickedEngine/Jolt/.clang-format new file mode 100644 index 0000000000..fdd9df63da --- /dev/null +++ b/WickedEngine/Jolt/.clang-format @@ -0,0 +1,3 @@ +# no formatting for vendored files +DisableFormat: true +SortIncludes: Never \ No newline at end of file diff --git a/WickedEngine/LUA/.clang-format b/WickedEngine/LUA/.clang-format new file mode 100644 index 0000000000..fdd9df63da --- /dev/null +++ b/WickedEngine/LUA/.clang-format @@ -0,0 +1,3 @@ +# no formatting for vendored files +DisableFormat: true +SortIncludes: Never \ No newline at end of file diff --git a/WickedEngine/Utility/.clang-format b/WickedEngine/Utility/.clang-format new file mode 100644 index 0000000000..fdd9df63da --- /dev/null +++ b/WickedEngine/Utility/.clang-format @@ -0,0 +1,3 @@ +# no formatting for vendored files +DisableFormat: true +SortIncludes: Never \ No newline at end of file diff --git a/WickedEngine/logo.h b/WickedEngine/logo.h index 3e8b1cff72..45f890f389 100644 --- a/WickedEngine/logo.h +++ b/WickedEngine/logo.h @@ -1,3 +1,4 @@ +// clang-format off const uint8_t wicked_engine_logo[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, diff --git a/WickedEngine/offlineshadercompiler.cpp b/WickedEngine/offlineshadercompiler.cpp index 94f0ab49e8..69329da0ce 100644 --- a/WickedEngine/offlineshadercompiler.cpp +++ b/WickedEngine/offlineshadercompiler.cpp @@ -609,6 +609,7 @@ int main(int argc, char* argv[]) std::cout << "[Wicked Engine Offline Shader Compiler] Creating ShaderDump...\n"; timer.record(); std::string ss; + ss += "// clang-format off\n"; ss += "namespace wiShaderDump {\n"; for (auto& x : results) { diff --git a/WickedEngine/sdl2.h b/WickedEngine/sdl2.h index 745e50e405..055023fc88 100644 --- a/WickedEngine/sdl2.h +++ b/WickedEngine/sdl2.h @@ -1,3 +1,4 @@ +// clang-format off // From https://github.com/xyproto/sdl2-examples/blob/master/include/sdl2.h // MIT License diff --git a/WickedEngine/shaders/compressonator/.clang-format b/WickedEngine/shaders/compressonator/.clang-format new file mode 100644 index 0000000000..fdd9df63da --- /dev/null +++ b/WickedEngine/shaders/compressonator/.clang-format @@ -0,0 +1,3 @@ +# no formatting for vendored files +DisableFormat: true +SortIncludes: Never \ No newline at end of file diff --git a/WickedEngine/shaders/ffx-fsr/.clang-format b/WickedEngine/shaders/ffx-fsr/.clang-format new file mode 100644 index 0000000000..fdd9df63da --- /dev/null +++ b/WickedEngine/shaders/ffx-fsr/.clang-format @@ -0,0 +1,3 @@ +# no formatting for vendored files +DisableFormat: true +SortIncludes: Never \ No newline at end of file diff --git a/WickedEngine/shaders/ffx-fsr2/.clang-format b/WickedEngine/shaders/ffx-fsr2/.clang-format new file mode 100644 index 0000000000..fdd9df63da --- /dev/null +++ b/WickedEngine/shaders/ffx-fsr2/.clang-format @@ -0,0 +1,3 @@ +# no formatting for vendored files +DisableFormat: true +SortIncludes: Never \ No newline at end of file diff --git a/WickedEngine/shaders/ffx-shadows-dnsr/.clang-format b/WickedEngine/shaders/ffx-shadows-dnsr/.clang-format new file mode 100644 index 0000000000..fdd9df63da --- /dev/null +++ b/WickedEngine/shaders/ffx-shadows-dnsr/.clang-format @@ -0,0 +1,3 @@ +# no formatting for vendored files +DisableFormat: true +SortIncludes: Never \ No newline at end of file diff --git a/WickedEngine/waterripple.h b/WickedEngine/waterripple.h index 6fd960c52f..1309f3279b 100644 --- a/WickedEngine/waterripple.h +++ b/WickedEngine/waterripple.h @@ -1,3 +1,4 @@ +// clang-format off const uint8_t waterriple[] = { 128,128,0,0,0,0,0,0,128,128,0,0,0,0,0,0,128,128,0,0,0,0,0,0,128,128,0,0,0,0,0,0, 128,128,0,0,0,0,0,0,128,128,0,0,0,0,0,0,128,128,0,0,0,0,0,0,128,128,0,0,0,0,0,0, diff --git a/WickedEngine/wiHelper.cpp b/WickedEngine/wiHelper.cpp index 8bf0976593..01f751dc36 100644 --- a/WickedEngine/wiHelper.cpp +++ b/WickedEngine/wiHelper.cpp @@ -1276,6 +1276,7 @@ namespace wi::helper bool Bin2H(const uint8_t* data, size_t size, const std::string& dst_filename, const char* dataName) { std::string ss; + ss += "// clang-format off\n"; ss += "const uint8_t "; ss += dataName ; ss += "[] = {"; diff --git a/WickedEngine/wiSheenLUT.h b/WickedEngine/wiSheenLUT.h index daecf31224..9a98e1fc0f 100644 --- a/WickedEngine/wiSheenLUT.h +++ b/WickedEngine/wiSheenLUT.h @@ -1 +1,2 @@ +// clang-format off const uint8_t sheenLUTdata[] = {255, 220, 162, 121, 90, 65, 47, 34, 23, 16, 10, 6, 4, 2, 1, 0, 255, 221, 163, 119, 88, 64, 47, 33, 23, 16, 10, 7, 4, 2, 1, 0, 255, 219, 159, 119, 88, 65, 47, 33, 23, 16, 10, 7, 4, 2, 1, 0, 255, 220, 161, 120, 88, 65, 47, 33, 24, 16, 11, 6, 4, 2, 1, 0, 255, 216, 160, 122, 92, 69, 51, 37, 27, 19, 13, 8, 5, 3, 1, 0, 255, 198, 155, 123, 98, 78, 61, 47, 37, 28, 20, 15, 10, 7, 4, 2, 233, 184, 147, 122, 100, 84, 68, 56, 45, 36, 28, 22, 16, 11, 8, 4, 211, 171, 142, 121, 101, 86, 72, 61, 51, 42, 34, 28, 22, 16, 12, 8, 196, 163, 136, 118, 102, 88, 76, 65, 56, 48, 40, 33, 27, 21, 17, 12, 185, 154, 132, 116, 101, 89, 78, 68, 59, 52, 45, 38, 32, 26, 21, 16, 175, 148, 128, 114, 100, 89, 80, 71, 63, 55, 48, 42, 36, 30, 25, 20, 166, 142, 125, 111, 99, 89, 81, 72, 65, 58, 51, 45, 39, 34, 29, 24, 161, 138, 122, 109, 99, 89, 81, 74, 67, 60, 54, 48, 43, 37, 33, 28, 155, 134, 120, 108, 98, 90, 82, 75, 68, 62, 56, 51, 46, 41, 36, 31, 150, 131, 117, 107, 97, 90, 82, 75, 69, 63, 58, 53, 48, 43, 39, 34, 147, 128, 116, 105, 97, 89, 82, 76, 70, 65, 60, 55, 50, 46, 41, 37, 253, 253, 253, 253, 0, 0, 0, 0, 19, 4, 29, 66, 0, 4, 0, 128, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, 0, 0, 0, 0, 7, 4, 33, 66, 0, 5, 0, 128, 184, 155, 118, 144, 249, 127, 0, 0, 208, 242, 25, 238, 6, 2, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 49, 91, 16, 36, 23, 91, 16, 80, 255, 209, 237, 6, 2, 0, 0, 96, 180, 217, 237, 6, 2, 0, 0, 11, 0, 0, 0, 192, 208, 224, 240, 195, 109, 228, 194, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 247, 25, 238, 6, 2, 0, 0, };