Unify shaders
This commit is contained in:
1 parent
7190568012
commit
9d808aa55b
7 files changed
+86
-140
No files matched your search
+17
-11
@@ -1,11 +1,17 @@
|
||||
#version 460 core
|
||||
|
||||
in vec2 fragmentTextureCoordinates;
|
||||
|
||||
uniform sampler2D sampler;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
void main() {
|
||||
color = texture(sampler, fragmentTextureCoordinates);
|
||||
}
|
||||
#version 460 core
|
||||
|
||||
in vec3 fNormal;
|
||||
in vec2 fTextureCoordinates;
|
||||
in vec3 fColor;
|
||||
|
||||
layout(location = 3) uniform sampler2D sampler;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
const vec3 lightDirection = normalize(vec3(0.0f, 0.0f, -1.0f));
|
||||
|
||||
void main() {
|
||||
vec3 sampleColor = texture(sampler, fTextureCoordinates).rgb;
|
||||
float intensity = clamp(dot(lightDirection, -normalize(fNormal)), 0.0f, 1.0f);
|
||||
color = vec4(intensity * sampleColor * fColor + vec3(0.15f, 0.15f, 0.15f), 1.0f);
|
||||
}
|
||||
Reference in new issue
Block a user