diff options
Diffstat (limited to 'tests/RenderScriptTests/MiscSamples/res/raw')
11 files changed, 192 insertions, 0 deletions
diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/multitexf.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/multitexf.glsl new file mode 100644 index 0000000..e492a47 --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/multitexf.glsl @@ -0,0 +1,13 @@ +varying vec2 varTex0; + +void main() { + vec2 t0 = varTex0.xy; + lowp vec4 col0 = texture2D(UNI_Tex0, t0).rgba; + lowp vec4 col1 = texture2D(UNI_Tex1, t0*4.0).rgba; + lowp vec4 col2 = texture2D(UNI_Tex2, t0).rgba; + col0.xyz = col0.xyz*col1.xyz*1.5; + col0.xyz = mix(col0.xyz, col2.xyz, col2.w); + col0.w = 0.5; + gl_FragColor = col0; +} + diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/shader2f.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/shader2f.glsl new file mode 100644 index 0000000..5fc05f1 --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/shader2f.glsl @@ -0,0 +1,29 @@ +varying vec3 varWorldPos; +varying vec3 varWorldNormal; +varying vec2 varTex0; + +void main() { + + vec3 V = normalize(-varWorldPos.xyz); + vec3 worldNorm = normalize(varWorldNormal); + + vec3 light0Vec = normalize(UNI_light0_Posision.xyz - varWorldPos); + vec3 light0R = -reflect(light0Vec, worldNorm); + float light0_Diffuse = clamp(dot(worldNorm, light0Vec), 0.0, 1.0) * UNI_light0_Diffuse; + float light0Spec = clamp(dot(light0R, V), 0.001, 1.0); + float light0_Specular = pow(light0Spec, UNI_light0_CosinePower) * UNI_light0_Specular; + + vec3 light1Vec = normalize(UNI_light1_Posision.xyz - varWorldPos); + vec3 light1R = reflect(light1Vec, worldNorm); + float light1_Diffuse = clamp(dot(worldNorm, light1Vec), 0.0, 1.0) * UNI_light1_Diffuse; + float light1Spec = clamp(dot(light1R, V), 0.001, 1.0); + float light1_Specular = pow(light1Spec, UNI_light1_CosinePower) * UNI_light1_Specular; + + vec2 t0 = varTex0.xy; + lowp vec4 col = texture2D(UNI_Tex0, t0).rgba; + col.xyz = col.xyz * (light0_Diffuse * UNI_light0_DiffuseColor.xyz + light1_Diffuse * UNI_light1_DiffuseColor.xyz); + col.xyz += light0_Specular * UNI_light0_SpecularColor.xyz; + col.xyz += light1_Specular * UNI_light1_SpecularColor.xyz; + gl_FragColor = col; +} + diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/shader2movev.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/shader2movev.glsl new file mode 100644 index 0000000..a2c807e --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/shader2movev.glsl @@ -0,0 +1,21 @@ +varying vec3 varWorldPos; +varying vec3 varWorldNormal; +varying vec2 varTex0; + +// This is where actual shader code begins +void main() { + vec4 objPos = ATTRIB_position; + vec3 oldPos = objPos.xyz; + objPos.xyz += 0.1*sin(objPos.xyz*2.0 + UNI_time); + objPos.xyz += 0.05*sin(objPos.xyz*4.0 + UNI_time*0.5); + objPos.xyz += 0.02*sin(objPos.xyz*7.0 + UNI_time*0.75); + vec4 worldPos = UNI_model * objPos; + gl_Position = UNI_proj * worldPos; + + mat3 model3 = mat3(UNI_model[0].xyz, UNI_model[1].xyz, UNI_model[2].xyz); + vec3 worldNorm = model3 * (ATTRIB_normal + oldPos - objPos.xyz); + + varWorldPos = worldPos.xyz; + varWorldNormal = worldNorm; + varTex0 = ATTRIB_texture0; +} diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/shader2v.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/shader2v.glsl new file mode 100644 index 0000000..e6885a3 --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/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_proj * 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/MiscSamples/res/raw/shaderarrayf.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/shaderarrayf.glsl new file mode 100644 index 0000000..238ecad --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/shaderarrayf.glsl @@ -0,0 +1,16 @@ + +varying lowp float light0_Diffuse; +varying lowp float light0_Specular; +varying lowp float light1_Diffuse; +varying lowp float light1_Specular; +varying vec2 varTex0; + +void main() { + vec2 t0 = varTex0.xy; + lowp vec4 col = texture2D(UNI_Tex0, t0).rgba; + col.xyz = col.xyz * (light0_Diffuse * UNI_light_DiffuseColor[0].xyz + light1_Diffuse * UNI_light_DiffuseColor[1].xyz); + col.xyz += light0_Specular * UNI_light_SpecularColor[0].xyz; + col.xyz += light1_Specular * UNI_light_SpecularColor[1].xyz; + gl_FragColor = col; +} + diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/shaderarrayv.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/shaderarrayv.glsl new file mode 100644 index 0000000..7a1310a --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/shaderarrayv.glsl @@ -0,0 +1,32 @@ +varying float light0_Diffuse; +varying float light0_Specular; +varying float light1_Diffuse; +varying float light1_Specular; +varying vec2 varTex0; + +// This is where actual shader code begins +void main() { + vec4 worldPos = UNI_model[0] * ATTRIB_position; + worldPos = UNI_model[1] * worldPos; + gl_Position = UNI_proj * worldPos; + + mat4 model0 = UNI_model[0]; + mat3 model3 = mat3(model0[0].xyz, model0[1].xyz, model0[2].xyz); + vec3 worldNorm = model3 * ATTRIB_normal; + vec3 V = normalize(-worldPos.xyz); + + vec3 light0Vec = normalize(UNI_light_Posision[0].xyz - worldPos.xyz); + vec3 light0R = -reflect(light0Vec, worldNorm); + light0_Diffuse = clamp(dot(worldNorm, light0Vec), 0.0, 1.0) * UNI_light_Diffuse[0]; + float light0Spec = clamp(dot(light0R, V), 0.001, 1.0); + light0_Specular = pow(light0Spec, UNI_light_CosinePower[0]) * UNI_light_Specular[0]; + + vec3 light1Vec = normalize(UNI_light_Posision[1].xyz - worldPos.xyz); + vec3 light1R = reflect(light1Vec, worldNorm); + light1_Diffuse = clamp(dot(worldNorm, light1Vec), 0.0, 1.0) * UNI_light_Diffuse[1]; + float light1Spec = clamp(dot(light1R, V), 0.001, 1.0); + light1_Specular = pow(light1Spec, UNI_light_CosinePower[1]) * UNI_light_Specular[1]; + + gl_PointSize = 1.0; + varTex0 = ATTRIB_texture0; +} diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/shadercubef.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/shadercubef.glsl new file mode 100644 index 0000000..15696a4 --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/shadercubef.glsl @@ -0,0 +1,8 @@ + +varying vec3 worldNormal; + +void main() { + lowp vec4 col = textureCube(UNI_Tex0, worldNormal); + gl_FragColor = col; +} + diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/shadercubev.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/shadercubev.glsl new file mode 100644 index 0000000..70f5cd6 --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/shadercubev.glsl @@ -0,0 +1,10 @@ +varying vec3 worldNormal; + +// This is where actual shader code begins +void main() { + vec4 worldPos = UNI_model * ATTRIB_position; + gl_Position = UNI_proj * worldPos; + + mat3 model3 = mat3(UNI_model[0].xyz, UNI_model[1].xyz, UNI_model[2].xyz); + worldNormal = model3 * ATTRIB_normal; +} diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/shaderf.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/shaderf.glsl new file mode 100644 index 0000000..d56e203 --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/shaderf.glsl @@ -0,0 +1,16 @@ + +varying lowp float light0_Diffuse; +varying lowp float light0_Specular; +varying lowp float light1_Diffuse; +varying lowp float light1_Specular; +varying vec2 varTex0; + +void main() { + vec2 t0 = varTex0.xy; + lowp vec4 col = texture2D(UNI_Tex0, t0).rgba; + col.xyz = col.xyz * (light0_Diffuse * UNI_light0_DiffuseColor.xyz + light1_Diffuse * UNI_light1_DiffuseColor.xyz); + col.xyz += light0_Specular * UNI_light0_SpecularColor.xyz; + col.xyz += light1_Specular * UNI_light1_SpecularColor.xyz; + gl_FragColor = col; +} + diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/shaderv.glsl b/tests/RenderScriptTests/MiscSamples/res/raw/shaderv.glsl new file mode 100644 index 0000000..f7d01de --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/shaderv.glsl @@ -0,0 +1,30 @@ +varying float light0_Diffuse; +varying float light0_Specular; +varying float light1_Diffuse; +varying float light1_Specular; +varying vec2 varTex0; + +// This is where actual shader code begins +void main() { + vec4 worldPos = UNI_model * ATTRIB_position; + gl_Position = UNI_proj * worldPos; + + mat3 model3 = mat3(UNI_model[0].xyz, UNI_model[1].xyz, UNI_model[2].xyz); + vec3 worldNorm = model3 * ATTRIB_normal; + vec3 V = normalize(-worldPos.xyz); + + vec3 light0Vec = normalize(UNI_light0_Posision.xyz - worldPos.xyz); + vec3 light0R = -reflect(light0Vec, worldNorm); + light0_Diffuse = clamp(dot(worldNorm, light0Vec), 0.0, 1.0) * UNI_light0_Diffuse; + float light0Spec = clamp(dot(light0R, V), 0.001, 1.0); + light0_Specular = pow(light0Spec, UNI_light0_CosinePower) * UNI_light0_Specular; + + vec3 light1Vec = normalize(UNI_light1_Posision.xyz - worldPos.xyz); + vec3 light1R = reflect(light1Vec, worldNorm); + light1_Diffuse = clamp(dot(worldNorm, light1Vec), 0.0, 1.0) * UNI_light1_Diffuse; + float light1Spec = clamp(dot(light1R, V), 0.001, 1.0); + light1_Specular = pow(light1Spec, UNI_light1_CosinePower) * UNI_light1_Specular; + + gl_PointSize = 1.0; + varTex0 = ATTRIB_texture0; +} diff --git a/tests/RenderScriptTests/MiscSamples/res/raw/torus.a3d b/tests/RenderScriptTests/MiscSamples/res/raw/torus.a3d Binary files differnew file mode 100644 index 0000000..0322b01 --- /dev/null +++ b/tests/RenderScriptTests/MiscSamples/res/raw/torus.a3d |