Browse Source

better formatting

Kajetan Johannes Hammerle 3 years ago
parent
commit
bd8c3a83db

+ 16 - 16
Main.cpp

@@ -1,30 +1,30 @@
 #include <iostream>
 
+#include "rendering/FileTexture.h"
 #include "tests/ArrayTests.h"
+#include "tests/BitArrayTests.h"
+#include "tests/BufferTests.h"
+#include "tests/ClockTests.h"
+#include "tests/ColorTests.h"
+#include "tests/FrustumTests.h"
 #include "tests/HashMapTests.h"
 #include "tests/ListTests.h"
-#include "tests/BitArrayTests.h"
-#include "tests/StringBufferTests.h"
-#include "tests/RandomTests.h"
-#include "tests/RingBufferTests.h"
-#include "tests/SplitStringTests.h"
-#include "tests/VectorTests.h"
-#include "tests/MatrixTests.h"
-#include "tests/StackTests.h"
 #include "tests/MatrixStackTests.h"
+#include "tests/MatrixTests.h"
+#include "tests/ObjectPoolTests.h"
+#include "tests/PNGReaderTests.h"
 #include "tests/PlaneTests.h"
-#include "tests/FrustumTests.h"
 #include "tests/QuaternionTests.h"
-#include "tests/UtilsTests.h"
-#include "tests/ColorTests.h"
-#include "tests/ClockTests.h"
-#include "tests/PNGReaderTests.h"
-#include "tests/BufferTests.h"
+#include "tests/RandomTests.h"
+#include "tests/RingBufferTests.h"
+#include "tests/SplitStringTests.h"
 #include "tests/StackAllocatorTests.h"
+#include "tests/StackTests.h"
+#include "tests/StringBufferTests.h"
 #include "tests/TypedBufferTests.h"
-#include "tests/ObjectPoolTests.h"
+#include "tests/UtilsTests.h"
+#include "tests/VectorTests.h"
 #include "wrapper/Framebuffer.h"
-#include "rendering/FileTexture.h"
 
 int main(int argAmount, char** args) {
     if(argAmount < 2) {

+ 8 - 7
images/PNGReader.cpp

@@ -1,11 +1,12 @@
-#include <iostream>
 #include <cstring>
+#include <iostream>
 #include <libpng16/png.h>
 
 #include "images/PNGReader.h"
 
-PNGReader::PNGReader(const char* path) : path(path), width(0), height(0), channels(0), bitDepth(0), rowBytes(0),
-file(fopen(path, "r")), read(nullptr), info(nullptr), rowPointers(nullptr) {
+PNGReader::PNGReader(const char* path)
+    : path(path), width(0), height(0), channels(0), bitDepth(0), rowBytes(0), file(fopen(path, "r")), read(nullptr),
+      info(nullptr), rowPointers(nullptr) {
     if(file == nullptr) {
         std::cout << "file '" << path << "' cannot be read: " << strerror(errno) << "\n";
         return;
@@ -88,7 +89,7 @@ bool PNGReader::hasError() const {
 
 bool PNGReader::checkSignature() {
     png_byte buffer[8];
-    if(fread(buffer, sizeof (png_byte), 8, file) != 8) {
+    if(fread(buffer, sizeof(png_byte), 8, file) != 8) {
         std::cout << "cannot read signature of file '" << path << "'\n";
         return true;
     }
@@ -104,11 +105,11 @@ bool PNGReader::readData(ColorChannel* buffer) {
         std::cout << "png file '" << path << "' has used error callback\n";
         return true;
     }
-    rowPointers = static_cast<ColorChannel**> (png_malloc(read, height * (sizeof (ColorChannel*))));
+    rowPointers = static_cast<ColorChannel**>(png_malloc(read, height * sizeof(ColorChannel*)));
     for(int i = 0; i < height; i++) {
         rowPointers[i] = (buffer + i * width * channels);
     }
-    png_set_rows(read, info, reinterpret_cast<png_bytepp> (rowPointers));
-    png_read_image(read, reinterpret_cast<png_bytepp> (rowPointers));
+    png_set_rows(read, info, reinterpret_cast<png_bytepp>(rowPointers));
+    png_read_image(read, reinterpret_cast<png_bytepp>(rowPointers));
     return false;
 }

+ 1 - 1
images/PNGReader.h

@@ -32,7 +32,7 @@ public:
     bool hasError() const;
 
     bool readData(ColorChannel* buffer);
-    
+
 private:
     bool checkSignature();
 };

+ 4 - 4
input/Button.h

@@ -3,20 +3,20 @@
 
 class Button final {
     friend class Buttons;
-    
+
     int key;
     int downTime;
     bool released;
     const char* name;
-    
+
 public:
     Button(int key, const char* name);
-    
+
     bool isDown() const;
     int getDownTime() const;
     bool wasReleased() const;
     const char* getName() const;
-    
+
 private:
     void tick(bool down);
 };

+ 5 - 5
input/Buttons.h

@@ -1,15 +1,15 @@
 #ifndef BUTTONS_H
 #define BUTTONS_H
 
-#include "wrapper/Window.h"
 #include "input/Button.h"
-#include "utils/List.h"
 #include "utils/Array.h"
+#include "utils/List.h"
+#include "wrapper/Window.h"
 
 typedef List<Button, 32> ButtonList;
 
 class Buttons final {
-    typedef Array<bool, 32 > DownArray;
+    typedef Array<bool, 32> DownArray;
 
     const Window& window;
     Button dummy;
@@ -34,9 +34,9 @@ public:
     Button& add(int key, const char* name);
     void mapGamepadButton(const Button& button, int mapping);
     void mapGamepadAxis(const Button& button, float value, int index);
-    
+
     void tick();
-    
+
     const ButtonList& get() const;
 
 private:

+ 9 - 9
math/Frustum.cpp

@@ -1,13 +1,13 @@
 #include "math/Frustum.h"
 
-Frustum::Frustum(float fieldOfView, float nearClip, float farClip, const Size& size) : size(size),
-fieldOfView(fieldOfView), nearClip(nearClip), farClip(farClip) {
+Frustum::Frustum(float fieldOfView, float nearClip, float farClip, const Size& size)
+    : size(size), fieldOfView(fieldOfView), nearClip(nearClip), farClip(farClip) {
 }
 
 Matrix& Frustum::updateProjection() {
     float tan = tanf(fieldOfView * (0.5f * M_PI / 180.0f));
     float q = 1.0f / tan;
-    float aspect = static_cast<float> (size.width) / size.height;
+    float aspect = static_cast<float>(size.width) / size.height;
     float diff = 1.0f / (nearClip - farClip);
 
     projection.set(0, Vector4(q / aspect, 0.0f, 0.0f, 0.0f));
@@ -19,7 +19,7 @@ Matrix& Frustum::updateProjection() {
 
 void Frustum::updatePlanes(const Vector3& pos, const Vector3& right, const Vector3& up, const Vector3& front) {
     float tan = tanf(fieldOfView * (0.5f * M_PI / 180.0f));
-    float aspect = static_cast<float> (size.width) / size.height;
+    float aspect = static_cast<float>(size.width) / size.height;
 
     float halfNearHeight = tan * nearClip;
     float halfNearWidth = halfNearHeight * aspect;
@@ -37,12 +37,12 @@ void Frustum::updatePlanes(const Vector3& pos, const Vector3& right, const Vecto
     Vector3 nearBottomLeft = nearCenter - (up * halfNearHeight) - (right * halfNearWidth);
     Vector3 nearBottomRight = nearCenter - (up * halfNearHeight) + (right * halfNearWidth);
 
-    planes[0] = Plane(nearBottomRight, nearTopLeft, nearBottomLeft); // near plane
-    planes[1] = Plane(farTopRight, farBottomRight, farTopLeft); // far plane
+    planes[0] = Plane(nearBottomRight, nearTopLeft, nearBottomLeft);    // near plane
+    planes[1] = Plane(farTopRight, farBottomRight, farTopLeft);         // far plane
     planes[2] = Plane(nearBottomRight, nearBottomLeft, farBottomRight); // bottom plane
-    planes[3] = Plane(farTopLeft, nearTopLeft, farTopRight); // top plane
-    planes[4] = Plane(nearBottomLeft, nearTopLeft, farTopLeft); // left plane
-    planes[5] = Plane(farBottomRight, farTopRight, nearBottomRight); // right plane
+    planes[3] = Plane(farTopLeft, nearTopLeft, farTopRight);            // top plane
+    planes[4] = Plane(nearBottomLeft, nearTopLeft, farTopLeft);         // left plane
+    planes[5] = Plane(farBottomRight, farTopRight, nearBottomRight);    // right plane
 }
 
 bool Frustum::isInside(const Vector3& pos) const {

+ 3 - 3
math/Frustum.h

@@ -2,9 +2,9 @@
 #define FRUSTUM_H
 
 #include "math/Matrix.h"
-#include "utils/Size.h"
-#include "utils/Array.h"
 #include "math/Plane.h"
+#include "utils/Array.h"
+#include "utils/Size.h"
 #include "utils/StringBuffer.h"
 
 class Frustum final {
@@ -20,7 +20,7 @@ public:
     Frustum(float fieldOfView, float nearClip, float farClip, const Size& size);
     Matrix& updateProjection();
     void updatePlanes(const Vector3& pos, const Vector3& right, const Vector3& up, const Vector3& front);
-    
+
     bool isInside(const Vector3& pos) const;
     bool isInside(const Vector3& pos, float radius) const;
 

+ 1 - 1
math/Matrix.h

@@ -35,7 +35,7 @@ public:
     Matrix& rotateY(float degrees);
     Matrix& rotateZ(float degrees);
     Matrix& rotate(const Quaternion& q);
-    
+
     template<int L>
     void toString(StringBuffer<L>& s) const {
         s.append('[').append(data[0]).append(", ");

+ 1 - 2
math/MatrixStack.h

@@ -1,15 +1,14 @@
 #ifndef MATRIXSTACK_H
 #define MATRIXSTACK_H
 
-#include "utils/Stack.h"
 #include "math/Matrix.h"
+#include "utils/Stack.h"
 
 template<int N>
 class MatrixStack final {
     Stack<Matrix, N> stack;
 
 public:
-
     MatrixStack() {
         stack.push(Matrix());
     }

+ 2 - 2
math/Plane.cpp

@@ -3,8 +3,8 @@
 Plane::Plane() : d(0) {
 }
 
-Plane::Plane(const Vector3& a, const Vector3& b, const Vector3& c) :
-abc(static_cast<Vector3> (b - a).cross(c - a).normalize()), d(-abc.dot(b)) {
+Plane::Plane(const Vector3& a, const Vector3& b, const Vector3& c)
+    : abc(static_cast<Vector3>(b - a).cross(c - a).normalize()), d(-abc.dot(b)) {
 }
 
 float Plane::getSignedDistance(const Vector3& v) const {

+ 3 - 4
math/Vector.cpp

@@ -20,8 +20,7 @@ Vector<3>& Vector<3>::setAngles(float lengthAngle, float widthAngle) {
 
 template<>
 Vector<3> Vector<3>::cross(const Vector<3>& other) const {
-    return Vector<3>(
-            values[1] * other.values[2] - values[2] * other.values[1],
-            values[2] * other.values[0] - values[0] * other.values[2],
-            values[0] * other.values[1] - values[1] * other.values[0]);
+    return Vector<3>(values[1] * other.values[2] - values[2] * other.values[1],
+                     values[2] * other.values[0] - values[0] * other.values[2],
+                     values[0] * other.values[1] - values[1] * other.values[0]);
 }

+ 5 - 3
math/Vector.h

@@ -10,7 +10,6 @@ class Vector final {
     float values[N];
 
 public:
-
     Vector() {
         for(int i = 0; i < N; i++) {
             values[i] = 0.0f;
@@ -125,8 +124,11 @@ Vector<N> operator*(float factor, const Vector<N>& v) {
     return v * factor;
 }
 
-template<> Vector<3>& Vector<3>::setAngles(float lengthAngle, float widthAngle);
-template<> Vector<3> Vector<3>::cross(const Vector<3>& other) const;
+template<>
+Vector<3>& Vector<3>::setAngles(float lengthAngle, float widthAngle);
+
+template<>
+Vector<3> Vector<3>::cross(const Vector<3>& other) const;
 
 typedef Vector<4> Vector4;
 typedef Vector<3> Vector3;

+ 0 - 1
memory/ObjectPool.h

@@ -23,7 +23,6 @@ class ObjectPool {
     UninitializedArray<Node, N> data;
 
 public:
-
     ObjectPool() : freeIndex(0) {
         for(int i = 0; i < N - 1; i++) {
             data[i].next = i + 1;

+ 13 - 15
memory/StackAllocator.h

@@ -22,10 +22,9 @@ namespace StackAllocator {
         Pointer dataPointer;
 
     public:
-
-        Array(int n) : length(n), dataPointer(StackAllocator::allocate(sizeof (T), length)) {
+        Array(int n) : length(n), dataPointer(StackAllocator::allocate(sizeof(T), length)) {
             for(int i = 0; i < length; i++) {
-                new ((*this) + i) T;
+                new((*this) + i) T;
             }
         }
 
@@ -46,24 +45,24 @@ namespace StackAllocator {
         }
 
         int grow(int n) {
-            int add = StackAllocator::grow(dataPointer, sizeof (T), n);
+            int add = StackAllocator::grow(dataPointer, sizeof(T), n);
             for(int i = length; i < length + add; i++) {
-                new ((*this) + i) T();
+                new((*this) + i) T();
             }
             length += add;
             return add;
         }
 
         T& operator[](int index) {
-            return static_cast<T*> (StackAllocator::get(dataPointer))[index];
+            return static_cast<T*>(StackAllocator::get(dataPointer))[index];
         }
 
         const T& operator[](int index) const {
-            return static_cast<T*> (StackAllocator::get(dataPointer))[index];
+            return static_cast<T*>(StackAllocator::get(dataPointer))[index];
         }
 
         operator T*() {
-            return static_cast<T*> (StackAllocator::get(dataPointer));
+            return static_cast<T*>(StackAllocator::get(dataPointer));
         }
     };
 
@@ -73,10 +72,9 @@ namespace StackAllocator {
         Pointer dataPointer;
 
     public:
-
-        Object() : length(1), dataPointer(StackAllocator::allocate(sizeof (T), length)) {
+        Object() : length(1), dataPointer(StackAllocator::allocate(sizeof(T), length)) {
             if(!hasError()) {
-                new (StackAllocator::get(dataPointer)) T;
+                new(StackAllocator::get(dataPointer)) T;
             }
         }
 
@@ -96,12 +94,12 @@ namespace StackAllocator {
             return length != 1;
         }
 
-        T* operator ->() {
-            return static_cast<T*> (StackAllocator::get(dataPointer));
+        T* operator->() {
+            return static_cast<T*>(StackAllocator::get(dataPointer));
         }
-        
+
         operator T&() {
-            return *static_cast<T*> (StackAllocator::get(dataPointer));
+            return *static_cast<T*>(StackAllocator::get(dataPointer));
         }
     };
 }

+ 1 - 1
rendering/FileTexture.h

@@ -8,7 +8,7 @@ class FileTexture final {
 
 public:
     FileTexture(const char* path);
-    
+
     void bindTo(int index) const;
 };
 

+ 1 - 1
tests/StackTests.cpp

@@ -1,7 +1,7 @@
 #include "tests/StackTests.h"
 #include "tests/Test.h"
-#include "utils/StringBuffer.h"
 #include "utils/Stack.h"
+#include "utils/StringBuffer.h"
 
 typedef Stack<int, 10> IntStack;
 typedef StringBuffer<50> String;

+ 4 - 6
utils/BitArray.h

@@ -7,7 +7,7 @@
 
 template<int N, int BITS>
 class BitArray final {
-    static constexpr int INT_BITS = sizeof (int) * 8;
+    static constexpr int INT_BITS = sizeof(int) * 8;
 
     static_assert(BITS >= 1, "each bit array element must have at least one bit");
     static_assert(BITS <= INT_BITS, "each bit array element can have at most as much bits as an int");
@@ -44,7 +44,6 @@ class BitArray final {
     }
 
 public:
-
     class BitInt {
         friend BitArray;
 
@@ -58,13 +57,12 @@ public:
         BitInt(BitInt&& other) = default;
 
     public:
-
         BitInt& operator=(const BitInt& other) {
-            return (*this) = static_cast<int> (other);
+            return (*this) = static_cast<int>(other);
         }
 
         BitInt& operator=(BitInt&& other) {
-            return (*this) = static_cast<int> (other);
+            return (*this) = static_cast<int>(other);
         }
 
         BitInt& operator=(int i) {
@@ -109,7 +107,7 @@ public:
     constexpr int getLength() const {
         return N;
     }
-    
+
     template<int L>
     void toString(StringBuffer<L>& s) const {
         s.append("[");

+ 2 - 2
utils/Buffer.h

@@ -15,8 +15,8 @@ public:
     template<typename T>
     Buffer& add(const T& t) {
         int bytes = data.getLength() - length;
-        if(bytes > static_cast<int> (sizeof (T))) {
-            bytes = sizeof (T);
+        if(bytes > static_cast<int>(sizeof(T))) {
+            bytes = sizeof(T);
         } else if(data.grow(data.getLength()) > 0) {
             return add(t);
         }

+ 2 - 2
utils/Clock.h

@@ -1,12 +1,12 @@
 #ifndef CLOCK_H
 #define CLOCK_H
 
-#include "utils/Types.h"
 #include "utils/Array.h"
+#include "utils/Types.h"
 
 struct Clock final {
     typedef int64 Nanos;
-    
+
 private:
     static constexpr int BITS = 7;
     static constexpr int LENGTH = 1 << BITS;

+ 1 - 1
utils/Color.h

@@ -29,7 +29,7 @@ public:
     ColorChannel& operator[](int index) {
         return data[index];
     }
-    
+
     const ColorChannel& operator[](int index) const {
         return data[index];
     }

+ 5 - 10
utils/HashMap.h

@@ -2,11 +2,9 @@
 #define HASHMAP_H
 
 #include "utils/Array.h"
-#include "utils/Utils.h"
 #include "utils/List.h"
 #include "utils/StringBuffer.h"
-
-#include <iostream>
+#include "utils/Utils.h"
 
 template<typename K, typename V, int N_MIN>
 class HashMap final {
@@ -17,9 +15,7 @@ class HashMap final {
     List<K, CAPACITY> keys;
     List<V, CAPACITY> values;
 
-    enum SearchResult {
-        FREE_INDEX_FOUND, KEY_FOUND, NOTHING_FOUND
-    };
+    enum SearchResult { FREE_INDEX_FOUND, KEY_FOUND, NOTHING_FOUND };
 
     struct Search {
         int index;
@@ -52,7 +48,6 @@ class HashMap final {
     }
 
 public:
-
     HashMap() : used(-1) {
     }
 
@@ -158,15 +153,15 @@ public:
     V* begin() {
         return values.begin();
     }
-    
+
     V* end() {
         return values.end();
     }
-    
+
     const V* begin() const {
         return values.begin();
     }
-    
+
     const V* end() const {
         return values.end();
     }

+ 1 - 1
utils/List.h

@@ -1,8 +1,8 @@
 #ifndef LIST_H
 #define LIST_H
 
-#include "utils/UninitializedArray.h"
 #include "utils/StringBuffer.h"
+#include "utils/UninitializedArray.h"
 
 template<typename T, int N>
 class List final {

+ 2 - 2
utils/Random.cpp

@@ -32,7 +32,7 @@ int Random::next() {
     r ^= (r << 7) & 0x2B5B2500;
     r ^= (r << 15) & 0xDB8B0000;
     r ^= (r >> 16);
-    return r & static_cast<int> (-1u >> 1);
+    return r & static_cast<int>(-1u >> 1);
 }
 
 int Random::next(int min, int inclusiveMax) {
@@ -40,7 +40,7 @@ int Random::next(int min, int inclusiveMax) {
 }
 
 float Random::nextFloat() {
-    static constexpr int bits = sizeof (int) * 6;
+    static constexpr int bits = sizeof(int) * 6;
     static constexpr int mask = (1 << bits) - 1;
     return (next() & mask) * (1.0f / (1.0f + mask));
 }

+ 0 - 1
utils/RingBuffer.h

@@ -11,7 +11,6 @@ class RingBuffer final {
     int values = 0;
 
 public:
-
     bool write(const T& t) {
         if(values >= N) {
             return true;

+ 2 - 6
utils/SplitString.h

@@ -12,16 +12,13 @@ class SplitString final {
     bool fill(const StringBuffer<N>& s) {
         for(int i = 0; i < s.getLength(); i++) {
             switch(s[i]) {
-                case ' ':
-                    handleSpace(s, i);
-                    break;
+                case ' ': handleSpace(s, i); break;
                 case '"':
                     if(handleQuotation(s, i)) {
                         return true;
                     }
                     break;
-                default:
-                    data.add(s[i]);
+                default: data.add(s[i]);
             }
         }
         data.add('\0');
@@ -62,7 +59,6 @@ class SplitString final {
     }
 
 public:
-
     SplitString(const StringBuffer<N>& s) {
         if(fill(s)) {
             return;

+ 1 - 2
utils/Stack.h

@@ -8,7 +8,6 @@ class Stack final {
     List<T, N> data;
 
 public:
-
     bool push(const T& t) {
         return data.add(t);
     }
@@ -41,7 +40,7 @@ public:
     const T& peek() const {
         return data[data.getLength() - 1];
     }
-    
+
     template<int L>
     void toString(StringBuffer<L>& s) const {
         s.append(data);

+ 3 - 4
utils/StringBuffer.h

@@ -1,8 +1,8 @@
 #ifndef STRINGBUFFER_H
 #define STRINGBUFFER_H
 
-#include <iostream>
 #include <cstring>
+#include <iostream>
 
 template<int N>
 class StringBuffer final {
@@ -21,7 +21,6 @@ class StringBuffer final {
     }
 
 public:
-
     StringBuffer() : length(0), hash(0) {
         data[0] = '\0';
     }
@@ -76,7 +75,7 @@ public:
         data[length] = '\0';
         return *this;
     }
-    
+
     StringBuffer& append(char* str) {
         return append(static_cast<const char*>(str));
     }
@@ -127,7 +126,7 @@ public:
     void print() {
         std::cout << data;
     }
-    
+
     void printLine() {
         std::cout << data << '\n';
     }

+ 2 - 3
utils/TypedBuffer.h

@@ -8,8 +8,7 @@ class TypedBuffer {
     Buffer data;
 
 public:
-
-    TypedBuffer(int n) : data(sizeof (T) * n) {
+    TypedBuffer(int n) : data(sizeof(T) * n) {
     }
 
     TypedBuffer& add(const T& t) {
@@ -18,7 +17,7 @@ public:
     }
 
     int getLength() const {
-        return data.getLength() / sizeof (T);
+        return data.getLength() / sizeof(T);
     }
 
     int getByteLength() const {

+ 11 - 9
utils/Types.h

@@ -13,19 +13,21 @@ namespace NumberSize {
     };
 
     template<int N, typename A, typename B>
-    using SizeCheck = Conditional<sizeof (A) == N, A, B>;
+    using SizeCheck = Conditional<sizeof(A) == N, A, B>;
 
     template<int N>
-    using Signed = SizeCheck<N, long long,
-    typename SizeCheck<N, long,
-    typename SizeCheck<N, int,
-    typename SizeCheck<N, short, char>::dummy>::dummy>::dummy>;
+    using Signed =
+        SizeCheck<N, long long,
+                  typename SizeCheck<
+                      N, long, typename SizeCheck<N, int, typename SizeCheck<N, short, char>::dummy>::dummy>::dummy>;
 
     template<int N>
-    using Unsigned = SizeCheck<N, unsigned long long,
-    typename SizeCheck<N, unsigned long,
-    typename SizeCheck<N, unsigned int,
-    typename SizeCheck<N, unsigned short, unsigned char>::dummy>::dummy>::dummy>;
+    using Unsigned =
+        SizeCheck<N, unsigned long long,
+                  typename SizeCheck<
+                      N, unsigned long,
+                      typename SizeCheck<N, unsigned int,
+                                         typename SizeCheck<N, unsigned short, unsigned char>::dummy>::dummy>::dummy>;
 }
 
 typedef NumberSize::Signed<8>::dummy int64;

+ 10 - 10
utils/UninitializedArray.h

@@ -7,7 +7,7 @@
 
 template<typename T, int N>
 class UninitializedArray final {
-    char data[sizeof (T) * N];
+    char data[sizeof(T) * N];
 
 public:
     UninitializedArray() = default;
@@ -15,9 +15,9 @@ public:
     UninitializedArray(UninitializedArray&&) = delete;
     UninitializedArray& operator=(const UninitializedArray&) = delete;
     UninitializedArray& operator=(UninitializedArray&&) = delete;
-    
+
     T* begin() {
-        return reinterpret_cast<T*> (data);
+        return reinterpret_cast<T*>(data);
     }
 
     T* end() {
@@ -25,13 +25,13 @@ public:
     }
 
     const T* begin() const {
-        return reinterpret_cast<const T*> (data);
+        return reinterpret_cast<const T*>(data);
     }
 
     const T* end() const {
         return begin() + N;
     }
-    
+
     T& operator[](int index) {
         return begin()[index];
     }
@@ -39,20 +39,20 @@ public:
     const T& operator[](int index) const {
         return begin()[index];
     }
-    
+
     void init(int index, const T& t) {
-        new (begin() + index) T(t);
+        new(begin() + index) T(t);
     }
 
     void init(int index, T&& t) {
-        new (begin() + index) T(std::move(t));
+        new(begin() + index) T(std::move(t));
     }
 
     template<typename... Args>
     void init(int index, Args&&... args) {
-        new (begin() + index) T(std::forward<Args>(args)...);
+        new(begin() + index) T(std::forward<Args>(args)...);
     }
-    
+
     void destroy(int index) {
         begin()[index].~T();
     }

+ 1 - 1
utils/Utils.h

@@ -12,7 +12,7 @@ namespace Utils {
     int popCount(const T& t) {
         static constexpr int map[16] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
         int sum = 0;
-        for(int i = 0; i < static_cast<int> (sizeof (T) * 8); i += 4) {
+        for(int i = 0; i < static_cast<int>(sizeof(T) * 8); i += 4) {
             sum += map[(t >> i) & 0xF];
         }
         return sum;

+ 3 - 3
wrapper/Attributes.cpp

@@ -3,12 +3,12 @@
 #include "wrapper/Attributes.h"
 
 Attributes& Attributes::addFloat(int count) {
-    attributes.add({count, sizeof (float), GL_FLOAT, false});
+    attributes.add({count, sizeof(float), GL_FLOAT, false});
     return *this;
 }
 
 Attributes& Attributes::addColor4() {
-    attributes.add({4, sizeof (unsigned char), GL_UNSIGNED_BYTE, true});
+    attributes.add({4, sizeof(unsigned char), GL_UNSIGNED_BYTE, true});
     return *this;
 }
 
@@ -26,7 +26,7 @@ void Attributes::set() const {
     int offset = 0;
     for(const Attribute& a : attributes) {
         if(a.type != -1) {
-            glVertexAttribPointer(index, a.count, a.type, a.normalized, size, static_cast<char*> (0) + offset);
+            glVertexAttribPointer(index, a.count, a.type, a.normalized, size, static_cast<char*>(0) + offset);
             glEnableVertexAttribArray(index);
         }
         offset += a.count * a.size;

+ 0 - 1
wrapper/Attributes.h

@@ -4,7 +4,6 @@
 #include "utils/List.h"
 
 class Attributes final {
-
     struct Attribute final {
         int count;
         int size;

+ 4 - 12
wrapper/Framebuffer.h

@@ -4,8 +4,8 @@
 #include <iostream>
 
 #include "utils/List.h"
-#include "wrapper/Texture.h"
 #include "utils/Size.h"
+#include "wrapper/Texture.h"
 
 template<int N>
 class Framebuffer final {
@@ -13,7 +13,6 @@ class Framebuffer final {
     GLuint buffer;
 
 public:
-
     template<typename... Args>
     Framebuffer(const TextureFormat& a, Args&&... args) : buffer(0) {
         const int size = sizeof...(args) + 1;
@@ -70,19 +69,14 @@ public:
     }
 
 private:
-
     bool hasError() const {
         GLenum error = glCheckFramebufferStatus(GL_FRAMEBUFFER);
         if(error == GL_FRAMEBUFFER_COMPLETE) {
             return false;
         }
         switch(error) {
-            case GL_FRAMEBUFFER_UNDEFINED:
-                std::cout << "undefined framebuffer\n";
-                return true;
-            case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
-                std::cout << "incomplete framebuffer attachment\n";
-                return true;
+            case GL_FRAMEBUFFER_UNDEFINED: std::cout << "undefined framebuffer\n"; return true;
+            case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: std::cout << "incomplete framebuffer attachment\n"; return true;
             case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
                 std::cout << "incomplete missing framebuffer attachment\n";
                 return true;
@@ -92,9 +86,7 @@ private:
             case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
                 std::cout << "incomplete framebuffer read buffer\n";
                 return true;
-            case GL_FRAMEBUFFER_UNSUPPORTED:
-                std::cout << "unsupported framebuffer\n";
-                return true;
+            case GL_FRAMEBUFFER_UNSUPPORTED: std::cout << "unsupported framebuffer\n"; return true;
             case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
                 std::cout << "incomplete framebuffer multisample\n";
                 return true;

+ 9 - 9
wrapper/GL.cpp

@@ -6,14 +6,11 @@
 bool GL::checkAndPrintError(const char* message) {
     GLenum error = glGetError();
     switch(error) {
-        case GL_NO_ERROR:
-            return false;
+        case GL_NO_ERROR: return false;
         case GL_INVALID_ENUM:
             std::cout << message << ": an unacceptable value is specified for an enumerated argument\n";
             break;
-        case GL_INVALID_VALUE:
-            std::cout << message << ": a numeric argument is out of range\n";
-            break;
+        case GL_INVALID_VALUE: std::cout << message << ": a numeric argument is out of range\n"; break;
         case GL_INVALID_OPERATION:
             std::cout << message << ": the specified operation is not allowed in the current state\n";
             break;
@@ -24,13 +21,16 @@ bool GL::checkAndPrintError(const char* message) {
             std::cout << message << ": there is not enough memory left to execute the command\n";
             break;
         case GL_STACK_UNDERFLOW:
-            std::cout << message << ": an attempt has been made to perform an operation that would cause an internal stack to underflow\n";
+            std::cout << message
+                      << ": an attempt has been made to perform an operation that would cause an internal stack to "
+                         "underflow\n";
             break;
         case GL_STACK_OVERFLOW:
-            std::cout << message << ": an attempt has been made to perform an operation that would cause an internal stack to overflow\n";
+            std::cout << message
+                      << ": an attempt has been made to perform an operation that would cause an internal stack to "
+                         "overflow\n";
             break;
-        default:
-            std::cout << message << ": unknown OpenGL error '" << error << "'\n";
+        default: std::cout << message << ": unknown OpenGL error '" << error << "'\n";
     }
     return true;
 }

+ 0 - 1
wrapper/GL.h

@@ -12,5 +12,4 @@ namespace GL {
     void setViewport(int width, int height);
 }
 
-
 #endif

+ 1 - 3
wrapper/GLFW.cpp

@@ -7,9 +7,7 @@
 
 bool GLFW::init() {
     if(glfwInit()) {
-        atexit([]() {
-            glfwTerminate();
-        });
+        atexit([]() { glfwTerminate(); });
         return false;
     }
     std::cout << "could not initialize GLFW\n";

+ 3 - 3
wrapper/Shader.cpp

@@ -1,12 +1,12 @@
 #include <fstream>
 #include <iostream>
 
-#include "wrapper/Shader.h"
 #include "wrapper/GL.h"
+#include "wrapper/Shader.h"
 
 Shader::Shader(const char* vertexPath, const char* fragmentPath) : vertexShader(0), fragmentShader(0), program(0) {
-    if(readFileAndCompile(vertexPath, vertexShader, GL_VERTEX_SHADER) || 
-            readFileAndCompile(fragmentPath, fragmentShader, GL_FRAGMENT_SHADER)) {
+    if(readFileAndCompile(vertexPath, vertexShader, GL_VERTEX_SHADER) ||
+       readFileAndCompile(fragmentPath, fragmentShader, GL_FRAGMENT_SHADER)) {
         return;
     }
     program = glCreateProgram();

+ 2 - 2
wrapper/Shader.h

@@ -9,7 +9,7 @@ class Shader final {
     GLuint vertexShader;
     GLuint fragmentShader;
     GLuint program;
-    
+
 public:
     Shader(const char* vertexPath, const char* fragmentPath);
     ~Shader();
@@ -19,7 +19,7 @@ public:
     Shader& operator=(Shader&& other) = delete;
 
     bool hasError() const;
-    
+
     void use() const;
     void setMatrix(const GLchar* name, const GLfloat* data);
     void setInt(const GLchar* name, GLint data);

+ 2 - 2
wrapper/Texture.h

@@ -8,7 +8,7 @@
 class Texture final {
     TextureFormat format;
     GLuint texture;
-    
+
     template<int N>
     friend class Framebuffer;
 
@@ -29,7 +29,7 @@ public:
     void setData(int width, int height, const void* data = nullptr);
 
     void bindTo(int index = 0) const;
-    
+
 private:
     void setFilter(GLint param);
     void setWrap(GLint param);

+ 2 - 2
wrapper/TextureFormat.cpp

@@ -2,8 +2,8 @@
 
 #include "wrapper/TextureFormat.h"
 
-TextureFormat::TextureFormat(GLint internalformat, GLenum format, GLenum type, bool depth) :
-internalformat(internalformat), format(format), type(type), depth(depth) {
+TextureFormat::TextureFormat(GLint internalformat, GLenum format, GLenum type, bool depth)
+    : internalformat(internalformat), format(format), type(type), depth(depth) {
 }
 
 TextureFormat TextureFormat::color8(int channels) {

+ 0 - 1
wrapper/VertexBuffer.h

@@ -33,5 +33,4 @@ private:
     void bindBuffer() const;
 };
 
-
 #endif

+ 2 - 2
wrapper/Window.h

@@ -12,7 +12,7 @@ class Window final {
 public:
     Window(const WindowOptions& options);
     ~Window();
-    
+
     Window(const Window&) = delete;
     Window& operator=(const Window&) = delete;
     Window(Window&&) = delete;
@@ -22,7 +22,7 @@ public:
     void show();
     bool shouldClose() const;
     void swapBuffers();
-    
+
     void trapCursor(bool trap);
     Size getSize() const;
     Size getFramebufferSize() const;

+ 3 - 3
wrapper/WindowOptions.cpp

@@ -1,6 +1,6 @@
 #include "WindowOptions.h"
 
-WindowOptions::WindowOptions(int majorVersion, int minorVersion, const Size& size, bool es, const char* name) :
-majorVersion(majorVersion), minorVersion(minorVersion), size(size), fullscreen(false), es(es), vsync(true),
-name(name) {
+WindowOptions::WindowOptions(int majorVersion, int minorVersion, const Size& size, bool es, const char* name)
+    : majorVersion(majorVersion), minorVersion(minorVersion), size(size), fullscreen(false), es(es), vsync(true),
+      name(name) {
 }