Cleanup: add missing braces to draw manager

This commit is contained in:
2019-01-25 07:10:13 +11:00
parent b1f3a86d99
commit a4fe338dd8
47 changed files with 265 additions and 136 deletions

View File

@@ -69,13 +69,15 @@ void main(void)
if (abs(fac0) > 1e-5 && abs(fac3) > 1e-5) {
/* If both adjacent verts are facing the camera the same way,
* then it isn't an outline edge. */
if (sign(fac0) == sign(fac3))
if (sign(fac0) == sign(fac3)) {
return;
}
}
/* Don't outline if concave edge. */
if (dot(n0, v13) > 0.0001)
if (dot(n0, v13) > 0.0001) {
return;
}
vec2 thick = vColSize[0].w * (lineThickness / viewportSize);
vec2 edge_dir = compute_dir(ssPos[1], ssPos[2]);

View File

@@ -37,8 +37,9 @@ void main()
int color_id = (vertFlag[1] >> 4);
/* Don't output any edges if we don't show handles */
if (!showCurveHandles && (color_id < 5))
if (!showCurveHandles && (color_id < 5)) {
return;
}
bool edge_selected = (((vertFlag[1] | vertFlag[0]) & VERTEX_SELECTED) != 0);

View File

@@ -8,10 +8,12 @@ out vec4 FragColor;
void main()
{
if (isSelected != 0)
if (isSelected != 0) {
FragColor = colorFaceDot;
else
}
else {
FragColor = colorVertex;
}
#ifdef VERTEX_FACING
FragColor.a *= 1.0 - abs(facing) * 0.4;

View File

@@ -18,14 +18,18 @@ void main()
ivec4 data_m = data & dataMask;
if ((data_m.x & FACE_ACTIVE) != 0)
if ((data_m.x & FACE_ACTIVE) != 0) {
faceColor = colorFaceSelect;
else if ((data_m.x & FACE_SELECTED) != 0)
}
else if ((data_m.x & FACE_SELECTED) != 0) {
faceColor = colorFaceSelect;
else if ((data_m.x & FACE_FREESTYLE) != 0)
}
else if ((data_m.x & FACE_FREESTYLE) != 0) {
faceColor = colorFaceFreestyle;
else
}
else {
faceColor = colorFace;
}
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);

View File

@@ -148,5 +148,7 @@ void main()
#endif
/* don't write depth if not opaque */
if (FragColor.a == 0.0) discard;
if (FragColor.a == 0.0) {
discard;
}
}

View File

@@ -150,14 +150,18 @@ void main()
/* Face */
vec4 fcol;
if ((vData[0].x & FACE_ACTIVE) != 0)
if ((vData[0].x & FACE_ACTIVE) != 0) {
fcol = colorFaceSelect;
else if ((vData[0].x & FACE_SELECTED) != 0)
}
else if ((vData[0].x & FACE_SELECTED) != 0) {
fcol = colorFaceSelect;
else if ((vData[0].x & FACE_FREESTYLE) != 0)
}
else if ((vData[0].x & FACE_FREESTYLE) != 0) {
fcol = colorFaceFreestyle;
else
}
else {
fcol = colorFace;
}
/* Vertex */
ssPos[0] = proj(pPos[0]);

View File

@@ -82,14 +82,18 @@ void main()
}
/* Face */
if ((vData[0].x & FACE_ACTIVE) != 0)
if ((vData[0].x & FACE_ACTIVE) != 0) {
faceColor = colorFaceSelect;
else if ((vData[0].x & FACE_SELECTED) != 0)
}
else if ((vData[0].x & FACE_SELECTED) != 0) {
faceColor = colorFaceSelect;
else if ((vData[0].x & FACE_FREESTYLE) != 0)
}
else if ((vData[0].x & FACE_FREESTYLE) != 0) {
faceColor = colorFaceFreestyle;
else
}
else {
faceColor = colorFace;
}
# ifdef VERTEX_SELECTION
vertexColor = EDIT_MESH_vertex_color(data0.x).rgb;

View File

@@ -33,8 +33,9 @@ void main()
/* If both adjacent verts are facing the camera the same way,
* then it isn't an outline edge. */
if (sign(fac0) == sign(fac3))
if (sign(fac0) == sign(fac3)) {
return;
}
/* Don't outline if concave edge. */
/* That would hide a lot of non useful edge but it flickers badly.

View File

@@ -39,12 +39,15 @@ void main()
}
#ifdef USE_AXIS
if (axis == 0)
if (axis == 0) {
finalColor = vec4(1.0, 0.0, 0.0, 1.0);
else if (axis == 1)
}
else if (axis == 1) {
finalColor = vec4(0.0, 1.0, 0.0, 1.0);
else
}
else {
finalColor = vec4(0.0, 0.0, 1.0, 1.0);
}
#else
if (val < 0.0) {
finalColor = vec4(color, 1.0);

View File

@@ -18,15 +18,17 @@ float contours(float value, float steps, float width_px, float max_rel_width, fl
/* Don't draw lines at 0 or 1. */
float rel_value = value * steps;
if (rel_value < 0.5 || rel_value > steps - 0.5)
if (rel_value < 0.5 || rel_value > steps - 0.5) {
return 0.0;
}
/* Check if completely invisible due to fade out. */
float rel_gradient = gradient * steps;
float rel_min_width = min_width_px * rel_gradient;
if (max_rel_width <= rel_min_width)
if (max_rel_width <= rel_min_width) {
return 0.0;
}
/* Main shape of the line, accounting for width bias and maximum weight space width. */
float rel_width = width_px * rel_gradient;
@@ -48,8 +50,9 @@ vec4 contour_grid(float weight, float weight_gradient)
/* Fade away when the gradient is too low to avoid big fills and noise. */
float flt_eps = max(1e-8, 1e-6 * weight);
if (weight_gradient <= flt_eps)
if (weight_gradient <= flt_eps) {
return vec4(0.0);
}
/* Three levels of grid lines */
float grid10 = contours(weight, 10.0, 5.0, 0.3, weight_gradient);