fixes for glsles2

celladd
sylar 10 years ago
parent 5e2839977b
commit 4c57cfc2d3

@ -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;

@ -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;

@ -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;

@ -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

@ -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;

@ -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;

@ -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;

@ -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);

@ -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,

Loading…
Cancel
Save