Cleanup: style

This commit is contained in:
2019-03-25 11:42:28 +11:00
parent e86e0aad55
commit abd18f6ec0
18 changed files with 43 additions and 40 deletions

View File

@@ -21,10 +21,10 @@
* \ingroup bke
*/
typedef void* CCGMeshHDL;
typedef void* CCGVertHDL;
typedef void* CCGEdgeHDL;
typedef void* CCGFaceHDL;
typedef void *CCGMeshHDL;
typedef void *CCGVertHDL;
typedef void *CCGEdgeHDL;
typedef void *CCGFaceHDL;
typedef struct CCGEdge CCGEdge;
typedef struct CCGFace CCGFace;
@@ -40,7 +40,7 @@ typedef struct CCGMeshIFC {
/***/
typedef void* CCGAllocatorHDL;
typedef void *CCGAllocatorHDL;
typedef struct CCGAllocatorIFC {
void* (*alloc) (CCGAllocatorHDL a, int numBytes);

View File

@@ -1557,7 +1557,7 @@ typedef struct SPHRangeData {
SPHNeighbor neighbors[SPH_NEIGHBORS];
int tot_neighbors;
float* data;
float *data;
ParticleSystem *npsys;
ParticleData *pa;
@@ -1623,8 +1623,8 @@ static void sph_density_accum_cb(void *userdata, int index, const float co[3], f
if (pfr->use_size)
q *= npa->size;
pfr->data[0] += q*q;
pfr->data[1] += q*q*q;
pfr->data[0] += q * q;
pfr->data[1] += q * q * q;
}
/*

View File

@@ -1565,7 +1565,7 @@ static void sb_sfesf_threads_run(struct Depsgraph *depsgraph, Scene *scene, stru
/* --- the spring external section*/
static int choose_winner(float*w, float* pos, float*a, float*b, float*c, float*ca, float*cb, float*cc)
static int choose_winner(float *w, float *pos, float *a, float *b, float *c, float *ca, float *cb, float *cc)
{
float mindist, cp;
int winner =1;
@@ -1885,13 +1885,13 @@ static void sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, floa
switch (bs->springtype) {
case SB_EDGE:
case SB_HANDLE:
forcefactor *= kw;
forcefactor *= kw;
break;
case SB_BEND:
forcefactor *=sb->secondspring*kw;
forcefactor *= sb->secondspring * kw;
break;
case SB_STIFFQUAD:
forcefactor *=sb->shearstiff*sb->shearstiff* kw;
forcefactor *= sb->shearstiff * sb->shearstiff * kw;
break;
default:
break;
@@ -2043,11 +2043,11 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
BKE_effectors_apply(effectors, NULL, sb->effector_weights, &epoint, force, speed);
/* apply forcefield*/
mul_v3_fl(force, fieldfactor* eval_sb_fric_force_scale);
mul_v3_fl(force, fieldfactor * eval_sb_fric_force_scale);
add_v3_v3(bp->force, force);
/* BP friction in moving media */
kd= sb->mediafrict* eval_sb_fric_force_scale;
kd= sb->mediafrict * eval_sb_fric_force_scale;
bp->force[0] -= kd * (bp->vec[0] + windfactor*speed[0]/eval_sb_fric_force_scale);
bp->force[1] -= kd * (bp->vec[1] + windfactor*speed[1]/eval_sb_fric_force_scale);
bp->force[2] -= kd * (bp->vec[2] + windfactor*speed[2]/eval_sb_fric_force_scale);
@@ -2056,7 +2056,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
}
else {
/* BP friction in media (not) moving*/
float kd = sb->mediafrict* sb_fric_force_scale(ob);
float kd = sb->mediafrict * sb_fric_force_scale(ob);
/* assume it to be proportional to actual velocity */
bp->force[0]-= bp->vec[0]*kd;
bp->force[1]-= bp->vec[1]*kd;

View File

@@ -614,8 +614,8 @@ void update_edit_mode_pointers(const Depsgraph *depsgraph,
}
template <typename T>
void update_list_orig_pointers(const ListBase* listbase_orig,
ListBase* listbase,
void update_list_orig_pointers(const ListBase *listbase_orig,
ListBase *listbase,
T *T::*orig_field)
{
T *element_orig = reinterpret_cast<T*>(listbase_orig->first);
@@ -934,7 +934,7 @@ void ObjectRuntimeBackup::init_from_object(Object *object)
}
inline ModifierDataBackupID create_modifier_data_id(
const ModifierData* modifier_data)
const ModifierData *modifier_data)
{
return ModifierDataBackupID(modifier_data->orig_modifier_data,
static_cast<ModifierType>(modifier_data->type));

View File

@@ -26,9 +26,10 @@ uniform vec2 nearFar; /* Near & far view depths values */
/* divide by sensor size to get the normalized size */
#define calculate_coc(zdepth) (dof_mul / zdepth - dof_bias)
#define linear_depth(z) ((ProjectionMatrix[3][3] == 0.0) \
? (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) \
: z * (nearFar.y - nearFar.x) + nearFar.x) /* Only true for camera view! */
#define linear_depth(z) \
((ProjectionMatrix[3][3] == 0.0) ? \
(nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) : \
z * (nearFar.y - nearFar.x) + nearFar.x) /* Only true for camera view! */
#define weighted_sum(a, b, c, d, e) (a * e.x + b * e.y + c * e.z + d * e.w) / max(1e-6, dot(e, vec4(1.0)));

View File

@@ -31,9 +31,10 @@ float max_v4(vec4 v) { return max(max(v.x, v.y), max(v.z, v.w)); }
/* divide by sensor size to get the normalized size */
#define calculate_coc(zdepth) (dof_aperturesize * (dof_distance / zdepth - 1.0) * dof_invsensorsize)
#define linear_depth(z) ((ProjectionMatrix[3][3] == 0.0) \
? (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) \
: (z * 2.0 - 1.0) * nearFar.y)
#define linear_depth(z) \
((ProjectionMatrix[3][3] == 0.0) ? \
(nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) : \
(z * 2.0 - 1.0) * nearFar.y)
const float MAX_COC_SIZE = 100.0;

View File

@@ -264,8 +264,7 @@ static GPUShader *ensure_background_shader(WORKBENCH_PrivateData *wpd)
static void select_deferred_shaders(WORKBENCH_PrivateData *wpd, eGPUShaderConfig sh_cfg)
{
wpd->prepass_solid_sh
= ensure_deferred_prepass_shader(wpd, false, false, sh_cfg);
wpd->prepass_solid_sh = ensure_deferred_prepass_shader(wpd, false, false, sh_cfg);
wpd->prepass_solid_hair_sh = ensure_deferred_prepass_shader(wpd, false, true, sh_cfg);
wpd->prepass_texture_sh = ensure_deferred_prepass_shader(wpd, true, false, sh_cfg);
wpd->prepass_texture_hair_sh = ensure_deferred_prepass_shader(wpd, true, true, sh_cfg);

View File

@@ -155,13 +155,15 @@ static void PAINT_TEXTURE_engine_init(void *UNUSED(vedata))
}
}
static DRWShadingGroup* create_texture_paint_shading_group(PAINT_TEXTURE_PassList *psl, const struct GPUTexture *texture, const DRWContextState *draw_ctx, const bool nearest_interp)
static DRWShadingGroup *create_texture_paint_shading_group(
PAINT_TEXTURE_PassList *psl, const struct GPUTexture *texture, const DRWContextState *draw_ctx, const bool nearest_interp)
{
Scene *scene = draw_ctx->scene;
const ImagePaintSettings *imapaint = &scene->toolsettings->imapaint;
const bool masking_enabled = imapaint->flag & IMAGEPAINT_PROJECT_LAYER_STENCIL && imapaint->stencil != NULL;
DRWShadingGroup *grp = DRW_shgroup_create(masking_enabled?e_data.image_masking_sh:e_data.image_sh, psl->image_faces);
DRWShadingGroup *grp = DRW_shgroup_create(
masking_enabled ? e_data.image_masking_sh : e_data.image_sh, psl->image_faces);
DRW_shgroup_uniform_texture(grp, "image", texture);
DRW_shgroup_uniform_float(grp, "alpha", &draw_ctx->v3d->overlay.texture_paint_mode_opacity, 1);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);

View File

@@ -78,9 +78,9 @@ void main()
/* Facing based color blend */
vec4 vpos = ModelViewMatrix * vec4(pos, 1.0);
vec3 view_normal = normalize(NormalMatrix * vnor + 1e-4);
vec3 view_vec = (ProjectionMatrix[3][3] == 0.0)
? normalize(vpos.xyz)
: vec3(0.0, 0.0, 1.0);
vec3 view_vec = (ProjectionMatrix[3][3] == 0.0) ?
normalize(vpos.xyz) :
vec3(0.0, 0.0, 1.0);
float facing = dot(view_vec, view_normal);
facing = 1.0 - abs(facing) * 0.3;

View File

@@ -242,7 +242,7 @@ unsigned int BlenderStrokeRenderer::get_stroke_mesh_id(void) const
return mesh_id;
}
Material* BlenderStrokeRenderer::GetStrokeShader(Main *bmain, bNodeTree *iNodeTree, bool do_id_user)
Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain, bNodeTree *iNodeTree, bool do_id_user)
{
Material *ma = BKE_material_add(bmain, "stroke_shader");
bNodeTree *ntree;

View File

@@ -67,7 +67,7 @@ public:
Render *RenderScene(Render *re, bool render);
static Material* GetStrokeShader(Main *bmain, bNodeTree *iNodeTree, bool do_id_user);
static Material *GetStrokeShader(Main *bmain, bNodeTree *iNodeTree, bool do_id_user);
protected:
Main *freestyle_bmain;

View File

@@ -176,7 +176,7 @@ public:
return _Normals;
}
virtual const FrsMaterial*const* frs_materials() const
virtual const FrsMaterial * const *frs_materials() const
{
return _FrsMaterials;
}

View File

@@ -1132,7 +1132,7 @@ void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap)
// It was easier to copy this function from upstream than to resync.
// This should be removed if a resync ever occurs.
void* DirectDrawSurface::readData(uint &rsize)
void *DirectDrawSurface::readData(uint &rsize)
{
uint header_size = 128; // sizeof(DDSHeader);
if (header.hasDX10Header())

View File

@@ -183,7 +183,7 @@ bool RE_engine_is_opengl(RenderEngineType *render_type);
RenderEngineType *RE_engines_find(const char *idname);
rcti* RE_engine_get_current_tiles(struct Render *re, int *r_total_tiles, bool *r_needs_free);
rcti *RE_engine_get_current_tiles(struct Render *re, int *r_total_tiles, bool *r_needs_free);
struct RenderData *RE_engine_get_render_data(struct Render *re);
void RE_bake_engine_set_engine_parameters(
struct Render *re, struct Main *bmain, struct Scene *scene);

View File

@@ -432,7 +432,7 @@ bool RE_engine_get_spherical_stereo(RenderEngine *engine, Object *camera)
return BKE_camera_multiview_spherical_stereo(re ? &re->r : NULL, camera) ? 1 : 0;
}
rcti* RE_engine_get_current_tiles(Render *re, int *r_total_tiles, bool *r_needs_free)
rcti *RE_engine_get_current_tiles(Render *re, int *r_total_tiles, bool *r_needs_free)
{
static rcti tiles_static[BLENDER_MAX_THREADS];
const int allocation_step = BLENDER_MAX_THREADS;

View File

@@ -689,7 +689,7 @@ static int ibuf_get_color_clip(float col[4], ImBuf *ibuf, int x, int y, int extf
}
if (ibuf->rect_float) {
const float* fp = ibuf->rect_float + (x + y*ibuf->x)*ibuf->channels;
const float *fp = ibuf->rect_float + (x + y * ibuf->x) * ibuf->channels;
if (ibuf->channels == 1)
col[0] = col[1] = col[2] = col[3] = *fp;
else {

View File

@@ -354,7 +354,7 @@ Scene *RE_GetScene(Render *re)
return NULL;
}
void RE_SetScene(Render *re, Scene* sce)
void RE_SetScene(Render *re, Scene *sce)
{
if (re) {
re->scene = sce;

View File

@@ -169,7 +169,7 @@ void render_result_views_shallowdelete(RenderResult *rr)
}
static char* set_pass_name(char *outname, const char *name, int channel, const char *chan_id)
static char *set_pass_name(char *outname, const char *name, int channel, const char *chan_id)
{
BLI_strncpy(outname, name, EXR_PASS_MAXNAME);
if (channel >= 0) {