summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl')
-rw-r--r--tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl
new file mode 100644
index 0000000..ef93e1c
--- /dev/null
+++ b/tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl
@@ -0,0 +1,22 @@
+varying vec3 varWorldPos;
+varying vec3 varWorldNormal;
+varying vec2 varTex0;
+
+void main() {
+
+ vec3 V = normalize(UNI_cameraPos.xyz - varWorldPos.xyz);
+ vec3 worldNorm = normalize(varWorldNormal);
+
+ vec3 light0Vec = normalize(UNI_lightPos_0.xyz - varWorldPos.xyz);
+ float light0_Diffuse = clamp(dot(worldNorm, light0Vec), 0.0, 1.0);
+
+ vec3 light1Vec = normalize(UNI_lightPos_1.xyz - varWorldPos.xyz);
+ float light1_Diffuse = clamp(dot(worldNorm, light1Vec), 0.0, 1.0);
+
+ vec2 t0 = varTex0.xy;
+ lowp vec4 col = UNI_diffuse;
+ col.xyz = col.xyz * (light0_Diffuse * UNI_lightColor_0.xyz +
+ light1_Diffuse * UNI_lightColor_1.xyz);
+ gl_FragColor = col;
+}
+