diff options
Diffstat (limited to 'tests/RenderScriptTests/SceneGraph/res/raw')
-rw-r--r-- | tests/RenderScriptTests/SceneGraph/res/raw/diffuse_lights.glsl | 22 | ||||
-rw-r--r-- | tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl | 5 |
2 files changed, 27 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; +} + diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl index 1ea234f..7910a54 100644 --- a/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl +++ b/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl @@ -1,3 +1,8 @@ +/* + rs_matrix4x4 model; + rs_matrix4x4 viewProj; +*/ + varying vec3 varWorldPos; varying vec3 varWorldNormal; varying vec2 varTex0; |