Fixed some compilations warning in the lightScattering shaders and a compilation error in the glsl 1.2 shader
This commit is contained in:
parent
4f6c061d4e
commit
1b3c2e4436
@ -14,23 +14,23 @@ void main(void)
|
|||||||
if(m_Display){
|
if(m_Display){
|
||||||
|
|
||||||
vec4 colorRes= texture2D(m_Texture,texCoord);
|
vec4 colorRes= texture2D(m_Texture,texCoord);
|
||||||
float factor=(m_BlurWidth/float(m_NbSamples-1.0));
|
float factor=(m_BlurWidth/(float(m_NbSamples)-1.0));
|
||||||
float scale;
|
float scale;
|
||||||
vec2 texCoo=texCoord - m_LightPosition.xy;
|
vec2 texCoo=texCoord - m_LightPosition.xy;
|
||||||
vec2 scaledCoord;
|
vec2 scaledCoord;
|
||||||
vec4 res = vec4(0.0);
|
vec4 res = vec4(0.0);
|
||||||
for(int i=0; i<m_NbSamples; i++) {
|
for(int i=0; i<m_NbSamples; i++) {
|
||||||
scale = i * factor + m_BlurStart ;
|
scale = float(i) * factor + m_BlurStart ;
|
||||||
scaledCoord=texCoo*scale + m_LightPosition.xy;
|
scaledCoord=texCoo*scale + m_LightPosition.xy;
|
||||||
if(texture2D(m_DepthTexture,scaledCoord).r==1.0){
|
if(texture2D(m_DepthTexture,scaledCoord).r==1.0){
|
||||||
res += texture2D(m_Texture,scaledCoord);
|
res += texture2D(m_Texture,scaledCoord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res /= m_NbSamples;
|
res /= float(m_NbSamples);
|
||||||
|
|
||||||
//Blend the original color with the averaged pixels
|
//Blend the original color with the averaged pixels
|
||||||
float mean = (res.r + res.g + res.b)/3;
|
float mean = (res.r + res.g + res.b)/3.0;
|
||||||
fragColor =mix(colorRes ,mix( colorRes, res, m_LightDensity),mean);
|
gl_FragColor =mix(colorRes ,mix( colorRes, res, m_LightDensity),mean);
|
||||||
}else{
|
}else{
|
||||||
gl_FragColor= texture2D(m_Texture,texCoord);
|
gl_FragColor= texture2D(m_Texture,texCoord);
|
||||||
}
|
}
|
||||||
|
@ -18,22 +18,22 @@ void main(void)
|
|||||||
if(m_Display){
|
if(m_Display){
|
||||||
|
|
||||||
vec4 colorRes= getColor(m_Texture,texCoord);
|
vec4 colorRes= getColor(m_Texture,texCoord);
|
||||||
float factor=(m_BlurWidth/float(m_NbSamples-1.0));
|
float factor=(m_BlurWidth/(float(m_NbSamples)-1.0));
|
||||||
float scale;
|
float scale;
|
||||||
vec2 texCoo=texCoord - m_LightPosition.xy;
|
vec2 texCoo=texCoord - m_LightPosition.xy;
|
||||||
vec2 scaledCoord;
|
vec2 scaledCoord;
|
||||||
vec4 res = vec4(0.0);
|
vec4 res = vec4(0.0);
|
||||||
for(int i=0; i<m_NbSamples; i++) {
|
for(int i=0; i<m_NbSamples; i++) {
|
||||||
scale = i * factor + m_BlurStart ;
|
scale = float(i) * factor + m_BlurStart ;
|
||||||
scaledCoord=texCoo*scale + m_LightPosition.xy;
|
scaledCoord=texCoo*scale + m_LightPosition.xy;
|
||||||
if(fetchTextureSample(m_DepthTexture, scaledCoord,0).r==1.0){
|
if(fetchTextureSample(m_DepthTexture, scaledCoord,0).r==1.0){
|
||||||
res += fetchTextureSample(m_Texture,scaledCoord,0);
|
res += fetchTextureSample(m_Texture,scaledCoord,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res /= m_NbSamples;
|
res /= float(m_NbSamples);
|
||||||
|
|
||||||
//Blend the original color with the averaged pixels
|
//Blend the original color with the averaged pixels
|
||||||
float mean = (res.r + res.g + res.b)/3;
|
float mean = (res.r + res.g + res.b)/3.0;
|
||||||
fragColor =mix(colorRes ,mix( colorRes, res, m_LightDensity),mean);
|
fragColor =mix(colorRes ,mix( colorRes, res, m_LightDensity),mean);
|
||||||
}else{
|
}else{
|
||||||
fragColor = getColor(m_Texture,texCoord);
|
fragColor = getColor(m_Texture,texCoord);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user