diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 06:05:32 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 06:05:32 +0400 |
commit | e59ab6486f9e7285815671044b785c28365d5165 (patch) | |
tree | 4a9406c8181a817a8b96243ae167acc740ed20f7 /source/blender/blenkernel/intern | |
parent | 35ab6cabbf62187290e417dba6d8b18cd4fe18de (diff) | |
parent | b1019a56b54294fc91293c5c43ef46d54950ae84 (diff) |
svn merge -r41751:41779 ^/trunk/blender
Diffstat (limited to 'source/blender/blenkernel/intern')
23 files changed, 138 insertions, 116 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 224f25db2f7..33df6132c13 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -68,6 +68,7 @@ #include "BKE_tessmesh.h" #include "BKE_depsgraph.h" #include "BKE_anim.h" +#include "BKE_report.h" // XXX bad level call... @@ -148,7 +149,7 @@ void animviz_free_motionpath(bMotionPath *mpath) * - ob: object to add paths for (must be provided) * - pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed) */ -bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel *pchan) +bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Object *ob, bPoseChannel *pchan) { bAnimVizSettings *avs; bMotionPath *mpath, **dst; @@ -171,6 +172,11 @@ bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel * /* avoid 0 size allocs */ if (avs->path_sf >= avs->path_ef) { + BKE_reportf(reports, RPT_ERROR, + "Motion Path frame extents invalid for %s (%d to %d).%s\n", + (pchan)? pchan->name : ob->id.name, + avs->path_sf, avs->path_ef, + (avs->path_sf == avs->path_ef)? " Cannot have single-frame paths." : ""); return NULL; } diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index c9868bd900f..6656d06e72e 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -175,7 +175,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, if(len2 > 0.0f && efd.distance - surface < len2) { len2 = (efd.distance - surface)/len2; - bbd->wanted_speed *= pow(len2, boids->landing_smoothness); + bbd->wanted_speed *= powf(len2, boids->landing_smoothness); } } @@ -242,7 +242,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * mul_v3_fl(bbd->wanted_co, (1.0f - t) * val->personal_space * pa->size); - bbd->wanted_speed = sqrt(t) * len_v3(pa->prev_state.vel); + bbd->wanted_speed = sqrtf(t) * len_v3(pa->prev_state.vel); bbd->wanted_speed = MAX2(bbd->wanted_speed, val->min_speed); return 1; diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 09021e71025..5303baddbca 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -333,7 +333,7 @@ void brush_reset_sculpt(Brush *br) /* enable this to see any non-default settings used by a brush: - brush_debug_print_state(br); + brush_debug_print_state(br); */ brush_set_defaults(br); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 956028de28c..62a23da2230 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -262,7 +262,7 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) cddm->pbvh = BLI_pbvh_new(); cddm->pbvh_draw = can_pbvh_draw(ob, dm); BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert, - me->totface, me->totvert); + me->totface, me->totvert); if(ss->modifiers_active && ob->derivedDeform) { DerivedMesh *deformdm= ob->derivedDeform; diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 78f803be0d3..bd11625bf6e 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -61,9 +61,9 @@ double tval( void ) } #else #include <sys/time.h> - static struct timeval _tstart, _tend; - static struct timezone tz; - void tstart ( void ) +static struct timeval _tstart, _tend; +static struct timezone tz; +void tstart ( void ) { gettimeofday ( &_tstart, &tz ); } @@ -1094,7 +1094,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) cloth->verts[spring->kl].spring_count++; spring->type = CLOTH_SPRING_TYPE_STRUCTURAL; spring->flags = 0; - spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0f; struct_springs++; BLI_linklist_prepend ( &cloth->springs, spring ); @@ -1111,7 +1111,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) for(i = 0; i < numverts; i++) { - cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49 / ((float)cloth->verts[i].spring_count); + cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49f / ((float)cloth->verts[i].spring_count); } // shear springs @@ -1133,7 +1133,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = MAX2(mface[i].v3, mface[i].v1); spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_SHEAR; - spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0f; BLI_linklist_append ( &edgelist[spring->ij], spring ); BLI_linklist_append ( &edgelist[spring->kl], spring ); @@ -1196,7 +1196,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = MAX2(tspring2->ij, index2); spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_BENDING; - spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; BLI_edgehash_insert ( edgehash, spring->ij, spring->kl, NULL ); bend_springs++; @@ -1235,7 +1235,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) spring->kl = tspring->kl; spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_BENDING; - spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0; + spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; bend_springs++; BLI_linklist_prepend ( &cloth->springs, spring ); diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 72bebd6bb85..10a955760f0 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -465,7 +465,7 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3 d = ( a * c - b * b ); - if ( ABS ( d ) < ALMOST_ZERO ) + if ( ABS ( d ) < (double)ALMOST_ZERO ) { *w1 = *w2 = *w3 = 1.0 / 3.0; return; @@ -555,14 +555,14 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // Decrease in magnitude of relative tangential velocity due to coulomb friction // in original formula "magrelVel" should be the "change of relative velocity in normal direction" - magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) ); + magtangent = MIN2 ( clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf( INPR ( vrel_t_pre,vrel_t_pre ) ) ); // Apply friction impulse. if ( magtangent > ALMOST_ZERO ) { normalize_v3( vrel_t_pre ); - impulse = magtangent / ( 1.0 + w1*w1 + w2*w2 + w3*w3 ); // 2.0 * + impulse = magtangent / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // 2.0 * VECADDMUL ( cloth1->verts[collpair->ap1].impulse, vrel_t_pre, w1 * impulse ); VECADDMUL ( cloth1->verts[collpair->ap2].impulse, vrel_t_pre, w2 * impulse ); VECADDMUL ( cloth1->verts[collpair->ap3].impulse, vrel_t_pre, w3 * impulse ); @@ -586,17 +586,17 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // I_r = -min(dt*kd, m(0,1d/dt - v_n)) spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; - d = clmd->coll_parms->epsilon*8.0/9.0 + epsilon2*8.0/9.0 - collpair->distance; - if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) ) + d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; + if ( ( magrelVel < 0.1f*d*spf ) && ( d > ALMOST_ZERO ) ) { - repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel ); + repulse = MIN2 ( d*1.0f/spf, 0.1f*d*spf - magrelVel ); // stay on the safe side and clamp repulse if ( impulse > ALMOST_ZERO ) repulse = MIN2 ( repulse, 5.0*impulse ); repulse = MAX2 ( impulse, repulse ); - impulse = repulse / ( 1.0 + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25 + impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25 VECADDMUL ( cloth1->verts[collpair->ap1].impulse, collpair->normal, impulse ); VECADDMUL ( cloth1->verts[collpair->ap2].impulse, collpair->normal, impulse ); VECADDMUL ( cloth1->verts[collpair->ap3].impulse, collpair->normal, impulse ); @@ -1493,8 +1493,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, collmd->current_xnew[collpair->bp2].co, collmd->current_xnew[collpair->bp3].co, &l, 0)) { - if (l >= 0.0 && l < sdis) { - mul_v3_fl(n2, (l-sdis)*cloth->verts[collpair->ap1].mass*dt*clmd->coll_parms->repel_force*0.1); + if (l >= 0.0f && l < sdis) { + mul_v3_fl(n2, (l-sdis)*cloth->verts[collpair->ap1].mass*dt*clmd->coll_parms->repel_force*0.1f); add_v3_v3(cloth->verts[collpair->ap1].tv, n2); add_v3_v3(cloth->verts[collpair->ap2].tv, n2); @@ -1508,7 +1508,7 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, verts1[collpair->ap1].txold, verts1[collpair->ap2].txold, verts1[collpair->ap3].txold, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa,collpair->pb,collpair->vector ); #else // just be sure that we don't add anything - distance = 2.0 * ( epsilon1 + epsilon2 + ALMOST_ZERO ); + distance = 2.0 * (double)( epsilon1 + epsilon2 + ALMOST_ZERO ); #endif if ( distance <= ( epsilon1 + epsilon2 + ALMOST_ZERO ) ) @@ -2535,7 +2535,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl } else { - mul_v3_fl( temp, -correction*0.5 ); + mul_v3_fl( temp, correction * -0.5 ); VECADD ( verts[j].tx, verts[j].tx, temp ); VECSUB ( verts[i].tx, verts[i].tx, temp ); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 3f441361b0a..5f1a5f73973 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -68,8 +68,8 @@ /* local */ static int cu_isectLL(float *v1, float *v2, float *v3, float *v4, - short cox, short coy, - float *labda, float *mu, float *vec); + short cox, short coy, + float *labda, float *mu, float *vec); void unlink_curve(Curve *cu) { diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index f005ed4a2a3..f0b93212766 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -96,7 +96,7 @@ typedef struct LayerTypeInfo { * count gives the number of elements in sources */ void (*interp)(void **sources, float *weights, float *sub_weights, - int count, void *dest); + int count, void *dest); /* a function to swap the data in corners of the element */ void (*swap)(void *data, const int *corner_indices); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 7f099c03d09..b1e39b1d768 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1148,8 +1148,8 @@ void graph_bfs(void) set_node_xy(node, node->BFS_dist*DEPSX*2, pos[node->BFS_dist]*DEPSY*2); node->color = DAG_BLACK; /* - fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y); - */ + fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y); + */ } } queue_delete(nqueue); @@ -1208,8 +1208,8 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a post_func(node->ob,data); node->color = DAG_BLACK; /* - fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y); - */ + fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y); + */ } } queue_delete(nqueue); @@ -1325,7 +1325,7 @@ DagNodeQueue * graph_dfs(void) set_node_xy(node, node->DFS_dist*DEPSX*2, pos[node->DFS_dist]*DEPSY*2); /* - fprintf(stderr,"DFS node : %20s %i %i %i %i\n",((ID *) node->ob)->name,node->BFS_dist, node->DFS_dist, node->DFS_dvtm, node->DFS_fntm ); + fprintf(stderr,"DFS node : %20s %i %i %i %i\n",((ID *) node->ob)->name,node->BFS_dist, node->DFS_dist, node->DFS_dvtm, node->DFS_fntm ); */ push_stack(retqueue,node); @@ -1574,7 +1574,7 @@ int is_acyclic( DagForest *dag) { void set_node_xy(DagNode *node, float x, float y) { - node->x = x; + node->x = x; node->y = y; } diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 1522497bb04..c71a8f2bfc7 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -677,7 +677,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface) volume = td[0]*td[1]*td[2]; /* determine final grid size by trying to fit average 10.000 points per grid cell */ - dim_factor = pow(volume / ((double)sData->total_points / 10000.f), 1.0f/axis); + dim_factor = (float)pow(volume / ((double)sData->total_points / 10000.0), 1.0/(double)axis); /* define final grid size using dim_factor, use min 3 for active axises */ for (i=0; i<3; i++) { @@ -3175,13 +3175,20 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, { float ray_start[3], ray_dir[3]; - float colorband[4] = {0.0f}; - float sample_factor; + float sample_factor = 0.0f; float sampleStrength = 0.0f; BVHTreeRayHit hit; BVHTreeNearest nearest; short hit_found = 0; + /* volume sample */ + float volume_factor = 0.0f; + /* proximity sample */ + float proximity_factor = 0.0f; + float prox_colorband[4] = {0.0f}; + int inner_proximity = (brush->flags & MOD_DPAINT_INVERSE_PROX && + brush->collision == MOD_DPAINT_COL_VOLDIST); + /* hit data */ float hitCoord[3]; int hitFace = -1; @@ -3236,7 +3243,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, if(hit.index != -1) { /* Add factor on supersample filter */ - sampleStrength += sample_factor; + volume_factor = 1.0f; hit_found = HIT_VOLUME; /* Mark hit info */ @@ -3256,8 +3263,6 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, float hitCo[3]; short hQuad; int face; - int inner_proximity = (brush->flags & MOD_DPAINT_INVERSE_PROX && - brush->collision == MOD_DPAINT_COL_VOLDIST); /* if inverse prox and no hit found, skip this sample */ if (inner_proximity && !hit_found) continue; @@ -3299,25 +3304,12 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, /* If a hit was found, calculate required values */ if (proxDist >= 0.0f && proxDist <= brush->paint_distance) { - float dist_rate = proxDist / brush->paint_distance; - float prox_influence = 0.0f; - - /* in case of inverse prox also undo volume effect */ - if (inner_proximity) { - sampleStrength -= sample_factor; - dist_rate = 1.0f - dist_rate; - } - - /* if using proximity color ramp use it's alpha */ - if (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP && do_colorband(brush->paint_ramp, dist_rate, colorband)) - prox_influence = colorband[3]; - else if (brush->proximity_falloff == MOD_DPAINT_PRFALL_SMOOTH) { - prox_influence = (1.0f - dist_rate) * sample_factor; - } - else prox_influence = inner_proximity ? 0.0f : 1.0f; + proximity_factor = proxDist / brush->paint_distance; + CLAMP(proximity_factor, 0.0f, 1.0f); + if (!inner_proximity) + proximity_factor = 1.0f - proximity_factor; hit_found = HIT_PROXIMITY; - sampleStrength += prox_influence*sample_factor; /* if no volume hit, use prox point face info */ if (hitFace == -1) { @@ -3328,7 +3320,32 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, } } - if (!hit_found) continue; + /* mix final sample strength depending on brush settings */ + if (hit_found) { + /* if "negate volume" enabled, negate all factors within volume*/ + if (brush->collision == MOD_DPAINT_COL_VOLDIST && brush->flags & MOD_DPAINT_NEGATE_VOLUME) { + volume_factor = 1.0f - volume_factor; + if (inner_proximity) + proximity_factor = 1.0f - proximity_factor; + } + + /* apply final sample depending on final hit type */ + if (hit_found == HIT_VOLUME) { + sampleStrength = volume_factor; + } + else if (hit_found == HIT_PROXIMITY) { + /* apply falloff curve to the proximity_factor */ + if (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP && do_colorband(brush->paint_ramp, (1.0f-proximity_factor), prox_colorband)) + proximity_factor = prox_colorband[3]; + else if (brush->proximity_falloff == MOD_DPAINT_PRFALL_CONSTANT) + proximity_factor = (!inner_proximity || brush->flags & MOD_DPAINT_NEGATE_VOLUME) ? 1.0f : 0.0f; + /* apply sample */ + sampleStrength = proximity_factor; + } + + sampleStrength *= sample_factor; + } + else continue; /* velocity brush, only do on main sample */ if (brush->flags & MOD_DPAINT_USES_VELOCITY && ss==0 && brushVelocity) { @@ -3395,9 +3412,9 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, /* Sample proximity colorband if required */ if ((hit_found == HIT_PROXIMITY) && (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP)) { if (!(brush->flags & MOD_DPAINT_RAMP_ALPHA)) { - sampleColor[0] = colorband[0]; - sampleColor[1] = colorband[1]; - sampleColor[2] = colorband[2]; + sampleColor[0] = prox_colorband[0]; + sampleColor[1] = prox_colorband[1]; + sampleColor[2] = prox_colorband[2]; } } @@ -3478,7 +3495,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, float range = solidradius + smooth; float particle_timestep = 0.04f * part->timetweak; - Bounds3D part_bb; + Bounds3D part_bb = {0}; if (psys->totpart < 1) return 1; @@ -3678,7 +3695,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || surface->type == MOD_DPAINT_SURFACE_T_WAVE) { /* get displace depth */ - disp_intersect = (1.0f - sqrt(disp_intersect / radius)) * radius; + disp_intersect = (1.0f - sqrtf(disp_intersect / radius)) * radius; depth = (radius - disp_intersect) / bData->bNormal[index].normal_scale; if (depth<0.0f) depth = 0.0f; } @@ -3786,7 +3803,7 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || surface->type == MOD_DPAINT_SURFACE_T_WAVE) { /* get displace depth */ - float disp_intersect = (1.0f - sqrt((brush->paint_distance-distance) / brush->paint_distance)) * brush->paint_distance; + float disp_intersect = (1.0f - sqrtf((brush->paint_distance-distance) / brush->paint_distance)) * brush->paint_distance; depth = (brush->paint_distance - disp_intersect) / bData->bNormal[index].normal_scale; if (depth<0.0f) depth = 0.0f; } @@ -3846,7 +3863,7 @@ static void dynamicPaint_prepareNeighbourData(DynamicPaintSurface *surface, int int numOfNeighs = adj_data->n_num[index]; for (i=0; i<numOfNeighs; i++) { - bData->average_dist += bNeighs[adj_data->n_index[index]+i].dist; + bData->average_dist += (double)bNeighs[adj_data->n_index[index]+i].dist; } } bData->average_dist /= adj_data->total_targets; @@ -3905,18 +3922,18 @@ void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, floa /* get drip factor based on force dir in relation to angle between those neighbours */ temp = dot_v3v3(bNeighs[closest_id[0]].dir, force_proj); CLAMP(temp, -1.0f, 1.0f); /* float precision might cause values > 1.0f that return infinite */ - closest_d[1] = acos(temp)/neigh_diff; + closest_d[1] = acosf(temp)/neigh_diff; closest_d[0] = 1.0f - closest_d[1]; /* and multiply depending on how deeply force intersects surface */ temp = fabs(force_intersect); CLAMP(temp, 0.0f, 1.0f); - closest_d[0] *= acos(temp)/1.57079633f; - closest_d[1] *= acos(temp)/1.57079633f; + closest_d[0] *= acosf(temp)/1.57079633f; + closest_d[1] *= acosf(temp)/1.57079633f; } else { /* if only single neighbour, still linearize force intersection effect */ - closest_d[0] = 1.0f - acos(closest_d[0])/1.57079633f; + closest_d[0] = 1.0f - acosf(closest_d[0])/1.57079633f; } } @@ -4482,7 +4499,7 @@ static int dynamicPaint_surfaceHasMoved(DynamicPaintSurface *surface, Object *ob return ret; } -static int surface_needsVelocityData(DynamicPaintSurface *surface, Scene *scene, Object *UNUSED(ob)) +static int surface_needsVelocityData(DynamicPaintSurface *surface, Scene *scene) { if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) return 1; @@ -4509,7 +4526,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc PaintBakeData *bData = sData->bData; DerivedMesh *dm = surface->canvas->dm; int index, new_bdata = 0; - int do_velocity_data = surface_needsVelocityData(surface, scene, ob); + int do_velocity_data = surface_needsVelocityData(surface, scene); int do_accel_data = surface_needsAccelerationData(surface); int canvasNumOfVerts = dm->getNumVerts(dm); diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 313143f362b..df3694e0bf1 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -79,9 +79,9 @@ double itval(void) // #include <pmmintrin.h> // #include <pthread.h> - static struct timeval _itstart, _itend; - static struct timezone itz; - void itstart(void) +static struct timeval _itstart, _itend; +static struct timezone itz; +void itstart(void) { gettimeofday(&_itstart, &itz); } diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index f397aa736aa..4155551763e 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -671,10 +671,10 @@ static ID *alloc_libblock_notest(short type) break; case ID_PA: id = MEM_callocN(sizeof(ParticleSettings), "ParticleSettings"); - break; + break; case ID_WM: id = MEM_callocN(sizeof(wmWindowManager), "Window manager"); - break; + break; case ID_GD: id = MEM_callocN(sizeof(bGPdata), "Grease Pencil"); break; diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 5c82acde99b..d8628e526ef 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -776,7 +776,7 @@ void *new_pgn_element(int size) if(cur) { if(size+offs < blocksize) { adr= (void *) (cur->data+offs); - offs+= size; + offs+= size; return adr; } } diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 94e8f4863a0..6db24258dca 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1313,10 +1313,10 @@ static MultiresFace *find_old_face(ListBase *map, MultiresFace *faces, int v1, i IndexNode *n1; int v[4], i, j; - v[0]= v1; - v[1]= v2; - v[2]= v3; - v[3]= v4; + v[0]= v1; + v[1]= v2; + v[2]= v3; + v[3]= v4; for(n1 = map[v1].first; n1; n1 = n1->next) { int fnd[4] = {0, 0, 0, 0}; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index fd5c7912e1f..8a908097862 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -356,7 +356,7 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker) { AUD_SoundInfo info = AUD_getInfo(speaker->sound->playback_handle); - strip->end = ceil(info.length * FPS); + strip->end = (float)ceil((double)info.length * FPS); } else #endif diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index fa023d8fb43..c4edddf587c 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -961,8 +961,8 @@ void ntreeSetOutput(bNodeTree *ntree) /* we need a check for which output node should be tagged like this, below an exception */ if(node->type==CMP_NODE_OUTPUT_FILE) - continue; - + continue; + /* there is more types having output class, each one is checked */ for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) { if(tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 645d983bb7a..82da0e549d9 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -640,7 +640,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center w= co[2]*data->winmat[2][3] + data->winmat[3][3]; dx= data->winx*ortho2[0]*data->winmat[0][0]; dy= data->winy*ortho2[1]*data->winmat[1][1]; - w= sqrt(dx*dx + dy*dy)/w; + w= sqrtf(dx*dx + dy*dy)/w; /* w squared because we are working with area */ area= area*w*w; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index a9aeb37e478..dbfda18942a 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1127,7 +1127,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra) if (!BLI_exists(filename)) { return NULL; } - fp = fopen(filename, "rb"); + fp = fopen(filename, "rb"); } else if (mode==PTCACHE_FILE_WRITE) { BLI_make_existing_file(filename); /* will create the dir if needs be, same as //textures is created */ fp = fopen(filename, "wb"); diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 3699cf40aa8..e8e9c754806 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -2144,7 +2144,7 @@ static struct ImBuf * do_transform_effect( struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3); do_transform(context.scene, seq, facf0, - context.rectx, context.recty, ibuf1, out); + context.rectx, context.recty, ibuf1, out); return out; } @@ -2541,7 +2541,7 @@ static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out, for(y=0;y< height;y++) { for (x=0;x< width;x++) { - index= (x+y*width)*4; + index= (x+y*width)*4; /* Isolate the intensity */ intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold); @@ -2570,7 +2570,7 @@ static void RVIsolateHighlights_float (float* in, float* out, for(y=0;y< height;y++) { for (x=0;x< width;x++) { - index= (x+y*width)*4; + index= (x+y*width)*4; /* Isolate the intensity */ intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 3e9b570d104..53878176fec 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1160,13 +1160,13 @@ static void seq_open_anim_file(Sequence * seq) return; } - BLI_join_dirfile(name, sizeof(name), - seq->strip->dir, seq->strip->stripdata->name); + BLI_join_dirfile(name, sizeof(name), + seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(name, G.main->name); seq->anim = openanim(name, IB_rect | - ((seq->flag & SEQ_FILTERY) ? - IB_animdeinterlace : 0), seq->streamindex); + ((seq->flag & SEQ_FILTERY) ? + IB_animdeinterlace : 0), seq->streamindex); if (seq->anim == NULL) { return; @@ -1211,8 +1211,8 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, } if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { - BLI_join_dirfile(name, PROXY_MAXFILE, - dir, seq->strip->proxy->file); + BLI_join_dirfile(name, PROXY_MAXFILE, + dir, seq->strip->proxy->file); BLI_path_abs(name, G.main->name); return TRUE; @@ -1227,14 +1227,13 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, if (seq->type == SEQ_IMAGE) { BLI_snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir, - context.preview_render_size, - give_stripelem(seq, cfra)->name); + context.preview_render_size, + give_stripelem(seq, cfra)->name); frameno = 1; } else { - frameno = (int) give_stripelem_index(seq, cfra) - + seq->anim_startofs; + frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, - context.preview_render_size); + context.preview_render_size); } BLI_path_abs(name, G.main->name); @@ -1504,7 +1503,7 @@ static void color_balance_byte_byte(Sequence * seq, ImBuf* ibuf, float mul) for (c = 0; c < 3; c++) { make_cb_table_byte(cb.lift[c], cb.gain[c], cb.gamma[c], - cb_tab[c], mul); + cb_tab[c], mul); } while (p < e) { @@ -1847,14 +1846,14 @@ static ImBuf* seq_render_effect_strip_impl( switch (early_out) { case EARLY_NO_INPUT: - out = sh.execute(context, seq, cfra, fac, facf, - NULL, NULL, NULL); + out = sh.execute(context, seq, cfra, fac, facf, + NULL, NULL, NULL); break; case EARLY_DO_EFFECT: for(i=0; i<3; i++) { if(input[i]) ibuf[i] = seq_render_strip( - context, input[i], cfra); + context, input[i], cfra); } if (ibuf[0] && ibuf[1]) { @@ -2909,7 +2908,7 @@ int seq_single_check(Sequence *seq) return (seq->len==1 && ( seq->type == SEQ_IMAGE || ((seq->type & SEQ_EFFECT) && - get_sequence_effect_num_inputs(seq->type) == 0))); + get_sequence_effect_num_inputs(seq->type) == 0))); } /* check if the selected seq's reference unselected seq's */ diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 5b02731050e..d3d6a658ede 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -561,7 +561,7 @@ static void ccd_build_deflector_hash(Scene *scene, Object *vertexowner, GHash *h }/*--- only with deflecting set */ }/* mesh && layer*/ - base = base->next; + base = base->next; } /* while (base) */ } @@ -589,7 +589,7 @@ static void ccd_update_deflector_hash(Scene *scene, Object *vertexowner, GHash * }/*--- only with deflecting set */ }/* mesh && layer*/ - base = base->next; + base = base->next; } /* while (base) */ } @@ -2270,7 +2270,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo kd = sb->goalfrict * sb_fric_force_scale(ob) ; add_v3_v3v3(auxvect,velgoal,bp->vec); - if (forcetime > 0.0 ) { /* make sure friction does not become rocket motor on time reversal */ + if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */ bp->force[0]-= kd * (auxvect[0]); bp->force[1]-= kd * (auxvect[1]); bp->force[2]-= kd * (auxvect[2]); @@ -2675,7 +2675,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa kd = sb->goalfrict * sb_fric_force_scale(ob) ; add_v3_v3v3(auxvect,velgoal,bp->vec); - if (forcetime > 0.0 ) { /* make sure friction does not become rocket motor on time reversal */ + if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */ bp->force[0]-= kd * (auxvect[0]); bp->force[1]-= kd * (auxvect[1]); bp->force[2]-= kd * (auxvect[2]); @@ -3149,7 +3149,7 @@ static void apply_spring_memory(Object *ob) bp2 =&sb->bpoint[bs->v2]; l = len_v3v3(bp1->pos,bp2->pos); r = bs->len/l; - if (( r > 1.05f) || (r < 0.95)){ + if (( r > 1.05f) || (r < 0.95f)){ bs->len = ((100.0f - b) * bs->len + b*l)/100.0f; } } @@ -3356,7 +3356,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob) build_bps_springlist(ob); /* yes we need to do it again*/ } springs_from_mesh(ob); /* write the 'rest'-length of the springs */ - if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);} + if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);} } @@ -3952,7 +3952,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime) while ( (ABS(timedone) < ABS(dtime)) && (loops < 2000) ) { /* set goals in time */ - interpolate_exciter(ob,200,(int)(200.0*(timedone/dtime))); + interpolate_exciter(ob,200,(int)(200.0f*(timedone/dtime))); sb->scratch->flag &= ~SBF_DOFUZZY; /* do predictive euler step */ @@ -3993,7 +3993,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime) timedone += forcetime; newtime=MIN2(forcetimemax,MAX2(newtime,forcetimemin)); //if (newtime > forcetime) printf("up,"); - if (forcetime > 0.0) + if (forcetime > 0.0f) forcetime = MIN2(dtime - timedone,newtime); else forcetime = MAX2(dtime - timedone,newtime); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 38bb615896b..65b27f725bc 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1794,8 +1794,8 @@ static void calculate_stabdata(MovieTracking *tracking, int framenr, float width *angle*= stab->rotinf; /* convert to rotation around image center */ - loc[0]-= (x0 + (x-x0)*cos(*angle)-(y-y0)*sin(*angle) - x)*(*scale); - loc[1]-= (y0 + (x-x0)*sin(*angle)+(y-y0)*cos(*angle) - y)*(*scale); + loc[0]-= (x0 + (x-x0)*cosf(*angle)-(y-y0)*sinf(*angle) - x)*(*scale); + loc[1]-= (y0 + (x-x0)*sinf(*angle)+(y-y0)*cosf(*angle) - y)*(*scale); } } diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 2646f5164b2..036a52a1235 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -343,8 +343,8 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports) if (c->pix_fmt != PIX_FMT_BGR32) { sws_scale(img_convert_ctx, (const uint8_t * const*) rgb_frame->data, - rgb_frame->linesize, 0, c->height, - current_frame->data, current_frame->linesize); + rgb_frame->linesize, 0, c->height, + current_frame->data, current_frame->linesize); delete_picture(rgb_frame); } return current_frame; |