Cleanup: Draw, Clang-Tidy else-after-return fixes (incomplete)
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/draw` module. Not all warnings are addressed in this commit. No functional changes.
This commit is contained in:
parent
88cc3f167f
commit
156448ba4b
|
@ -1021,9 +1021,8 @@ static void compute_cell_id(EEVEE_LightGrid *egrid,
|
|||
if (visited_cells == cell_idx) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
visited_cells++;
|
||||
}
|
||||
|
||||
visited_cells++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -483,9 +483,8 @@ static EeveeMaterialCache material_opaque(EEVEE_Data *vedata,
|
|||
if (BLI_ghash_ensure_p(pd->material_hash, key, (void ***)&emc_p)) {
|
||||
return **emc_p;
|
||||
}
|
||||
else {
|
||||
*emc_p = emc = BLI_memblock_alloc(sldata->material_cache);
|
||||
}
|
||||
|
||||
*emc_p = emc = BLI_memblock_alloc(sldata->material_cache);
|
||||
|
||||
material_shadow(vedata, sldata, ma, is_hair, emc);
|
||||
|
||||
|
|
|
@ -480,16 +480,15 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata)
|
|||
GPU_VERTBUF_DISCARD_SAFE(mb_geom->vbo[MB_NEXT]);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Modify the batch to include the previous & next position. */
|
||||
if (i == MB_PREV) {
|
||||
GPU_batch_vertbuf_add_ex(batch, vbo, true);
|
||||
mb_geom->vbo[i] = NULL;
|
||||
}
|
||||
else {
|
||||
/* Modify the batch to include the previous & next position. */
|
||||
if (i == MB_PREV) {
|
||||
GPU_batch_vertbuf_add_ex(batch, vbo, true);
|
||||
mb_geom->vbo[i] = NULL;
|
||||
}
|
||||
else {
|
||||
/* This VBO can be reuse by next time step. Don't pass ownership. */
|
||||
GPU_batch_vertbuf_add_ex(batch, vbo, false);
|
||||
}
|
||||
/* This VBO can be reuse by next time step. Don't pass ownership. */
|
||||
GPU_batch_vertbuf_add_ex(batch, vbo, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,12 +132,11 @@ static int gpencil_tobject_dist_sort(const void *a, const void *b)
|
|||
if (ob_a->camera_z > ob_b->camera_z) {
|
||||
return 1;
|
||||
}
|
||||
else if (ob_a->camera_z < ob_b->camera_z) {
|
||||
if (ob_a->camera_z < ob_b->camera_z) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gpencil_object_cache_sort(GPENCIL_PrivateData *pd)
|
||||
|
@ -193,7 +192,7 @@ static float gpencil_layer_final_opacity_get(const GPENCIL_PrivateData *pd,
|
|||
if (is_obact && is_fade) {
|
||||
return gpl->opacity * pd->fade_layer_opacity;
|
||||
}
|
||||
else if (!is_obact && (pd->fade_gp_object_opacity > -1.0f)) {
|
||||
if (!is_obact && (pd->fade_gp_object_opacity > -1.0f)) {
|
||||
return gpl->opacity * pd->fade_gp_object_opacity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -359,12 +359,11 @@ static float light_power_get(const Light *la)
|
|||
if (la->type == LA_AREA) {
|
||||
return 1.0f / (4.0f * M_PI);
|
||||
}
|
||||
else if (la->type == LA_SPOT || la->type == LA_LOCAL) {
|
||||
if (la->type == LA_SPOT || la->type == LA_LOCAL) {
|
||||
return 1.0f / (4.0f * M_PI * M_PI);
|
||||
}
|
||||
else {
|
||||
return 1.0f / M_PI;
|
||||
}
|
||||
|
||||
return 1.0f / M_PI;
|
||||
}
|
||||
|
||||
void gpencil_light_pool_populate(GPENCIL_LightPool *lightpool, Object *ob)
|
||||
|
|
|
@ -924,12 +924,11 @@ static float get_bone_wire_thickness(const ArmatureDrawContext *ctx, int bonefla
|
|||
if (ctx->const_color) {
|
||||
return ctx->const_wire;
|
||||
}
|
||||
else if (boneflag & (BONE_DRAW_ACTIVE | BONE_SELECTED)) {
|
||||
if (boneflag & (BONE_DRAW_ACTIVE | BONE_SELECTED)) {
|
||||
return 2.0f;
|
||||
}
|
||||
else {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
static const float *get_bone_wire_color(const ArmatureDrawContext *ctx,
|
||||
|
@ -2219,13 +2218,13 @@ static bool POSE_is_driven_by_active_armature(Object *ob)
|
|||
}
|
||||
return is_active;
|
||||
}
|
||||
else {
|
||||
Object *ob_mesh_deform = BKE_modifiers_is_deformed_by_meshdeform(ob);
|
||||
if (ob_mesh_deform) {
|
||||
/* Recursive. */
|
||||
return POSE_is_driven_by_active_armature(ob_mesh_deform);
|
||||
}
|
||||
|
||||
Object *ob_mesh_deform = BKE_modifiers_is_deformed_by_meshdeform(ob);
|
||||
if (ob_mesh_deform) {
|
||||
/* Recursive. */
|
||||
return POSE_is_driven_by_active_armature(ob_mesh_deform);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1018,9 +1018,8 @@ static float camera_offaxis_shiftx_get(Scene *scene,
|
|||
const float width = instdata->corner_x * 2.0f;
|
||||
return delta_shiftx * width;
|
||||
}
|
||||
else {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
/**
|
||||
* Draw the stereo 3d support elements (cameras, plane, volume).
|
||||
|
|
|
@ -109,13 +109,12 @@ static eStereoViews camera_background_images_stereo_eye(const Scene *scene, cons
|
|||
if ((scene->r.scemode & R_MULTIVIEW) == 0) {
|
||||
return STEREO_LEFT_ID;
|
||||
}
|
||||
else if (v3d->stereo3d_camera != STEREO_3D_ID) {
|
||||
if (v3d->stereo3d_camera != STEREO_3D_ID) {
|
||||
/* show only left or right camera */
|
||||
return v3d->stereo3d_camera;
|
||||
}
|
||||
else {
|
||||
return v3d->multiview_eye;
|
||||
}
|
||||
|
||||
return v3d->multiview_eye;
|
||||
}
|
||||
|
||||
static void camera_background_images_stereo_setup(const Scene *scene,
|
||||
|
@ -162,9 +161,8 @@ static struct GPUTexture *image_camera_background_texture_get(CameraBGImage *bgp
|
|||
/* Frame is out of range, dont show. */
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
camera_background_images_stereo_setup(scene, draw_ctx->v3d, image, iuser);
|
||||
}
|
||||
|
||||
camera_background_images_stereo_setup(scene, draw_ctx->v3d, image, iuser);
|
||||
|
||||
iuser->scene = draw_ctx->scene;
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, &lock);
|
||||
|
|
|
@ -36,7 +36,7 @@ static bool paint_object_is_rendered_transparent(View3D *v3d, Object *ob)
|
|||
if (v3d->shading.type == OB_WIRE) {
|
||||
return true;
|
||||
}
|
||||
else if (v3d->shading.type == OB_SOLID) {
|
||||
if (v3d->shading.type == OB_SOLID) {
|
||||
if (v3d->shading.flag & V3D_SHADING_XRAY) {
|
||||
return true;
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ static bool paint_object_is_rendered_transparent(View3D *v3d, Object *ob)
|
|||
if (ob && v3d->shading.color_type == V3D_SHADING_OBJECT_COLOR) {
|
||||
return ob->color[3] < 1.0f;
|
||||
}
|
||||
else if (ob && ob->type == OB_MESH && ob->data &&
|
||||
v3d->shading.color_type == V3D_SHADING_MATERIAL_COLOR) {
|
||||
if (ob && ob->type == OB_MESH && ob->data &&
|
||||
v3d->shading.color_type == V3D_SHADING_MATERIAL_COLOR) {
|
||||
Mesh *me = ob->data;
|
||||
for (int i = 0; i < me->totcol; i++) {
|
||||
Material *mat = me->mat[i];
|
||||
|
|
|
@ -112,17 +112,15 @@ int workbench_antialiasing_sample_count_get(WORKBENCH_PrivateData *wpd)
|
|||
/* Only draw using SMAA or no AA when navigating. */
|
||||
return min_ii(wpd->preferences->viewport_aa, 1);
|
||||
}
|
||||
else if (DRW_state_is_image_render()) {
|
||||
if (DRW_state_is_image_render()) {
|
||||
if (draw_ctx->v3d) {
|
||||
return scene->display.viewport_aa;
|
||||
}
|
||||
else {
|
||||
return scene->display.render_aa;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return wpd->preferences->viewport_aa;
|
||||
|
||||
return scene->display.render_aa;
|
||||
}
|
||||
|
||||
return wpd->preferences->viewport_aa;
|
||||
}
|
||||
|
||||
void workbench_antialiasing_view_updated(WORKBENCH_Data *vedata)
|
||||
|
@ -361,53 +359,52 @@ bool workbench_antialiasing_setup(WORKBENCH_Data *vedata)
|
|||
/* TAA accumulation has finish. Just copy the result back */
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
const float *viewport_size = DRW_viewport_size_get();
|
||||
const DRWView *default_view = DRW_view_default_get();
|
||||
float *transform_offset;
|
||||
|
||||
switch (wpd->taa_sample_len) {
|
||||
default:
|
||||
case 5:
|
||||
transform_offset = e_data.jitter_5[min_ii(wpd->taa_sample, 5)];
|
||||
break;
|
||||
case 8:
|
||||
transform_offset = e_data.jitter_8[min_ii(wpd->taa_sample, 8)];
|
||||
break;
|
||||
case 11:
|
||||
transform_offset = e_data.jitter_11[min_ii(wpd->taa_sample, 11)];
|
||||
break;
|
||||
case 16:
|
||||
transform_offset = e_data.jitter_16[min_ii(wpd->taa_sample, 16)];
|
||||
break;
|
||||
case 32:
|
||||
transform_offset = e_data.jitter_32[min_ii(wpd->taa_sample, 32)];
|
||||
break;
|
||||
}
|
||||
const float *viewport_size = DRW_viewport_size_get();
|
||||
const DRWView *default_view = DRW_view_default_get();
|
||||
float *transform_offset;
|
||||
|
||||
/* construct new matrices from transform delta */
|
||||
float winmat[4][4], viewmat[4][4], persmat[4][4];
|
||||
DRW_view_winmat_get(default_view, winmat, false);
|
||||
DRW_view_viewmat_get(default_view, viewmat, false);
|
||||
DRW_view_persmat_get(default_view, persmat, false);
|
||||
|
||||
window_translate_m4(winmat,
|
||||
persmat,
|
||||
transform_offset[0] / viewport_size[0],
|
||||
transform_offset[1] / viewport_size[1]);
|
||||
|
||||
if (wpd->view) {
|
||||
/* When rendering just update the view. This avoids recomputing the culling. */
|
||||
DRW_view_update_sub(wpd->view, viewmat, winmat);
|
||||
}
|
||||
else {
|
||||
/* TAA is not making a big change to the matrices.
|
||||
* Reuse the main view culling by creating a sub-view. */
|
||||
wpd->view = DRW_view_create_sub(default_view, viewmat, winmat);
|
||||
}
|
||||
DRW_view_set_active(wpd->view);
|
||||
return true;
|
||||
switch (wpd->taa_sample_len) {
|
||||
default:
|
||||
case 5:
|
||||
transform_offset = e_data.jitter_5[min_ii(wpd->taa_sample, 5)];
|
||||
break;
|
||||
case 8:
|
||||
transform_offset = e_data.jitter_8[min_ii(wpd->taa_sample, 8)];
|
||||
break;
|
||||
case 11:
|
||||
transform_offset = e_data.jitter_11[min_ii(wpd->taa_sample, 11)];
|
||||
break;
|
||||
case 16:
|
||||
transform_offset = e_data.jitter_16[min_ii(wpd->taa_sample, 16)];
|
||||
break;
|
||||
case 32:
|
||||
transform_offset = e_data.jitter_32[min_ii(wpd->taa_sample, 32)];
|
||||
break;
|
||||
}
|
||||
|
||||
/* construct new matrices from transform delta */
|
||||
float winmat[4][4], viewmat[4][4], persmat[4][4];
|
||||
DRW_view_winmat_get(default_view, winmat, false);
|
||||
DRW_view_viewmat_get(default_view, viewmat, false);
|
||||
DRW_view_persmat_get(default_view, persmat, false);
|
||||
|
||||
window_translate_m4(winmat,
|
||||
persmat,
|
||||
transform_offset[0] / viewport_size[0],
|
||||
transform_offset[1] / viewport_size[1]);
|
||||
|
||||
if (wpd->view) {
|
||||
/* When rendering just update the view. This avoids recomputing the culling. */
|
||||
DRW_view_update_sub(wpd->view, viewmat, winmat);
|
||||
}
|
||||
else {
|
||||
/* TAA is not making a big change to the matrices.
|
||||
* Reuse the main view culling by creating a sub-view. */
|
||||
wpd->view = DRW_view_create_sub(default_view, viewmat, winmat);
|
||||
}
|
||||
DRW_view_set_active(wpd->view);
|
||||
return true;
|
||||
}
|
||||
|
||||
void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata)
|
||||
|
|
|
@ -2909,9 +2909,8 @@ GPUBatch *DRW_cache_curve_edge_wire_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_loose_edges(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_curve_edge_normal_get(Object *ob)
|
||||
|
@ -2947,9 +2946,8 @@ GPUBatch *DRW_cache_curve_surface_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_surface(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_curve_loose_edges_get(Object *ob)
|
||||
|
@ -2961,11 +2959,10 @@ GPUBatch *DRW_cache_curve_loose_edges_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_loose_edges(mesh_eval);
|
||||
}
|
||||
else {
|
||||
/* TODO */
|
||||
UNUSED_VARS(cu);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
UNUSED_VARS(cu);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob)
|
||||
|
@ -2977,9 +2974,8 @@ GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_wireframes_face(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_wireframes_face(cu);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_curve_edge_detection_get(Object *ob, bool *r_is_manifold)
|
||||
|
@ -2990,9 +2986,8 @@ GPUBatch *DRW_cache_curve_edge_detection_get(Object *ob, bool *r_is_manifold)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold);
|
||||
}
|
||||
|
||||
/* Return list of batches */
|
||||
|
@ -3007,9 +3002,8 @@ GPUBatch **DRW_cache_curve_surface_shaded_get(Object *ob,
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -3061,12 +3055,11 @@ GPUBatch *DRW_cache_text_edge_wire_get(Object *ob)
|
|||
if (!has_surface) {
|
||||
return NULL;
|
||||
}
|
||||
else if (mesh_eval != NULL) {
|
||||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_loose_edges(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_text_surface_get(Object *ob)
|
||||
|
@ -3080,9 +3073,8 @@ GPUBatch *DRW_cache_text_surface_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_surface(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_text_edge_detection_get(Object *ob, bool *r_is_manifold)
|
||||
|
@ -3096,9 +3088,8 @@ GPUBatch *DRW_cache_text_edge_detection_get(Object *ob, bool *r_is_manifold)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_text_loose_edges_get(Object *ob)
|
||||
|
@ -3112,9 +3103,8 @@ GPUBatch *DRW_cache_text_loose_edges_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_loose_edges(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_text_face_wireframe_get(Object *ob)
|
||||
|
@ -3128,9 +3118,8 @@ GPUBatch *DRW_cache_text_face_wireframe_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_wireframes_face(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_wireframes_face(cu);
|
||||
}
|
||||
|
||||
GPUBatch **DRW_cache_text_surface_shaded_get(Object *ob,
|
||||
|
@ -3146,9 +3135,8 @@ GPUBatch **DRW_cache_text_surface_shaded_get(Object *ob,
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -3166,9 +3154,8 @@ GPUBatch *DRW_cache_surf_surface_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_surface(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_triangles_with_normals(cu);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_surf_edge_wire_get(Object *ob)
|
||||
|
@ -3180,9 +3167,8 @@ GPUBatch *DRW_cache_surf_edge_wire_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_loose_edges(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_wire_edge(cu);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob)
|
||||
|
@ -3194,9 +3180,8 @@ GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_wireframes_face(cu);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_wireframes_face(cu);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_surf_edge_detection_get(Object *ob, bool *r_is_manifold)
|
||||
|
@ -3207,9 +3192,8 @@ GPUBatch *DRW_cache_surf_edge_detection_get(Object *ob, bool *r_is_manifold)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_surf_loose_edges_get(Object *ob)
|
||||
|
@ -3221,11 +3205,10 @@ GPUBatch *DRW_cache_surf_loose_edges_get(Object *ob)
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_loose_edges(mesh_eval);
|
||||
}
|
||||
else {
|
||||
/* TODO */
|
||||
UNUSED_VARS(cu);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
UNUSED_VARS(cu);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return list of batches */
|
||||
|
@ -3240,9 +3223,8 @@ GPUBatch **DRW_cache_surf_surface_shaded_get(Object *ob,
|
|||
if (mesh_eval != NULL) {
|
||||
return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
else {
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
|
||||
return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -474,10 +474,9 @@ BLI_INLINE const float *bm_vert_co_get(const MeshRenderData *mr, const BMVert *e
|
|||
if (vert_coords != NULL) {
|
||||
return vert_coords[BM_elem_index_get(eve)];
|
||||
}
|
||||
else {
|
||||
UNUSED_VARS(mr);
|
||||
return eve->co;
|
||||
}
|
||||
|
||||
UNUSED_VARS(mr);
|
||||
return eve->co;
|
||||
}
|
||||
|
||||
BLI_INLINE const float *bm_vert_no_get(const MeshRenderData *mr, const BMVert *eve)
|
||||
|
@ -486,10 +485,9 @@ BLI_INLINE const float *bm_vert_no_get(const MeshRenderData *mr, const BMVert *e
|
|||
if (vert_normals != NULL) {
|
||||
return vert_normals[BM_elem_index_get(eve)];
|
||||
}
|
||||
else {
|
||||
UNUSED_VARS(mr);
|
||||
return eve->no;
|
||||
}
|
||||
|
||||
UNUSED_VARS(mr);
|
||||
return eve->no;
|
||||
}
|
||||
|
||||
BLI_INLINE const float *bm_face_no_get(const MeshRenderData *mr, const BMFace *efa)
|
||||
|
@ -498,10 +496,9 @@ BLI_INLINE const float *bm_face_no_get(const MeshRenderData *mr, const BMFace *e
|
|||
if (poly_normals != NULL) {
|
||||
return poly_normals[BM_elem_index_get(efa)];
|
||||
}
|
||||
else {
|
||||
UNUSED_VARS(mr);
|
||||
return efa->no;
|
||||
}
|
||||
|
||||
UNUSED_VARS(mr);
|
||||
return efa->no;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -2937,7 +2934,7 @@ static float evaluate_vertex_weight(const MDeformVert *dvert, const DRW_MeshWeig
|
|||
if ((wstate->defgroup_active < 0) && (wstate->defgroup_len > 0)) {
|
||||
return -2.0f;
|
||||
}
|
||||
else if (dvert == NULL) {
|
||||
if (dvert == NULL) {
|
||||
return (wstate->alert_mode != OB_DRAW_GROUPUSER_NONE) ? -1.0f : 0.0f;
|
||||
}
|
||||
|
||||
|
@ -4296,7 +4293,7 @@ static void statvis_calc_sharp(const MeshRenderData *mr, float *r_sharp)
|
|||
/* non-manifold edge, yet... */
|
||||
continue;
|
||||
}
|
||||
else if (*pval != NULL) {
|
||||
if (*pval != NULL) {
|
||||
const float *f1_no = mr->poly_normals[mp_index];
|
||||
const float *f2_no = *pval;
|
||||
angle = angle_normalized_v3v3(f1_no, f2_no);
|
||||
|
|
|
@ -135,9 +135,8 @@ static GpencilBatchCache *gpencil_batch_cache_get(Object *ob, int cfra)
|
|||
gpencil_batch_cache_clear(cache);
|
||||
return gpencil_batch_cache_init(ob, cfra);
|
||||
}
|
||||
else {
|
||||
return cache;
|
||||
}
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
void DRW_gpencil_batch_cache_dirty_tag(bGPdata *gpd)
|
||||
|
|
|
@ -83,10 +83,9 @@ static int lattice_render_verts_len_get(Lattice *lt)
|
|||
if ((lt->flag & LT_OUTSIDE) == 0) {
|
||||
return vert_len_calc(u, v, w);
|
||||
}
|
||||
else {
|
||||
/* TODO remove internal coords */
|
||||
return vert_len_calc(u, v, w);
|
||||
}
|
||||
|
||||
/* TODO remove internal coords */
|
||||
return vert_len_calc(u, v, w);
|
||||
}
|
||||
|
||||
static int lattice_render_edges_len_get(Lattice *lt)
|
||||
|
@ -102,10 +101,9 @@ static int lattice_render_edges_len_get(Lattice *lt)
|
|||
if ((lt->flag & LT_OUTSIDE) == 0) {
|
||||
return edge_len_calc(u, v, w);
|
||||
}
|
||||
else {
|
||||
/* TODO remove internal coords */
|
||||
return edge_len_calc(u, v, w);
|
||||
}
|
||||
|
||||
/* TODO remove internal coords */
|
||||
return edge_len_calc(u, v, w);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -252,12 +250,11 @@ static bool lattice_batch_cache_valid(Lattice *lt)
|
|||
if (cache->is_dirty) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if ((cache->dims.u_len != lt->pntsu) || (cache->dims.v_len != lt->pntsv) ||
|
||||
(cache->dims.w_len != lt->pntsw) ||
|
||||
((cache->show_only_outside != ((lt->flag & LT_OUTSIDE) != 0)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((cache->dims.u_len != lt->pntsu) || (cache->dims.v_len != lt->pntsv) ||
|
||||
(cache->dims.w_len != lt->pntsw) ||
|
||||
((cache->show_only_outside != ((lt->flag & LT_OUTSIDE) != 0)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -803,9 +803,8 @@ GPUBatch *DRW_mesh_batch_cache_get_loose_edges(Mesh *me)
|
|||
if (cache->no_loose_wire) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return DRW_batch_request(&cache->batch.loose_edges);
|
||||
}
|
||||
|
||||
return DRW_batch_request(&cache->batch.loose_edges);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_mesh_batch_cache_get_surface_weights(Mesh *me)
|
||||
|
|
|
@ -128,9 +128,8 @@ static bool particle_batch_cache_valid(ParticleSystem *psys)
|
|||
if (cache->is_dirty == false) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -647,14 +646,13 @@ static float particle_key_weight(const ParticleData *particle, int strand, float
|
|||
if (t == 1.0) {
|
||||
return hkeys[part->totkey - 1].weight;
|
||||
}
|
||||
else {
|
||||
float interp = t / edit_key_seg_t;
|
||||
int index = (int)interp;
|
||||
interp -= floorf(interp); /* Time between 2 edit key */
|
||||
float s1 = hkeys[index].weight;
|
||||
float s2 = hkeys[index + 1].weight;
|
||||
return s1 + interp * (s2 - s1);
|
||||
}
|
||||
|
||||
float interp = t / edit_key_seg_t;
|
||||
int index = (int)interp;
|
||||
interp -= floorf(interp); /* Time between 2 edit key */
|
||||
float s1 = hkeys[index].weight;
|
||||
float s2 = hkeys[index + 1].weight;
|
||||
return s1 + interp * (s2 - s1);
|
||||
}
|
||||
|
||||
static int particle_batch_cache_fill_segments_edit(
|
||||
|
|
|
@ -455,11 +455,11 @@ bool DRW_object_is_flat(Object *ob, int *r_axis)
|
|||
*r_axis = 0;
|
||||
return true;
|
||||
}
|
||||
else if (dim[1] == 0.0f) {
|
||||
if (dim[1] == 0.0f) {
|
||||
*r_axis = 1;
|
||||
return true;
|
||||
}
|
||||
else if (dim[2] == 0.0f) {
|
||||
if (dim[2] == 0.0f) {
|
||||
*r_axis = 2;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -792,9 +792,8 @@ DrawDataList *DRW_drawdatalist_from_id(ID *id)
|
|||
IdDdtTemplate *idt = (IdDdtTemplate *)id;
|
||||
return &idt->drawdata;
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DrawData *DRW_drawdata_get(ID *id, DrawEngineType *engine_type)
|
||||
|
|
|
@ -594,28 +594,26 @@ static DRWResourceHandle drw_resource_handle(DRWShadingGroup *shgroup,
|
|||
DRWResourceHandle handle = 0;
|
||||
return handle;
|
||||
}
|
||||
else {
|
||||
return drw_resource_handle_new(obmat, NULL);
|
||||
|
||||
return drw_resource_handle_new(obmat, NULL);
|
||||
}
|
||||
|
||||
if (DST.ob_handle == 0) {
|
||||
DST.ob_handle = drw_resource_handle_new(obmat, ob);
|
||||
DST.ob_state_obinfo_init = false;
|
||||
}
|
||||
|
||||
if (shgroup->objectinfo) {
|
||||
if (!DST.ob_state_obinfo_init) {
|
||||
DST.ob_state_obinfo_init = true;
|
||||
DRWObjectInfos *ob_infos = DRW_memblock_elem_from_handle(DST.vmempool->obinfos,
|
||||
&DST.ob_handle);
|
||||
|
||||
drw_call_obinfos_init(ob_infos, ob);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (DST.ob_handle == 0) {
|
||||
DST.ob_handle = drw_resource_handle_new(obmat, ob);
|
||||
DST.ob_state_obinfo_init = false;
|
||||
}
|
||||
|
||||
if (shgroup->objectinfo) {
|
||||
if (!DST.ob_state_obinfo_init) {
|
||||
DST.ob_state_obinfo_init = true;
|
||||
DRWObjectInfos *ob_infos = DRW_memblock_elem_from_handle(DST.vmempool->obinfos,
|
||||
&DST.ob_handle);
|
||||
|
||||
drw_call_obinfos_init(ob_infos, ob);
|
||||
}
|
||||
}
|
||||
|
||||
return DST.ob_handle;
|
||||
}
|
||||
return DST.ob_handle;
|
||||
}
|
||||
|
||||
static void command_type_set(uint64_t *command_type_bits, int index, eDRWCommandType type)
|
||||
|
@ -1904,9 +1902,8 @@ float DRW_view_near_distance_get(const DRWView *view)
|
|||
if (DRW_view_is_persp_get(view)) {
|
||||
return -projmat[3][2] / (projmat[2][2] - 1.0f);
|
||||
}
|
||||
else {
|
||||
return -(projmat[3][2] + 1.0f) / projmat[2][2];
|
||||
}
|
||||
|
||||
return -(projmat[3][2] + 1.0f) / projmat[2][2];
|
||||
}
|
||||
|
||||
float DRW_view_far_distance_get(const DRWView *view)
|
||||
|
@ -1917,9 +1914,8 @@ float DRW_view_far_distance_get(const DRWView *view)
|
|||
if (DRW_view_is_persp_get(view)) {
|
||||
return -projmat[3][2] / (projmat[2][2] + 1.0f);
|
||||
}
|
||||
else {
|
||||
return -(projmat[3][2] - 1.0f) / projmat[2][2];
|
||||
}
|
||||
|
||||
return -(projmat[3][2] - 1.0f) / projmat[2][2];
|
||||
}
|
||||
|
||||
void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse)
|
||||
|
@ -2026,18 +2022,16 @@ static int pass_shgroup_dist_sort(const void *a, const void *b)
|
|||
if (shgrp_a->z_sorting.distance < shgrp_b->z_sorting.distance) {
|
||||
return 1;
|
||||
}
|
||||
else if (shgrp_a->z_sorting.distance > shgrp_b->z_sorting.distance) {
|
||||
if (shgrp_a->z_sorting.distance > shgrp_b->z_sorting.distance) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
/* If distances are the same, keep original order. */
|
||||
if (shgrp_a->z_sorting.original_index > shgrp_b->z_sorting.original_index) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If distances are the same, keep original order. */
|
||||
if (shgrp_a->z_sorting.original_index > shgrp_b->z_sorting.original_index) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------ Shading group sorting --------------------- */
|
||||
|
|
|
@ -518,7 +518,7 @@ static bool draw_culling_box_test(const float (*frustum_planes)[4], const BoundB
|
|||
* Go to next plane. */
|
||||
break;
|
||||
}
|
||||
else if (v == 7) {
|
||||
if (v == 7) {
|
||||
/* 8 points behind this plane. */
|
||||
return false;
|
||||
}
|
||||
|
@ -995,9 +995,8 @@ static void draw_call_single_do(DRWShadingGroup *shgroup,
|
|||
draw_select_buffer(shgroup, state, batch, &handle);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
GPU_select_load_id(state->select_id);
|
||||
}
|
||||
|
||||
GPU_select_load_id(state->select_id);
|
||||
}
|
||||
|
||||
draw_geometry_execute(shgroup,
|
||||
|
|
|
@ -88,7 +88,7 @@ static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, Vie
|
|||
/* no exception met? then don't draw cursor! */
|
||||
return false;
|
||||
}
|
||||
else if (draw_ctx->object_mode & OB_MODE_WEIGHT_GPENCIL) {
|
||||
if (draw_ctx->object_mode & OB_MODE_WEIGHT_GPENCIL) {
|
||||
/* grease pencil hide always in some modes */
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue