Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: '-4'
AccessModifierOffset: -4
AlignEscapedNewlines: Left
AlignTrailingComments: 'false'
AllowAllArgumentsOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'false'
AlignTrailingComments: true
AlignAfterOpenBracket: true
AllowAllArgumentsOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'true'
BinPackParameters: 'false'
AlwaysBreakTemplateDeclarations: "Yes"
AlignArrayOfStructures: Left
BinPackArguments: true
BinPackParameters: false
BraceWrapping:
AfterEnum: 'false'
BeforeCatch: 'true'
BeforeElse: 'true'
BeforeLambdaBody: 'false'
BeforeWhile: 'false'
AfterEnum: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: 'false'
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: 'false'
ColumnLimit: '80'
DerivePointerAlignment: 'false'
BreakStringLiterals: false
ColumnLimit: 0
DerivePointerAlignment: false
#EmptyLineAfterAccessModifier: Leave
#EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: 'true'
FixNamespaceComments: 'false'
IndentCaseLabels: 'true'
IndentWidth: '4'
KeepEmptyLinesAtTheStartOfBlocks: 'true'
Language: Cpp
MaxEmptyLinesToKeep: '10'
ExperimentalAutoDetectBinPacking: true
FixNamespaceComments: false
IndentCaseLabels: true
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 10
NamespaceIndentation: All
PenaltyBreakComment: '20'
PenaltyExcessCharacter: '5'
PenaltyBreakComment: 20
PenaltyExcessCharacter: 5
PointerAlignment: Middle
SortUsingDeclarations: 'false'
SpaceAfterTemplateKeyword: 'false'
SpaceBeforeCpp11BracedList: 'true'
SpacesBeforeTrailingComments: '1'
SortUsingDeclarations: false
SpaceAfterTemplateKeyword: false
SpaceBeforeCpp11BracedList: true
SpacesBeforeTrailingComments: 1
UseTab: Never

...
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Lint & Test

on:
push:
branches:
- main

pull_request:
types:
- opened
- reopened
- synchronize

jobs:
# test:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4

# - name: Install dependencies
# run: sudo apt-get install -y build-essential gcc-multilib g++-multilib

# - name: Install gcovr
# run: pip install gcovr

# - name: Setup project
# run: cmake -S ${TEST_DIR} -B ${BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug

# - name: Build
# run: cmake --build ${BUILD_DIR}

# # - name: Test
# # working-directory: build
# # run: ctest -V

# - name: Test with Coverage
# working-directory: build
# run: cmake --build ${BUILD_DIR} --target os_test_coverage

lint:
runs-on: ubuntu-latest

strategy:
matrix:
folder:
- src
- examples
- tests

steps:
- uses: actions/checkout@v4

- name: Lint ${{ matrix.folder }}
uses: jidicula/clang-format-action@v4.14.0
with:
clang-format-version: "20"
check-path: ${{ matrix.folder }}

increment_version:
name: Increment Version
uses: automas-dev/reusable-workflows/.github/workflows/increment_version.yml@main
if: github.ref == 'refs/heads/main'
secrets: inherit

needs:
# - test
- lint

permissions:
contents: write
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ build:
install:
cmake --install ${PWD}/build --config ${CONFIG}

.PHONY: config build install
lint:
@find src include examples tests -name '*.c' -or -name '*.h' -or -name '*.cpp' -or -name '*.hpp' | xargs clang-format --dry-run --Werror --sort-includes

format:
@find src include examples tests -name '*.c' -or -name '*.h' -or -name '*.cpp' -or -name '*.hpp' | xargs clang-format -i --Werror --sort-includes

.PHONY: config build install lint format
10 changes: 5 additions & 5 deletions examples/01_triangle/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,22 @@ int main() {

const float vertices[] = {
-0.5f, -0.5f, 0.0f, // Bottom Left
0.5f, -0.5f, 0.0f, // Bottom Right
0.0f, 0.5f, 0.0f // Top Center
0.5f, -0.5f, 0.0f, // Bottom Right
0.0f, 0.5f, 0.0f // Top Center
};

const float colors[] = {
1.0, 0.0, 0.0, // Bottom Left
0.0, 1.0, 0.0, // Bottom Right
0.0, 0.0, 1.0 // Top Center
0.0, 0.0, 1.0 // Top Center
};

const unsigned int indices[] = {
0, 1, 2, // First Triangle
};

Buffer::Attribute a0 (0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a1 (1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a0(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a1(1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));

BufferArray array(vector<vector<Buffer::Attribute>> {{a0}, {a1}});
array.bind();
Expand Down
20 changes: 10 additions & 10 deletions examples/02_camera/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ int main() {

const float vertices[] = {
-0.5f, -0.5f, 0.0f, // Bottom Left
0.5f, -0.5f, 0.0f, // Bottom Right
0.0f, 0.5f, 0.0f, // Top Center
0.5f, -0.5f, 0.0f, // Bottom Right
0.0f, 0.5f, 0.0f, // Top Center

0.0f, -0.5f, 0.0f, //
1.0f, -0.5f, 0.0f, //
1.0f, -0.5f, 1.0f, //
0.0f, -0.5f, 0.0f, //
1.0f, -0.5f, 0.0f, //
1.0f, -0.5f, 1.0f, //

0.5f, 0.0f, 0.0f, //
0.5f, 1.0f, 0.0f, //
0.5f, 1.0f, 1.0f, //
0.5f, 0.0f, 0.0f, //
0.5f, 1.0f, 0.0f, //
0.5f, 1.0f, 1.0f, //
};

const float colors[] = {
Expand All @@ -131,8 +131,8 @@ int main() {
0.0, 0.0, 1.0, // Top Center
};

Buffer::Attribute a0 (0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a1 (1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a0(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a1(1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));

BufferArray array(vector<vector<Buffer::Attribute>> {{a0}, {a1}});
array.bind();
Expand Down
20 changes: 10 additions & 10 deletions examples/03_grid/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ int main() {

const float vertices[] = {
-0.5f, -0.5f, 0.0f, // Bottom Left
0.5f, -0.5f, 0.0f, // Bottom Right
0.0f, 0.5f, 0.0f, // Top Center
0.5f, -0.5f, 0.0f, // Bottom Right
0.0f, 0.5f, 0.0f, // Top Center

0.0f, -0.5f, 0.0f, //
1.0f, -0.5f, 0.0f, //
1.0f, -0.5f, 1.0f, //
0.0f, -0.5f, 0.0f, //
1.0f, -0.5f, 0.0f, //
1.0f, -0.5f, 1.0f, //

0.5f, 0.0f, 0.0f, //
0.5f, 1.0f, 0.0f, //
0.5f, 1.0f, 1.0f, //
0.5f, 0.0f, 0.0f, //
0.5f, 1.0f, 0.0f, //
0.5f, 1.0f, 1.0f, //
};

const float colors[] = {
Expand All @@ -134,8 +134,8 @@ int main() {
0.0, 0.0, 1.0, // Top Center
};

Buffer::Attribute a0 (0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a1 (1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a0(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a1(1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));

BufferArray array(vector<vector<Buffer::Attribute>> {{a0}, {a1}});
array.bind();
Expand Down
30 changes: 15 additions & 15 deletions examples/04_framebuffer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,22 @@ int main() {

const float vertices[] = {
-0.5f, -0.5f, 0.0f, // Bottom Left
0.5f, -0.5f, 0.0f, // Bottom Right
0.0f, 0.5f, 0.0f // Top Center
0.5f, -0.5f, 0.0f, // Bottom Right
0.0f, 0.5f, 0.0f // Top Center
};

const float texCoords[] = {
-0.5f, -0.5f, // Bottom Left
0.5f, -0.5f, // Bottom Right
0.0f, 0.5f, // Top Center
0.5f, -0.5f, // Bottom Right
0.0f, 0.5f, // Top Center
};

const unsigned int indices[] = {
0, 1, 2, // First Triangle
};

Buffer::Attribute a0 (0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a1 (1, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float));
Buffer::Attribute a0(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float));
Buffer::Attribute a1(1, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float));

BufferArray array(vector<vector<Buffer::Attribute>> {{a0}, {a1}});
array.bind();
Expand All @@ -135,7 +135,7 @@ int main() {
array.bufferElements(sizeof(indices), indices);
array.unbind();

Quad quad ({0, 0}, {1, 1});
Quad quad({0, 0}, {1, 1});

// Needed because FrameBuffer is storing size for future blit to default
FrameBuffer::getDefault().resize(uvec2(width, height));
Expand All @@ -146,14 +146,14 @@ int main() {
fbo.attach(rbo, GL_DEPTH_STENCIL_ATTACHMENT);

Texture::Ptr tex2 = make_shared<Texture>(uvec2(width, height),
Texture::RGBA,
Texture::RGBA,
GL_FLOAT,
0,
Texture::Linear,
Texture::Linear,
Texture::Clamp,
false);
Texture::RGBA,
Texture::RGBA,
GL_FLOAT,
0,
Texture::Linear,
Texture::Linear,
Texture::Clamp,
false);
fbo.attach(tex2, GL_COLOR_ATTACHMENT0);

if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
Expand Down
Loading