-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/plugin/shaders #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c033eb9
Feat: First shader plugin with glsl and spirv
bobis33 caae4fa
Fix: improve usage of shader plugin
bobis33 fa43b80
Fix: missing git shallow and git progress for fetch_content deps
bobis33 d57fa27
Fix:only build tests when flag, smooth fps logging
bobis33 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) out vec4 FragColor; | ||
|
|
||
| layout(binding = 1) uniform TimeColor { | ||
| float time; | ||
| } uTime; | ||
|
|
||
| void main() | ||
| { | ||
| float r = 0.5 + 0.5 * sin(uTime.time); | ||
| float g = 0.5 + 0.5 * sin(uTime.time * 1.3); | ||
| float b = 0.5 + 0.5 * sin(uTime.time * 2.1); | ||
| FragColor = vec4(r, g, b, 1.0); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) in vec2 aPos; | ||
|
|
||
| layout(binding = 0) uniform TimeData { | ||
| float time; | ||
| } uTime; | ||
|
|
||
| void main() | ||
| { | ||
| float scale = 0.5 + 0.5 * sin(uTime.time); | ||
| gl_Position = vec4(aPos * scale, 0.0, 1.0); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) in vec3 vColor; | ||
| layout(location = 0) out vec4 FragColor; | ||
|
|
||
| void main() | ||
| { | ||
| FragColor = vec4(vColor, 1.0); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) in vec2 aPos; | ||
| layout(location = 1) in vec3 aColor; | ||
|
|
||
| layout(location = 0) out vec3 vColor; | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = vec4(aPos, 0.0, 1.0); | ||
| vColor = aColor; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) in vec2 vUV; | ||
| layout(location = 0) out vec4 FragColor; | ||
|
|
||
| layout(binding = 0) uniform sampler2D uTexture; | ||
|
|
||
| void main() | ||
| { | ||
| // Même sans texture bindée, ça se compile. | ||
| FragColor = texture(uTexture, vUV); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) in vec2 aPos; | ||
| layout(location = 1) in vec2 aUV; | ||
|
|
||
| layout(location = 0) out vec2 vUV; | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = vec4(aPos, 0.0, 1.0); | ||
| vUV = aUV; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) in vec3 vColor; | ||
| layout(location = 0) out vec4 FragColor; | ||
|
|
||
| void main() | ||
| { | ||
| FragColor = vec4(vColor, 1.0); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) in vec2 aPos; | ||
| layout(location = 1) in vec3 aColor; | ||
|
|
||
| layout(location = 0) out vec3 vColor; | ||
|
|
||
| layout(binding = 0) uniform Matrices { | ||
| mat4 model; | ||
| mat4 view; | ||
| mat4 proj; | ||
| } uMVP; | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = uMVP.proj * uMVP.view * uMVP.model * vec4(aPos, 0.0, 1.0); | ||
| vColor = aColor; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) out vec4 FragColor; | ||
|
|
||
| layout(binding = 0) uniform ColorData { | ||
| vec3 color; | ||
| } uColor; | ||
|
|
||
| void main() | ||
| { | ||
| FragColor = vec4(uColor.color, 1.0); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #version 450 core | ||
|
|
||
| layout(location = 0) in vec2 aPos; | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = vec4(aPos, 0.0, 1.0); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
modules/Interfaces/include/Interfaces/Renderer/ARenderer.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /// | ||
| /// @file ARenderer.hpp | ||
| /// @brief This file contains the Renderer abstract class | ||
| /// @namespace cae | ||
| /// | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Interfaces/Renderer/IRenderer.hpp" | ||
|
|
||
| #include <memory> | ||
|
|
||
| namespace cae | ||
| { | ||
|
|
||
| /// | ||
| /// @interface ARenderer | ||
| /// @brief Abstract class for renderer | ||
| /// @namespace cae | ||
| /// | ||
| class ARenderer : public IRenderer | ||
| { | ||
|
|
||
| public: | ||
| ~ARenderer() override = default; | ||
|
|
||
| std::shared_ptr<IShader> getShader() const override { return m_shader; } | ||
| std::shared_ptr<IModel> getModel() const override { return m_model; } | ||
|
|
||
| void setShader(const std::shared_ptr<IShader> shader) override { m_shader = shader; } | ||
| void setModel(const std::shared_ptr<IModel> model) override { m_model = model; } | ||
|
|
||
| protected: | ||
| std::shared_ptr<IShader> m_shader; | ||
| std::shared_ptr<IModel> m_model; | ||
|
|
||
| }; // interface ARenderer | ||
|
|
||
| } // namespace cae |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / CodeQL
Commented-out code Note
Copilot Autofix
AI 19 days ago
To fix the problem, simply remove the commented-out code on line 36:
// ShaderSourceType type;. This will make the code cleaner, less confusing, and prevent the risk of misleading developers or creating unnecessary clutter. Only edit the affected region, leaving the remainder of the struct and file unchanged. No further changes, imports, methods, or definitions are necessary.