Skip to content

Commit 55ce1ac

Browse files
committed
Clang Reformat + Math Modules for Physics
1 parent 00081d1 commit 55ce1ac

36 files changed

+1468
-625
lines changed

.vscode/settings.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
"vector": "cpp",
55
"iostream": "cpp"
66
},
7-
"cmake.configureArgs": [
8-
"-DCMAKE_CXX_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe",
9-
"-DCMAKE_C_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe",
10-
],
117
"cmake.generator": "Visual Studio 15 2017",
128
"C_Cpp.clang_format_style": "{ BasedOnStyle: LLVM, UseTab: Always, IndentWidth: 4, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, TabWidth: 4, NamespaceIndentation: All, AllowAllParametersOfDeclarationOnNextLine: true }"
139
}

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ cmake_minimum_required(VERSION 2.8)
22

33
project("forth")
44

5-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
5+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
6+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
7+
endif()
68

79
set(forth_version 0.1)
810

source/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ set(forth_math_srcs
2222
math/Matrix4.cpp
2323
math/Matrix4.h
2424
math/Plane4.h
25+
math/Ray4.h
2526
math/SphereBounds4.h
27+
math/Tensor4.cpp
28+
math/Tensor4.h
2629
math/Transform4.h
2730
math/Vector3.h
31+
math/Vector4.cpp
2832
math/Vector4.h
2933
)
3034

source/common/Buffer3.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#pragma once
22

3-
#include "../math/Vector3.h"
43
#include "../common/Color.h"
54
#include "../extras/Utils.h"
6-
#include "VertexProfile.h"
5+
#include "../math/Vector3.h"
76
#include "Enums.h"
7+
#include "VertexProfile.h"
88
#include <vector>
99

1010
namespace Forth
@@ -55,6 +55,5 @@ namespace Forth
5555
indices[indices_count++] = b;
5656
indices[indices_count++] = c;
5757
}
58-
5958
};
60-
}
59+
} // namespace Forth

source/common/Buffer4.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ namespace Forth
499499
void Buffer4::AddBySequence(SequenceMode mode, const std::vector<int> &v)
500500
{
501501
// Copy of the original sequence
502-
int va = v.size();
502+
int va = (int)v.size();
503503
switch (mode)
504504
{
505505
case SQM_Points:

source/common/Buffer4.h

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -158,39 +158,38 @@ namespace Forth
158158
void SequenceGrid(int x, int y = 1, int z = 1, int w = 1);
159159

160160
/// <summary>
161-
/// Add by given sequence
162-
/// </summary>
163-
void AddBySequence(SequenceMode mode, const std::vector<int> &v);
164-
165-
/// <summary>
166-
/// Add points.
167-
/// </summary>
168-
void AddPoint(const std::vector<int> &v);
169-
170-
/// <summary>
171-
/// Add segments.
172-
/// </summary>
173-
void AddSegment(const std::vector<int> &v);
174-
175-
/// <summary>
176-
/// Add triangles.
177-
/// </summary>
178-
void AddTriangle(const std::vector<int> &v);
179-
180-
/// <summary>
181-
/// Add quads.
182-
/// </summary>
183-
void AddQuad(const std::vector<int> &v);
184-
185-
/// <summary>
186-
/// Add trimids.
187-
/// </summary>
188-
void AddTrimid(const std::vector<int> &v);
189-
190-
/// <summary>
191-
/// Add polygon points/wires/surfaces.
192-
/// </summary>
193-
void AddPolygon(const std::vector<int> &v);
161+
/// Add by given sequence
162+
/// </summary>
163+
void AddBySequence(SequenceMode mode, const std::vector<int> &v);
164+
165+
/// <summary>
166+
/// Add points.
167+
/// </summary>
168+
void AddPoint(const std::vector<int> &v);
169+
170+
/// <summary>
171+
/// Add segments.
172+
/// </summary>
173+
void AddSegment(const std::vector<int> &v);
174+
175+
/// <summary>
176+
/// Add triangles.
177+
/// </summary>
178+
void AddTriangle(const std::vector<int> &v);
194179

180+
/// <summary>
181+
/// Add quads.
182+
/// </summary>
183+
void AddQuad(const std::vector<int> &v);
184+
185+
/// <summary>
186+
/// Add trimids.
187+
/// </summary>
188+
void AddTrimid(const std::vector<int> &v);
189+
190+
/// <summary>
191+
/// Add polygon points/wires/surfaces.
192+
/// </summary>
193+
void AddPolygon(const std::vector<int> &v);
195194
};
196195
} // namespace Forth

source/common/BufferGL.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

33
#include "../common/Color.h"
4-
#include "../math/Vector3.h"
54
#include "../extras/Utils.h"
5+
#include "../math/Vector3.h"
66
#include "Buffer3.h"
77
#include "Enums.h"
88
#include <vector>
@@ -56,11 +56,10 @@ namespace Forth
5656
};
5757
// clang-format on
5858

59-
for(int j = 0; j < BUFFER_PER_TRIS;)
59+
for (int j = 0; j < BUFFER_PER_TRIS;)
6060
{
6161
vb[vb_count++] = arr[j++];
6262
}
63-
6463
}
6564
}
6665
};

source/common/Color.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@ namespace Forth
66
{
77
float r, g, b, a;
88

9-
Color(void) { }
9+
Color(void) {}
1010

11-
Color(float r, float g, float b, float a) : r(r), g(g), b(b), a(a) { }
11+
Color(float r, float g, float b, float a) : r(r), g(g), b(b), a(a) {}
1212
};
1313

1414
/// <summary>
1515
/// Interpolate between two colors (without clamping)
1616
/// </summary>
17-
inline Color LerpUnclamped(const Color& a, const Color& b, float t)
17+
inline Color LerpUnclamped(const Color &a, const Color &b, float t)
1818
{
1919
return Color(
2020
a.r + (b.r - a.r) * t,
2121
a.g + (b.g - a.g) * t,
2222
a.b + (b.b - a.b) * t,
23-
a.a + (b.a - a.a) * t
24-
);
23+
a.a + (b.a - a.a) * t);
2524
}
26-
}
25+
} // namespace Forth

0 commit comments

Comments
 (0)