From 1f693aefca052918d308082f752f388d487f39b6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 30 May 2018 19:45:03 +0200 Subject: Cleanup: style/whitespace Also use 'uint'. --- source/blender/draw/engines/eevee/eevee_effects.c | 7 +- source/blender/draw/engines/eevee/eevee_lookdev.c | 23 +- .../draw/engines/workbench/workbench_data.c | 2 +- source/blender/draw/intern/draw_cache_impl_mesh.c | 10 +- .../draw/intern/draw_cache_impl_particles.c | 352 +++++++++++---------- source/blender/draw/intern/draw_debug.c | 2 +- source/blender/draw/intern/draw_hair.c | 2 +- source/blender/draw/intern/draw_manager_data.c | 8 +- source/blender/draw/intern/draw_manager_exec.c | 5 +- 9 files changed, 226 insertions(+), 185 deletions(-) (limited to 'source/blender/draw') diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index 211a8abd42c..d7a978066d5 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -511,10 +511,13 @@ void EEVEE_draw_effects(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) /* Save the final texture and framebuffer for final transformation or read. */ effects->final_tx = effects->source_buffer; effects->final_fb = (effects->target_buffer != fbl->main_color_fb) ? fbl->main_fb : fbl->effect_fb; - if ((effects->enabled_effects & EFFECT_TAA) && (effects->enabled_effects & (EFFECT_BLOOM | EFFECT_DOF | EFFECT_MOTION_BLUR)) == 0) { + if ((effects->enabled_effects & EFFECT_TAA) && + (effects->enabled_effects & (EFFECT_BLOOM | EFFECT_DOF | EFFECT_MOTION_BLUR)) == 0) + { if (!effects->swap_double_buffer) { effects->final_fb = fbl->double_buffer_fb; - } else { + } + else { effects->final_fb = fbl->main_fb; } } diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 77472fcda67..0e0bea53927 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -32,13 +32,14 @@ #include "eevee_private.h" -void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShader *shader, DRWPass *pass, World *world, EEVEE_LightProbesInfo *pinfo) +void EEVEE_lookdev_cache_init( + EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShader *shader, DRWPass *pass, + World *world, EEVEE_LightProbesInfo *pinfo) { EEVEE_StorageList *stl = vedata->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); View3D *v3d = draw_ctx->v3d; - if (LOOK_DEV_MODE_ENABLED(v3d)) - { + if (LOOK_DEV_MODE_ENABLED(v3d)) { StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_ORIENTATION_WORLD); if ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) { struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get(); @@ -57,14 +58,18 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShad BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE); tex = sl->equirectangular_irradiance_gputexture; - } else { + } + else { BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE); tex = sl->equirectangular_radiance_gputexture; } DRW_shgroup_uniform_texture(*grp, "image", tex); /* Do we need to recalc the lightprobes? */ - if (pinfo && (pinfo->studiolight_index != sl->index || pinfo->studiolight_rot_z != v3d->shading.studiolight_rot_z)) { + if (pinfo && + ((pinfo->studiolight_index != sl->index) || + (pinfo->studiolight_rot_z != v3d->shading.studiolight_rot_z))) + { pinfo->update_world |= PROBE_UPDATE_ALL; pinfo->studiolight_index = sl->index; pinfo->studiolight_rot_z = v3d->shading.studiolight_rot_z; @@ -106,8 +111,8 @@ void EEVEE_lookdev_draw_background(EEVEE_Data *vedata) BKE_camera_params_compute_matrix(¶ms); const float *viewport_size = DRW_viewport_size_get(); - int viewport_inset_x = viewport_size[0]/4; - int viewport_inset_y = viewport_size[1]/4; + int viewport_inset_x = viewport_size[0] / 4; + int viewport_inset_y = viewport_size[1] / 4; EEVEE_CommonUniformBuffer *common = &sldata->common_data; common->la_num_light = 0; @@ -137,10 +142,10 @@ void EEVEE_lookdev_draw_background(EEVEE_Data *vedata) GPUFrameBuffer *fb = effects->final_fb; GPU_framebuffer_bind(fb); - GPU_framebuffer_viewport_set(fb, viewport_size[0]-viewport_inset_x, 0, viewport_inset_x, viewport_inset_y); + GPU_framebuffer_viewport_set(fb, viewport_size[0] - viewport_inset_x, 0, viewport_inset_x, viewport_inset_y); DRW_draw_pass(psl->lookdev_pass); DRW_viewport_matrix_override_unset_all(); DRW_stats_group_end(); } -} \ No newline at end of file +} diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c index 062a5b04988..03155b45a34 100644 --- a/source/blender/draw/engines/workbench/workbench_data.c +++ b/source/blender/draw/engines/workbench/workbench_data.c @@ -37,7 +37,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd) copy_v3_v3(wd->object_outline_color, wpd->shading.object_outline_color); wd->object_outline_color[3] = 1.0f; - wd->specular_sharpness = 100 - sqrtf(scene->display.roughness)* 100; + wd->specular_sharpness = 100.0f - sqrtf(scene->display.roughness) * 100.0f; wpd->world_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_World), &wpd->world_data); } diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 188ba6b07f7..e1b66a85ca2 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -3252,7 +3252,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata, /* Create edges for each pair of triangles sharing an edge. */ for (int i = 0; i < tri_len; i++) { for (int e = 0; e < 3; ++e) { - unsigned int v0, v1, v2; + uint v0, v1, v2; if (rdata->edit_bmesh) { const BMLoop **bm_looptri = (const BMLoop **)rdata->edit_bmesh->looptris[i]; if (BM_elem_flag_test(bm_looptri[0]->f, BM_ELEM_HIDDEN)) { @@ -3283,7 +3283,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata, /* HACK Tag as not used. Prevent overhead of BLI_edgehash_remove. */ *pval = SET_INT_IN_POINTER(NO_EDGE); bool inv_opposite = (v_data < 0); - unsigned int v_opposite = (unsigned int)abs(v_data) - 1; + uint v_opposite = (uint)abs(v_data) - 1; if (inv_opposite == inv_indices) { /* Don't share edge if triangles have non matching winding. */ @@ -3303,15 +3303,15 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata, BLI_edgehashIterator_isDone(ehi) == false; BLI_edgehashIterator_step(ehi)) { - unsigned int v1, v2; + uint v1, v2; int v_data = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi)); if (v_data == NO_EDGE) { continue; } BLI_edgehashIterator_getKey(ehi, &v1, &v2); - unsigned int v0 = (unsigned int)abs(v_data) - 1; + uint v0 = (uint)abs(v_data) - 1; if (v_data < 0) { /* inv_opposite */ - SWAP(unsigned int, v1, v2); + SWAP(uint, v1, v2); } GWN_indexbuf_add_line_adj_verts(&elb, v0, v1, v2, v0); cache->is_manifold = false; diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index dbf1b9357d3..1348968bad7 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -216,9 +216,10 @@ void DRW_particle_batch_cache_free(ParticleSystem *psys) MEM_SAFE_FREE(psys->batch_cache); } -static void count_cache_segment_keys(ParticleCacheKey **pathcache, - const int num_path_cache_keys, - ParticleHairCache *hair_cache) +static void count_cache_segment_keys( + ParticleCacheKey **pathcache, + const int num_path_cache_keys, + ParticleHairCache *hair_cache) { for (int i = 0; i < num_path_cache_keys; i++) { ParticleCacheKey *path = pathcache[i]; @@ -230,12 +231,14 @@ static void count_cache_segment_keys(ParticleCacheKey **pathcache, } } -static void ensure_seg_pt_count(PTCacheEdit *edit, - ParticleSystem *psys, - ParticleHairCache *hair_cache) +static void ensure_seg_pt_count( + PTCacheEdit *edit, + ParticleSystem *psys, + ParticleHairCache *hair_cache) { if ((hair_cache->pos != NULL && hair_cache->indices != NULL) || - (hair_cache->proc_point_buf != NULL)) { + (hair_cache->proc_point_buf != NULL)) + { return; } @@ -268,12 +271,13 @@ static void particle_pack_mcol(MCol *mcol, unsigned short r_scol[3]) } /* Used by parent particles and simple children. */ -static void particle_calculate_parent_uvs(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const int num_uv_layers, - const int parent_index, - /*const*/ MTFace **mtfaces, - float (*r_uv)[2]) +static void particle_calculate_parent_uvs( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const int num_uv_layers, + const int parent_index, + /*const*/ MTFace **mtfaces, + float (*r_uv)[2]) { if (psmd == NULL) { return; @@ -292,20 +296,22 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys, if (num != DMCACHE_NOTFOUND) { MFace *mface = &psmd->mesh_final->mface[num]; for (int j = 0; j < num_uv_layers; j++) { - psys_interpolate_uvs(mtfaces[j] + num, - mface->v4, - particle->fuv, - r_uv[j]); + psys_interpolate_uvs( + mtfaces[j] + num, + mface->v4, + particle->fuv, + r_uv[j]); } } } -static void particle_calculate_parent_mcol(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const int num_uv_layers, - const int parent_index, - /*const*/ MCol **mcols, - MCol *r_mcol) +static void particle_calculate_parent_mcol( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const int num_uv_layers, + const int parent_index, + /*const*/ MCol **mcols, + MCol *r_mcol) { if (psmd == NULL) { return; @@ -324,21 +330,23 @@ static void particle_calculate_parent_mcol(ParticleSystem *psys, if (num != DMCACHE_NOTFOUND) { MFace *mface = &psmd->mesh_final->mface[num]; for (int j = 0; j < num_uv_layers; j++) { - psys_interpolate_mcol(mcols[j] + num, - mface->v4, - particle->fuv, - &r_mcol[j]); + psys_interpolate_mcol( + mcols[j] + num, + mface->v4, + particle->fuv, + &r_mcol[j]); } } } /* Used by interpolated children. */ -static void particle_interpolate_children_uvs(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const int num_uv_layers, - const int child_index, - /*const*/ MTFace **mtfaces, - float (*r_uv)[2]) +static void particle_interpolate_children_uvs( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const int num_uv_layers, + const int child_index, + /*const*/ MTFace **mtfaces, + float (*r_uv)[2]) { if (psmd == NULL) { return; @@ -352,20 +360,22 @@ static void particle_interpolate_children_uvs(ParticleSystem *psys, if (num != DMCACHE_NOTFOUND) { MFace *mface = &psmd->mesh_final->mface[num]; for (int j = 0; j < num_uv_layers; j++) { - psys_interpolate_uvs(mtfaces[j] + num, - mface->v4, - particle->fuv, - r_uv[j]); + psys_interpolate_uvs( + mtfaces[j] + num, + mface->v4, + particle->fuv, + r_uv[j]); } } } -static void particle_interpolate_children_mcol(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const int num_col_layers, - const int child_index, - /*const*/ MCol **mcols, - MCol *r_mcol) +static void particle_interpolate_children_mcol( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const int num_col_layers, + const int child_index, + /*const*/ MCol **mcols, + MCol *r_mcol) { if (psmd == NULL) { return; @@ -379,23 +389,25 @@ static void particle_interpolate_children_mcol(ParticleSystem *psys, if (num != DMCACHE_NOTFOUND) { MFace *mface = &psmd->mesh_final->mface[num]; for (int j = 0; j < num_col_layers; j++) { - psys_interpolate_mcol(mcols[j] + num, - mface->v4, - particle->fuv, - &r_mcol[j]); + psys_interpolate_mcol( + mcols[j] + num, + mface->v4, + particle->fuv, + &r_mcol[j]); } } } -static void particle_calculate_uvs(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const bool is_simple, - const int num_uv_layers, - const int parent_index, - const int child_index, - /*const*/ MTFace **mtfaces, - float (**r_parent_uvs)[2], - float (**r_uv)[2]) +static void particle_calculate_uvs( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const bool is_simple, + const int num_uv_layers, + const int parent_index, + const int child_index, + /*const*/ MTFace **mtfaces, + float (**r_parent_uvs)[2], + float (**r_uv)[2]) { if (psmd == NULL) { return; @@ -433,15 +445,16 @@ static void particle_calculate_uvs(ParticleSystem *psys, } } -static void particle_calculate_mcol(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const bool is_simple, - const int num_col_layers, - const int parent_index, - const int child_index, - /*const*/ MCol **mcols, - MCol **r_parent_mcol, - MCol **r_mcol) +static void particle_calculate_mcol( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const bool is_simple, + const int num_col_layers, + const int parent_index, + const int child_index, + /*const*/ MCol **mcols, + MCol **r_parent_mcol, + MCol **r_mcol) { if (psmd == NULL) { return; @@ -508,12 +521,14 @@ static int particle_batch_cache_fill_segments( const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN); if (is_simple && *r_parent_uvs == NULL) { /* TODO(sergey): For edit mode it should be edit->totcached. */ - *r_parent_uvs = MEM_callocN(sizeof(*r_parent_uvs) * psys->totpart, - "Parent particle UVs"); + *r_parent_uvs = MEM_callocN( + sizeof(*r_parent_uvs) * psys->totpart, + "Parent particle UVs"); } if (is_simple && *r_parent_mcol == NULL) { - *r_parent_mcol = MEM_callocN(sizeof(*r_parent_mcol) * psys->totpart, - "Parent particle MCol"); + *r_parent_mcol = MEM_callocN( + sizeof(*r_parent_mcol) * psys->totpart, + "Parent particle MCol"); } int curr_point = start_index; for (int i = 0; i < num_path_keys; i++) { @@ -552,17 +567,16 @@ static int particle_batch_cache_fill_segments( for (int k = 0; k < num_uv_layers; k++) { GWN_vertbuf_attr_set( hair_cache->pos, uv_id[k], curr_point, - (is_simple && is_child) - ? (*r_parent_uvs)[psys->child[i].parent][k] - : uv[k]); + (is_simple && is_child) ? + (*r_parent_uvs)[psys->child[i].parent][k] : uv[k]); } for (int k = 0; k < num_col_layers; k++) { /* TODO Put the conversion outside the loop */ unsigned short scol[4]; - particle_pack_mcol((is_simple && is_child) - ? &(*r_parent_mcol)[psys->child[i].parent][k] - : &mcol[k], - scol); + particle_pack_mcol( + (is_simple && is_child) ? + &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k], + scol); GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol); } } @@ -580,17 +594,16 @@ static int particle_batch_cache_fill_segments( for (int k = 0; k < num_uv_layers; k++) { GWN_vertbuf_attr_set( hair_cache->pos, uv_id[k], curr_point, - (is_simple && is_child) - ? (*r_parent_uvs)[psys->child[i].parent][k] - : uv[k]); + (is_simple && is_child) ? + (*r_parent_uvs)[psys->child[i].parent][k] : uv[k]); } for (int k = 0; k < num_col_layers; k++) { /* TODO Put the conversion outside the loop */ unsigned short scol[4]; - particle_pack_mcol((is_simple && is_child) - ? &(*r_parent_mcol)[psys->child[i].parent][k] - : &mcol[k], - scol); + particle_pack_mcol( + (is_simple && is_child) ? + &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k], + scol); GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol); } if (!is_simple) { @@ -632,7 +645,7 @@ static void particle_batch_cache_fill_segments_proc_pos( } if (total_len > 0.0f) { /* Divide by total length to have a [0-1] number. */ - for (int j = 0; j <= path->segments; j++, seg_data_first+=4) { + for (int j = 0; j <= path->segments; j++, seg_data_first += 4) { seg_data_first[3] /= total_len; } } @@ -669,18 +682,20 @@ static int particle_batch_cache_fill_strands_data( const int num_path_keys, Gwn_VertBufRaw *data_step, float (***r_parent_uvs)[2], Gwn_VertBufRaw *uv_step, MTFace **mtfaces, int num_uv_layers, - MCol ***r_parent_mcol, Gwn_VertBufRaw *col_step, MCol **mcols, int num_col_layers) + MCol ***r_parent_mcol, Gwn_VertBufRaw *col_step, MCol **mcols, int num_col_layers) { const bool is_simple = (psys->part->childtype == PART_CHILD_PARTICLES); const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN); if (is_simple && *r_parent_uvs == NULL) { /* TODO(sergey): For edit mode it should be edit->totcached. */ - *r_parent_uvs = MEM_callocN(sizeof(*r_parent_uvs) * psys->totpart, - "Parent particle UVs"); + *r_parent_uvs = MEM_callocN( + sizeof(*r_parent_uvs) * psys->totpart, + "Parent particle UVs"); } if (is_simple && *r_parent_mcol == NULL) { - *r_parent_mcol = MEM_callocN(sizeof(*r_parent_mcol) * psys->totpart, - "Parent particle MCol"); + *r_parent_mcol = MEM_callocN( + sizeof(*r_parent_mcol) * psys->totpart, + "Parent particle MCol"); } int curr_point = start_index; for (int i = 0; i < num_path_keys; i++) { @@ -689,7 +704,7 @@ static int particle_batch_cache_fill_strands_data( continue; } - unsigned int *seg_data = (unsigned int *)GWN_vertbuf_raw_step(data_step); + uint *seg_data = (uint *)GWN_vertbuf_raw_step(data_step); *seg_data = (curr_point & 0xFFFFFF) | (path->segments << 24); curr_point += path->segments + 1; @@ -719,10 +734,10 @@ static int particle_batch_cache_fill_strands_data( } for (int k = 0; k < num_col_layers; k++) { unsigned short *scol = (unsigned short *)GWN_vertbuf_raw_step(col_step + k); - particle_pack_mcol((is_simple && is_child) - ? &(*r_parent_mcol)[psys->child[i].parent][k] - : &mcol[k], - scol); + particle_pack_mcol( + (is_simple && is_child) ? + &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k], + scol); } if (!is_simple) { MEM_freeN(uv); @@ -733,8 +748,9 @@ static int particle_batch_cache_fill_strands_data( return curr_point; } -static void particle_batch_cache_ensure_procedural_final_points(ParticleHairCache *cache, - int subdiv) +static void particle_batch_cache_ensure_procedural_final_points( + ParticleHairCache *cache, + int subdiv) { /* Same format as point_tex. */ Gwn_VertFormat format = { 0 }; @@ -752,10 +768,11 @@ static void particle_batch_cache_ensure_procedural_final_points(ParticleHairCach cache->final[subdiv].proc_tex = GPU_texture_create_from_vertbuf(cache->final[subdiv].proc_buf); } -static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit, - ParticleSystem *psys, - ModifierData *md, - ParticleHairCache *cache) +static void particle_batch_cache_ensure_procedural_strand_data( + PTCacheEdit *edit, + ParticleSystem *psys, + ModifierData *md, + ParticleHairCache *cache) { int active_uv = 0; int active_col = 0; @@ -783,13 +800,13 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit MCol **parent_mcol = NULL; Gwn_VertFormat format_data = {0}; - unsigned int data_id = GWN_vertformat_attr_add(&format_data, "data", GWN_COMP_U32, 1, GWN_FETCH_INT); + uint data_id = GWN_vertformat_attr_add(&format_data, "data", GWN_COMP_U32, 1, GWN_FETCH_INT); Gwn_VertFormat format_uv = {0}; - unsigned int uv_id = GWN_vertformat_attr_add(&format_uv, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint uv_id = GWN_vertformat_attr_add(&format_uv, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); Gwn_VertFormat format_col = {0}; - unsigned int col_id = GWN_vertformat_attr_add(&format_col, "col", GWN_COMP_U16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint col_id = GWN_vertformat_attr_add(&format_col, "col", GWN_COMP_U16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); memset(cache->uv_layer_names, 0, sizeof(cache->uv_layer_names)); memset(cache->col_layer_names, 0, sizeof(cache->col_layer_names)); @@ -806,7 +823,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit GWN_vertbuf_attr_get_raw_data(cache->proc_uv_buf[i], uv_id, &uv_step[i]); const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i); - unsigned int hash = BLI_ghashutil_strhash_p(name); + uint hash = BLI_ghashutil_strhash_p(name); int n = 0; BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "u%u", hash); BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%u", hash); @@ -822,7 +839,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit GWN_vertbuf_attr_get_raw_data(cache->proc_col_buf[i], col_id, &col_step[i]); const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i); - unsigned int hash = BLI_ghashutil_strhash_p(name); + uint hash = BLI_ghashutil_strhash_p(name); int n = 0; BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "c%u", hash); @@ -909,15 +926,16 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit } } -static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit, - ParticleSystem *psys, - ParticleHairCache *cache, - int thickness_res, - int subdiv) +static void particle_batch_cache_ensure_procedural_indices( + PTCacheEdit *edit, + ParticleSystem *psys, + ParticleHairCache *cache, + int thickness_res, + int subdiv) { BLI_assert(thickness_res <= MAX_THICKRES); /* Cylinder strip not currently supported. */ - if (cache->final[subdiv].proc_hairs[thickness_res-1] != NULL) { + if (cache->final[subdiv].proc_hairs[thickness_res - 1] != NULL) { return; } @@ -957,15 +975,17 @@ static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit, } } - cache->final[subdiv].proc_hairs[thickness_res-1] = GWN_batch_create_ex(prim_type, - vbo, - GWN_indexbuf_build(&elb), - GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX); + cache->final[subdiv].proc_hairs[thickness_res - 1] = GWN_batch_create_ex( + prim_type, + vbo, + GWN_indexbuf_build(&elb), + GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX); } -static void particle_batch_cache_ensure_procedural_pos(PTCacheEdit *edit, - ParticleSystem *psys, - ParticleHairCache *cache) +static void particle_batch_cache_ensure_procedural_pos( + PTCacheEdit *edit, + ParticleSystem *psys, + ParticleHairCache *cache) { if (cache->proc_point_buf != NULL) { return; @@ -1011,10 +1031,11 @@ static void particle_batch_cache_ensure_procedural_pos(PTCacheEdit *edit, cache->point_tex = GPU_texture_create_from_vertbuf(cache->proc_point_buf); } -static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, - ParticleSystem *psys, - ModifierData *md, - ParticleHairCache *hair_cache) +static void particle_batch_cache_ensure_pos_and_seg( + PTCacheEdit *edit, + ParticleSystem *psys, + ModifierData *md, + ParticleHairCache *hair_cache) { if (hair_cache->pos != NULL && hair_cache->indices != NULL) { return; @@ -1090,10 +1111,11 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, GWN_vertbuf_data_alloc(hair_cache->pos, hair_cache->point_count); Gwn_IndexBufBuilder elb; - GWN_indexbuf_init_ex(&elb, - GWN_PRIM_LINE_STRIP, - hair_cache->elems_count, hair_cache->point_count, - true); + GWN_indexbuf_init_ex( + &elb, + GWN_PRIM_LINE_STRIP, + hair_cache->elems_count, hair_cache->point_count, + true); if (num_uv_layers || num_col_layers) { BKE_mesh_tessface_ensure(psmd->mesh_final); @@ -1163,9 +1185,10 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, hair_cache->indices = GWN_indexbuf_build(&elb); } -static void particle_batch_cache_ensure_pos(Object *object, - ParticleSystem *psys, - ParticlePointCache *point_cache) +static void particle_batch_cache_ensure_pos( + Object *object, + ParticleSystem *psys, + ParticlePointCache *point_cache) { if (point_cache->pos != NULL) { return; @@ -1240,9 +1263,10 @@ static void particle_batch_cache_ensure_pos(Object *object, } } -static void drw_particle_update_ptcache_edit(Object *object_eval, - ParticleSystem *psys, - PTCacheEdit *edit) +static void drw_particle_update_ptcache_edit( + Object *object_eval, + ParticleSystem *psys, + PTCacheEdit *edit) { if (edit->psys == NULL) { return; @@ -1259,16 +1283,18 @@ static void drw_particle_update_ptcache_edit(Object *object_eval, } if (edit->pathcache == NULL) { Depsgraph *depsgraph = draw_ctx->depsgraph; - psys_cache_edit_paths(depsgraph, - scene_orig, object_orig, - edit, - DEG_get_ctime(depsgraph), - DEG_get_mode(depsgraph) == DAG_EVAL_RENDER); + psys_cache_edit_paths( + depsgraph, + scene_orig, object_orig, + edit, + DEG_get_ctime(depsgraph), + DEG_get_mode(depsgraph) == DAG_EVAL_RENDER); } } -static void drw_particle_update_ptcache(Object *object_eval, - ParticleSystem *psys) +static void drw_particle_update_ptcache( + Object *object_eval, + ParticleSystem *psys) { if ((object_eval->mode & OB_MODE_PARTICLE_EDIT) == 0) { return; @@ -1294,11 +1320,11 @@ Gwn_Batch *DRW_particles_batch_cache_get_hair( drw_particle_update_ptcache(object, psys); ensure_seg_pt_count(NULL, psys, &cache->hair); particle_batch_cache_ensure_pos_and_seg(NULL, psys, md, &cache->hair); - cache->hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP, - cache->hair.pos, - cache->hair.indices); + cache->hair.hairs = GWN_batch_create( + GWN_PRIM_LINE_STRIP, + cache->hair.pos, + cache->hair.indices); } - return cache->hair.hairs; } @@ -1326,14 +1352,16 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_strands( drw_particle_update_ptcache_edit(object, psys, edit); ensure_seg_pt_count(edit, psys, &cache->edit_hair); particle_batch_cache_ensure_pos_and_seg(edit, psys, NULL, &cache->edit_hair); - cache->edit_hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP, - cache->edit_hair.pos, - cache->edit_hair.indices); + cache->edit_hair.hairs = GWN_batch_create( + GWN_PRIM_LINE_STRIP, + cache->edit_hair.pos, + cache->edit_hair.indices); return cache->edit_hair.hairs; } -static void ensure_edit_inner_points_count(const PTCacheEdit *edit, - ParticleBatchCache *cache) +static void ensure_edit_inner_points_count( + const PTCacheEdit *edit, + ParticleBatchCache *cache) { if (cache->edit_inner_pos != NULL) { return; @@ -1346,9 +1374,10 @@ static void ensure_edit_inner_points_count(const PTCacheEdit *edit, } } -static void edit_colors_get(PTCacheEdit *edit, - float selected_color[4], - float normal_color[4]) +static void edit_colors_get( + PTCacheEdit *edit, + float selected_color[4], + float normal_color[4]) { rgb_uchar_to_float(selected_color, edit->sel_col); rgb_uchar_to_float(normal_color, edit->nosel_col); @@ -1410,14 +1439,16 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_inner_points( drw_particle_update_ptcache_edit(object, psys, edit); ensure_edit_inner_points_count(edit, cache); particle_batch_cache_ensure_edit_inner_pos(edit, cache); - cache->edit_inner_points = GWN_batch_create(GWN_PRIM_POINTS, - cache->edit_inner_pos, - NULL); + cache->edit_inner_points = GWN_batch_create( + GWN_PRIM_POINTS, + cache->edit_inner_pos, + NULL); return cache->edit_inner_points; } -static void ensure_edit_tip_points_count(const PTCacheEdit *edit, - ParticleBatchCache *cache) +static void ensure_edit_tip_points_count( + const PTCacheEdit *edit, + ParticleBatchCache *cache) { if (cache->edit_tip_pos != NULL) { return; @@ -1475,9 +1506,10 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_tip_points( drw_particle_update_ptcache_edit(object, psys, edit); ensure_edit_tip_points_count(edit, cache); particle_batch_cache_ensure_edit_tip_pos(edit, cache); - cache->edit_tip_points = GWN_batch_create(GWN_PRIM_POINTS, - cache->edit_tip_pos, - NULL); + cache->edit_tip_points = GWN_batch_create( + GWN_PRIM_POINTS, + cache->edit_tip_pos, + NULL); return cache->edit_tip_points; } @@ -1515,7 +1547,7 @@ bool particles_ensure_procedural_data( particle_batch_cache_ensure_procedural_final_points(&cache->hair, subdiv); need_ft_update = true; } - if ((*r_hair_cache)->final[subdiv].proc_hairs[thickness_res-1] == NULL) { + if ((*r_hair_cache)->final[subdiv].proc_hairs[thickness_res - 1] == NULL) { particle_batch_cache_ensure_procedural_indices(NULL, psys, &cache->hair, thickness_res, subdiv); } diff --git a/source/blender/draw/intern/draw_debug.c b/source/blender/draw/intern/draw_debug.c index 00960d92962..0e4176f90a6 100644 --- a/source/blender/draw/intern/draw_debug.c +++ b/source/blender/draw/intern/draw_debug.c @@ -65,7 +65,7 @@ void DRW_debug_polygon_v3(const float (*v)[3], const int vert_len, const float c BLI_assert(vert_len > 1); for (int i = 0; i < vert_len; ++i) { - DRW_debug_line_v3v3(v[i], v[(i+1)%vert_len], color); + DRW_debug_line_v3v3(v[i], v[(i + 1) % vert_len], color); } } diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index 2b1f658a276..8cb9e0886a9 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -126,7 +126,7 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex( DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", part->rad_tip * part->rad_scale * 0.5f); DRW_shgroup_uniform_bool_copy(shgrp, "hairCloseTip", (part->shape_flag & PART_SHAPE_CLOSE_TIP) != 0); /* TODO(fclem): Until we have a better way to cull the hair and render with orco, bypass culling test. */ - DRW_shgroup_call_object_add_no_cull(shgrp, hair_cache->final[subdiv].proc_hairs[thickness_res-1], object); + DRW_shgroup_call_object_add_no_cull(shgrp, hair_cache->final[subdiv].proc_hairs[thickness_res - 1], object); /* Transform Feedback subdiv. */ if (need_ft_update) { diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index c5d7f205687..054db5968cc 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -367,7 +367,7 @@ void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Gwn_Batch *geom, float (*obm } static void drw_shgroup_call_procedural_add_ex( - DRWShadingGroup *shgroup, Gwn_PrimType prim_type, unsigned int prim_count, float (*obmat)[4]) + DRWShadingGroup *shgroup, Gwn_PrimType prim_type, uint prim_count, float (*obmat)[4]) { BLI_assert(ELEM(shgroup->type, DRW_SHG_NORMAL, DRW_SHG_FEEDBACK_TRANSFORM)); @@ -383,17 +383,17 @@ static void drw_shgroup_call_procedural_add_ex( BLI_LINKS_APPEND(&shgroup->calls, call); } -void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, unsigned int point_count, float (*obmat)[4]) +void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, uint point_count, float (*obmat)[4]) { drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_POINTS, point_count, obmat); } -void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, unsigned int line_count, float (*obmat)[4]) +void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, uint line_count, float (*obmat)[4]) { drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_LINES, line_count, obmat); } -void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, unsigned int tria_count, float (*obmat)[4]) +void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, uint tria_count, float (*obmat)[4]) { drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_TRIS, tria_count, obmat); } diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index 98135a614d9..94250920c57 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -749,11 +749,12 @@ static void draw_matrices_model_prepare(DRWCallState *st) /* No need to go further the call will not be used. */ if ((st->flag & DRW_CALL_CULLED) != 0 && (st->flag & DRW_CALL_BYPASS_CULLING) == 0) + { return; - + } /* Order matters */ if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE | - DRW_CALL_NORMALVIEW | DRW_CALL_EYEVEC)) + DRW_CALL_NORMALVIEW | DRW_CALL_EYEVEC)) { mul_m4_m4m4(st->modelview, DST.view_data.matstate.mat[DRW_MAT_VIEW], st->model); } -- cgit v1.2.3