forked from bartvdbraak/blender
Cleanup: glsl style
This commit is contained in:
parent
fe766d9c7a
commit
7424ded9c7
@ -38,7 +38,7 @@ float read_curve_mapping(int table, int index)
|
||||
* But is it actually correct to subtract 1 here?
|
||||
*/
|
||||
float texture_index = float(index) / float(curve_mapping_lut_size - 1);
|
||||
return texture1D(curve_mapping_texture, texture_index) [table];
|
||||
return texture1D(curve_mapping_texture, texture_index)[table];
|
||||
}
|
||||
|
||||
float curvemap_calc_extend(int table, float x, vec2 first, vec2 last)
|
||||
|
@ -111,7 +111,7 @@ void emit(int index, vec3 normal)
|
||||
outpt.v.normal = normal;
|
||||
|
||||
/* TODO(sergey): Only uniform subdivisions atm. */
|
||||
vec2 quadst[4] = vec2[](vec2(0,0), vec2(1,0), vec2(1,1), vec2(0,1));
|
||||
vec2 quadst[4] = vec2[](vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1));
|
||||
vec2 st = quadst[index];
|
||||
|
||||
INTERP_FACE_VARYING_2(outpt.v.uv, osd_active_uv_offset, st);
|
||||
@ -135,7 +135,7 @@ void emit(int index)
|
||||
outpt.v.normal = inpt[index].v.normal;
|
||||
|
||||
/* TODO(sergey): Only uniform subdivisions atm. */
|
||||
vec2 quadst[4] = vec2[](vec2(0,0), vec2(1,0), vec2(1,1), vec2(0,1));
|
||||
vec2 quadst[4] = vec2[](vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1));
|
||||
vec2 st = quadst[index];
|
||||
|
||||
INTERP_FACE_VARYING_2(outpt.v.uv, osd_active_uv_offset, st);
|
||||
@ -261,7 +261,7 @@ void main()
|
||||
#else /* USE_COLOR_MATERIAL */
|
||||
vec3 varying_position = inpt.v.position.xyz;
|
||||
vec3 V = (gl_ProjectionMatrix[3][3] == 0.0) ?
|
||||
normalize(varying_position): vec3(0.0, 0.0, -1.0);
|
||||
normalize(varying_position) : vec3(0.0, 0.0, -1.0);
|
||||
for (int i = 0; i < num_enabled_lights; i++) {
|
||||
/* todo: this is a slow check for disabled lights */
|
||||
if (lightSource[i].specular.a == 0.0)
|
||||
@ -299,7 +299,7 @@ void main()
|
||||
/* diffuse light */
|
||||
vec3 light_diffuse = lightSource[i].diffuse.rgb;
|
||||
float diffuse_bsdf = max(dot(N, light_direction), 0.0);
|
||||
L_diffuse += light_diffuse*diffuse_bsdf*intensity;
|
||||
L_diffuse += light_diffuse * diffuse_bsdf * intensity;
|
||||
|
||||
/* specular light */
|
||||
vec3 light_specular = lightSource[i].specular.rgb;
|
||||
@ -307,7 +307,7 @@ void main()
|
||||
|
||||
float specular_bsdf = pow(max(dot(N, H), 0.0),
|
||||
gl_FrontMaterial.shininess);
|
||||
L_specular += light_specular*specular_bsdf * intensity;
|
||||
L_specular += light_specular * specular_bsdf * intensity;
|
||||
}
|
||||
#endif /* USE_COLOR_MATERIAL */
|
||||
|
||||
|
@ -88,7 +88,7 @@ void main()
|
||||
discard;
|
||||
}
|
||||
else if (stipple_id == STIPPLE_CHECKER_8PX) {
|
||||
int result = int(mod(int(gl_FragCoord.x)/8 + int(gl_FragCoord.y) / 8, 2));
|
||||
int result = int(mod(int(gl_FragCoord.x) / 8 + int(gl_FragCoord.y) / 8, 2));
|
||||
if (result != 0)
|
||||
discard;
|
||||
}
|
||||
@ -158,7 +158,7 @@ void main()
|
||||
/* diffuse light */
|
||||
vec3 light_diffuse = gl_LightSource[i].diffuse.rgb;
|
||||
float diffuse_bsdf = max(dot(N, light_direction), 0.0);
|
||||
L_diffuse += light_diffuse*diffuse_bsdf;
|
||||
L_diffuse += light_diffuse * diffuse_bsdf;
|
||||
|
||||
#ifndef NO_SPECULAR
|
||||
/* specular light */
|
||||
@ -166,7 +166,7 @@ void main()
|
||||
vec3 H = gl_LightSource[i].halfVector.xyz;
|
||||
|
||||
float specular_bsdf = pow(max(dot(N, H), 0.0), gl_FrontMaterial.shininess);
|
||||
L_specular += light_specular*specular_bsdf;
|
||||
L_specular += light_specular * specular_bsdf;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
@ -174,7 +174,7 @@ void main()
|
||||
|
||||
#ifndef NO_SPECULAR
|
||||
/* view vector computation, depends on orthographics or perspective */
|
||||
vec3 V = (gl_ProjectionMatrix[3][3] == 0.0) ? normalize(varying_position): vec3(0.0, 0.0, -1.0);
|
||||
vec3 V = (gl_ProjectionMatrix[3][3] == 0.0) ? normalize(varying_position) : vec3(0.0, 0.0, -1.0);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < NUM_SCENE_LIGHTS; i++) {
|
||||
@ -205,14 +205,14 @@ void main()
|
||||
float distance = length(d);
|
||||
|
||||
intensity /= gl_LightSource[i].constantAttenuation +
|
||||
gl_LightSource[i].linearAttenuation * distance +
|
||||
gl_LightSource[i].quadraticAttenuation * distance * distance;
|
||||
gl_LightSource[i].linearAttenuation * distance +
|
||||
gl_LightSource[i].quadraticAttenuation * distance * distance;
|
||||
}
|
||||
|
||||
/* diffuse light */
|
||||
vec3 light_diffuse = gl_LightSource[i].diffuse.rgb;
|
||||
float diffuse_bsdf = max(dot(N, light_direction), 0.0);
|
||||
L_diffuse += light_diffuse*diffuse_bsdf*intensity;
|
||||
L_diffuse += light_diffuse * diffuse_bsdf * intensity;
|
||||
|
||||
#ifndef NO_SPECULAR
|
||||
/* specular light */
|
||||
@ -220,7 +220,7 @@ void main()
|
||||
vec3 H = normalize(light_direction - V);
|
||||
|
||||
float specular_bsdf = pow(max(dot(N, H), 0.0), gl_FrontMaterial.shininess);
|
||||
L_specular += light_specular*specular_bsdf*intensity;
|
||||
L_specular += light_specular * specular_bsdf * intensity;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -250,7 +250,7 @@ void main()
|
||||
vec3 L = gl_FrontLightModelProduct.sceneColor.rgb + L_diffuse;
|
||||
|
||||
#ifndef NO_SPECULAR
|
||||
L += L_specular*gl_FrontMaterial.specular.rgb;
|
||||
L += L_specular * gl_FrontMaterial.specular.rgb;
|
||||
#endif
|
||||
|
||||
/* write out fragment color */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Used the implementation of wide lines of Timo Suoranta (http://neure.dy.fi/wideline.html)
|
||||
*/
|
||||
* Used the implementation of wide lines of Timo Suoranta (http://neure.dy.fi/wideline.html)
|
||||
*/
|
||||
|
||||
#define PASSTHROUGH 0
|
||||
|
||||
|
@ -115,9 +115,9 @@ void second_pass()
|
||||
color += texture2D(colorbuffer, uvcoordsvar.xy + invrendertargetdim) * 0.234375;
|
||||
color += texture2D(colorbuffer, uvcoordsvar.xy + 2.5 * invrendertargetdim) * 0.09375;
|
||||
color += texture2D(colorbuffer, uvcoordsvar.xy + 4.5 * invrendertargetdim) * 0.015625;
|
||||
color += texture2D(colorbuffer, uvcoordsvar.xy -invrendertargetdim) * 0.234375;
|
||||
color += texture2D(colorbuffer, uvcoordsvar.xy -2.5 * invrendertargetdim) * 0.09375;
|
||||
color += texture2D(colorbuffer, uvcoordsvar.xy -4.5 * invrendertargetdim) * 0.015625;
|
||||
color += texture2D(colorbuffer, uvcoordsvar.xy - invrendertargetdim) * 0.234375;
|
||||
color += texture2D(colorbuffer, uvcoordsvar.xy - 2.5 * invrendertargetdim) * 0.09375;
|
||||
color += texture2D(colorbuffer, uvcoordsvar.xy - 4.5 * invrendertargetdim) * 0.015625;
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
@ -128,7 +128,7 @@ void third_pass()
|
||||
{
|
||||
vec4 color = texture2D(colorbuffer, uvcoordsvar.xy);
|
||||
vec4 color_blurred = texture2D(blurredcolorbuffer, uvcoordsvar.xy);
|
||||
float coc = 2.0 * max(color_blurred.a, color.a); - color.a;
|
||||
float coc = 2.0 * max(color_blurred.a, color.a); -color.a;
|
||||
gl_FragColor = vec4(color.rgb, coc);
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ void fourth_pass()
|
||||
|
||||
vec4 small_sample_blur(in sampler2D colorbuffer, in vec2 uv, in vec4 color)
|
||||
{
|
||||
float weight = 1.0/ 17.0;
|
||||
float weight = 1.0 / 17.0;
|
||||
vec4 result = weight * color;
|
||||
weight *= 4.0;
|
||||
|
||||
|
@ -103,7 +103,7 @@ void accumulate_pass(void) {
|
||||
r = 1.0;
|
||||
else
|
||||
r = cos(M_PI / dof_params.w) /
|
||||
(cos(theta - (2.0 * M_PI / dof_params.w) * floor((dof_params.w * theta + M_PI) / (2.0 * M_PI))));
|
||||
(cos(theta - (2.0 * M_PI / dof_params.w) * floor((dof_params.w * theta + M_PI) / (2.0 * M_PI))));
|
||||
|
||||
if (dot(particlecoord, particlecoord) > r * r)
|
||||
discard;
|
||||
|
@ -38,8 +38,12 @@ void vert_dof_first_pass()
|
||||
void vert_dof_fourth_pass()
|
||||
{
|
||||
vec4 halfpixel = vec4(-0.5, 0.5, -0.5, 0.5);
|
||||
uvcoordsvar = gl_MultiTexCoord0.xxyy + halfpixel * vec4(invrendertargetdim.x,
|
||||
invrendertargetdim.x, invrendertargetdim.y, invrendertargetdim.y);
|
||||
uvcoordsvar = gl_MultiTexCoord0.xxyy +
|
||||
halfpixel *
|
||||
vec4(invrendertargetdim.x,
|
||||
invrendertargetdim.x,
|
||||
invrendertargetdim.y,
|
||||
invrendertargetdim.y);
|
||||
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ float calculate_ssao_factor(float depth)
|
||||
|
||||
/* use minor bias here to avoid self shadowing */
|
||||
if (f > 0.05 * len + 0.0001)
|
||||
factor += f * 1.0/(len * (1.0 + len * len * ssao_params.z));
|
||||
factor += f * 1.0 / (len * (1.0 + len * len * ssao_params.z));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ void emit_flat(int index, vec3 normal)
|
||||
varposition = outpt.v.position.xyz;
|
||||
|
||||
/* TODO(sergey): Only uniform subdivisions atm. */
|
||||
vec2 quadst[4] = vec2[](vec2(0,0), vec2(1,0), vec2(1,1), vec2(0,1));
|
||||
vec2 quadst[4] = vec2[](vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1));
|
||||
vec2 st = quadst[index];
|
||||
|
||||
INTERP_FACE_VARYING_2(outpt.v.uv, osd_active_uv_offset, st);
|
||||
@ -70,7 +70,7 @@ void emit_smooth(int index)
|
||||
varposition = outpt.v.position.xyz;
|
||||
|
||||
/* TODO(sergey): Only uniform subdivisions atm. */
|
||||
vec2 quadst[4] = vec2[](vec2(0,0), vec2(1,0), vec2(1,1), vec2(0,1));
|
||||
vec2 quadst[4] = vec2[](vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1));
|
||||
vec2 st = quadst[index];
|
||||
|
||||
INTERP_FACE_VARYING_2(outpt.v.uv, osd_active_uv_offset, st);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,13 +4,13 @@ uniform sampler2D textureSource;
|
||||
void main()
|
||||
{
|
||||
vec4 color = vec4(0.0);
|
||||
color += texture2D( textureSource, gl_TexCoord[0].st + vec2(-3.0 * ScaleU.x, -3.0 * ScaleU.y ) ) * 0.015625;
|
||||
color += texture2D( textureSource, gl_TexCoord[0].st + vec2(-2.0 * ScaleU.x, -2.0 * ScaleU.y ) ) * 0.09375;
|
||||
color += texture2D( textureSource, gl_TexCoord[0].st + vec2(-1.0 * ScaleU.x, -1.0 * ScaleU.y ) ) * 0.234375;
|
||||
color += texture2D( textureSource, gl_TexCoord[0].st + vec2(0.0, 0.0)) * 0.3125;
|
||||
color += texture2D( textureSource, gl_TexCoord[0].st + vec2(1.0 * ScaleU.x, 1.0 * ScaleU.y ) ) * 0.234375;
|
||||
color += texture2D( textureSource, gl_TexCoord[0].st + vec2(2.0 * ScaleU.x, 2.0 * ScaleU.y ) ) * 0.09375;
|
||||
color += texture2D( textureSource, gl_TexCoord[0].st + vec2(3.0 * ScaleU.x, 3.0 * ScaleU.y ) ) * 0.015625;
|
||||
color += texture2D(textureSource, gl_TexCoord[0].st + vec2(-3.0 * ScaleU.x, -3.0 * ScaleU.y)) * 0.015625;
|
||||
color += texture2D(textureSource, gl_TexCoord[0].st + vec2(-2.0 * ScaleU.x, -2.0 * ScaleU.y)) * 0.09375;
|
||||
color += texture2D(textureSource, gl_TexCoord[0].st + vec2(-1.0 * ScaleU.x, -1.0 * ScaleU.y)) * 0.234375;
|
||||
color += texture2D(textureSource, gl_TexCoord[0].st + vec2(0.0, 0.0)) * 0.3125;
|
||||
color += texture2D(textureSource, gl_TexCoord[0].st + vec2(1.0 * ScaleU.x, 1.0 * ScaleU.y)) * 0.234375;
|
||||
color += texture2D(textureSource, gl_TexCoord[0].st + vec2(2.0 * ScaleU.x, 2.0 * ScaleU.y)) * 0.09375;
|
||||
color += texture2D(textureSource, gl_TexCoord[0].st + vec2(3.0 * ScaleU.x, 3.0 * ScaleU.y)) * 0.015625;
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ void main()
|
||||
// Adjusting moments using partial derivative
|
||||
float dx = dFdx(depth);
|
||||
float dy = dFdy(depth);
|
||||
moment2 += 0.25*(dx*dx+dy*dy);
|
||||
moment2 += 0.25 * (dx * dx + dy * dy);
|
||||
|
||||
gl_FragColor = vec4(moment1, moment2, 0.0, 0.0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user