-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Got Animation Render Pipeline Working
- Loading branch information
1 parent
4280f12
commit 3dd1a79
Showing
16 changed files
with
260 additions
and
14 deletions.
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
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
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,15 @@ | ||
#version 450 | ||
|
||
layout (location = 0) in vec3 fragColor; | ||
layout (location = 1) in vec2 fragTexCoord; | ||
layout (location = 2) in flat int fragTexId; | ||
|
||
layout(location = 0) out vec4 Color; | ||
layout(location = 1) out int EntityIds; | ||
|
||
layout(set = 1, binding = 0) uniform sampler2D sprites[32]; | ||
|
||
void main() { | ||
EntityIds = 1; | ||
Color = texture(sprites[fragTexId], fragTexCoord) * vec4(fragColor, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#version 450 | ||
|
||
layout (location = 0) in vec3 aPos; | ||
layout (location = 1) in vec3 aColor; | ||
layout (location = 2) in vec2 aTexCoord; | ||
layout (location = 3) in int aTexId; | ||
|
||
layout (location = 0) out vec3 fragColor; | ||
layout (location = 1) out vec2 fragTexCoord; | ||
layout (location = 2) out flat int fragTexId; | ||
|
||
// Global Frame data | ||
layout (set = 0, binding = 0) uniform Camera { | ||
mat4 proj; | ||
mat4 view; | ||
vec3 cameraPosition; | ||
} camera; | ||
|
||
void main() { | ||
gl_Position = camera.proj * camera.view * vec4(aPos, 1.0); | ||
fragColor = aColor; | ||
fragTexCoord = aTexCoord; | ||
fragTexId = aTexId; | ||
} |
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,23 @@ | ||
#version 450 | ||
|
||
layout (location = 0) in vec3 fragColor; | ||
layout (location = 1) in vec2 fragTexCoord; | ||
|
||
layout (set = 1, binding = 0) uniform sampler2D sprite; | ||
|
||
layout (set = 1, binding = 1) uniform AnimData { | ||
float currentFrameCountX; | ||
float currentFrameCountY; | ||
float totalFrameCountX; | ||
float totalFrameCountY; | ||
} animData; | ||
|
||
layout(location = 0) out vec4 Color; | ||
|
||
void main() { | ||
float animTexCoordX = (fragTexCoord.x + animData.currentFrameCountX) * (1.0 / animData.totalFrameCountX); | ||
float animTexCoordY = (fragTexCoord.y + animData.currentFrameCountY) * (1.0 / animData.totalFrameCountY); | ||
|
||
vec2 animTexCoords = vec2(animTexCoordX, animTexCoordY); | ||
Color = texture(sprite, animTexCoords) * vec4(fragColor, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#version 450 | ||
|
||
layout (location = 0) in vec3 aPos; | ||
layout (location = 1) in vec3 aColor; | ||
layout (location = 2) in vec2 aTexCoord; | ||
|
||
layout (location = 0) out vec3 fragColor; | ||
layout (location = 1) out vec2 fragTexCoord; | ||
|
||
// Global Frame data | ||
layout (set = 0, binding = 0) uniform Camera { | ||
mat4 proj; | ||
mat4 view; | ||
vec3 cameraPosition; | ||
} camera; | ||
|
||
void main() { | ||
gl_Position = camera.proj * camera.view * vec4(aPos, 1.0); | ||
fragColor = aColor; | ||
fragTexCoord = aTexCoord; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.