mirror of
https://github.com/lubosz/overte.git
synced 2025-04-07 14:22:06 +02:00
Make Fade.slh compatible with Open GLES SL
This commit is contained in:
parent
76b38bebad
commit
dad526d22b
1 changed files with 5 additions and 5 deletions
|
@ -34,7 +34,7 @@ vec2 hash2D(vec3 position) {
|
|||
}
|
||||
|
||||
float noise3D(vec3 position) {
|
||||
float n = textureLod(fadeMaskMap, hash2D(position), 0).r;
|
||||
float n = textureLod(fadeMaskMap, hash2D(position), 0.0).r;
|
||||
return pow(n, 1.0/2.2); // Remove sRGB. Need to fix this later directly in the texture
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ float evalFadeNoiseGradient(FadeObjectParams params, vec3 position) {
|
|||
vec3 noisePositionFloored = floor(noisePosition);
|
||||
vec3 noisePositionFraction = fract(noisePosition);
|
||||
|
||||
noisePositionFraction = noisePositionFraction*noisePositionFraction*(3 - 2*noisePositionFraction);
|
||||
noisePositionFraction = noisePositionFraction*noisePositionFraction*(3.0 - 2.0*noisePositionFraction);
|
||||
|
||||
float noiseLowXLowYLowZ = noise3D(noisePositionFloored);
|
||||
float noiseLowXHighYLowZ = noise3D(noisePositionFloored+vec3(0,1,0));
|
||||
|
@ -84,7 +84,7 @@ float evalFadeAlpha(FadeObjectParams params, vec3 position) {
|
|||
}
|
||||
|
||||
void applyFadeClip(FadeObjectParams params, vec3 position) {
|
||||
if (evalFadeAlpha(params, position) < 0) {
|
||||
if (evalFadeAlpha(params, position) < 0.0) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
@ -95,12 +95,12 @@ void applyFade(FadeObjectParams params, vec3 position, out vec3 emissive) {
|
|||
alpha = -alpha;
|
||||
}
|
||||
|
||||
if (alpha < 0) {
|
||||
if (alpha < 0.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
float edgeMask = alpha * fadeParameters[params.category]._edgeWidthInvWidth.y;
|
||||
float edgeAlpha = 1.0-clamp(edgeMask, 0, 1);
|
||||
float edgeAlpha = 1.0-clamp(edgeMask, 0.0, 1.0);
|
||||
|
||||
edgeMask = step(edgeMask, 1.f);
|
||||
edgeAlpha *= edgeAlpha; // Square to have a nice ease out
|
||||
|
|
Loading…
Reference in a new issue