diff options
Diffstat (limited to 'shaders')
| -rw-r--r-- | shaders/shader.frag | 11 | ||||
| -rw-r--r-- | shaders/shader.vert | 7 |
2 files changed, 14 insertions, 4 deletions
diff --git a/shaders/shader.frag b/shaders/shader.frag index f554b9b..20550ba 100644 --- a/shaders/shader.frag +++ b/shaders/shader.frag @@ -1,8 +1,15 @@ #version 460 -layout(location = 0) in vec3 vertexColor; +layout(binding = 1) uniform sampler2D textureSampler; + +layout(location = 0) in vec3 fragmentColor; +layout(location = 1) in vec2 fragmentTextureCoordinate; + layout(location = 0) out vec4 outColor; void main() { - outColor = vec4(vertexColor, 1.0); + outColor = vec4(fragmentColor + * texture(textureSampler, + fragmentTextureCoordinate).rgb, + 1.0); } diff --git a/shaders/shader.vert b/shaders/shader.vert index d72c6a8..b14c94b 100644 --- a/shaders/shader.vert +++ b/shaders/shader.vert @@ -14,8 +14,10 @@ layout(binding = 0) uniform UniformBlock { layout(location = 0) in vec2 inPosition; layout(location = 1) in vec3 inColor; +layout(location = 2) in vec2 inTextureCoordinate; -layout(location = 0) out vec3 vertexColor; +layout(location = 0) out vec3 fragmentColor; +layout(location = 1) out vec2 fragmentTextureCoordinate; // ///////////////// @@ -84,6 +86,7 @@ vec4 apply_all_transforms(vec3 position) { void main() { gl_Position = apply_all_transforms(vec3(inPosition, 0.0)); - vertexColor = inColor; + fragmentColor = inColor; + fragmentTextureCoordinate = inTextureCoordinate; } |