Cleanup: clang format

This commit is contained in:
Philipp Oeser 2021-09-24 10:45:36 +02:00
parent 9a45a4c525
commit 3ac342dc6d
8 changed files with 33 additions and 26 deletions

View File

@ -339,8 +339,7 @@ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CDa
num_curve_keys++;
}
if (attr_length != NULL)
{
if (attr_length != NULL) {
attr_length->add(CData->curve_length[curve]);
}
@ -671,8 +670,7 @@ static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair)
if (hair->need_attribute(scene, ATTR_STD_CURVE_INTERCEPT)) {
attr_intercept = hair->attributes.add(ATTR_STD_CURVE_INTERCEPT);
}
if (hair->need_attribute(scene, ATTR_STD_CURVE_LENGTH))
{
if (hair->need_attribute(scene, ATTR_STD_CURVE_LENGTH)) {
attr_length = hair->attributes.add(ATTR_STD_CURVE_LENGTH);
}
if (hair->need_attribute(scene, ATTR_STD_CURVE_RANDOM)) {
@ -727,8 +725,7 @@ static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair)
}
}
if (attr_length)
{
if (attr_length) {
attr_length->add(length);
}

View File

@ -4391,7 +4391,7 @@ void HairInfoNode::attributes(Shader *shader, AttributeRequestSet *attributes)
if (!intercept_out->links.empty())
attributes->add(ATTR_STD_CURVE_INTERCEPT);
if (!output("Length")->links.empty())
if (!output("Length")->links.empty())
attributes->add(ATTR_STD_CURVE_LENGTH);
if (!output("Random")->links.empty())

View File

@ -536,8 +536,9 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
}
}
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
if (brush->clone.image != NULL && ELEM(brush->clone.image->type, IMA_TYPE_R_RESULT,
IMA_TYPE_COMPOSITE)) { brush->clone.image = NULL;
if (brush->clone.image != NULL &&
ELEM(brush->clone.image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
brush->clone.image = NULL;
}
}
}

View File

@ -773,7 +773,8 @@ static void eevee_hair_cache_populate(EEVEE_Data *vedata,
DRW_shgroup_add_material_resources(*matcache.depth_grp_p, matcache.shading_gpumat);
}
if (matcache.shading_grp) {
*matcache.shading_grp_p = DRW_shgroup_hair_create_sub(ob, psys, md, matcache.shading_grp, matcache.shading_gpumat);
*matcache.shading_grp_p = DRW_shgroup_hair_create_sub(
ob, psys, md, matcache.shading_grp, matcache.shading_gpumat);
DRW_shgroup_add_material_resources(*matcache.shading_grp_p, matcache.shading_gpumat);
}
if (matcache.shadow_grp) {

View File

@ -27,10 +27,10 @@
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_base.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "DNA_hair_types.h"
#include "DNA_object_types.h"
@ -38,8 +38,8 @@
#include "BKE_hair.h"
#include "GPU_batch.h"
#include "GPU_texture.h"
#include "GPU_material.h"
#include "GPU_texture.h"
#include "draw_cache_impl.h" /* own include */
#include "draw_hair_private.h" /* own include */
@ -143,7 +143,9 @@ static void ensure_seg_pt_count(Hair *hair, ParticleHairCache *hair_cache)
}
}
static void hair_batch_cache_fill_segments_proc_pos(Hair *hair, GPUVertBufRaw *attr_step, GPUVertBufRaw *length_step)
static void hair_batch_cache_fill_segments_proc_pos(Hair *hair,
GPUVertBufRaw *attr_step,
GPUVertBufRaw *length_step)
{
/* TODO: use hair radius layer if available. */
HairCurve *curve = hair->curves;
@ -165,7 +167,7 @@ static void hair_batch_cache_fill_segments_proc_pos(Hair *hair, GPUVertBufRaw *a
co_prev = curve_co[j];
}
/* Assign length value*/
*(float *)GPU_vertbuf_raw_step(length_step) = total_len;
*(float *)GPU_vertbuf_raw_step(length_step) = total_len;
if (total_len > 0.0f) {
/* Divide by total length to have a [0-1] number. */
for (int j = 0; j < curve->numpoints; j++, seg_data_first += 4) {

View File

@ -1697,9 +1697,11 @@ bool particles_ensure_procedural_data(Object *object,
(*r_hair_cache)->final[subdiv].strands_res = 1 << (part->draw_step + subdiv);
/* Refreshed on combing and simulation. */
if ((*r_hair_cache)->proc_point_buf == NULL || (gpu_material && (*r_hair_cache)->length_tex == NULL)) {
if ((*r_hair_cache)->proc_point_buf == NULL ||
(gpu_material && (*r_hair_cache)->length_tex == NULL)) {
ensure_seg_pt_count(source.edit, source.psys, &cache->hair);
particle_batch_cache_ensure_procedural_pos(source.edit, source.psys, &cache->hair, gpu_material);
particle_batch_cache_ensure_procedural_pos(
source.edit, source.psys, &cache->hair, gpu_material);
need_ft_update = true;
}

View File

@ -38,10 +38,10 @@
#include "GPU_batch.h"
#include "GPU_capabilities.h"
#include "GPU_compute.h"
#include "GPU_material.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
#include "GPU_vertex_buffer.h"
#include "GPU_material.h"
#include "draw_hair_private.h"
#include "draw_shader.h"
@ -173,14 +173,19 @@ static void drw_hair_particle_cache_update_transform_feedback(ParticleHairCache
}
}
static ParticleHairCache *drw_hair_particle_cache_get(
Object *object, ParticleSystem *psys, ModifierData *md, GPUMaterial* gpu_material, int subdiv, int thickness_res)
static ParticleHairCache *drw_hair_particle_cache_get(Object *object,
ParticleSystem *psys,
ModifierData *md,
GPUMaterial *gpu_material,
int subdiv,
int thickness_res)
{
bool update;
ParticleHairCache *cache;
if (psys) {
/* Old particle hair. */
update = particles_ensure_procedural_data(object, psys, md, &cache, gpu_material, subdiv, thickness_res);
update = particles_ensure_procedural_data(
object, psys, md, &cache, gpu_material, subdiv, thickness_res);
}
else {
/* New hair object. */
@ -207,7 +212,8 @@ GPUVertBuf *DRW_hair_pos_buffer_get(Object *object, ParticleSystem *psys, Modifi
int subdiv = scene->r.hair_subdiv;
int thickness_res = (scene->r.hair_type == SCE_HAIR_SHAPE_STRAND) ? 1 : 2;
ParticleHairCache *cache = drw_hair_particle_cache_get(object, psys, md, NULL, subdiv, thickness_res);
ParticleHairCache *cache = drw_hair_particle_cache_get(
object, psys, md, NULL, subdiv, thickness_res);
return cache->final[subdiv].proc_buf;
}
@ -250,7 +256,7 @@ DRWShadingGroup *DRW_shgroup_hair_create_sub(Object *object,
ParticleSystem *psys,
ModifierData *md,
DRWShadingGroup *shgrp_parent,
GPUMaterial* gpu_material)
GPUMaterial *gpu_material)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;

View File

@ -718,8 +718,7 @@ static char *code_generate_vertex(GPUNodeGraph *graph,
BLI_dynstr_append(ds, datatoc_gpu_shader_common_obinfos_lib_glsl);
BLI_dynstr_append(ds, "DEFINE_ATTR(vec4, orco);\n");
}
if (attr->type == CD_HAIRLENGTH)
{
if (attr->type == CD_HAIRLENGTH) {
BLI_dynstr_append(ds, datatoc_gpu_shader_common_obinfos_lib_glsl);
BLI_dynstr_append(ds, "DEFINE_ATTR(float, hairLen);\n");
}
@ -768,8 +767,7 @@ static char *code_generate_vertex(GPUNodeGraph *graph,
ds, " var%d = orco_get(position, modelmatinv, OrcoTexCoFactors, orco);\n", attr->id);
}
else if (attr->type == CD_HAIRLENGTH) {
BLI_dynstr_appendf(
ds, " var%d = hair_len_get(hair_get_strand_id(), hairLen);\n", attr->id);
BLI_dynstr_appendf(ds, " var%d = hair_len_get(hair_get_strand_id(), hairLen);\n", attr->id);
}
else {
const char *type_str = gpu_data_type_to_string(attr->gputype);