-
Notifications
You must be signed in to change notification settings - Fork 0
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
shader restructure #16
+2,040
−751
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
23517fb
implament 2d render
arozx 388dcea
add 2d render support properly
arozx 7267bef
fixes: debug window programmer error
arozx cd0ab27
update log levels
arozx 0f15f5e
update shader system
arozx 1984bc2
fix logging on windows
arozx ebf466c
load exising shaders from disk
arozx adbe181
Merge branch 'main' into dev
arozx 2fcbf18
use direct addresing for batched textures
arozx 82d2f2b
Update src/Renderer/Texture.h
arozx 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 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,3 @@ | ||
{ | ||
"enableCMake": true | ||
} |
This file contains 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"CurrentProjectSetting": "x64-Debug" | ||
"CurrentProjectSetting": "x64-Release" | ||
} |
This file contains 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 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 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,49 @@ | ||
#version 330 core | ||
|
||
in vec4 v_Color; | ||
in vec2 v_TexCoord; | ||
in float v_TexIndex; | ||
in float v_TilingFactor; | ||
|
||
uniform sampler2D u_Textures[32]; | ||
|
||
out vec4 FragColor; | ||
|
||
void main() { | ||
vec4 texColor = v_Color; | ||
switch(int(v_TexIndex)) { | ||
case 0: texColor *= texture(u_Textures[ 0], v_TexCoord * v_TilingFactor); break; | ||
case 1: texColor *= texture(u_Textures[ 1], v_TexCoord * v_TilingFactor); break; | ||
case 2: texColor *= texture(u_Textures[ 2], v_TexCoord * v_TilingFactor); break; | ||
case 3: texColor *= texture(u_Textures[ 3], v_TexCoord * v_TilingFactor); break; | ||
case 4: texColor *= texture(u_Textures[ 4], v_TexCoord * v_TilingFactor); break; | ||
case 5: texColor *= texture(u_Textures[ 5], v_TexCoord * v_TilingFactor); break; | ||
case 6: texColor *= texture(u_Textures[ 6], v_TexCoord * v_TilingFactor); break; | ||
case 7: texColor *= texture(u_Textures[ 7], v_TexCoord * v_TilingFactor); break; | ||
case 8: texColor *= texture(u_Textures[ 8], v_TexCoord * v_TilingFactor); break; | ||
case 9: texColor *= texture(u_Textures[ 9], v_TexCoord * v_TilingFactor); break; | ||
case 10: texColor *= texture(u_Textures[10], v_TexCoord * v_TilingFactor); break; | ||
case 11: texColor *= texture(u_Textures[11], v_TexCoord * v_TilingFactor); break; | ||
case 12: texColor *= texture(u_Textures[12], v_TexCoord * v_TilingFactor); break; | ||
case 13: texColor *= texture(u_Textures[13], v_TexCoord * v_TilingFactor); break; | ||
case 14: texColor *= texture(u_Textures[14], v_TexCoord * v_TilingFactor); break; | ||
case 15: texColor *= texture(u_Textures[15], v_TexCoord * v_TilingFactor); break; | ||
case 16: texColor *= texture(u_Textures[16], v_TexCoord * v_TilingFactor); break; | ||
case 17: texColor *= texture(u_Textures[17], v_TexCoord * v_TilingFactor); break; | ||
case 18: texColor *= texture(u_Textures[18], v_TexCoord * v_TilingFactor); break; | ||
case 19: texColor *= texture(u_Textures[19], v_TexCoord * v_TilingFactor); break; | ||
case 20: texColor *= texture(u_Textures[20], v_TexCoord * v_TilingFactor); break; | ||
case 21: texColor *= texture(u_Textures[21], v_TexCoord * v_TilingFactor); break; | ||
case 22: texColor *= texture(u_Textures[22], v_TexCoord * v_TilingFactor); break; | ||
case 23: texColor *= texture(u_Textures[23], v_TexCoord * v_TilingFactor); break; | ||
case 24: texColor *= texture(u_Textures[24], v_TexCoord * v_TilingFactor); break; | ||
case 25: texColor *= texture(u_Textures[25], v_TexCoord * v_TilingFactor); break; | ||
case 26: texColor *= texture(u_Textures[26], v_TexCoord * v_TilingFactor); break; | ||
case 27: texColor *= texture(u_Textures[27], v_TexCoord * v_TilingFactor); break; | ||
case 28: texColor *= texture(u_Textures[28], v_TexCoord * v_TilingFactor); break; | ||
case 29: texColor *= texture(u_Textures[29], v_TexCoord * v_TilingFactor); break; | ||
case 30: texColor *= texture(u_Textures[30], v_TexCoord * v_TilingFactor); break; | ||
case 31: texColor *= texture(u_Textures[31], v_TexCoord * v_TilingFactor); break; | ||
} | ||
arozx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
FragColor = texColor; | ||
} |
This file contains 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,22 @@ | ||
#version 330 core | ||
|
||
layout (location = 0) in vec3 a_Position; | ||
layout (location = 1) in vec4 a_Color; | ||
layout (location = 2) in vec2 a_TexCoord; | ||
layout (location = 3) in float a_TexIndex; | ||
layout (location = 4) in float a_TilingFactor; | ||
|
||
uniform mat4 u_ViewProjection; | ||
|
||
out vec4 v_Color; | ||
out vec2 v_TexCoord; | ||
out float v_TexIndex; | ||
out float v_TilingFactor; | ||
|
||
void main() { | ||
v_Color = a_Color; | ||
v_TexCoord = a_TexCoord; | ||
v_TexIndex = a_TexIndex; | ||
v_TilingFactor = a_TilingFactor; | ||
gl_Position = u_ViewProjection * vec4(a_Position, 1.0); | ||
} |
This file contains 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove duplicate include directory entry.
The same include path
${CMAKE_SOURCE_DIR}/build/vcpkg_installed/x86-windows/include
is added twice.Apply this diff to fix the redundancy:
target_include_directories(voxel-engine PUBLIC ${CMAKE_SOURCE_DIR}/src ${IMGUI_DIR} ${IMGUI_DIR}/backends ${CMAKE_SOURCE_DIR}/build/vcpkg_installed/x86-windows/include ${CMAKE_SOURCE_DIR}/external/stb_image/src ${CMAKE_SOURCE_DIR}/external/json ${CMAKE_SOURCE_DIR}/external/glad/include - ${CMAKE_SOURCE_DIR}/build/vcpkg_installed/x86-windows/include ${CMAKE_SOURCE_DIR}/external/sol2 )
Also applies to: 104-104