Created
October 9, 2018 14:50
-
-
Save Dooskington/df7b6177f1e2b504b7995c66348e00de to your computer and use it in GitHub Desktop.
Shaders
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
FRAGMENT: | |
#version 450 | |
#extension GL_ARB_separate_shader_objects : enable | |
layout(location = 0) in vec4 fragColor; | |
layout(location = 1) in vec2 fragUv; | |
layout(location = 0) out vec4 target; | |
layout(set = 0, binding = 1) uniform texture2D colorMap; | |
layout(set = 0, binding = 2) uniform sampler colorSampler; | |
void main() { | |
target = fragColor * texture(sampler2D(colorMap, colorSampler), fragUv); | |
} | |
VERTEX: | |
#version 450 | |
#extension GL_ARB_separate_shader_objects : enable | |
layout(location = 0) in vec3 inPosition; | |
layout(location = 1) in vec4 inColor; | |
layout(location = 2) in vec2 inUv; | |
layout(location = 0) out vec4 fragColor; | |
layout(location = 1) out vec2 fragUv; | |
layout(binding = 0) uniform UniformBufferObject { | |
mat4 view; | |
mat4 model; | |
mat4 projection; | |
} ubo; | |
void main() { | |
fragColor = inColor; | |
fragUv = inUv; | |
gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPosition, 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment