- Timestamp:
- Aug 25, 2019, 12:58:06 AM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 721e8be
- Parents:
- d53ef6a
- Location:
- shaders
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
shaders/overlay.frag
rd53ef6a rf00ee54 4 4 layout(binding = 0) uniform sampler2D uiTexSampler; 5 5 6 layout(location = 0) in vec3 fragColor; 7 layout(location = 1) in vec2 fragTexCoord; 8 layout(location = 2) flat in uint isOverlay; 6 layout(location = 0) in vec2 fragTexCoord; 9 7 10 8 layout(location = 0) out vec4 outColor; … … 12 10 void main() { 13 11 outColor = texture(uiTexSampler, fragTexCoord); 14 15 if (isOverlay == 1) {16 outColor = texture(uiTexSampler, fragTexCoord);17 } else {18 outColor = vec4(fragColor * texture(uiTexSampler, fragTexCoord).rgb, 1.0);19 }20 12 } -
shaders/overlay.vert
rd53ef6a rf00ee54 3 3 4 4 layout(location = 0) in vec3 inPosition; 5 layout(location = 1) in vec3 inColor; 6 layout(location = 2) in vec2 inTexCoord; 5 layout(location = 1) in vec2 inTexCoord; 7 6 8 layout(location = 0) out vec3 fragColor; 9 layout(location = 1) out vec2 fragTexCoord; 10 layout(location = 2) out uint isOverlay; 7 layout(location = 0) out vec2 fragTexCoord; 11 8 12 9 void main() { 13 if (gl_VertexIndex < 0) { 14 fragColor = inColor; 15 isOverlay = 0; 16 } else { 17 fragColor = inColor; 18 isOverlay = 1; 19 } 10 fragTexCoord = inTexCoord; 20 11 21 fragTexCoord = inTexCoord;22 12 gl_Position = vec4(inPosition, 1.0); 23 13 } -
shaders/scene.frag
rd53ef6a rf00ee54 3 3 4 4 layout(binding = 1) uniform sampler2D texSampler; 5 layout(binding = 2) uniform sampler2D uiTexSampler;6 5 7 6 layout(location = 0) in vec3 fragColor; 8 7 layout(location = 1) in vec2 fragTexCoord; 9 layout(location = 2) flat in uint isOverlay;10 8 11 9 layout(location = 0) out vec4 outColor; 12 10 13 11 void main() { 14 if (isOverlay == 1) { 15 outColor = texture(uiTexSampler, fragTexCoord); 16 } else { 17 outColor = vec4(fragColor * texture(texSampler, fragTexCoord).rgb, 1.0); 18 } 12 outColor = vec4(fragColor * texture(texSampler, fragTexCoord).rgb, 1.0); 19 13 } -
shaders/scene.vert
rd53ef6a rf00ee54 14 14 layout(location = 0) out vec3 fragColor; 15 15 layout(location = 1) out vec2 fragTexCoord; 16 layout(location = 2) out uint isOverlay;17 16 18 17 void main() { 19 if (gl_VertexIndex < 8) { 20 gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 1.0); 21 fragColor = inColor; 22 isOverlay = 0; 23 } else { 24 gl_Position = vec4(inPosition, 1.0); 25 fragColor = vec3(1.0, 1.0, 1.0); 26 isOverlay = 1; 27 } 18 fragColor = inColor; 19 fragTexCoord = inTexCoord; 28 20 29 fragTexCoord = inTexCoord;21 gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 1.0); 30 22 }
Note:
See TracChangeset
for help on using the changeset viewer.