quiet gcc float -> double promotion warnings.

This commit is contained in:
2011-04-02 02:08:33 +00:00
parent fb994b3c85
commit 69bd72c3b6
16 changed files with 115 additions and 115 deletions

View File

@@ -233,7 +233,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
t = hit.dist/col.original_ray_length; t = hit.dist/col.original_ray_length;
/* avoid head-on collision */ /* avoid head-on collision */
if(dot_v3v3(col.pce.nor, pa->prev_state.ave) < -0.99) { if(dot_v3v3(col.pce.nor, pa->prev_state.ave) < -0.99f) {
/* don't know why, but uneven range [0.0,1.0] */ /* don't know why, but uneven range [0.0,1.0] */
/* works much better than even [-1.0,1.0] */ /* works much better than even [-1.0,1.0] */
bbd->wanted_co[0] = BLI_frand(); bbd->wanted_co[0] = BLI_frand();
@@ -439,7 +439,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
mul = dot_v3v3(vec, vec); mul = dot_v3v3(vec, vec);
/* leader is not moving */ /* leader is not moving */
if(mul < 0.01) { if(mul < 0.01f) {
len = len_v3(loc); len = len_v3(loc);
/* too close to leader */ /* too close to leader */
if(len < 2.0f * val->personal_space * pa->size) { if(len < 2.0f * val->personal_space * pa->size) {
@@ -476,7 +476,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
else { else {
VECCOPY(loc, flbr->oloc); VECCOPY(loc, flbr->oloc);
sub_v3_v3v3(vec, flbr->loc, flbr->oloc); sub_v3_v3v3(vec, flbr->loc, flbr->oloc);
mul_v3_fl(vec, 1.0/bbd->timestep); mul_v3_fl(vec, 1.0f/bbd->timestep);
} }
/* fac is seconds behind leader */ /* fac is seconds behind leader */
@@ -499,7 +499,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
mul = dot_v3v3(vec, vec); mul = dot_v3v3(vec, vec);
/* leader is not moving */ /* leader is not moving */
if(mul < 0.01) { if(mul < 0.01f) {
len = len_v3(loc); len = len_v3(loc);
/* too close to leader */ /* too close to leader */
if(len < 2.0f * val->personal_space * pa->size) { if(len < 2.0f * val->personal_space * pa->size) {
@@ -730,7 +730,7 @@ static void set_boid_values(BoidValues *val, BoidSettings *boids, ParticleData *
if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) { if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
val->max_speed = boids->land_max_speed * bpa->data.health/boids->health; val->max_speed = boids->land_max_speed * bpa->data.health/boids->health;
val->max_acc = boids->land_max_acc * val->max_speed; val->max_acc = boids->land_max_acc * val->max_speed;
val->max_ave = boids->land_max_ave * M_PI * bpa->data.health/boids->health; val->max_ave = boids->land_max_ave * (float)M_PI * bpa->data.health/boids->health;
val->min_speed = 0.0f; /* no minimum speed on land */ val->min_speed = 0.0f; /* no minimum speed on land */
val->personal_space = boids->land_personal_space; val->personal_space = boids->land_personal_space;
val->jump_speed = boids->land_jump_speed * bpa->data.health/boids->health; val->jump_speed = boids->land_jump_speed * bpa->data.health/boids->health;
@@ -738,7 +738,7 @@ static void set_boid_values(BoidValues *val, BoidSettings *boids, ParticleData *
else { else {
val->max_speed = boids->air_max_speed * bpa->data.health/boids->health; val->max_speed = boids->air_max_speed * bpa->data.health/boids->health;
val->max_acc = boids->air_max_acc * val->max_speed; val->max_acc = boids->air_max_acc * val->max_speed;
val->max_ave = boids->air_max_ave * M_PI * bpa->data.health/boids->health; val->max_ave = boids->air_max_ave * (float)M_PI * bpa->data.health/boids->health;
val->min_speed = boids->air_min_speed * boids->air_max_speed; val->min_speed = boids->air_min_speed * boids->air_max_speed;
val->personal_space = boids->air_personal_space; val->personal_space = boids->air_personal_space;
val->jump_speed = 0.0f; /* no jumping in air */ val->jump_speed = 0.0f; /* no jumping in air */
@@ -872,7 +872,7 @@ static void boid_climb(BoidSettings *boids, ParticleData *pa, float *surface_co,
VECCOPY(nor, surface_nor); VECCOPY(nor, surface_nor);
/* gather apparent gravity */ /* gather apparent gravity */
VECADDFAC(bpa->gravity, bpa->gravity, surface_nor, -1.0); VECADDFAC(bpa->gravity, bpa->gravity, surface_nor, -1.0f);
normalize_v3(bpa->gravity); normalize_v3(bpa->gravity);
/* raise boid it's size from surface */ /* raise boid it's size from surface */
@@ -1010,7 +1010,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
/* decide on jumping & liftoff */ /* decide on jumping & liftoff */
if(bpa->data.mode == eBoidMode_OnLand) { if(bpa->data.mode == eBoidMode_OnLand) {
/* fuzziness makes boids capable of misjudgement */ /* fuzziness makes boids capable of misjudgement */
float mul = 1.0 + state->rule_fuzziness; float mul = 1.0f + state->rule_fuzziness;
if(boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) { if(boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) {
float cvel[3], dir[3]; float cvel[3], dir[3];
@@ -1021,7 +1021,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
VECCOPY(cvel, bbd->wanted_co); VECCOPY(cvel, bbd->wanted_co);
normalize_v2(cvel); normalize_v2(cvel);
if(dot_v2v2(cvel, dir) > 0.95 / mul) if(dot_v2v2(cvel, dir) > 0.95f / mul)
bpa->data.mode = eBoidMode_Liftoff; bpa->data.mode = eBoidMode_Liftoff;
} }
else if(val.jump_speed > 0.0f) { else if(val.jump_speed > 0.0f) {
@@ -1129,7 +1129,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor); bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
/* level = how many particle sizes above ground */ /* level = how many particle sizes above ground */
level = (pa->prev_state.co[2] - ground_co[2])/(2.0f * pa->size) - 0.5; level = (pa->prev_state.co[2] - ground_co[2])/(2.0f * pa->size) - 0.5f;
landing_level = - boids->landing_smoothness * pa->prev_state.vel[2] * pa_mass; landing_level = - boids->landing_smoothness * pa->prev_state.vel[2] * pa_mass;
@@ -1328,7 +1328,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
boid_climb(boids, pa, ground_co, ground_nor); boid_climb(boids, pa, ground_co, ground_nor);
} }
/* land boid when really near ground */ /* land boid when really near ground */
else if(pa->state.co[2] <= ground_co[2] + 1.01 * pa->size * boids->height){ else if(pa->state.co[2] <= ground_co[2] + 1.01f * pa->size * boids->height){
pa->state.co[2] = ground_co[2] + pa->size * boids->height; pa->state.co[2] = ground_co[2] + pa->size * boids->height;
pa->state.vel[2] = 0.0f; pa->state.vel[2] = 0.0f;
bpa->data.mode = eBoidMode_OnLand; bpa->data.mode = eBoidMode_OnLand;
@@ -1370,7 +1370,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
boid_climb(boids, pa, ground_co, ground_nor); boid_climb(boids, pa, ground_co, ground_nor);
} }
/* ground is too far away so boid falls */ /* ground is too far away so boid falls */
else if(pa->state.co[2]-ground_co[2] > 1.1 * pa->size * boids->height) else if(pa->state.co[2]-ground_co[2] > 1.1f * pa->size * boids->height)
bpa->data.mode = eBoidMode_Falling; bpa->data.mode = eBoidMode_Falling;
else { else {
/* constrain to surface */ /* constrain to surface */
@@ -1402,7 +1402,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* save direction to state.ave unless the boid is falling */ /* save direction to state.ave unless the boid is falling */
/* (boids can't effect their direction when falling) */ /* (boids can't effect their direction when falling) */
if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1*pa->size) { if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1f*pa->size) {
copy_v3_v3(pa->state.ave, pa->state.vel); copy_v3_v3(pa->state.ave, pa->state.vel);
pa->state.ave[2] *= bbd->part->boids->pitch; pa->state.ave[2] *= bbd->part->boids->pitch;
normalize_v3(pa->state.ave); normalize_v3(pa->state.ave);

View File

@@ -495,7 +495,7 @@ static float wind_func(struct RNG *rng, float strength)
float ret; float ret;
float sign = 0; float sign = 0;
sign = ((float)random > 64.0) ? 1.0: -1.0; // dividing by 2 is not giving equal sign distribution sign = ((float)random > 64.0f) ? 1.0f: -1.0f; // dividing by 2 is not giving equal sign distribution
ret = sign*((float)random / force)*strength/128.0f; ret = sign*((float)random / force)*strength/128.0f;
@@ -517,7 +517,7 @@ static float falloff_func(float fac, int usemin, float mindist, int usemax, floa
if(!usemin) if(!usemin)
mindist = 0.0; mindist = 0.0;
return pow((double)1.0+fac-mindist, (double)-power); return pow((double)(1.0f+fac-mindist), (double)(-power));
} }
static float falloff_func_dist(PartDeflect *pd, float fac) static float falloff_func_dist(PartDeflect *pd, float fac)
@@ -653,7 +653,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
sim.psys= eff->psys; sim.psys= eff->psys;
/* TODO: time from actual previous calculated frame (step might not be 1) */ /* TODO: time from actual previous calculated frame (step might not be 1) */
state.time = cfra - 1.0; state.time = cfra - 1.0f;
ret = psys_get_particle_state(&sim, *efd->index, &state, 0); ret = psys_get_particle_state(&sim, *efd->index, &state, 0);
/* TODO */ /* TODO */
@@ -705,7 +705,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
if(real_velocity) { if(real_velocity) {
VECCOPY(efd->vel, ob->obmat[3]); VECCOPY(efd->vel, ob->obmat[3]);
where_is_object_time(eff->scene, ob, cfra - 1.0); where_is_object_time(eff->scene, ob, cfra - 1.0f);
sub_v3_v3v3(efd->vel, efd->vel, ob->obmat[3]); sub_v3_v3v3(efd->vel, efd->vel, ob->obmat[3]);
} }
@@ -931,10 +931,10 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
case PFIELD_LENNARDJ: case PFIELD_LENNARDJ:
fac = pow((efd->size + point->size) / efd->distance, 6.0); fac = pow((efd->size + point->size) / efd->distance, 6.0);
fac = - fac * (1.0 - fac) / efd->distance; fac = - fac * (1.0f - fac) / efd->distance;
/* limit the repulsive term drastically to avoid huge forces */ /* limit the repulsive term drastically to avoid huge forces */
fac = ((fac>2.0) ? 2.0 : fac); fac = ((fac>2.0f) ? 2.0f : fac);
mul_v3_fl(force, strength * fac); mul_v3_fl(force, strength * fac);
break; break;

View File

@@ -346,7 +346,7 @@ static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, floa
case FCM_GENERATOR_FN_LN: /* natural log */ case FCM_GENERATOR_FN_LN: /* natural log */
{ {
/* check that value is greater than 1? */ /* check that value is greater than 1? */
if (arg > 1.0f) { if (arg > 1.0) {
fn= log; fn= log;
} }
else { else {
@@ -358,7 +358,7 @@ static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, floa
case FCM_GENERATOR_FN_SQRT: /* square root */ case FCM_GENERATOR_FN_SQRT: /* square root */
{ {
/* no negative numbers */ /* no negative numbers */
if (arg > 0.0f) { if (arg > 0.0) {
fn= sqrt; fn= sqrt;
} }
else { else {
@@ -374,7 +374,7 @@ static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, floa
/* execute function callback to set value if appropriate */ /* execute function callback to set value if appropriate */
if (fn) { if (fn) {
float value= (float)(data->amplitude*fn(arg) + data->value_offset); float value= (float)(data->amplitude*(float)fn(arg) + data->value_offset);
if (data->flag & FCM_GENERATOR_ADDITIVE) if (data->flag & FCM_GENERATOR_ADDITIVE)
*cvalue += value; *cvalue += value;

View File

@@ -2725,7 +2725,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
node= getExecutableNode(ntree); node= getExecutableNode(ntree);
if(node) { if(node) {
if(ntree->progress && totnode) if(ntree->progress && totnode)
ntree->progress(ntree->prh, (1.0 - curnode/(float)totnode)); ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode));
if(ntree->stats_draw) { if(ntree->stats_draw) {
char str[64]; char str[64];
sprintf(str, "Compositing %d %s", curnode, node->name); sprintf(str, "Compositing %d %s", curnode, node->name);

View File

@@ -880,7 +880,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
if((arearatio < 1.0f || viewport < 1.0f) && elem->totchild) { if((arearatio < 1.0f || viewport < 1.0f) && elem->totchild) {
/* lambda is percentage of elements to keep */ /* lambda is percentage of elements to keep */
lambda= (arearatio < 1.0f)? pow(arearatio, powrate): 1.0f; lambda= (arearatio < 1.0f)? powf(arearatio, powrate): 1.0f;
lambda *= viewport; lambda *= viewport;
lambda= MAX2(lambda, 1.0f/elem->totchild); lambda= MAX2(lambda, 1.0f/elem->totchild);
@@ -2254,7 +2254,7 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK
pd_point_from_particle(sim, sim->psys->particles+i, &eff_key, &epoint); pd_point_from_particle(sim, sim->psys->particles+i, &eff_key, &epoint);
pdDoEffectors(sim->psys->effectors, sim->colliders, sim->psys->part->effector_weights, &epoint, force, NULL); pdDoEffectors(sim->psys->effectors, sim->colliders, sim->psys->part->effector_weights, &epoint, force, NULL);
mul_v3_fl(force, effector*pow((float)k / (float)steps, 100.0f * sim->psys->part->eff_hair) / (float)steps); mul_v3_fl(force, effector*powf((float)k / (float)steps, 100.0f * sim->psys->part->eff_hair) / (float)steps);
add_v3_v3(force, vec); add_v3_v3(force, vec);

View File

@@ -659,7 +659,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
if(num==0) return; if(num==0) return;
rad1= (float)(1.0f/sqrt((float)num)); rad1= (float)(1.0f/sqrtf((float)num));
rad2= (float)(1.0f/((float)num)); rad2= (float)(1.0f/((float)num));
rad3= (float)sqrt((float)num)/((float)num); rad3= (float)sqrt((float)num)/((float)num);
@@ -1668,7 +1668,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
zero_v3(pa->state.vel); zero_v3(pa->state.vel);
/* boids store direction in ave */ /* boids store direction in ave */
if(fabs(nor[2])==1.0f) { if(fabsf(nor[2])==1.0f) {
sub_v3_v3v3(pa->state.ave, loc, ob->obmat[3]); sub_v3_v3v3(pa->state.ave, loc, ob->obmat[3]);
normalize_v3(pa->state.ave); normalize_v3(pa->state.ave);
} }
@@ -2334,7 +2334,7 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist)
pfr->neighbors[pfr->tot_neighbors].psys = pfr->npsys; pfr->neighbors[pfr->tot_neighbors].psys = pfr->npsys;
pfr->tot_neighbors++; pfr->tot_neighbors++;
q = (1.f - sqrt(squared_dist)/pfr->h) * pfr->massfac; q = (1.f - sqrtf(squared_dist)/pfr->h) * pfr->massfac;
if(pfr->use_size) if(pfr->use_size)
q *= npa->size; q *= npa->size;
@@ -2658,7 +2658,7 @@ static float nr_distance_to_edge(float *p, float radius, ParticleCollisionElemen
cross_v3_v3v3(c, v1, v2); cross_v3_v3v3(c, v1, v2);
return fabs(len_v3(c)/len_v3(v0)) - radius; return fabsf(len_v3(c)/len_v3(v0)) - radius;
} }
static float nr_distance_to_vert(float *p, float radius, ParticleCollisionElement *pce, float *UNUSED(nor)) static float nr_distance_to_vert(float *p, float radius, ParticleCollisionElement *pce, float *UNUSED(nor))
{ {

View File

@@ -2557,7 +2557,7 @@ static void *ptcache_bake_thread(void *ptr) {
ptcache_dt_to_str(run, ctime-stime); ptcache_dt_to_str(run, ctime-stime);
ptcache_dt_to_str(etd, fetd); ptcache_dt_to_str(etd, fetd);
printf("Baked for %s, current frame: %i/%i (%.3fs), ETC: %s \r", run, *data->cfra_ptr-sfra+1, efra-sfra+1, (float)(ctime-ptime), etd); printf("Baked for %s, current frame: %i/%i (%.3fs), ETC: %s \r", run, *data->cfra_ptr-sfra+1, efra-sfra+1, ctime-ptime, etd);
} }
ptime = ctime; ptime = ctime;
} }

View File

@@ -1582,11 +1582,11 @@ typedef struct WipeZone {
static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo) static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo)
{ {
wipezone->flip = (wipe->angle < 0); wipezone->flip = (wipe->angle < 0);
wipezone->angle = pow(fabs(wipe->angle)/45.0f, log(xo)/log(2.0f)); wipezone->angle = pow(fabsf(wipe->angle)/45.0f, log(xo)/log(2.0f));
wipezone->xo = xo; wipezone->xo = xo;
wipezone->yo = yo; wipezone->yo = yo;
wipezone->width = (int)(wipe->edgeWidth*((xo+yo)/2.0f)); wipezone->width = (int)(wipe->edgeWidth*((xo+yo)/2.0f));
wipezone->pythangle = 1.0f/sqrt(wipe->angle*wipe->angle + 1.0f); wipezone->pythangle = 1.0f/sqrtf(wipe->angle*wipe->angle + 1.0f);
if(wipe->wipetype == DO_SINGLE_WIPE) if(wipe->wipetype == DO_SINGLE_WIPE)
wipezone->invwidth = 1.0f/wipezone->width; wipezone->invwidth = 1.0f/wipezone->width;

View File

@@ -1029,7 +1029,7 @@ static float give_stripelem_index(Sequence *seq, float cfra)
if (seq->strobe < 1.0f) seq->strobe = 1.0f; if (seq->strobe < 1.0f) seq->strobe = 1.0f;
if (seq->strobe > 1.0f) { if (seq->strobe > 1.0f) {
nr -= fmod((double)nr, (double)seq->strobe); nr -= fmodf((double)nr, (double)seq->strobe);
} }
return nr; return nr;

View File

@@ -329,7 +329,7 @@ static float sound_get_volume(Scene* scene, Sequence* sequence, float time)
fcu= list_find_fcurve(&adt->action->curves, buf, 0); fcu= list_find_fcurve(&adt->action->curves, buf, 0);
if(fcu) if(fcu)
return evaluate_fcurve(fcu, time * FPS); return evaluate_fcurve(fcu, time * (float)FPS);
else else
return sequence->volume; return sequence->volume;
} }

View File

@@ -88,10 +88,10 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
// adjust font size // adjust font size
height= ((double) face->bbox.yMax - (double) face->bbox.yMin); height= ((double) face->bbox.yMax - (double) face->bbox.yMin);
if(height != 0.0) if(height != 0.0f)
scale = 1.0 / height; scale = 1.0f / height;
else else
scale = 1.0 / 1000.0; scale = 1.0f / 1000.0f;
// //
// Generate the character 3D data // Generate the character 3D data
@@ -167,20 +167,20 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
if(k < npoints[j] - 1 ) if(k < npoints[j] - 1 )
{ {
if( ftoutline.tags[l] == FT_Curve_Tag_Conic && ftoutline.tags[l+1] == FT_Curve_Tag_Conic) { if( ftoutline.tags[l] == FT_Curve_Tag_Conic && ftoutline.tags[l+1] == FT_Curve_Tag_Conic) {
dx = (ftoutline.points[l].x + ftoutline.points[l+1].x)* scale / 2.0; dx = (ftoutline.points[l].x + ftoutline.points[l+1].x)* scale / 2.0f;
dy = (ftoutline.points[l].y + ftoutline.points[l+1].y)* scale / 2.0; dy = (ftoutline.points[l].y + ftoutline.points[l+1].y)* scale / 2.0f;
//left handle //left handle
bezt->vec[0][0] = (dx + (2 * ftoutline.points[l].x)* scale) / 3.0; bezt->vec[0][0] = (dx + (2 * ftoutline.points[l].x)* scale) / 3.0f;
bezt->vec[0][1] = (dy + (2 * ftoutline.points[l].y)* scale) / 3.0; bezt->vec[0][1] = (dy + (2 * ftoutline.points[l].y)* scale) / 3.0f;
//midpoint (virtual on-curve point) //midpoint (virtual on-curve point)
bezt->vec[1][0] = dx; bezt->vec[1][0] = dx;
bezt->vec[1][1] = dy; bezt->vec[1][1] = dy;
//right handle //right handle
bezt->vec[2][0] = (dx + (2 * ftoutline.points[l+1].x)* scale) / 3.0; bezt->vec[2][0] = (dx + (2 * ftoutline.points[l+1].x)* scale) / 3.0f;
bezt->vec[2][1] = (dy + (2 * ftoutline.points[l+1].y)* scale) / 3.0; bezt->vec[2][1] = (dy + (2 * ftoutline.points[l+1].y)* scale) / 3.0f;
bezt->h1= bezt->h2= HD_ALIGN; bezt->h1= bezt->h2= HD_ALIGN;
bezt->radius= 1.0f; bezt->radius= 1.0f;
@@ -197,12 +197,12 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
bezt->vec[0][1] = ftoutline.points[l-1].y* scale; bezt->vec[0][1] = ftoutline.points[l-1].y* scale;
bezt->h1= HD_FREE; bezt->h1= HD_FREE;
} else if(ftoutline.tags[l - 1] == FT_Curve_Tag_Conic) { } else if(ftoutline.tags[l - 1] == FT_Curve_Tag_Conic) {
bezt->vec[0][0] = (ftoutline.points[l].x + (2 * ftoutline.points[l - 1].x))* scale / 3.0; bezt->vec[0][0] = (ftoutline.points[l].x + (2 * ftoutline.points[l - 1].x))* scale / 3.0f;
bezt->vec[0][1] = (ftoutline.points[l].y + (2 * ftoutline.points[l - 1].y))* scale / 3.0; bezt->vec[0][1] = (ftoutline.points[l].y + (2 * ftoutline.points[l - 1].y))* scale / 3.0f;
bezt->h1= HD_FREE; bezt->h1= HD_FREE;
} else { } else {
bezt->vec[0][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[l-1].x)* scale / 3.0; bezt->vec[0][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[l-1].x)* scale / 3.0f;
bezt->vec[0][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[l-1].y)* scale / 3.0; bezt->vec[0][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[l-1].y)* scale / 3.0f;
bezt->h1= HD_VECT; bezt->h1= HD_VECT;
} }
} else { //first point on curve } else { //first point on curve
@@ -211,12 +211,12 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
bezt->vec[0][1] = ftoutline.points[ftoutline.contours[j]].y * scale; bezt->vec[0][1] = ftoutline.points[ftoutline.contours[j]].y * scale;
bezt->h1= HD_FREE; bezt->h1= HD_FREE;
} else if(ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Conic) { } else if(ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Conic) {
bezt->vec[0][0] = (ftoutline.points[l].x + (2 * ftoutline.points[ftoutline.contours[j]].x))* scale / 3.0 ; bezt->vec[0][0] = (ftoutline.points[l].x + (2 * ftoutline.points[ftoutline.contours[j]].x))* scale / 3.0f;
bezt->vec[0][1] = (ftoutline.points[l].y + (2 * ftoutline.points[ftoutline.contours[j]].y))* scale / 3.0 ; bezt->vec[0][1] = (ftoutline.points[l].y + (2 * ftoutline.points[ftoutline.contours[j]].y))* scale / 3.0f;
bezt->h1= HD_FREE; bezt->h1= HD_FREE;
} else { } else {
bezt->vec[0][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[ftoutline.contours[j]].x)* scale / 3.0; bezt->vec[0][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[ftoutline.contours[j]].x)* scale / 3.0f;
bezt->vec[0][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[ftoutline.contours[j]].y)* scale / 3.0; bezt->vec[0][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[ftoutline.contours[j]].y)* scale / 3.0f;
bezt->h1= HD_VECT; bezt->h1= HD_VECT;
} }
} }
@@ -232,12 +232,12 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
bezt->vec[2][1] = ftoutline.points[l+1].y* scale; bezt->vec[2][1] = ftoutline.points[l+1].y* scale;
bezt->h2= HD_FREE; bezt->h2= HD_FREE;
} else if(ftoutline.tags[l+1] == FT_Curve_Tag_Conic) { } else if(ftoutline.tags[l+1] == FT_Curve_Tag_Conic) {
bezt->vec[2][0] = (ftoutline.points[l].x + (2 * ftoutline.points[l+1].x))* scale / 3.0; bezt->vec[2][0] = (ftoutline.points[l].x + (2 * ftoutline.points[l+1].x))* scale / 3.0f;
bezt->vec[2][1] = (ftoutline.points[l].y + (2 * ftoutline.points[l+1].y))* scale / 3.0; bezt->vec[2][1] = (ftoutline.points[l].y + (2 * ftoutline.points[l+1].y))* scale / 3.0f;
bezt->h2= HD_FREE; bezt->h2= HD_FREE;
} else { } else {
bezt->vec[2][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[l+1].x)* scale / 3.0; bezt->vec[2][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[l+1].x)* scale / 3.0f;
bezt->vec[2][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[l+1].y)* scale / 3.0; bezt->vec[2][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[l+1].y)* scale / 3.0f;
bezt->h2= HD_VECT; bezt->h2= HD_VECT;
} }
} else { //last point on curve } else { //last point on curve
@@ -246,12 +246,12 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
bezt->vec[2][1] = ftoutline.points[m].y* scale; bezt->vec[2][1] = ftoutline.points[m].y* scale;
bezt->h2= HD_FREE; bezt->h2= HD_FREE;
} else if(ftoutline.tags[m] == FT_Curve_Tag_Conic) { } else if(ftoutline.tags[m] == FT_Curve_Tag_Conic) {
bezt->vec[2][0] = (ftoutline.points[l].x + (2 * ftoutline.points[m].x))* scale / 3.0 ; bezt->vec[2][0] = (ftoutline.points[l].x + (2 * ftoutline.points[m].x))* scale / 3.0f;
bezt->vec[2][1] = (ftoutline.points[l].y + (2 * ftoutline.points[m].y))* scale / 3.0 ; bezt->vec[2][1] = (ftoutline.points[l].y + (2 * ftoutline.points[m].y))* scale / 3.0f;
bezt->h2= HD_FREE; bezt->h2= HD_FREE;
} else { } else {
bezt->vec[2][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[m].x)* scale / 3.0; bezt->vec[2][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[m].x)* scale / 3.0f;
bezt->vec[2][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[m].y)* scale / 3.0; bezt->vec[2][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[m].y)* scale / 3.0f;
bezt->h2= HD_VECT; bezt->h2= HD_VECT;
} }
} }
@@ -261,10 +261,10 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
// len_squared_v2v2, see if there's a distance between the three points // len_squared_v2v2, see if there's a distance between the three points
// len_squared_v2v2 again, to check the angle between the handles // len_squared_v2v2 again, to check the angle between the handles
// finally, check if one of them is a vector handle // finally, check if one of them is a vector handle
if((dist_to_line_v2(bezt->vec[0],bezt->vec[1],bezt->vec[2]) < 0.001) && if((dist_to_line_v2(bezt->vec[0],bezt->vec[1],bezt->vec[2]) < 0.001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001*0.0001) && (len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001f*0.0001f) &&
(len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001*0.0001) && (len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f*0.0001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002*0.0001) && (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f*0.0001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > MAX2(len_squared_v2v2(bezt->vec[0], bezt->vec[1]), len_squared_v2v2(bezt->vec[1], bezt->vec[2]))) && (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > MAX2(len_squared_v2v2(bezt->vec[0], bezt->vec[1]), len_squared_v2v2(bezt->vec[1], bezt->vec[2]))) &&
bezt->h1 != HD_VECT && bezt->h2 != HD_VECT) bezt->h1 != HD_VECT && bezt->h2 != HD_VECT)
{ {

View File

@@ -1060,7 +1060,7 @@ static void do_material_tex(GPUShadeInput *shi)
else else
newnor = tnor; newnor = tnor;
norfac = MIN2(fabsf(mtex->norfac), 1.0); norfac = MIN2(fabsf(mtex->norfac), 1.0f);
if(norfac == 1.0f && !GPU_link_changed(stencil)) { if(norfac == 1.0f && !GPU_link_changed(stencil)) {
shi->vn = newnor; shi->vn = newnor;
@@ -1308,7 +1308,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
/* exposure correction */ /* exposure correction */
if(world->exp!=0.0f || world->range!=1.0f) { if(world->exp!=0.0f || world->range!=1.0f) {
linfac= 1.0 + pow((2.0*world->exp + 0.5), -10); linfac= 1.0 + pow((2.0*world->exp + 0.5), -10);
logfac= log((linfac-1.0)/linfac)/world->range; logfac= log((linfac-1.0f)/linfac)/world->range;
GPU_link(mat, "set_value", GPU_uniform(&linfac), &ulinfac); GPU_link(mat, "set_value", GPU_uniform(&linfac), &ulinfac);
GPU_link(mat, "set_value", GPU_uniform(&logfac), &ulogfac); GPU_link(mat, "set_value", GPU_uniform(&logfac), &ulogfac);
@@ -1481,10 +1481,10 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
lamp->spotsi= la->spotsize; lamp->spotsi= la->spotsize;
if(lamp->mode & LA_HALO) if(lamp->mode & LA_HALO)
if(lamp->spotsi > 170.0) if(lamp->spotsi > 170.0f)
lamp->spotsi = 170.0; lamp->spotsi = 170.0f;
lamp->spotsi= cos(M_PI*lamp->spotsi/360.0); lamp->spotsi= cos(M_PI*lamp->spotsi/360.0);
lamp->spotbl= (1.0 - lamp->spotsi)*la->spotblend; lamp->spotbl= (1.0f - lamp->spotsi)*la->spotblend;
lamp->k= la->k; lamp->k= la->k;
lamp->dist= la->dist; lamp->dist= la->dist;

View File

@@ -37,15 +37,15 @@
#ifndef TEXTURE_EXT_H #ifndef TEXTURE_EXT_H
#define TEXTURE_EXT_H #define TEXTURE_EXT_H
#define BRICONT texres->tin= (texres->tin-0.5)*tex->contrast+tex->bright-0.5; \ #define BRICONT texres->tin= (texres->tin-0.5f)*tex->contrast+tex->bright-0.5f; \
if(texres->tin<0.0) texres->tin= 0.0; else if(texres->tin>1.0) texres->tin= 1.0; if(texres->tin<0.0f) texres->tin= 0.0f; else if(texres->tin>1.0f) texres->tin= 1.0f;
#define BRICONTRGB texres->tr= tex->rfac*((texres->tr-0.5)*tex->contrast+tex->bright-0.5); \ #define BRICONTRGB texres->tr= tex->rfac*((texres->tr-0.5f)*tex->contrast+tex->bright-0.5f); \
if(texres->tr<0.0) texres->tr= 0.0; \ if(texres->tr<0.0f) texres->tr= 0.0f; \
texres->tg= tex->gfac*((texres->tg-0.5)*tex->contrast+tex->bright-0.5); \ texres->tg= tex->gfac*((texres->tg-0.5f)*tex->contrast+tex->bright-0.5f); \
if(texres->tg<0.0) texres->tg= 0.0; \ if(texres->tg<0.0f) texres->tg= 0.0f; \
texres->tb= tex->bfac*((texres->tb-0.5)*tex->contrast+tex->bright-0.5); \ texres->tb= tex->bfac*((texres->tb-0.5f)*tex->contrast+tex->bright-0.5f); \
if(texres->tb<0.0) texres->tb= 0.0; \ if(texres->tb<0.0f) texres->tb= 0.0f; \
if(tex->saturation != 1.0f) { \ if(tex->saturation != 1.0f) { \
float _hsv[3]; \ float _hsv[3]; \
rgb_to_hsv(texres->tr, texres->tg, texres->tb, _hsv, _hsv+1, _hsv+2); \ rgb_to_hsv(texres->tr, texres->tg, texres->tb, _hsv, _hsv+1, _hsv+2); \
@@ -53,7 +53,7 @@ if(tex->saturation != 1.0f) { \
hsv_to_rgb(_hsv[0], _hsv[1], _hsv[2], &texres->tr, &texres->tg, &texres->tb); \ hsv_to_rgb(_hsv[0], _hsv[1], _hsv[2], &texres->tr, &texres->tg, &texres->tb); \
} \ } \
#define RGBTOBW(r,g,b) ( r*0.35 + g*0.45 + b*0.2 ) /* keep this in sync with gpu_shader_material.glsl:rgbtobw */ #define RGBTOBW(r,g,b) ( r*0.35f + g*0.45f + b*0.2f ) /* keep this in sync with gpu_shader_material.glsl:rgbtobw */
struct HaloRen; struct HaloRen;
struct ShadeInput; struct ShadeInput;

View File

@@ -158,9 +158,9 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texre
if((xs+ys) & 1) return retval; if((xs+ys) & 1) return retval;
} }
/* scale around center, (0.5, 0.5) */ /* scale around center, (0.5, 0.5) */
if(tex->checkerdist<1.0) { if(tex->checkerdist<1.0f) {
fx= (fx-0.5)/(1.0-tex->checkerdist) +0.5; fx= (fx-0.5f)/(1.0f-tex->checkerdist) +0.5f;
fy= (fy-0.5)/(1.0-tex->checkerdist) +0.5; fy= (fy-0.5f)/(1.0f-tex->checkerdist) +0.5f;
} }
} }
@@ -168,7 +168,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texre
y = (int)floorf(fy*ibuf->y); y = (int)floorf(fy*ibuf->y);
if(tex->extend == TEX_CLIPCUBE) { if(tex->extend == TEX_CLIPCUBE) {
if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0 || texvec[2]>1.0) { if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0f || texvec[2]>1.0f) {
return retval; return retval;
} }
} }
@@ -400,7 +400,7 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
rf->xmin = rf->xmax; rf->xmin = rf->xmax;
return 0.0; return 0.0;
} }
else if(size!=0.0) { else if(size!=0.0f) {
return (rf->xmax - rf->xmin)/size; return (rf->xmax - rf->xmin)/size;
} }
return 1.0; return 1.0;
@@ -423,7 +423,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
rf->ymin = rf->ymax; rf->ymin = rf->ymax;
return 0.0; return 0.0;
} }
else if(size!=0.0) { else if(size!=0.0f) {
return (rf->ymax - rf->ymin)/size; return (rf->ymax - rf->ymin)/size;
} }
return 1.0; return 1.0;
@@ -482,12 +482,12 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
ibuf_get_color(col, ibuf, x, y); ibuf_get_color(col, ibuf, x, y);
if(mulx==1.0) { if(mulx==1.0f) {
texres->ta+= col[3]; texres->ta+= col[3];
texres->tr+= col[0]; texres->tr+= col[0];
texres->tg+= col[1]; texres->tg+= col[1];
texres->tb+= col[2]; texres->tb+= col[2];
div+= 1.0; div+= 1.0f;
} }
else { else {
texres->ta+= mulx*col[3]; texres->ta+= mulx*col[3];
@@ -500,7 +500,7 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
} }
} }
if(div!=0.0) { if(div!=0.0f) {
div= 1.0f/div; div= 1.0f/div;
texres->tb*= div; texres->tb*= div;
texres->tg*= div; texres->tg*= div;
@@ -544,7 +544,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
else { else {
alphaclip= clipx_rctf(rf, 0.0, (float)(ibuf->x)); alphaclip= clipx_rctf(rf, 0.0, (float)(ibuf->x));
if(alphaclip<=0.0) { if(alphaclip<=0.0f) {
texres->tr= texres->tb= texres->tg= texres->ta= 0.0; texres->tr= texres->tb= texres->tg= texres->ta= 0.0;
return; return;
} }
@@ -559,7 +559,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
else { else {
alphaclip*= clipy_rctf(rf, 0.0, (float)(ibuf->y)); alphaclip*= clipy_rctf(rf, 0.0, (float)(ibuf->y));
if(alphaclip<=0.0) { if(alphaclip<=0.0f) {
texres->tr= texres->tb= texres->tg= texres->ta= 0.0; texres->tr= texres->tb= texres->tg= texres->ta= 0.0;
return; return;
} }
@@ -579,7 +579,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
if(texres->talpha) texres->ta+= opp*texr.ta; if(texres->talpha) texres->ta+= opp*texr.ta;
rf++; rf++;
} }
if(tot!= 0.0) { if(tot!= 0.0f) {
texres->tr/= tot; texres->tr/= tot;
texres->tg/= tot; texres->tg/= tot;
texres->tb/= tot; texres->tb/= tot;
@@ -591,7 +591,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
if(texres->talpha==0) texres->ta= 1.0; if(texres->talpha==0) texres->ta= 1.0;
if(alphaclip!=1.0) { if(alphaclip!=1.0f) {
/* premul it all */ /* premul it all */
texres->tr*= alphaclip; texres->tr*= alphaclip;
texres->tg*= alphaclip; texres->tg*= alphaclip;
@@ -964,7 +964,7 @@ static void alpha_clip_aniso(ImBuf *ibuf, float minx, float miny, float maxx, fl
alphaclip*= clipy_rctf(&rf, 0.0, (float)(ibuf->y)); alphaclip*= clipy_rctf(&rf, 0.0, (float)(ibuf->y));
alphaclip= MAX2(alphaclip, 0.0f); alphaclip= MAX2(alphaclip, 0.0f);
if(alphaclip!=1.0) { if(alphaclip!=1.0f) {
/* premul it all */ /* premul it all */
texres->tr*= alphaclip; texres->tr*= alphaclip;
texres->tg*= alphaclip; texres->tg*= alphaclip;
@@ -1100,8 +1100,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec,
} }
// side faces of unit-cube // side faces of unit-cube
minx = (minx > 0.25f) ? 0.25f : ((minx < 1e-5f) ? 1e-5 : minx); minx = (minx > 0.25f) ? 0.25f : ((minx < 1e-5f) ? 1e-5f : minx);
miny = (miny > 0.25f) ? 0.25f : ((miny < 1e-5f) ? 1e-5 : miny); miny = (miny > 0.25f) ? 0.25f : ((miny < 1e-5f) ? 1e-5f : miny);
// repeat and clip // repeat and clip
@@ -1486,9 +1486,9 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
if(tex->imaflag & TEX_IMAROT) SWAP(float, minx, miny); if(tex->imaflag & TEX_IMAROT) SWAP(float, minx, miny);
if(minx>0.25) minx= 0.25; if(minx>0.25f) minx= 0.25f;
else if(minx<0.00001f) minx= 0.00001f; /* side faces of unit-cube */ else if(minx<0.00001f) minx= 0.00001f; /* side faces of unit-cube */
if(miny>0.25) miny= 0.25; if(miny>0.25f) miny= 0.25f;
else if(miny<0.00001f) miny= 0.00001f; else if(miny<0.00001f) miny= 0.00001f;
@@ -1552,41 +1552,41 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
} }
/* scale around center, (0.5, 0.5) */ /* scale around center, (0.5, 0.5) */
if(tex->checkerdist<1.0) { if(tex->checkerdist<1.0f) {
fx= (fx-0.5)/(1.0-tex->checkerdist) +0.5; fx= (fx-0.5f)/(1.0f-tex->checkerdist) +0.5f;
fy= (fy-0.5)/(1.0-tex->checkerdist) +0.5; fy= (fy-0.5f)/(1.0f-tex->checkerdist) +0.5f;
minx/= (1.0-tex->checkerdist); minx/= (1.0f-tex->checkerdist);
miny/= (1.0-tex->checkerdist); miny/= (1.0f-tex->checkerdist);
} }
} }
if(tex->extend == TEX_CLIPCUBE) { if(tex->extend == TEX_CLIPCUBE) {
if(fx+minx<0.0 || fy+miny<0.0 || fx-minx>1.0 || fy-miny>1.0 || texvec[2]<-1.0 || texvec[2]>1.0) { if(fx+minx<0.0f || fy+miny<0.0f || fx-minx>1.0f || fy-miny>1.0f || texvec[2]<-1.0f || texvec[2]>1.0f) {
return retval; return retval;
} }
} }
else if(tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) { else if(tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
if(fx+minx<0.0 || fy+miny<0.0 || fx-minx>1.0 || fy-miny>1.0) { if(fx+minx<0.0f || fy+miny<0.0f || fx-minx>1.0f || fy-miny>1.0f) {
return retval; return retval;
} }
} }
else { else {
if(imapextend) { if(imapextend) {
if(fx>1.0) fx = 1.0; if(fx>1.0f) fx = 1.0f;
else if(fx<0.0) fx= 0.0; else if(fx<0.0f) fx= 0.0f;
} }
else { else {
if(fx>1.0) fx -= (int)(fx); if(fx>1.0f) fx -= (int)(fx);
else if(fx<0.0) fx+= 1-(int)(fx); else if(fx<0.0f) fx+= 1-(int)(fx);
} }
if(imapextend) { if(imapextend) {
if(fy>1.0) fy = 1.0; if(fy>1.0f) fy = 1.0f;
else if(fy<0.0) fy= 0.0; else if(fy<0.0f) fy= 0.0f;
} }
else { else {
if(fy>1.0) fy -= (int)(fy); if(fy>1.0f) fy -= (int)(fy);
else if(fy<0.0) fy+= 1-(int)(fy); else if(fy<0.0f) fy+= 1-(int)(fy);
} }
} }
@@ -1603,7 +1603,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
dx= minx; dx= minx;
dy= miny; dy= miny;
maxd= MAX2(dx, dy); maxd= MAX2(dx, dy);
if(maxd>0.5) maxd= 0.5; if(maxd>0.5f) maxd= 0.5f;
pixsize = 1.0f/ (float) MIN2(ibuf->x, ibuf->y); pixsize = 1.0f/ (float) MIN2(ibuf->x, ibuf->y);
@@ -1694,7 +1694,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
fx= 2.0f*(pixsize-maxd)/pixsize; fx= 2.0f*(pixsize-maxd)/pixsize;
if(fx>=1.0) { if(fx>=1.0f) {
texres->ta= texr.ta; texres->tb= texr.tb; texres->ta= texr.ta; texres->tb= texr.tb;
texres->tg= texr.tg; texres->tr= texr.tr; texres->tg= texr.tg; texres->tr= texr.tr;
} else { } else {

View File

@@ -134,7 +134,7 @@ int wm_gesture_evaluate(wmGesture *gesture)
int dx= rect->xmax - rect->xmin; int dx= rect->xmax - rect->xmin;
int dy= rect->ymax - rect->ymin; int dy= rect->ymax - rect->ymin;
if(ABS(dx)+ABS(dy) > TWEAK_THRESHOLD) { if(ABS(dx)+ABS(dy) > TWEAK_THRESHOLD) {
int theta= (int)floor(4.0f*atan2((float)dy, (float)dx)/M_PI + 0.5); int theta= (int)floor(4.0f*atan2f((float)dy, (float)dx)/(float)M_PI + 0.5f);
int val= EVT_GESTURE_W; int val= EVT_GESTURE_W;
if(theta==0) val= EVT_GESTURE_E; if(theta==0) val= EVT_GESTURE_E;

View File

@@ -2766,11 +2766,11 @@ int WM_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
else if(mode == WM_RADIALCONTROL_STRENGTH) { else if(mode == WM_RADIALCONTROL_STRENGTH) {
new_value = 1 - dist / WM_RADIAL_CONTROL_DISPLAY_SIZE; new_value = 1 - dist / WM_RADIAL_CONTROL_DISPLAY_SIZE;
} else if(mode == WM_RADIALCONTROL_ANGLE) } else if(mode == WM_RADIALCONTROL_ANGLE)
new_value = ((int)(atan2(delta[1], delta[0]) * (180.0 / M_PI)) + 180); new_value = ((int)(atan2f(delta[1], delta[0]) * (float)(180.0 / M_PI)) + 180);
if(event->ctrl) { if(event->ctrl) {
if(mode == WM_RADIALCONTROL_STRENGTH) if(mode == WM_RADIALCONTROL_STRENGTH)
new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f; new_value = ((int)ceilf(new_value * 10.f) * 10.0f) / 100.f;
else else
new_value = ((int)new_value + 5) / 10*10; new_value = ((int)new_value + 5) / 10*10;
} }