Properly pipe texture names through.

Change-Id: I3e44c2757acee90539869c32771626cd0f770a25
This commit is contained in:
Alex Sakhartchouk
2012-02-21 17:33:27 -08:00
parent 1eb4c26a96
commit 9cc290038c
9 changed files with 23 additions and 21 deletions

View File

@@ -3,13 +3,13 @@ varying vec2 varTex0;
void main() {
vec2 blurCoord = varTex0;
blurCoord.x = varTex0.x + UNI_blurOffset0;
vec3 col = texture2D(UNI_Tex0, blurCoord).rgb;
vec3 col = texture2D(UNI_color, blurCoord).rgb;
blurCoord.x = varTex0.x + UNI_blurOffset1;
col += texture2D(UNI_Tex0, blurCoord).rgb;
col += texture2D(UNI_color, blurCoord).rgb;
blurCoord.x = varTex0.x + UNI_blurOffset2;
col += texture2D(UNI_Tex0, blurCoord).rgb;
col += texture2D(UNI_color, blurCoord).rgb;
blurCoord.x = varTex0.x + UNI_blurOffset3;
col += texture2D(UNI_Tex0, blurCoord).rgb;
col += texture2D(UNI_color, blurCoord).rgb;
gl_FragColor = vec4(col * 0.25, 0.0); //texture2D(UNI_Tex0, varTex0);
gl_FragColor = vec4(col * 0.25, 0.0);
}

View File

@@ -3,15 +3,15 @@ varying vec2 varTex0;
void main() {
vec2 blurCoord = varTex0;
blurCoord.y = varTex0.y + UNI_blurOffset0;
vec3 col = texture2D(UNI_Tex0, blurCoord).rgb;
vec3 col = texture2D(UNI_color, blurCoord).rgb;
blurCoord.y = varTex0.y + UNI_blurOffset1;
col += texture2D(UNI_Tex0, blurCoord).rgb;
col += texture2D(UNI_color, blurCoord).rgb;
blurCoord.y = varTex0.y + UNI_blurOffset2;
col += texture2D(UNI_Tex0, blurCoord).rgb;
col += texture2D(UNI_color, blurCoord).rgb;
blurCoord.y = varTex0.y + UNI_blurOffset3;
col += texture2D(UNI_Tex0, blurCoord).rgb;
col += texture2D(UNI_color, blurCoord).rgb;
col = col * 0.25;
gl_FragColor = vec4(col, 0.0); //texture2D(UNI_Tex0, varTex0);
gl_FragColor = vec4(col, 0.0);
}

View File

@@ -12,8 +12,8 @@ void main() {
float light0_Diffuse = dot(worldNorm, light0Vec);
vec2 t0 = varTex0.xy;
lowp vec4 col = texture2D(UNI_Tex0, t0).rgba;
lowp vec4 col = texture2D(UNI_diffuse, t0).rgba;
col.xyz = col.xyz * light0_Diffuse * 1.2;
gl_FragColor = col; //vec4(0.0, 1.0, 0.0, 0.0);
gl_FragColor = col;
}

View File

@@ -14,8 +14,8 @@ void main() {
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));
lowp vec4 col = texture2D(UNI_diffuse, t0).rgba;
col.xyz = col.xyz * (textureCube(UNI_reflection, worldNorm).rgb * 0.5 + vec3(light0_Diffuse));
col.xyz += light0_Specular * vec3(0.8, 0.8, 1.0);
gl_FragColor = col;

View File

@@ -14,12 +14,12 @@ void main() {
float light0_Specular = pow(light0Spec, 150.0) * 0.5;
vec2 t0 = varTex0.xy;
lowp vec4 col = texture2D(UNI_Tex0, t0).rgba;
lowp vec4 col = texture2D(UNI_diffuse, 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.xyz = mix(col.xyz, textureCube(UNI_reflection, -light0R).rgb * 2.4, fresnel);
col.w = 0.8;
gl_FragColor = col;
}

View File

@@ -14,7 +14,7 @@ void main() {
float light0_Specular = pow(light0Spec, 10.0) * 0.5;
vec2 t0 = varTex0.xy;
lowp vec4 col = texture2D(UNI_Tex0, t0).rgba;
lowp vec4 col = texture2D(UNI_diffuse, t0).rgba;
col.xyz = col.xyz * light0_Diffuse * 1.2;
col.xyz += light0_Specular * vec3(0.8, 0.8, 1.0);
gl_FragColor = col;

View File

@@ -1,7 +1,7 @@
varying vec2 varTex0;
void main() {
vec3 col = texture2D(UNI_Tex0, varTex0).rgb;
vec3 col = texture2D(UNI_color, varTex0).rgb;
vec3 desat = vec3(0.299, 0.587, 0.114);
float lum = dot(desat, col);

View File

@@ -1,7 +1,7 @@
varying vec2 varTex0;
void main() {
lowp vec4 col = texture2D(UNI_Tex0, varTex0).rgba;
lowp vec4 col = texture2D(UNI_color, varTex0).rgba;
gl_FragColor = col;
}

View File

@@ -83,10 +83,12 @@ public class FragmentShader extends Shader {
mBuilder.addConstant(mShader.mPerObjConstants);
}
for (int i = 0; i < mShader.mTextureTypes.size(); i ++) {
mBuilder.addTexture(mShader.mTextureTypes.get(i));
mBuilder.addTexture(mShader.mTextureTypes.get(i),
mShader.mTextureNames.get(i));
}
for (int i = 0; i < mShader.mShaderTextureTypes.size(); i ++) {
mBuilder.addTexture(mShader.mShaderTextureTypes.get(i));
mBuilder.addTexture(mShader.mShaderTextureTypes.get(i),
mShader.mShaderTextureNames.get(i));
}
mShader.mProgram = mBuilder.create();