From 4c57cfc2d32c35a8acc156f4ccc8fff893a6528e Mon Sep 17 00:00:00 2001 From: sylar Date: Sun, 1 Mar 2015 09:49:33 +0400 Subject: [PATCH] fixes for glsles2 --- files/materials/atmosphere.shader | 2 +- files/materials/clouds.shader | 2 +- files/materials/moon.shader | 2 +- files/materials/objects.shader | 4 ++-- files/materials/stars.shader | 2 +- files/materials/sun.shader | 2 +- files/materials/terrain.shader | 2 +- files/materials/underwater.h | 4 ++-- files/materials/water.shader | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/files/materials/atmosphere.shader b/files/materials/atmosphere.shader index 5040052fc..3eaa73b1c 100644 --- a/files/materials/atmosphere.shader +++ b/files/materials/atmosphere.shader @@ -11,7 +11,7 @@ SH_START_PROGRAM { float4x4 viewFixed = view; -#if !SH_GLSL +#if !SH_GLSL && !SH_GLSLES viewFixed[0][3] = 0.0; viewFixed[1][3] = 0.0; viewFixed[2][3] = 0.0; diff --git a/files/materials/clouds.shader b/files/materials/clouds.shader index 93d0780e0..5902d2fdc 100644 --- a/files/materials/clouds.shader +++ b/files/materials/clouds.shader @@ -13,7 +13,7 @@ { float4x4 worldviewFixed = worldview; -#if !SH_GLSL +#if !SH_GLSL && !SH_GLSLES worldviewFixed[0][3] = 0.0; worldviewFixed[1][3] = 0.0; worldviewFixed[2][3] = 0.0; diff --git a/files/materials/moon.shader b/files/materials/moon.shader index 0e1a4ffc8..151b94180 100644 --- a/files/materials/moon.shader +++ b/files/materials/moon.shader @@ -12,7 +12,7 @@ shUniform(float4x4, projection) @shAutoConstant(projection, projection_matrix) SH_START_PROGRAM { float4x4 viewFixed = view; -#if !SH_GLSL +#if !SH_GLSL && !SH_GLSLES viewFixed[0][3] = 0.0; viewFixed[1][3] = 0.0; viewFixed[2][3] = 0.0; diff --git a/files/materials/objects.shader b/files/materials/objects.shader index 828674cc7..5c74b1139 100644 --- a/files/materials/objects.shader +++ b/files/materials/objects.shader @@ -166,7 +166,7 @@ #if VIEWPROJ_FIX float4x4 vpFixed = vpMatrix; -#if !SH_GLSL +#if !SH_GLSL && !SH_GLSLES vpFixed[2] = vpRow2Fix; #else vpFixed[0][2] = vpRow2Fix.x; @@ -384,7 +384,7 @@ float4 normalTex = shSample(normalMap, UV.xy); - normal = normalize (shMatrixMult( transpose(tbn), normalTex.xyz * 2.0 - float3 (1.0,1.0,1.0) )); + normal = normalize (shMatrixMult( transpose(tbn), normalTex.xyz * 2.0 - 1.0 )); #endif #if ENV_MAP || SPECULAR || PARALLAX diff --git a/files/materials/stars.shader b/files/materials/stars.shader index f2eb616a2..830be862a 100644 --- a/files/materials/stars.shader +++ b/files/materials/stars.shader @@ -13,7 +13,7 @@ SH_START_PROGRAM { float4x4 worldviewFixed = worldview; -#if !SH_GLSL +#if !SH_GLSL && !SH_GLSLES worldviewFixed[0][3] = 0.0; worldviewFixed[1][3] = 0.0; worldviewFixed[2][3] = 0.0; diff --git a/files/materials/sun.shader b/files/materials/sun.shader index fc747b522..72e49d1a7 100644 --- a/files/materials/sun.shader +++ b/files/materials/sun.shader @@ -12,7 +12,7 @@ shUniform(float4x4, projection) @shAutoConstant(projection, projection_matrix) SH_START_PROGRAM { float4x4 viewFixed = view; -#if !SH_GLSL +#if !SH_GLSL && !SH_GLSLES viewFixed[0][3] = 0.0; viewFixed[1][3] = 0.0; viewFixed[2][3] = 0.0; diff --git a/files/materials/terrain.shader b/files/materials/terrain.shader index 9bb5d247d..f20fce506 100644 --- a/files/materials/terrain.shader +++ b/files/materials/terrain.shader @@ -136,7 +136,7 @@ #if NEED_DEPTH #if VIEWPROJ_FIX float4x4 vpFixed = viewProjMatrix; -#if !SH_GLSL +#if !SH_GLSL && !SH_GLSLES vpFixed[2] = vpRow2Fix; #else vpFixed[0][2] = vpRow2Fix.x; diff --git a/files/materials/underwater.h b/files/materials/underwater.h index 332a0fd7d..2f38f6546 100644 --- a/files/materials/underwater.h +++ b/files/materials/underwater.h @@ -93,7 +93,7 @@ float3 getCaustics (shTexture2D causticMap, float3 worldPos, float3 waterEyePos, // NOTE: the original shader calculated a tangent space basis here, // but using only the world normal is cheaper and i couldn't see a visual difference // also, if this effect gets moved to screen-space some day, it's unlikely to have tangent information - float3 causticNorm = worldNormal.xyz * perturb(causticMap, causticPos.xy, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).xyz * 2 - 1; + float3 causticNorm = worldNormal.xyz * perturb(causticMap, causticPos.xy, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).xyz * 2.0 - 1.0; causticNorm = float3(causticNorm.x, causticNorm.y, -causticNorm.z); //float fresnel = pow(clamp(dot(LV,causticnorm),0.0,1.0),2.0); @@ -111,7 +111,7 @@ float3 getCaustics (shTexture2D causticMap, float3 worldPos, float3 waterEyePos, //caustics = shSaturate(pow(float3(causticR,causticG,causticB)*5.5,float3(5.5*causticdepth)))*NdotL*sunFade*causticdepth; caustics = shSaturate(pow(float3(causticR,causticG,causticB)*5.5,float3(5.5*causticdepth,5.5*causticdepth,5.5*causticdepth)))*NdotL*causticdepth; - caustics *= 3; + caustics *= 3.0; // shore transition caustics = shLerp (float3(1,1,1), caustics, waterDepth); diff --git a/files/materials/water.shader b/files/materials/water.shader index 10d63cdf4..eff245b5e 100644 --- a/files/materials/water.shader +++ b/files/materials/water.shader @@ -97,7 +97,7 @@ shOutputPosition = shMatrixMult(wvp, shInputPosition); - #if !SH_GLSL + #if !SH_GLSL && !SH_GLSLES float4x4 scalemat = float4x4( 0.5, 0.0, 0.0, 0.5, 0.0, -0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5,