Cleanup: trailing space

This commit is contained in:
Campbell Barton 2018-07-31 19:07:56 +10:00
parent 66da2f537a
commit f6300030e0
13 changed files with 46 additions and 46 deletions

View File

@ -21,10 +21,10 @@ void main()
ivec2 uv = ivec2(gl_FragCoord.xy);
vec4 nloc = ProjectionMatrix * ViewMatrix * vec4(loc.xyz, 1.0);
float dx = (ProjectionMatrix[3][3] == 0.0) ? (noffset[0] / (nloc.z * defaultpixsize)) : (noffset[0] / defaultpixsize);
float dy = (ProjectionMatrix[3][3] == 0.0) ? (noffset[1] / (nloc.z * defaultpixsize)) : (noffset[1] / defaultpixsize);
/* apply blurring, using a 9-tap filter with predefined gaussian weights */
/* depth */
float outdepth = 0;
@ -42,7 +42,7 @@ void main()
gl_FragDepth = outdepth;
/* color */
/* color */
vec4 outcolor = vec4(0.0);
outcolor += texelFetch(strokeColor, ivec2(uv.x - 1.0 * dx, uv.y + 1.0 * dy), 0) * 0.0947416;
outcolor += texelFetch(strokeColor, ivec2(uv.x - 0.0 * dx, uv.y + 1.0 * dy), 0) * 0.118318;

View File

@ -28,12 +28,12 @@ void main()
vec4 src_pixel= texelFetch(strokeColor, uv.xy, 0);
float luminance = get_luminance(src_pixel);
vec4 outcolor;
/* is transparent */
/* is transparent */
if (src_pixel.a == 0.0f) {
discard;
}
switch(mode) {
case MODE_GRAYSCALE:
{
@ -78,7 +78,7 @@ void main()
{
outcolor = src_pixel;
}
}
gl_FragDepth = stroke_depth;

View File

@ -27,7 +27,7 @@ void main()
if (mode[1] > 0) {
uv.y = wsize.y - uv.y;
}
ivec2 iuv = ivec2(uv.x, uv.y);
stroke_depth = texelFetch(strokeDepth, iuv, 0).r;
outcolor = texelFetch(strokeColor, iuv, 0);

View File

@ -23,11 +23,11 @@ vec2 toScreenSpace(vec4 vertex)
{
/* need to calculate ndc because this is not done by vertex shader */
vec3 ndc = vec3(vertex).xyz / vertex.w;
vec2 sc;
sc.x = ((ndc.x + 1.0) / 2.0) * Viewport.x;
sc.y = ((ndc.y + 1.0) / 2.0) * Viewport.y;
return sc;
}
@ -35,20 +35,20 @@ void main()
{
float stroke_depth;
vec4 objcolor;
vec4 light_loc = ProjectionMatrix * ViewMatrix * vec4(loc.xyz, 1.0);
vec4 light_loc = ProjectionMatrix * ViewMatrix * vec4(loc.xyz, 1.0);
vec2 light2d = toScreenSpace(light_loc);
/* calc pixel scale */
float pxscale = (ProjectionMatrix[3][3] == 0.0) ? (10.0 / (light_loc.z * defaultpixsize)) : (10.0 / defaultpixsize);
pxscale = max(pxscale, 0.000001);
/* the height over plane is received in the w component of the loc
/* the height over plane is received in the w component of the loc
* and needs a factor to adapt to pixels
*/
float peak = height * 10.0 * pxscale;
vec3 light3d = vec3(light2d.x, light2d.y, peak);
vec3 light3d = vec3(light2d.x, light2d.y, peak);
vec2 uv = vec2(gl_FragCoord.xy);
vec3 frag_loc = vec3(uv.x, uv.y, 0);
vec3 norm = vec3(0, 0, 1.0); /* always z-up */
@ -56,15 +56,15 @@ void main()
ivec2 iuv = ivec2(uv.x, uv.y);
stroke_depth = texelFetch(strokeDepth, iuv, 0).r;
objcolor = texelFetch(strokeColor, iuv, 0);
/* diffuse light */
vec3 lightdir = normalize(light3d - frag_loc);
float diff = max(dot(norm, lightdir), 0.0);
float dist = length(light3d - frag_loc) / pxscale;
float factor = diff * ((energy * 100.0) / (dist * dist));
float factor = diff * ((energy * 100.0) / (dist * dist));
vec3 result = factor * max(ambient, 0.1) * vec3(objcolor);
gl_FragDepth = stroke_depth;
FragColor = vec4(result.r, result.g, result.b, objcolor.a);
}

View File

@ -23,15 +23,15 @@ void main()
{
vec2 uv = vec2(gl_FragCoord.xy);
vec4 nloc = ProjectionMatrix * ViewMatrix * vec4(loc.xyz, 1.0);
float dx = (ProjectionMatrix[3][3] == 0.0) ? (nsize[0] / (nloc.z * defaultpixsize)) : (nsize[0] / defaultpixsize);
float dy = (ProjectionMatrix[3][3] == 0.0) ? (nsize[1] / (nloc.z * defaultpixsize)) : (nsize[1] / defaultpixsize);
dx = max(abs(dx), 3.0);
dy = max(abs(dy), 3.0);
vec2 coord = vec2(dx * floor(uv.x / dx), dy * floor(uv.y / dy));
float stroke_depth = texelFetch(strokeDepth, ivec2(coord), 0).r;
vec4 outcolor = texelFetch(strokeColor, ivec2(coord), 0);

View File

@ -26,7 +26,7 @@ void main()
{
vec2 uv = vec2(gl_FragCoord.xy);
vec4 nloc = ProjectionMatrix * ViewMatrix * vec4(loc.xyz, 1.0);
float dx = (ProjectionMatrix[3][3] == 0.0) ? (noffset[0] / (nloc.z * defaultpixsize)) : (noffset[0] / defaultpixsize);
float dy = (ProjectionMatrix[3][3] == 0.0) ? (noffset[1] / (nloc.z * defaultpixsize)) : (noffset[1] / defaultpixsize);
@ -35,7 +35,7 @@ void main()
vec4 offset_pixel= texelFetch(strokeColor, ivec2(uv.x - dx, uv.y - dy), 0);
vec4 outcolor;
/* is transparent */
/* is transparent */
if (src_pixel.a == 0.0f) {
discard;
}
@ -56,7 +56,7 @@ void main()
}
else {
outcolor = vec4(rim_color, 1.0);
}
}
}
gl_FragDepth = stroke_depth;

View File

@ -19,14 +19,14 @@ out vec4 FragColor;
float overlay_color(float a, float b)
{
float rtn;
float rtn;
if (a < 0.5) {
rtn = 2.0 * a * b;
}
else {
rtn = 1.0 - 2.0 * (1.0 - a) * (1.0 - b);
}
return rtn;
}
@ -53,16 +53,16 @@ vec4 get_blend_color(int mode, vec4 src_color, vec4 mix_color)
else if (mode == MODE_DIVIDE) {
outcolor = src_color / mix_color;
}
else {
else {
outcolor = mix_color;
}
/* use always the alpha of source color */
outcolor.a = src_color.a;
/* use alpha to calculate the weight of the mixed color */
outcolor = mix(src_color, outcolor, mix_color.a);
return outcolor;
}
@ -75,8 +75,8 @@ void main()
vec4 rim_pixel= texelFetch(strokeRim, uv.xy, 0);
vec4 outcolor = src_pixel;
/* is transparent */
/* is transparent */
if (src_pixel.a == 0.0f) {
discard;
}
@ -92,7 +92,7 @@ void main()
outcolor = get_blend_color(mode, src_pixel, rim_pixel);
}
}
gl_FragDepth = stroke_depth;
FragColor = outcolor;
}

View File

@ -23,11 +23,11 @@ vec2 toScreenSpace(vec4 vertex)
{
/* need to calculate ndc because this is not done by vertex shader */
vec3 ndc = vec3(vertex).xyz / vertex.w;
vec2 sc;
sc.x = ((ndc.x + 1.0) / 2.0) * Viewport.x;
sc.y = ((ndc.y + 1.0) / 2.0) * Viewport.y;
return sc;
}
@ -37,15 +37,15 @@ void main()
vec2 uv = vec2(gl_FragCoord.xy);
float stroke_depth;
vec4 outcolor;
vec4 center3d = ProjectionMatrix * ViewMatrix * vec4(loc.xyz, 1.0);
vec4 center3d = ProjectionMatrix * ViewMatrix * vec4(loc.xyz, 1.0);
vec2 center = toScreenSpace(center3d);
vec2 tc = uv - center;
float dist = length(tc);
float pxradius = (ProjectionMatrix[3][3] == 0.0) ? (radius / (loc.z * defaultpixsize)) : (radius / defaultpixsize);
pxradius = max(pxradius, 1);
if (dist <= pxradius) {
float percent = (pxradius - dist) / pxradius;
float theta = percent * percent * angle * 8.0;

View File

@ -1785,13 +1785,13 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
/* Copy over the relevant point data */
new_stroke->points = MEM_callocN(sizeof(bGPDspoint) * new_stroke->totpoints, "gp delete stroke fragment");
memcpy(new_stroke->points, gps->points + island->start_idx, sizeof(bGPDspoint) * new_stroke->totpoints);
/* Copy over vertex weight data (if available) */
if (new_stroke->dvert != NULL) {
/* Copy over the relevant vertex-weight points */
new_stroke->dvert = MEM_callocN(sizeof(MDeformVert) * new_stroke->totpoints, "gp delete stroke fragment weight");
memcpy(new_stroke->dvert, gps->dvert + island->start_idx, sizeof(MDeformVert) * new_stroke->totpoints);
/* Copy weights */
int e = island->start_idx;
for (int i = 0; i < new_stroke->totpoints; i++) {

View File

@ -1690,7 +1690,7 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
break;
}
/* unsupported views */
default:
{

View File

@ -1245,7 +1245,7 @@ void uiItemsFullEnumO(
if (ui_layout_is_radial(layout)) {
/* XXX: While "_all()" guarantees spatial stability, it's bad when an enum has > 8 items total,
* but only a small subset will ever be shown at once (e.g. Mode Switch menu, after the
* but only a small subset will ever be shown at once (e.g. Mode Switch menu, after the
* introduction of GP editing modes)
*/
#if 0

View File

@ -1573,7 +1573,7 @@ void init_userdef_do_versions(Main *bmain)
for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
memcpy(btheme, &U_theme_default, sizeof(*btheme));
}
/* Annotations - new layer color
* Replace anything that used to be set if it looks like was left
* on the old default (i.e. black), which most users used

View File

@ -443,7 +443,7 @@ static void rna_def_shader_fx_light(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ShaderFxLight", "ShaderFx");
RNA_def_struct_ui_text(srna, "Light Effect", "Light effect");
RNA_def_struct_sdna(srna, "LightShaderFxData");
@ -517,7 +517,7 @@ void RNA_def_shader_fx(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Edit Mode", "Display effect in Edit mode");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Expanded);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);