xyYToRGB.glsl   xyYToRGB.glsl 
const mediump float pi = 3.1415926535897931; const highp float pi = 3.1415926535897931;
const mediump float ln10 = 2.3025850929940459; const highp float ln10 = 2.3025850929940459;
// Variable for the xyYTo RGB conversion // Variable for the xyYTo RGB conversion
uniform mediump float alphaWaOverAlphaDa; uniform highp float alphaWaOverAlphaDa;
uniform mediump float oneOverGamma; uniform highp float oneOverGamma;
uniform mediump float term2TimesOneOverMaxdLpOneOverGamma; uniform highp float term2TimesOneOverMaxdLpOneOverGamma;
uniform mediump float brightnessScale; uniform highp float brightnessScale;
// Variables for the color computation // Variables for the color computation
uniform mediump vec3 sunPos; uniform highp vec3 sunPos;
uniform mediump float term_x, Ax, Bx, Cx, Dx, Ex; uniform mediump float term_x, Ax, Bx, Cx, Dx, Ex;
uniform mediump float term_y, Ay, By, Cy, Dy, Ey; uniform mediump float term_y, Ay, By, Cy, Dy, Ey;
// The current projection matrix // The current projection matrix
uniform mediump mat4 projectionMatrix; uniform mediump mat4 projectionMatrix;
// Contains the 2d position of the point on the screen (before multiplicati on by the projection matrix) // Contains the 2d position of the point on the screen (before multiplicati on by the projection matrix)
attribute mediump vec2 skyVertex; attribute mediump vec2 skyVertex;
// Contains the r,g,b,Y (luminosity) components. // Contains the r,g,b,Y (luminosity) components.
attribute highp vec4 skyColor; attribute highp vec4 skyColor;
// The output variable passed to the fragment shader // The output variable passed to the fragment shader
varying mediump vec4 resultSkyColor; varying mediump vec4 resultSkyColor;
void main() void main()
{ {
gl_Position = projectionMatrix*vec4(skyVertex, 0., 1); gl_Position = projectionMatrix*vec4(skyVertex, 0., 1.);
vec4 color = skyColor; highp vec4 color = skyColor;
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// First compute the xy color component // First compute the xy color component
// color contains the unprojected vertex position in r,g,b // color contains the unprojected vertex position in r,g,b
// + the Y (luminance) component of the color in the alpha channel // + the Y (luminance) component of the color in the alpha channel
if (color[3]>0.01) if (color[3]>0.01)
{ {
float cosDistSunq = sunPos[0]*color[0] + sunPos[1]*color[1] highp float cosDistSunq = sunPos[0]*color[0] + sunPos[1]*col
+ sunPos[2]*color[2]; or[1] + sunPos[2]*color[2];
float distSun=acos(cosDistSunq); highp float distSun=acos(cosDistSunq);
float oneOverCosZenithAngle = (color[2]==0.) ? 99999999. : 1 highp float oneOverCosZenithAngle = (color[2]==0.) ? 9999999
. / color[2]; 999999. : 1. / color[2];
cosDistSunq*=cosDistSunq; cosDistSunq*=cosDistSunq;
color[0] = term_x * (1. + Ax * exp(Bx*oneOverCosZenithAngle) )* (1. + Cx * exp(Dx*distSun) + Ex * cosDistSunq); color[0] = term_x * (1. + Ax * exp(Bx*oneOverCosZenithAngle) )* (1. + Cx * exp(Dx*distSun) + Ex * cosDistSunq);
color[1] = term_y * (1. + Ay * exp(By*oneOverCosZenithAngle) )* (1. + Cy * exp(Dy*distSun) + Ey * cosDistSunq); color[1] = term_y * (1. + Ay * exp(By*oneOverCosZenithAngle) )* (1. + Cy * exp(Dy*distSun) + Ey * cosDistSunq);
if (color[0] < 0. || color[1] < 0.) if (color[0] < 0. || color[1] < 0.)
{ {
color[0] = 0.25; color[0] = 0.25;
color[1] = 0.25; color[1] = 0.25;
} }
} }
skipping to change at line 98 skipping to change at line 98
float V = color[2] * (1.33 * (1. + color[1] / color[ 0] + color[0] * (1. - color[0] - color[1])) - 1.68); float V = color[2] * (1.33 * (1. + color[1] / color[ 0] + color[0] * (1. - color[0] - color[1])) - 1.68);
color[2] = 0.4468 * (1. - s) * V + s * color[2]; color[2] = 0.4468 * (1. - s) * V + s * color[2];
} }
// 2. Adapt the luminance value and scale it to fit in the R GB range [2] // 2. Adapt the luminance value and scale it to fit in the R GB range [2]
// color[2] = std::pow(adaptLuminanceScaled(color[2]), oneOv erGamma); // color[2] = std::pow(adaptLuminanceScaled(color[2]), oneOv erGamma);
color[2] = pow(color[2]*pi*0.0001, alphaWaOverAlphaDa*oneOve rGamma)* term2TimesOneOverMaxdLpOneOverGamma; color[2] = pow(color[2]*pi*0.0001, alphaWaOverAlphaDa*oneOve rGamma)* term2TimesOneOverMaxdLpOneOverGamma;
// Convert from xyY to XZY // Convert from xyY to XZY
// Use a XYZ to Adobe RGB (1998) matrix which uses a D65 ref erence white // Use a XYZ to Adobe RGB (1998) matrix which uses a D65 ref erence white
vec3 mediump tmp = vec3(color[0] * color[2] / color[1], colo r[2], (1. - color[0] - color[1]) * color[2] / color[1]); mediump vec3 tmp = vec3(color[0] * color[2] / color[1], colo r[2], (1. - color[0] - color[1]) * color[2] / color[1]);
resultSkyColor = vec4(2.04148*tmp.x-0.564977*tmp.y-0.344713* tmp.z, -0.969258*tmp.x+1.87599*tmp.y+0.0415557*tmp.z, 0.0134455*tmp.x-0.118 373*tmp.y+1.01527*tmp.z, 1.); resultSkyColor = vec4(2.04148*tmp.x-0.564977*tmp.y-0.344713* tmp.z, -0.969258*tmp.x+1.87599*tmp.y+0.0415557*tmp.z, 0.0134455*tmp.x-0.118 373*tmp.y+1.01527*tmp.z, 1.);
resultSkyColor*=brightnessScale; resultSkyColor*=brightnessScale;
} }
} }
 End of changes. 6 change blocks. 
15 lines changed or deleted 15 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/