diff options
author | Frederico Linhares <fred@linhares.blue> | 2022-08-31 17:43:57 -0300 |
---|---|---|
committer | Frederico Linhares <fred@linhares.blue> | 2022-08-31 17:43:57 -0300 |
commit | a646fe175c20d9d95c76d28d7f8de88b203a8b94 (patch) | |
tree | 0f42a9c45f514b5cce4469a17999596181fd85b4 /glsl | |
parent | f1f1576543bb4e0f3b9bc4cd0ba4a12a70546c3c (diff) |
feat Add projection to 2D graphics pipeline
Diffstat (limited to 'glsl')
-rw-r--r-- | glsl/shader_2d.frag.glsl | 2 | ||||
-rw-r--r-- | glsl/shader_2d.vert.glsl | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/glsl/shader_2d.frag.glsl b/glsl/shader_2d.frag.glsl index 1edbbbb..54ab1be 100644 --- a/glsl/shader_2d.frag.glsl +++ b/glsl/shader_2d.frag.glsl @@ -21,7 +21,7 @@ layout(location = 0) in vec2 in_texture_coord; layout(location = 0) out vec4 out_color; -layout(set = 0, binding = 1) uniform sampler2D texture_sampler; +layout(set = 1, binding = 1) uniform sampler2D texture_sampler; void main() diff --git a/glsl/shader_2d.vert.glsl b/glsl/shader_2d.vert.glsl index 6e8ac59..b053fec 100644 --- a/glsl/shader_2d.vert.glsl +++ b/glsl/shader_2d.vert.glsl @@ -21,7 +21,12 @@ layout(location = 0) in vec2 in_texture_coord; layout(location = 0) out vec2 out_texture_coord; -layout(set = 0, binding = 0) uniform UBOSpritePositions +layout(set = 0, binding = 0) uniform UBOProjection +{ + mat4 proj; +} ubo_projection; + +layout(set = 1, binding = 0) uniform UBOSpritePositions { vec4 positions[128]; } ubo_sprite_positions; @@ -49,5 +54,5 @@ main() coordinate = vec2(position.z, position.w); break; } - gl_Position = vec4(coordinate, 0.0, 1.0); + gl_Position = ubo_projection.proj * vec4(coordinate, 0.0, 1.0); } |