diff options
Diffstat (limited to 'tests/RenderScriptTests/SceneGraph/res')
16 files changed, 215 insertions, 0 deletions
diff --git a/tests/RenderScriptTests/SceneGraph/res/drawable-nodpi/checker.png b/tests/RenderScriptTests/SceneGraph/res/drawable-nodpi/checker.png Binary files differnew file mode 100644 index 0000000..4bf9de5 --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/drawable-nodpi/checker.png diff --git a/tests/RenderScriptTests/SceneGraph/res/drawable-nodpi/defaultcube.png b/tests/RenderScriptTests/SceneGraph/res/drawable-nodpi/defaultcube.png Binary files differnew file mode 100644 index 0000000..351fc12 --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/drawable-nodpi/defaultcube.png diff --git a/tests/RenderScriptTests/SceneGraph/res/drawable-nodpi/robot.png b/tests/RenderScriptTests/SceneGraph/res/drawable-nodpi/robot.png Binary files differnew file mode 100644 index 0000000..f7353fd --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/drawable-nodpi/robot.png diff --git a/tests/RenderScriptTests/SceneGraph/res/menu/loader_menu.xml b/tests/RenderScriptTests/SceneGraph/res/menu/loader_menu.xml new file mode 100644 index 0000000..9ea30107 --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/menu/loader_menu.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +* Copyright (C) 2011 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--> + +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:id="@+id/load_model" + android:title="@string/load_model" /> + <item android:id="@+id/use_blur" + android:title="@string/use_blur" /> +</menu> diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/blur_h.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/blur_h.glsl new file mode 100644 index 0000000..fa468cc --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/blur_h.glsl @@ -0,0 +1,15 @@ +varying vec2 varTex0; + +void main() { + vec2 blurCoord = varTex0; + blurCoord.x = varTex0.x + UNI_blurOffset0; + vec3 col = texture2D(UNI_Tex0, blurCoord).rgb; + blurCoord.x = varTex0.x + UNI_blurOffset1; + col += texture2D(UNI_Tex0, blurCoord).rgb; + blurCoord.x = varTex0.x + UNI_blurOffset2; + col += texture2D(UNI_Tex0, blurCoord).rgb; + blurCoord.x = varTex0.x + UNI_blurOffset3; + col += texture2D(UNI_Tex0, blurCoord).rgb; + + gl_FragColor = vec4(col * 0.25, 0.0); //texture2D(UNI_Tex0, varTex0); +} diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/blur_v.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/blur_v.glsl new file mode 100644 index 0000000..a644a3e --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/blur_v.glsl @@ -0,0 +1,17 @@ +varying vec2 varTex0; + +void main() { + vec2 blurCoord = varTex0; + blurCoord.y = varTex0.y + UNI_blurOffset0; + vec3 col = texture2D(UNI_Tex0, blurCoord).rgb; + blurCoord.y = varTex0.y + UNI_blurOffset1; + col += texture2D(UNI_Tex0, blurCoord).rgb; + blurCoord.y = varTex0.y + UNI_blurOffset2; + col += texture2D(UNI_Tex0, blurCoord).rgb; + blurCoord.y = varTex0.y + UNI_blurOffset3; + col += texture2D(UNI_Tex0, blurCoord).rgb; + + col = col * 0.25; + + gl_FragColor = vec4(col, 0.0); //texture2D(UNI_Tex0, varTex0); +} diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/blur_vertex.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/blur_vertex.glsl new file mode 100644 index 0000000..bc824b6 --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/blur_vertex.glsl @@ -0,0 +1,7 @@ +varying vec2 varTex0; + +void main() { + gl_Position = ATTRIB_position; + varTex0 = ATTRIB_texture0; +} + diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/diffuse.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/diffuse.glsl new file mode 100644 index 0000000..5d8938b --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/diffuse.glsl @@ -0,0 +1,19 @@ +varying vec3 varWorldPos; +varying vec3 varWorldNormal; +varying vec2 varTex0; + +void main() { + + vec3 V = normalize(UNI_cameraPos.xyz - varWorldPos.xyz); + vec3 worldNorm = (varWorldNormal); + + vec3 light0Vec = V; + vec3 light0R = reflect(light0Vec, worldNorm); + float light0_Diffuse = dot(worldNorm, light0Vec); + + vec2 t0 = varTex0.xy; + lowp vec4 col = texture2D(UNI_Tex0, t0).rgba; + col.xyz = col.xyz * light0_Diffuse * 1.2; + gl_FragColor = col; //vec4(0.0, 1.0, 0.0, 0.0); +} + diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/metal.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/metal.glsl new file mode 100644 index 0000000..51f0612 --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/metal.glsl @@ -0,0 +1,23 @@ +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 = V; + vec3 light0R = reflect(light0Vec, worldNorm); + float light0_Diffuse = clamp(dot(worldNorm, light0Vec), 0.0, 1.0); + float light0Spec = clamp(dot(-light0R, V), 0.001, 1.0); + float light0_Specular = pow(light0Spec, 15.0) * 0.5; + + vec2 t0 = varTex0.xy; + lowp vec4 col = texture2D(UNI_Tex0, t0).rgba; + col.xyz = col.xyz * (textureCube(UNI_Tex1, worldNorm).rgb * 0.5 + vec3(light0_Diffuse)); + col.xyz += light0_Specular * vec3(0.8, 0.8, 1.0); + + gl_FragColor = col; +} + diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/paintf.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/paintf.glsl new file mode 100644 index 0000000..893d553 --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/paintf.glsl @@ -0,0 +1,26 @@ +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 = V; + vec3 light0R = reflect(light0Vec, worldNorm); + float light0_Diffuse = clamp(dot(worldNorm, light0Vec), 0.01, 0.99); + float light0Spec = clamp(dot(-light0R, V), 0.001, 1.0); + float light0_Specular = pow(light0Spec, 150.0) * 0.5; + + vec2 t0 = varTex0.xy; + lowp vec4 col = texture2D(UNI_Tex0, t0).rgba; + col.xyz = col.xyz * light0_Diffuse * 1.1; + col.xyz += light0_Specular * vec3(0.8, 0.8, 1.0); + + float fresnel = mix(pow(1.0 - light0_Diffuse, 15.0), 1.0, 0.1); + col.xyz = mix(col.xyz, textureCube(UNI_Tex1, -light0R).rgb * 2.4, fresnel); + col.w = 0.8; + gl_FragColor = col; +} + diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/plastic.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/plastic.glsl new file mode 100644 index 0000000..ceb53bd --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/plastic.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 = V; + vec3 light0R = reflect(light0Vec, worldNorm); + float light0_Diffuse = clamp(dot(worldNorm, light0Vec), 0.0, 1.0); + float light0Spec = clamp(dot(-light0R, V), 0.001, 1.0); + float light0_Specular = pow(light0Spec, 10.0) * 0.5; + + vec2 t0 = varTex0.xy; + lowp vec4 col = texture2D(UNI_Tex0, t0).rgba; + col.xyz = col.xyz * light0_Diffuse * 1.2; + col.xyz += light0_Specular * vec3(0.8, 0.8, 1.0); + gl_FragColor = col; +} + diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/robot.a3d b/tests/RenderScriptTests/SceneGraph/res/raw/robot.a3d Binary files differnew file mode 100644 index 0000000..f48895c --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/robot.a3d diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/select_color.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/select_color.glsl new file mode 100644 index 0000000..59a267b --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/select_color.glsl @@ -0,0 +1,13 @@ +varying vec2 varTex0; + +void main() { + vec3 col = texture2D(UNI_Tex0, varTex0).rgb; + + vec3 desat = vec3(0.299, 0.587, 0.114); + float lum = dot(desat, col); + float stepVal = step(lum, 0.8); + col = mix(col, vec3(0.0), stepVal)*0.8; + + gl_FragColor = vec4(col, 0.0); +} + diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl new file mode 100644 index 0000000..1ea234f --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl @@ -0,0 +1,17 @@ +varying vec3 varWorldPos; +varying vec3 varWorldNormal; +varying vec2 varTex0; + +// This is where actual shader code begins +void main() { + vec4 objPos = ATTRIB_position; + vec4 worldPos = UNI_model * objPos; + gl_Position = UNI_viewProj * worldPos; + + mat3 model3 = mat3(UNI_model[0].xyz, UNI_model[1].xyz, UNI_model[2].xyz); + vec3 worldNorm = model3 * ATTRIB_normal; + + varWorldPos = worldPos.xyz; + varWorldNormal = worldNorm; + varTex0 = ATTRIB_texture0; +} diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/texture.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/texture.glsl new file mode 100644 index 0000000..dd709cf --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/texture.glsl @@ -0,0 +1,7 @@ +varying vec2 varTex0; + +void main() { + lowp vec4 col = texture2D(UNI_Tex0, varTex0).rgba; + gl_FragColor = col; +} + diff --git a/tests/RenderScriptTests/SceneGraph/res/values/strings.xml b/tests/RenderScriptTests/SceneGraph/res/values/strings.xml new file mode 100644 index 0000000..c916d79 --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/values/strings.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +* Copyright (C) 2011 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <skip /> + <string name="load_model">Load Model</string> + <string name="use_blur">Use Blur</string> +</resources> |