Cleanup: add missing braces to draw manager
This commit is contained in:
parent
b1f3a86d99
commit
a4fe338dd8
|
@ -514,8 +514,9 @@ wmJob *EEVEE_lightbake_job_create(
|
|||
EEVEE_LightBake *lbake = NULL;
|
||||
|
||||
/* only one render job at a time */
|
||||
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER))
|
||||
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wmJob *wm_job = WM_jobs_get(wm, win, scene, "Bake Lighting",
|
||||
WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_LIGHT_BAKE);
|
||||
|
|
|
@ -78,15 +78,18 @@ bool EEVEE_lightprobes_obj_visibility_cb(bool vis_in, void *user_data)
|
|||
EEVEE_ObjectEngineData *oed = (EEVEE_ObjectEngineData *)user_data;
|
||||
|
||||
/* test disabled if group is NULL */
|
||||
if (oed->test_data->collection == NULL)
|
||||
if (oed->test_data->collection == NULL) {
|
||||
return vis_in;
|
||||
}
|
||||
|
||||
if (oed->test_data->cached == false)
|
||||
if (oed->test_data->cached == false) {
|
||||
oed->ob_vis_dirty = true;
|
||||
}
|
||||
|
||||
/* early out, don't need to compute ob_vis yet. */
|
||||
if (vis_in == false)
|
||||
if (vis_in == false) {
|
||||
return vis_in;
|
||||
}
|
||||
|
||||
if (oed->ob_vis_dirty) {
|
||||
oed->ob_vis_dirty = false;
|
||||
|
|
|
@ -457,8 +457,9 @@ void EEVEE_lights_cache_shcaster_material_add(
|
|||
DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo);
|
||||
DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
|
||||
|
||||
if (alpha_threshold != NULL)
|
||||
if (alpha_threshold != NULL) {
|
||||
DRW_shgroup_uniform_float(grp, "alphaThreshold", alpha_threshold, 1);
|
||||
}
|
||||
|
||||
DRW_shgroup_call_object_add(grp, geom, ob);
|
||||
}
|
||||
|
@ -599,8 +600,9 @@ void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
|
||||
float light_attenuation_radius_get(Lamp *la, float light_threshold)
|
||||
{
|
||||
if (la->mode & LA_CUSTOM_ATTENUATION)
|
||||
if (la->mode & LA_CUSTOM_ATTENUATION) {
|
||||
return la->att_dist;
|
||||
}
|
||||
|
||||
/* Compute max light power. */
|
||||
float power = max_fff(la->r, la->g, la->b);
|
||||
|
|
|
@ -784,8 +784,9 @@ struct GPUMaterial *EEVEE_material_mesh_depth_get(
|
|||
options |= VAR_MAT_CLIP;
|
||||
}
|
||||
|
||||
if (is_shadow)
|
||||
if (is_shadow) {
|
||||
options |= VAR_MAT_SHADOW;
|
||||
}
|
||||
|
||||
GPUMaterial *mat = DRW_shader_find_from_material(ma, engine, options, true);
|
||||
if (mat) {
|
||||
|
@ -1485,8 +1486,9 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
|
|||
shgrp_depth_array[i] = NULL;
|
||||
shgrp_depth_clip_array[i] = NULL;
|
||||
|
||||
if (ma == NULL)
|
||||
if (ma == NULL) {
|
||||
ma = &defmaterial;
|
||||
}
|
||||
|
||||
switch (ma->blend_method) {
|
||||
case MA_BM_SOLID:
|
||||
|
@ -1536,8 +1538,9 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
|
|||
EEVEE_ObjectEngineData *oedata = NULL;
|
||||
Material *ma = give_current_material(ob, i + 1);
|
||||
|
||||
if (ma == NULL)
|
||||
if (ma == NULL) {
|
||||
ma = &defmaterial;
|
||||
}
|
||||
|
||||
/* Do not render surface if we are rendering a volume object
|
||||
* and do not have a surface closure. */
|
||||
|
|
|
@ -288,8 +288,9 @@ static void eevee_render_result_normal(
|
|||
EEVEE_PrivateData *g_data = stl->g_data;
|
||||
|
||||
/* Only read the center texel. */
|
||||
if (stl->effects->taa_current_sample > 1)
|
||||
if (stl->effects->taa_current_sample > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((view_layer->passflag & SCE_PASS_NORMAL) != 0) {
|
||||
RenderPass *rp = RE_pass_find_by_name(rl, RE_PASSNAME_NORMAL, viewname);
|
||||
|
@ -336,8 +337,9 @@ static void eevee_render_result_z(
|
|||
EEVEE_PrivateData *g_data = stl->g_data;
|
||||
|
||||
/* Only read the center texel. */
|
||||
if (stl->effects->taa_current_sample > 1)
|
||||
if (stl->effects->taa_current_sample > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((view_layer->passflag & SCE_PASS_Z) != 0) {
|
||||
RenderPass *rp = RE_pass_find_by_name(rl, RE_PASSNAME_Z, viewname);
|
||||
|
|
|
@ -244,8 +244,9 @@ float line_unit_sphere_intersect_dist(vec3 lineorigin, vec3 linedirection)
|
|||
|
||||
float dist = 1e15;
|
||||
float determinant = b * b - a * c;
|
||||
if (determinant >= 0)
|
||||
if (determinant >= 0) {
|
||||
dist = (sqrt(determinant) - b) / a;
|
||||
}
|
||||
|
||||
return dist;
|
||||
}
|
||||
|
|
|
@ -108,15 +108,17 @@ layout(location = 1) out float fragAlpha;
|
|||
void main(void)
|
||||
{
|
||||
/* Discard to avoid bleeding onto the next layer */
|
||||
if (int(gl_FragCoord.x) * edge.x + edge.y > 0)
|
||||
if (int(gl_FragCoord.x) * edge.x + edge.y > 0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
/* Circle Dof */
|
||||
float dist = length(particlecoord);
|
||||
|
||||
/* Ouside of bokeh shape */
|
||||
if (dist > 1.0)
|
||||
if (dist > 1.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
/* Regular Polygon Dof */
|
||||
if (bokeh_sides.x > 0.0) {
|
||||
|
@ -134,8 +136,9 @@ void main(void)
|
|||
dist /= r;
|
||||
|
||||
/* Ouside of bokeh shape */
|
||||
if (dist > 1.0)
|
||||
if (dist > 1.0) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
fragColor = color;
|
||||
|
|
|
@ -91,8 +91,9 @@ void main()
|
|||
|
||||
/* Early out */
|
||||
/* We can't do discard because we don't clear the render target. */
|
||||
if (depth == 1.0)
|
||||
if (depth == 1.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
vec2 uvs = vec2(fullres_texel) / vec2(textureSize(depthBuffer, 0));
|
||||
|
||||
|
@ -105,16 +106,18 @@ void main()
|
|||
vec4 speccol_roughness = texelFetch(specroughBuffer, fullres_texel, 0).rgba;
|
||||
|
||||
/* Early out */
|
||||
if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0)
|
||||
if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
float roughness = speccol_roughness.a;
|
||||
float roughnessSquared = max(1e-3, roughness * roughness);
|
||||
float a2 = roughnessSquared * roughnessSquared;
|
||||
|
||||
/* Early out */
|
||||
if (roughness > ssrMaxRoughness + 0.2)
|
||||
if (roughness > ssrMaxRoughness + 0.2) {
|
||||
return;
|
||||
}
|
||||
|
||||
vec4 rand = texelFetch(utilTex, ivec3(halfres_texel % LUT_SIZE, 2), 0);
|
||||
|
||||
|
@ -394,8 +397,9 @@ void main()
|
|||
float depth = textureLod(depthBuffer, uvs, 0.0).r;
|
||||
|
||||
/* Early out */
|
||||
if (depth == 1.0)
|
||||
if (depth == 1.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
/* Using world space */
|
||||
vec3 viewPosition = get_view_space_from_depth(uvs, depth); /* Needed for viewCameraVec */
|
||||
|
@ -406,8 +410,9 @@ void main()
|
|||
vec4 speccol_roughness = texelFetch(specroughBuffer, fullres_texel, 0).rgba;
|
||||
|
||||
/* Early out */
|
||||
if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0)
|
||||
if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
float roughness = speccol_roughness.a;
|
||||
float roughnessSquared = max(1e-3, roughness * roughness);
|
||||
|
|
|
@ -52,8 +52,9 @@ float shadow_test(ShadowSample moments, float dist, ShadowData sd)
|
|||
{
|
||||
float p = 0.0;
|
||||
|
||||
if (dist <= moments.x)
|
||||
if (dist <= moments.x) {
|
||||
p = 1.0;
|
||||
}
|
||||
|
||||
float variance = moments.y - (moments.x * moments.x);
|
||||
variance = max(variance, sd.sh_bias / 10.0);
|
||||
|
|
|
@ -9,8 +9,9 @@ void main()
|
|||
float dist_sqr = dot(quadCoord, quadCoord);
|
||||
|
||||
/* Discard outside the circle. */
|
||||
if (dist_sqr > 1.0)
|
||||
if (dist_sqr > 1.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 view_nor = vec3(quadCoord, sqrt(max(0.0, 1.0 - dist_sqr)));
|
||||
vec3 world_ref = mat3(ViewMatrixInverse) * reflect(vec3(0.0, 0.0, -1.0), view_nor);
|
||||
|
|
|
@ -9,8 +9,9 @@ void main()
|
|||
float dist_sqr = dot(quadCoord, quadCoord);
|
||||
|
||||
/* Discard outside the circle. */
|
||||
if (dist_sqr > 1.0)
|
||||
if (dist_sqr > 1.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 view_nor = vec3(quadCoord, sqrt(max(0.0, 1.0 - dist_sqr)));
|
||||
vec3 world_nor = mat3(ViewMatrixInverse) * view_nor;
|
||||
|
|
|
@ -217,8 +217,9 @@ void CLOSURE_NAME(
|
|||
|
||||
float l_vis = light_visibility(ld, worldPosition, viewPosition, viewNormal, l_vector);
|
||||
|
||||
if (l_vis < 1e-8)
|
||||
if (l_vis < 1e-8) {
|
||||
continue;
|
||||
}
|
||||
|
||||
vec3 l_color_vis = ld.l_color * l_vis;
|
||||
|
||||
|
|
|
@ -93,10 +93,12 @@ vec3 solve_cubic(vec4 coefs)
|
|||
float x_3d = 2.0 * sqrt(-C_d) * cos(theta + (2.0 / 3.0) * M_PI);
|
||||
|
||||
float xs;
|
||||
if (x_1d + x_3d < 2.0 * C)
|
||||
if (x_1d + x_3d < 2.0 * C) {
|
||||
xs = x_1d;
|
||||
else
|
||||
}
|
||||
else {
|
||||
xs = x_3d;
|
||||
}
|
||||
|
||||
xsc = vec2(-D, xs + C);
|
||||
}
|
||||
|
@ -279,8 +281,9 @@ float ltc_evaluate_disk(vec3 N, vec3 V, mat3 Minv, vec3 disk_points[3])
|
|||
/* Now find front facing ellipse with same solid angle. */
|
||||
|
||||
vec3 V3 = normalize(cross(V1, V2));
|
||||
if (dot(C, V3) < 0.0)
|
||||
if (dot(C, V3) < 0.0) {
|
||||
V3 *= -1.0;
|
||||
}
|
||||
|
||||
float L = dot(V3, C);
|
||||
float x0 = dot(V1, C) / L;
|
||||
|
|
|
@ -75,12 +75,14 @@ void main()
|
|||
|
||||
#if defined(USE_ALPHA_HASH)
|
||||
/* Hashed Alpha Testing */
|
||||
if (cl.opacity < hashed_alpha_threshold(worldPosition))
|
||||
if (cl.opacity < hashed_alpha_threshold(worldPosition)) {
|
||||
discard;
|
||||
}
|
||||
#elif defined(USE_ALPHA_CLIP)
|
||||
/* Alpha clip */
|
||||
if (cl.opacity <= alphaThreshold)
|
||||
if (cl.opacity <= alphaThreshold) {
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -128,8 +128,9 @@ static void external_cache_populate(void *vedata, Object *ob)
|
|||
{
|
||||
EXTERNAL_StorageList *stl = ((EXTERNAL_Data *)vedata)->stl;
|
||||
|
||||
if (!DRW_object_is_renderable(ob))
|
||||
if (!DRW_object_is_renderable(ob)) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
|
||||
if (geom) {
|
||||
|
|
|
@ -156,8 +156,9 @@ static bool gpencil_can_draw_stroke(
|
|||
const bool onion, const bool is_mat_preview)
|
||||
{
|
||||
/* skip stroke if it doesn't have any valid data */
|
||||
if ((gps->points == NULL) || (gps->totpoints < 1) || (gp_style == NULL))
|
||||
if ((gps->points == NULL) || (gps->totpoints < 1) || (gp_style == NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* if mat preview render always visible */
|
||||
if (is_mat_preview) {
|
||||
|
@ -1130,8 +1131,9 @@ void DRW_gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
|
|||
}
|
||||
else {
|
||||
/* No triangles needed - Free anything allocated previously */
|
||||
if (gps->triangles)
|
||||
if (gps->triangles) {
|
||||
MEM_freeN(gps->triangles);
|
||||
}
|
||||
|
||||
gps->triangles = NULL;
|
||||
}
|
||||
|
@ -1496,8 +1498,9 @@ void DRW_gpencil_populate_multiedit(
|
|||
/* draw strokes */
|
||||
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
/* don't draw layer if hidden */
|
||||
if (gpl->flag & GP_LAYER_HIDE)
|
||||
if (gpl->flag & GP_LAYER_HIDE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* list of frames to draw */
|
||||
if (!playing) {
|
||||
|
@ -1603,8 +1606,9 @@ void DRW_gpencil_populate_datablock(
|
|||
}
|
||||
|
||||
gpf = BKE_gpencil_layer_getframe(gpl, remap_cfra, GP_GETFRAME_USE_PREV);
|
||||
if (gpf == NULL)
|
||||
if (gpf == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if solo mode, display only frames with keyframe in the current frame */
|
||||
if ((is_solomode) && (gpf->framenum != remap_cfra)) {
|
||||
|
|
|
@ -92,13 +92,15 @@ static bool effect_is_active(bGPdata *gpd, ShaderFxData *fx, bool is_render)
|
|||
static bool get_normal_vector(bGPdata *gpd, float r_point[3], float r_normal[3])
|
||||
{
|
||||
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
if (gpl->flag & GP_LAYER_HIDE)
|
||||
if (gpl->flag & GP_LAYER_HIDE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get frame */
|
||||
bGPDframe *gpf = gpl->actframe;
|
||||
if (gpf == NULL)
|
||||
if (gpf == NULL) {
|
||||
continue;
|
||||
}
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
if (gps->totpoints >= 3) {
|
||||
bGPDspoint *pt = &gps->points[0];
|
||||
|
|
|
@ -38,6 +38,7 @@ void main()
|
|||
FragColor = outcolor;
|
||||
gl_FragDepth = stroke_depth;
|
||||
|
||||
if (outcolor.a < 0.02f)
|
||||
if (outcolor.a < 0.02f) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,10 +79,12 @@ vec4 get_blend_color(int mode, vec4 src_color, vec4 blend_color)
|
|||
|
||||
float linearrgb_to_srgb(float c)
|
||||
{
|
||||
if (c < 0.0031308)
|
||||
if (c < 0.0031308) {
|
||||
return (c < 0.0) ? 0.0 : c * 12.92;
|
||||
else
|
||||
}
|
||||
else {
|
||||
return 1.055 * pow(c, 1.0 / 2.4) - 0.055;
|
||||
}
|
||||
}
|
||||
|
||||
vec4 tone(vec4 stroke_color)
|
||||
|
|
|
@ -23,9 +23,10 @@ void main()
|
|||
float dist_squared = dot(centered, centered);
|
||||
const float rad_squared = 0.25;
|
||||
|
||||
// round point with jaggy edges
|
||||
if ((mode != GPENCIL_MODE_BOX) && (dist_squared > rad_squared))
|
||||
/* Round point with jaggy edges. */
|
||||
if ((mode != GPENCIL_MODE_BOX) && (dist_squared > rad_squared)) {
|
||||
discard;
|
||||
}
|
||||
|
||||
vec4 tmp_color = texture2D(myTexture, mTexCoord);
|
||||
|
||||
|
|
|
@ -8,18 +8,22 @@ uniform int tonemapping;
|
|||
|
||||
float srgb_to_linearrgb(float c)
|
||||
{
|
||||
if (c < 0.04045)
|
||||
if (c < 0.04045) {
|
||||
return (c < 0.0) ? 0.0 : c * (1.0 / 12.92);
|
||||
else
|
||||
}
|
||||
else {
|
||||
return pow((c + 0.055) * (1.0 / 1.055), 2.4);
|
||||
}
|
||||
}
|
||||
|
||||
float linearrgb_to_srgb(float c)
|
||||
{
|
||||
if (c < 0.0031308)
|
||||
if (c < 0.0031308) {
|
||||
return (c < 0.0) ? 0.0 : c * 12.92;
|
||||
else
|
||||
}
|
||||
else {
|
||||
return 1.055 * pow(c, 1.0 / 2.4) - 0.055;
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
|
|
|
@ -9,8 +9,9 @@ void ssao_factors(
|
|||
{
|
||||
cavities = edges = 0.0;
|
||||
/* early out if there is no need for SSAO */
|
||||
if (ssao_factor_cavity == 0.0 && ssao_factor_edge == 0.0)
|
||||
if (ssao_factor_cavity == 0.0 && ssao_factor_edge == 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* take the normalized ray direction here */
|
||||
vec3 noise = texture(ssao_jitter, screenco.xy * jitter_tilling).rgb;
|
||||
|
@ -45,8 +46,9 @@ void ssao_factors(
|
|||
|
||||
vec2 uvcoords = screenco.xy + dir_jittered * offset;
|
||||
|
||||
if (uvcoords.x > 1.0 || uvcoords.x < 0.0 || uvcoords.y > 1.0 || uvcoords.y < 0.0)
|
||||
if (uvcoords.x > 1.0 || uvcoords.x < 0.0 || uvcoords.y > 1.0 || uvcoords.y < 0.0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
float depth_new = texture(depthBuffer, uvcoords).r;
|
||||
|
||||
|
@ -56,8 +58,9 @@ void ssao_factors(
|
|||
/* This trick provide good edge effect even if no neighboor is found. */
|
||||
vec3 pos_new = get_view_space_from_depth(uvcoords, (is_background) ? depth : depth_new);
|
||||
|
||||
if (is_background)
|
||||
if (is_background) {
|
||||
pos_new.z -= ssao_distance;
|
||||
}
|
||||
|
||||
vec3 dir = pos_new - position;
|
||||
float len = length(dir);
|
||||
|
@ -68,11 +71,13 @@ void ssao_factors(
|
|||
float attenuation = 1.0 / (len * (1.0 + len * len * ssao_attenuation));
|
||||
|
||||
/* use minor bias here to avoid self shadowing */
|
||||
if (f_cavities > -f_bias)
|
||||
if (f_cavities > -f_bias) {
|
||||
cavities += f_cavities * attenuation;
|
||||
}
|
||||
|
||||
if (f_edge > f_bias)
|
||||
if (f_edge > f_bias) {
|
||||
edges += f_edge * attenuation;
|
||||
}
|
||||
}
|
||||
|
||||
cavities /= ssao_samples_num;
|
||||
|
|
|
@ -144,10 +144,12 @@ vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped)
|
|||
|
||||
float srgb_to_linearrgb(float c)
|
||||
{
|
||||
if (c < 0.04045)
|
||||
if (c < 0.04045) {
|
||||
return (c < 0.0) ? 0.0 : c * (1.0 / 12.92);
|
||||
else
|
||||
}
|
||||
else {
|
||||
return pow((c + 0.055) * (1.0 / 1.055), 2.4);
|
||||
}
|
||||
}
|
||||
|
||||
vec4 srgb_to_linearrgb(vec4 col_from)
|
||||
|
|
|
@ -64,8 +64,9 @@ void main()
|
|||
bvec2 degen_faces = lessThan(abs(faces_area), vec2(DEGENERATE_THRESHOLD));
|
||||
|
||||
/* Both triangles are degenerate, abort. */
|
||||
if (all(degen_faces))
|
||||
if (all(degen_faces)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
vec2 facing = vec2(dot(n1, lightDirection),
|
||||
|
@ -92,8 +93,9 @@ void main()
|
|||
#endif
|
||||
|
||||
/* If both faces face the same direction it's not an outline edge. */
|
||||
if (backface.x == backface.y)
|
||||
if (backface.x == backface.y) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_INVOC_EXT
|
||||
if (gl_InvocationID == 0) {
|
||||
|
|
|
@ -169,8 +169,9 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
|
|||
/* normalized trick see:
|
||||
* http://www.derschmale.com/2014/01/26/reconstructing-positions-from-the-depth-buffer */
|
||||
mul_v3_fl(viewvecs[i], 1.0f / viewvecs[i][3]);
|
||||
if (is_persp)
|
||||
if (is_persp) {
|
||||
mul_v3_fl(viewvecs[i], 1.0f / viewvecs[i][2]);
|
||||
}
|
||||
viewvecs[i][3] = 1.0;
|
||||
|
||||
copy_v4_v4(wpd->viewvecs[i], viewvecs[i]);
|
||||
|
|
|
@ -813,8 +813,9 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
|
|||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
Scene *scene = draw_ctx->scene;
|
||||
|
||||
if (!DRW_object_is_renderable(ob))
|
||||
if (!DRW_object_is_renderable(ob)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ob->type == OB_MESH) {
|
||||
workbench_cache_populate_particles(vedata, ob);
|
||||
|
|
|
@ -498,8 +498,9 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
|
|||
Scene *scene = draw_ctx->scene;
|
||||
const bool is_wire = (ob->dt == OB_WIRE);
|
||||
|
||||
if (!DRW_object_is_renderable(ob))
|
||||
if (!DRW_object_is_renderable(ob)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ob->type == OB_MESH) {
|
||||
workbench_forward_cache_populate_particles(vedata, ob);
|
||||
|
|
|
@ -516,8 +516,9 @@ static void set_pchan_colorset(Object *ob, bPoseChannel *pchan)
|
|||
*/
|
||||
if (pchan->agrp_index) {
|
||||
grp = (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1));
|
||||
if (grp)
|
||||
if (grp) {
|
||||
color_index = grp->customCol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -775,8 +776,9 @@ static const float *get_bone_solid_color(
|
|||
const EditBone *UNUSED(eBone), const bPoseChannel *pchan, const bArmature *arm,
|
||||
const int boneflag, const short constflag)
|
||||
{
|
||||
if (g_theme.const_color)
|
||||
if (g_theme.const_color) {
|
||||
return g_theme.bone_solid_color;
|
||||
}
|
||||
|
||||
if (arm->flag & ARM_POSEMODE) {
|
||||
static float disp_color[4];
|
||||
|
@ -792,8 +794,9 @@ static const float *get_bone_solid_with_consts_color(
|
|||
const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm,
|
||||
const int boneflag, const short constflag)
|
||||
{
|
||||
if (g_theme.const_color)
|
||||
if (g_theme.const_color) {
|
||||
return g_theme.bone_solid_color;
|
||||
}
|
||||
|
||||
const float *col = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag);
|
||||
|
||||
|
@ -809,12 +812,15 @@ static const float *get_bone_solid_with_consts_color(
|
|||
|
||||
static float get_bone_wire_thickness(int boneflag)
|
||||
{
|
||||
if (g_theme.const_color)
|
||||
if (g_theme.const_color) {
|
||||
return g_theme.const_wire;
|
||||
else if (boneflag & (BONE_DRAW_ACTIVE | BONE_SELECTED))
|
||||
}
|
||||
else if (boneflag & (BONE_DRAW_ACTIVE | BONE_SELECTED)) {
|
||||
return 2.0f;
|
||||
else
|
||||
}
|
||||
else {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static const float *get_bone_wire_color(
|
||||
|
@ -1576,8 +1582,9 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
|
|||
float *line_start = NULL, *line_end = NULL;
|
||||
|
||||
for (con = pchan->constraints.first; con; con = con->next) {
|
||||
if (con->enforce == 0.0f)
|
||||
if (con->enforce == 0.0f) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (con->type) {
|
||||
case CONSTRAINT_TYPE_KINEMATIC:
|
||||
|
@ -1586,8 +1593,9 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
|
|||
int segcount = 0;
|
||||
|
||||
/* if only_temp, only draw if it is a temporary ik-chain */
|
||||
if (only_temp && !(data->flag & CONSTRAINT_IK_TEMP))
|
||||
if (only_temp && !(data->flag & CONSTRAINT_IK_TEMP)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* exclude tip from chain? */
|
||||
parchan = ((data->flag & CONSTRAINT_IK_TIP) == 0) ? pchan->parent : pchan;
|
||||
|
@ -1605,10 +1613,12 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
|
|||
if (parchan) {
|
||||
line_end = parchan->pose_head;
|
||||
|
||||
if (constflag & PCHAN_HAS_TARGET)
|
||||
if (constflag & PCHAN_HAS_TARGET) {
|
||||
drw_shgroup_bone_ik_lines(line_start, line_end);
|
||||
else
|
||||
}
|
||||
else {
|
||||
drw_shgroup_bone_ik_no_target_lines(line_start, line_end);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1618,8 +1628,9 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
|
|||
int segcount = 0;
|
||||
|
||||
/* don't draw if only_temp, as Spline IK chains cannot be temporary */
|
||||
if (only_temp)
|
||||
if (only_temp) {
|
||||
continue;
|
||||
}
|
||||
|
||||
parchan = pchan;
|
||||
line_start = parchan->pose_tail;
|
||||
|
@ -1826,8 +1837,9 @@ static void draw_armature_pose(Object *ob, const float const_color[4])
|
|||
}
|
||||
|
||||
/* set temporary flag for drawing bone as active, but only if selected */
|
||||
if (bone == arm->act_bone)
|
||||
if (bone == arm->act_bone) {
|
||||
boneflag |= BONE_DRAW_ACTIVE;
|
||||
}
|
||||
|
||||
draw_bone_relations(NULL, pchan, arm, boneflag, constflag, show_relations);
|
||||
|
||||
|
|
|
@ -3623,10 +3623,7 @@ GPUBatch *DRW_cache_cursor_get(bool crosshair_lines)
|
|||
float x = f10 * cosf(angle);
|
||||
float y = f10 * sinf(angle);
|
||||
|
||||
if (i % 2 == 0)
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.color, v, red);
|
||||
else
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.color, v, white);
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.color, v, (i % 2 == 0) ? red : white);
|
||||
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos, v, (const float[2]){x, y});
|
||||
GPU_indexbuf_add_generic_vert(&elb, v++);
|
||||
|
|
|
@ -1491,11 +1491,13 @@ static uchar mesh_render_data_looptri_flag(MeshRenderData *rdata, const BMFace *
|
|||
{
|
||||
uchar fflag = 0;
|
||||
|
||||
if (efa == rdata->efa_act)
|
||||
if (efa == rdata->efa_act) {
|
||||
fflag |= VFLAG_FACE_ACTIVE;
|
||||
}
|
||||
|
||||
if (BM_elem_flag_test(efa, BM_ELEM_SELECT))
|
||||
if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
|
||||
fflag |= VFLAG_FACE_SELECTED;
|
||||
}
|
||||
|
||||
#ifdef WITH_FREESTYLE
|
||||
if (rdata->cd.offset.freestyle_face != -1) {
|
||||
|
@ -1515,17 +1517,21 @@ static void mesh_render_data_edge_flag(
|
|||
{
|
||||
eattr->e_flag |= VFLAG_EDGE_EXISTS;
|
||||
|
||||
if (eed == rdata->eed_act)
|
||||
if (eed == rdata->eed_act) {
|
||||
eattr->e_flag |= VFLAG_EDGE_ACTIVE;
|
||||
}
|
||||
|
||||
if (BM_elem_flag_test(eed, BM_ELEM_SELECT))
|
||||
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
|
||||
eattr->e_flag |= VFLAG_EDGE_SELECTED;
|
||||
}
|
||||
|
||||
if (BM_elem_flag_test(eed, BM_ELEM_SEAM))
|
||||
if (BM_elem_flag_test(eed, BM_ELEM_SEAM)) {
|
||||
eattr->e_flag |= VFLAG_EDGE_SEAM;
|
||||
}
|
||||
|
||||
if (!BM_elem_flag_test(eed, BM_ELEM_SMOOTH))
|
||||
if (!BM_elem_flag_test(eed, BM_ELEM_SMOOTH)) {
|
||||
eattr->e_flag |= VFLAG_EDGE_SHARP;
|
||||
}
|
||||
|
||||
/* Use a byte for value range */
|
||||
if (rdata->cd.offset.crease != -1) {
|
||||
|
@ -1558,11 +1564,13 @@ static uchar mesh_render_data_vertex_flag(MeshRenderData *rdata, const BMVert *e
|
|||
uchar vflag = VFLAG_VERTEX_EXISTS;
|
||||
|
||||
/* Current vertex */
|
||||
if (eve == rdata->eve_act)
|
||||
if (eve == rdata->eve_act) {
|
||||
vflag |= VFLAG_VERTEX_ACTIVE;
|
||||
}
|
||||
|
||||
if (BM_elem_flag_test(eve, BM_ELEM_SELECT))
|
||||
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
|
||||
vflag |= VFLAG_VERTEX_SELECTED;
|
||||
}
|
||||
|
||||
return vflag;
|
||||
}
|
||||
|
@ -4803,8 +4811,9 @@ static void uvedit_fill_buffer_data(
|
|||
float (*av)[3], (*auv)[2];
|
||||
ushort area_stretch;
|
||||
/* Skip hidden faces. */
|
||||
if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
|
||||
if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uchar face_flag = edit_uv_get_face_flag(efa, efa_act, cd_loop_uv_offset, &scene);
|
||||
/* Face preprocess */
|
||||
|
|
|
@ -1309,8 +1309,9 @@ static void particle_batch_cache_ensure_pos(
|
|||
if (psys->part->phystype == PART_PHYS_KEYED) {
|
||||
if (psys->flag & PSYS_KEYED) {
|
||||
psys_count_keyed_targets(&sim);
|
||||
if (psys->totkeyed == 0)
|
||||
if (psys->totkeyed == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,8 +150,9 @@ void DRW_batching_buffer_request(
|
|||
}
|
||||
int new_id = 0; /* Find insertion point. */
|
||||
for (; new_id < chunk->alloc_size; ++new_id) {
|
||||
if (chunk->bbufs[new_id].format == NULL)
|
||||
if (chunk->bbufs[new_id].format == NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* If there is no batch left. Allocate more. */
|
||||
if (new_id == chunk->alloc_size) {
|
||||
|
@ -191,8 +192,9 @@ void DRW_instancing_buffer_request(
|
|||
}
|
||||
int new_id = 0; /* Find insertion point. */
|
||||
for (; new_id < chunk->alloc_size; ++new_id) {
|
||||
if (chunk->ibufs[new_id].format == NULL)
|
||||
if (chunk->ibufs[new_id].format == NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* If there is no batch left. Allocate more. */
|
||||
if (new_id == chunk->alloc_size) {
|
||||
|
|
|
@ -842,8 +842,9 @@ static bool id_type_can_have_drawdata(const short id_type)
|
|||
static bool id_can_have_drawdata(const ID *id)
|
||||
{
|
||||
/* sanity check */
|
||||
if (id == NULL)
|
||||
if (id == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return id_type_can_have_drawdata(GS(id->name));
|
||||
}
|
||||
|
@ -861,16 +862,18 @@ DrawDataList *DRW_drawdatalist_from_id(ID *id)
|
|||
IdDdtTemplate *idt = (IdDdtTemplate *)id;
|
||||
return &idt->drawdata;
|
||||
}
|
||||
else
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
DrawData *DRW_drawdata_get(ID *id, DrawEngineType *engine_type)
|
||||
{
|
||||
DrawDataList *drawdata = DRW_drawdatalist_from_id(id);
|
||||
|
||||
if (drawdata == NULL)
|
||||
if (drawdata == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH(DrawData *, dd, drawdata) {
|
||||
if (dd->engine_type == engine_type) {
|
||||
|
@ -930,8 +933,9 @@ void DRW_drawdata_free(ID *id)
|
|||
{
|
||||
DrawDataList *drawdata = DRW_drawdatalist_from_id(id);
|
||||
|
||||
if (drawdata == NULL)
|
||||
if (drawdata == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH(DrawData *, dd, drawdata) {
|
||||
if (dd->free != NULL) {
|
||||
|
@ -948,8 +952,9 @@ static void drw_drawdata_unlink_dupli(ID *id)
|
|||
if ((GS(id->name) == ID_OB) && (((Object *)id)->base_flag & BASE_FROM_DUPLI) != 0) {
|
||||
DrawDataList *drawdata = DRW_drawdatalist_from_id(id);
|
||||
|
||||
if (drawdata == NULL)
|
||||
if (drawdata == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
BLI_listbase_clear((ListBase *)drawdata);
|
||||
}
|
||||
|
|
|
@ -674,24 +674,33 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
|
|||
shgroup->callid = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_CALLID);
|
||||
|
||||
shgroup->matflag = 0;
|
||||
if (shgroup->modelinverse > -1)
|
||||
if (shgroup->modelinverse > -1) {
|
||||
shgroup->matflag |= DRW_CALL_MODELINVERSE;
|
||||
if (shgroup->modelview > -1)
|
||||
}
|
||||
if (shgroup->modelview > -1) {
|
||||
shgroup->matflag |= DRW_CALL_MODELVIEW;
|
||||
if (shgroup->modelviewinverse > -1)
|
||||
}
|
||||
if (shgroup->modelviewinverse > -1) {
|
||||
shgroup->matflag |= DRW_CALL_MODELVIEWINVERSE;
|
||||
if (shgroup->modelviewprojection > -1)
|
||||
}
|
||||
if (shgroup->modelviewprojection > -1) {
|
||||
shgroup->matflag |= DRW_CALL_MODELVIEWPROJECTION;
|
||||
if (shgroup->normalview > -1)
|
||||
}
|
||||
if (shgroup->normalview > -1) {
|
||||
shgroup->matflag |= DRW_CALL_NORMALVIEW;
|
||||
if (shgroup->normalworld > -1)
|
||||
}
|
||||
if (shgroup->normalworld > -1) {
|
||||
shgroup->matflag |= DRW_CALL_NORMALWORLD;
|
||||
if (shgroup->orcotexfac > -1)
|
||||
}
|
||||
if (shgroup->orcotexfac > -1) {
|
||||
shgroup->matflag |= DRW_CALL_ORCOTEXFAC;
|
||||
if (shgroup->objectinfo > -1)
|
||||
}
|
||||
if (shgroup->objectinfo > -1) {
|
||||
shgroup->matflag |= DRW_CALL_OBJECTINFO;
|
||||
if (shgroup->eye > -1)
|
||||
}
|
||||
if (shgroup->eye > -1) {
|
||||
shgroup->matflag |= DRW_CALL_EYEVEC;
|
||||
}
|
||||
}
|
||||
|
||||
static void drw_shgroup_instance_init(
|
||||
|
|
|
@ -521,8 +521,9 @@ static void draw_frustum_boundbox_calc(const float(*projmat)[4], BoundBox *r_bbo
|
|||
|
||||
static void draw_clipping_setup_from_view(void)
|
||||
{
|
||||
if (DST.clipping.updated)
|
||||
if (DST.clipping.updated) {
|
||||
return;
|
||||
}
|
||||
|
||||
float (*viewinv)[4] = DST.view_data.matstate.mat[DRW_MAT_VIEWINV];
|
||||
float (*projmat)[4] = DST.view_data.matstate.mat[DRW_MAT_WIN];
|
||||
|
@ -684,14 +685,16 @@ bool DRW_culling_sphere_test(BoundSphere *bsphere)
|
|||
draw_clipping_setup_from_view();
|
||||
|
||||
/* Bypass test if radius is negative. */
|
||||
if (bsphere->radius < 0.0f)
|
||||
if (bsphere->radius < 0.0f) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Do a rough test first: Sphere VS Sphere intersect. */
|
||||
BoundSphere *frustum_bsphere = &DST.clipping.frustum_bsphere;
|
||||
float center_dist = len_squared_v3v3(bsphere->center, frustum_bsphere->center);
|
||||
if (center_dist > SQUARE(bsphere->radius + frustum_bsphere->radius))
|
||||
if (center_dist > SQUARE(bsphere->radius + frustum_bsphere->radius)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Test against the 6 frustum planes. */
|
||||
for (int p = 0; p < 6; p++) {
|
||||
|
@ -1012,8 +1015,9 @@ static void release_texture_slots(bool with_persist)
|
|||
}
|
||||
else {
|
||||
for (int i = 0; i < GPU_max_textures(); ++i) {
|
||||
if (DST.RST.bound_tex_slots[i] != BIND_PERSIST)
|
||||
if (DST.RST.bound_tex_slots[i] != BIND_PERSIST) {
|
||||
DST.RST.bound_tex_slots[i] = BIND_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1029,8 +1033,9 @@ static void release_ubo_slots(bool with_persist)
|
|||
}
|
||||
else {
|
||||
for (int i = 0; i < GPU_max_ubo_binds(); ++i) {
|
||||
if (DST.RST.bound_ubo_slots[i] != BIND_PERSIST)
|
||||
if (DST.RST.bound_ubo_slots[i] != BIND_PERSIST) {
|
||||
DST.RST.bound_ubo_slots[i] = BIND_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1317,8 +1322,9 @@ static void drw_update_view(void)
|
|||
|
||||
static void drw_draw_pass_ex(DRWPass *pass, DRWShadingGroup *start_group, DRWShadingGroup *end_group)
|
||||
{
|
||||
if (start_group == NULL)
|
||||
if (start_group == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
DST.shader = NULL;
|
||||
|
||||
|
|
|
@ -219,10 +219,12 @@ static void edit_text_cache_populate_select(void *vedata, Object *ob)
|
|||
|
||||
float selboxw;
|
||||
if (i + 1 != ef->selboxes_len) {
|
||||
if (ef->selboxes[i + 1].y == sb->y)
|
||||
if (ef->selboxes[i + 1].y == sb->y) {
|
||||
selboxw = ef->selboxes[i + 1].x - sb->x;
|
||||
else
|
||||
}
|
||||
else {
|
||||
selboxw = sb->w;
|
||||
}
|
||||
}
|
||||
else {
|
||||
selboxw = sb->w;
|
||||
|
|
|
@ -542,12 +542,15 @@ static void OBJECT_engine_init(void *vedata)
|
|||
grid_res = fabsf(tanf(fov)) / grid_scale;
|
||||
|
||||
e_data.grid_flag = (1 << 4); /* XY plane */
|
||||
if (show_axis_x)
|
||||
if (show_axis_x) {
|
||||
e_data.grid_flag |= SHOW_AXIS_X;
|
||||
if (show_axis_y)
|
||||
}
|
||||
if (show_axis_y) {
|
||||
e_data.grid_flag |= SHOW_AXIS_Y;
|
||||
if (show_floor)
|
||||
}
|
||||
if (show_floor) {
|
||||
e_data.grid_flag |= SHOW_GRID;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
@ -925,8 +928,9 @@ static void DRW_shgroup_empty_image(
|
|||
{
|
||||
/* TODO: 'StereoViews', see draw_empty_image. */
|
||||
|
||||
if (!BKE_object_empty_image_is_visible_in_view3d(ob, rv3d))
|
||||
if (!BKE_object_empty_image_is_visible_in_view3d(ob, rv3d)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Calling 'BKE_image_get_size' may free the texture. Get the size from 'tex' instead, see: T59347 */
|
||||
int size[2] = {0};
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue