Cleanup: style, use braces in draw
This commit is contained in:
@@ -225,26 +225,34 @@ static struct GPUTexture *create_ggx_refraction_lut_texture(int w, int h)
|
||||
fprintf(f, "\t{\n\t\t");
|
||||
for (int i = 0; i < w * h * 3; i += 3) {
|
||||
fprintf(f, "%ff,", data[i]);
|
||||
if (((i / 3) + 1) % 12 == 0)
|
||||
if (((i / 3) + 1) % 12 == 0) {
|
||||
fprintf(f, "\n\t\t");
|
||||
else
|
||||
}
|
||||
else {
|
||||
fprintf(f, " ");
|
||||
}
|
||||
}
|
||||
fprintf(f, "\n\t},\n");
|
||||
# else
|
||||
for (int i = 0; i < w * h * 3; i += 3) {
|
||||
if (data[i] < 0.01)
|
||||
if (data[i] < 0.01) {
|
||||
printf(" ");
|
||||
else if (data[i] < 0.3)
|
||||
}
|
||||
else if (data[i] < 0.3) {
|
||||
printf(".");
|
||||
else if (data[i] < 0.6)
|
||||
}
|
||||
else if (data[i] < 0.6) {
|
||||
printf("+");
|
||||
else if (data[i] < 0.9)
|
||||
}
|
||||
else if (data[i] < 0.9) {
|
||||
printf("%%");
|
||||
else
|
||||
}
|
||||
else {
|
||||
printf("#");
|
||||
if ((i / 3 + 1) % 64 == 0)
|
||||
}
|
||||
if ((i / 3 + 1) % 64 == 0) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
@@ -232,8 +232,9 @@ void gtao(vec3 normal, vec3 position, vec4 noise, out float visibility, out vec3
|
||||
* Page 78 in the .pdf version. */
|
||||
float gtao_multibounce(float visibility, vec3 albedo)
|
||||
{
|
||||
if (aoBounceFac == 0.0)
|
||||
if (aoBounceFac == 0.0) {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
/* Median luminance. Because Colored multibounce looks bad. */
|
||||
float lum = dot(albedo, vec3(0.3333));
|
||||
|
||||
@@ -104,6 +104,7 @@ void main()
|
||||
}
|
||||
*/
|
||||
|
||||
if (fragColor.a < 0.0035)
|
||||
if (fragColor.a < 0.0035) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,18 +78,23 @@ void main(void)
|
||||
|
||||
/* culling outside viewport */
|
||||
vec2 area = Viewport * 4.0;
|
||||
if (sp1.x < -area.x || sp1.x > area.x)
|
||||
if (sp1.x < -area.x || sp1.x > area.x) {
|
||||
return;
|
||||
if (sp1.y < -area.y || sp1.y > area.y)
|
||||
}
|
||||
if (sp1.y < -area.y || sp1.y > area.y) {
|
||||
return;
|
||||
if (sp2.x < -area.x || sp2.x > area.x)
|
||||
}
|
||||
if (sp2.x < -area.x || sp2.x > area.x) {
|
||||
return;
|
||||
if (sp2.y < -area.y || sp2.y > area.y)
|
||||
}
|
||||
if (sp2.y < -area.y || sp2.y > area.y) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* culling behind camera */
|
||||
if (P1.w < 0 || P2.w < 0)
|
||||
if (P1.w < 0 || P2.w < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* determine the direction of each of the 3 segments (previous, current, next) */
|
||||
vec2 v0 = normalize(sp1 - sp0);
|
||||
@@ -108,16 +113,20 @@ void main(void)
|
||||
/* determine the length of the miter by projecting it onto normal and then inverse it */
|
||||
float an1 = dot(miter_a, n1);
|
||||
float bn1 = dot(miter_b, n2);
|
||||
if (an1 == 0)
|
||||
if (an1 == 0) {
|
||||
an1 = 1;
|
||||
if (bn1 == 0)
|
||||
}
|
||||
if (bn1 == 0) {
|
||||
bn1 = 1;
|
||||
}
|
||||
float length_a = finalThickness[1] / an1;
|
||||
float length_b = finalThickness[2] / bn1;
|
||||
if (length_a <= 0.0)
|
||||
if (length_a <= 0.0) {
|
||||
length_a = 0.01;
|
||||
if (length_b <= 0.0)
|
||||
}
|
||||
if (length_b <= 0.0) {
|
||||
length_b = 0.01;
|
||||
}
|
||||
|
||||
/* prevent excessively long miters at sharp corners */
|
||||
if (dot(v0, v1) < -MiterLimit) {
|
||||
|
||||
@@ -86,8 +86,9 @@ void main()
|
||||
# ifndef DOUBLE_MANIFOLD
|
||||
/* If the mesh is known to be manifold and we don't use double count,
|
||||
* only create an quad if the we encounter a facing geom. */
|
||||
if ((degen_faces.x && backface.y) || (degen_faces.y && backface.x))
|
||||
if ((degen_faces.x && backface.y) || (degen_faces.y && backface.x)) {
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
/* If one of the 2 triangles is degenerate, replace edge by a non-manifold one. */
|
||||
|
||||
@@ -48,16 +48,21 @@ void main()
|
||||
bool edge_selected = (((vertFlag[1] | vertFlag[0]) & VERT_SELECTED) != 0);
|
||||
|
||||
vec4 inner_color;
|
||||
if (color_id == 0)
|
||||
if (color_id == 0) {
|
||||
inner_color = (edge_selected) ? colorHandleSelFree : colorHandleFree;
|
||||
else if (color_id == 1)
|
||||
}
|
||||
else if (color_id == 1) {
|
||||
inner_color = (edge_selected) ? colorHandleSelAuto : colorHandleAuto;
|
||||
else if (color_id == 2)
|
||||
}
|
||||
else if (color_id == 2) {
|
||||
inner_color = (edge_selected) ? colorHandleSelVect : colorHandleVect;
|
||||
else if (color_id == 3)
|
||||
}
|
||||
else if (color_id == 3) {
|
||||
inner_color = (edge_selected) ? colorHandleSelAlign : colorHandleAlign;
|
||||
else if (color_id == 4)
|
||||
}
|
||||
else if (color_id == 4) {
|
||||
inner_color = (edge_selected) ? colorHandleSelAutoclamp : colorHandleAutoclamp;
|
||||
}
|
||||
else {
|
||||
bool is_selected = (((vertFlag[1] & vertFlag[0]) & VERT_SELECTED) != 0);
|
||||
bool is_u_segment = (((vertFlag[1] ^ vertFlag[0]) & EVEN_U_BIT) != 0);
|
||||
|
||||
Reference in New Issue
Block a user