reworked lighting uniforms
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / vg / standard.fs.glsl
diff --git a/shaders/vg/standard.fs.glsl b/shaders/vg/standard.fs.glsl
new file mode 100644 (file)
index 0000000..e3f05c8
--- /dev/null
@@ -0,0 +1,20 @@
+out vec4 FragColor;
+
+uniform sampler2D uTexMain;
+uniform vec4 uColour;
+
+in vec4 aColour;
+in vec2 aUv;
+in vec3 aNorm;
+in vec3 aCo;
+
+void main()
+{
+   vec3 diffuse = texture( uTexMain, aUv ).rgb;
+   float light1 = max(0.0,dot(-vec3(0.5,-0.8,0.25), aNorm));
+   float light2 = max(0.0,dot(-vec3(-0.8,0.5,-0.25), aNorm));
+   diffuse += vec3(0.2,0.2,0.2) +
+             vec3(1.0,1.0,0.9)*light1 + 
+             vec3(0.1,0.3,0.4)*light2;
+   FragColor = vec4(diffuse*uColour.rgb, aColour.a*uColour.a);
+}