diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-21 02:46:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-21 02:46:26 +0300 |
commit | 7a26e930a8c09c6380f47e97d8d3cb3ddd90f2bc (patch) | |
tree | bbb75625e8fe8beab2588f1bf0496fd841ef1b88 /source/blender/draw | |
parent | 217727cb35651a674fbca1718f0d5fc7e2107306 (diff) |
Cleanup: macro hygiene, line length
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl.h | 11 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 36 |
2 files changed, 28 insertions, 19 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h index bd7260f967b..64a1a72ed37 100644 --- a/source/blender/draw/intern/draw_cache_impl.h +++ b/source/blender/draw/intern/draw_cache_impl.h @@ -78,7 +78,8 @@ struct GPUBatch *DRW_curve_batch_cache_get_wireframes_face(struct Curve *cu); /* Metaball */ struct GPUBatch *DRW_metaball_batch_cache_get_triangles_with_normals(struct Object *ob); -struct GPUBatch **DRW_metaball_batch_cache_get_surface_shaded(struct Object *ob, struct MetaBall *mb, struct GPUMaterial **gpumat_array, uint gpumat_array_len); +struct GPUBatch **DRW_metaball_batch_cache_get_surface_shaded( + struct Object *ob, struct MetaBall *mb, struct GPUMaterial **gpumat_array, uint gpumat_array_len); struct GPUBatch *DRW_metaball_batch_cache_get_wireframes_face(struct Object *ob); /* DispList */ @@ -184,12 +185,12 @@ struct GPUBatch *DRW_particles_batch_cache_get_edit_tip_points( struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit); /* Common */ -#define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value) (flag |= DRW_vbo_requested(vbo) ? value : 0) -#define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value) (flag |= DRW_ibo_requested(ibo) ? value : 0) +#define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value) (flag |= DRW_vbo_requested(vbo) ? (value) : 0) +#define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value) (flag |= DRW_ibo_requested(ibo) ? (value) : 0) /* Test and assign NULL if test fails */ -#define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? v : NULL)) -#define DRW_TEST_ASSIGN_IBO(v) (v = (DRW_ibo_requested(v) ? v : NULL)) +#define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? (v) : NULL)) +#define DRW_TEST_ASSIGN_IBO(v) (v = (DRW_ibo_requested(v) ? (v) : NULL)) struct GPUBatch *DRW_batch_request(struct GPUBatch **batch); bool DRW_batch_requested(struct GPUBatch *batch, int prim_type); diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index d7c848909d3..30a940e27f6 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -495,8 +495,8 @@ static void mesh_render_calc_normals_loop_and_poly(const Mesh *me, const float s } static void mesh_cd_extract_auto_layers_names_and_srgb( - Mesh *me, const ushort cd_lused[CD_NUMTYPES], - char **r_auto_layers_names, int **r_auto_layers_srgb, int *r_auto_layers_len) + Mesh *me, const ushort cd_lused[CD_NUMTYPES], + char **r_auto_layers_names, int **r_auto_layers_srgb, int *r_auto_layers_len) { const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata; @@ -1015,7 +1015,7 @@ static MeshRenderData *mesh_render_data_create_ex( &rdata->cd.output.ldata, me->totloop, &rdata->cd.output.tangent_mask); - /* If we store tangents in the mesh, set temporary. */ + /* If we store tangents in the mesh, set temporary. */ #if 0 CustomData_set_layer_flag(cd_ldata, CD_TANGENT, CD_FLAG_TEMPORARY); #endif @@ -2413,7 +2413,7 @@ static void mesh_batch_cache_clear_selective(Mesh *me, GPUVertBuf *vert) BLI_assert(vert != NULL); if (ELEM(vert, cache->pos_with_normals, cache->pos_with_normals_visible_only, - cache->pos_with_normals_edit, cache->pos_with_normals_visible_only_edit)) + cache->pos_with_normals_edit, cache->pos_with_normals_visible_only_edit)) { GPU_BATCH_DISCARD_SAFE(cache->triangles_with_normals); GPU_BATCH_DISCARD_SAFE(cache->triangles_with_weights); @@ -4208,9 +4208,11 @@ static void mesh_create_surf_tris(MeshRenderData *rdata, GPUIndexBuf *ibo, const if (BM_elem_flag_test(bm_face, BM_ELEM_HIDDEN)) { continue; } - GPU_indexbuf_add_tri_verts(&elb, BM_elem_index_get(bm_looptri[0]->v), - BM_elem_index_get(bm_looptri[1]->v), - BM_elem_index_get(bm_looptri[2]->v)); + GPU_indexbuf_add_tri_verts( + &elb, + BM_elem_index_get(bm_looptri[0]->v), + BM_elem_index_get(bm_looptri[1]->v), + BM_elem_index_get(bm_looptri[2]->v)); } } else { @@ -4373,9 +4375,11 @@ static void mesh_create_loops_tris( continue; } int mat = (ibo_len > 1) ? bm_face->mat_nr : 0; - GPU_indexbuf_add_tri_verts(&elb[mat], BM_elem_index_get(bm_looptri[0]), - BM_elem_index_get(bm_looptri[1]), - BM_elem_index_get(bm_looptri[2])); + GPU_indexbuf_add_tri_verts( + &elb[mat], + BM_elem_index_get(bm_looptri[0]), + BM_elem_index_get(bm_looptri[1]), + BM_elem_index_get(bm_looptri[2])); } } else { @@ -5273,8 +5277,10 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me) const DRWContextState *draw_ctx = DRW_context_state_get(); const int mode = CTX_data_mode_enum_ex(draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode); const bool is_paint_mode = ELEM(mode, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT); - const bool use_hide = (ob->type == OB_MESH) && ((is_paint_mode && (ob == draw_ctx->obact)) || - ((mode == CTX_MODE_EDIT_MESH) && BKE_object_is_in_editmode(ob))); + const bool use_hide = ( + (ob->type == OB_MESH) && + ((is_paint_mode && (ob == draw_ctx->obact)) || + ((mode == CTX_MODE_EDIT_MESH) && BKE_object_is_in_editmode(ob)))); bool use_face_sel = false; /* Tex paint face select */ @@ -5526,8 +5532,10 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me) DRW_vbo_requested(cache->edit.lnor) || DRW_ibo_requested(cache->ibo.edit_verts_points)) { - mesh_create_edit_tris_and_verts(rdata, cache->edit.data, cache->edit.pos_nor, - cache->edit.lnor, cache->ibo.edit_verts_points); + mesh_create_edit_tris_and_verts( + rdata, + cache->edit.data, cache->edit.pos_nor, + cache->edit.lnor, cache->ibo.edit_verts_points); } if (DRW_vbo_requested(cache->edit.data_ledges) || DRW_vbo_requested(cache->edit.pos_nor_ledges)) { mesh_create_edit_loose_edges(rdata, cache->edit.data_ledges, cache->edit.pos_nor_ledges); |