Skip to content

Commit

Permalink
Fix ocean on Android devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Dec 5, 2012
1 parent 71a38d7 commit cf691c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Source/Shaders/CentralBodyFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ void main()
material.specular = mix(0.0, 1.0, mask);
material.shininess = 10.0;

color = czm_phong(normalize(v_positionEC), material);
// The double normalize below works around a bug in Firefox on Android devices.
color = czm_phong(normalize(normalize(v_positionEC)), material);
#endif
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion Source/Shaders/CentralBodyOcean.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat

vec3 positionToEyeEC = -positionEyeCoordinates;
float positionToEyeECLength = length(positionToEyeEC);
vec3 normalizedpositionToEyeEC = normalize(positionToEyeEC);

// The double normalize below works around a bug in Firefox on Android devices.
vec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));

// fade is a function of the distance from the fragment and the frequency of the waves
float fade = max(1.0, (positionToEyeECLength / 10000000000.0) * frequency * fadeFactor);
Expand Down

0 comments on commit cf691c2

Please sign in to comment.