quiet float -> double conversion warnings and do some osl style edits.

This commit is contained in:
Campbell Barton 2012-12-03 13:58:08 +00:00
parent 6213c6d69b
commit 4a9c522125
5 changed files with 11 additions and 11 deletions

@ -21,8 +21,8 @@
vector environment_texture_direction_to_equirectangular(vector dir)
{
float u = -atan2(dir[1], dir[0])/(2.0*M_PI) + 0.5;
float v = atan2(dir[2], hypot(dir[0], dir[1]))/M_PI + 0.5;
float u = -atan2(dir[1], dir[0]) / (2.0 * M_PI) + 0.5;
float v = atan2(dir[2], hypot(dir[0], dir[1])) / M_PI + 0.5;
return vector(u, v, 0.0);
}
@ -31,8 +31,8 @@ vector environment_texture_direction_to_mirrorball(vector dir)
{
dir[1] -= 1.0;
float div = 2.0*sqrt(max(-0.5*dir[1], 0.0));
if(div > 0.0)
float div = 2.0 * sqrt(max(-0.5 * dir[1], 0.0));
if (div > 0.0)
dir /= div;
float u = 0.5*(dir[0] + 1.0);

@ -52,9 +52,9 @@ shader node_geometry(
/* try to create spherical tangent from generated coordinates */
if (getattribute("geom:generated", generated)) {
matrix project = matrix(0.0, 1.0, 0.0, 0.0,
-1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0,
0.5, -0.5, 0.0, 1.0);
-1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0,
0.5, -0.5, 0.0, 1.0);
vector T = transform(project, generated);
T = transform("object", "world", T);

@ -31,8 +31,8 @@ shader node_rgb_ramp(
/* clamp int as well in case of NaN */
int i = (int)f;
if(i < 0) i = 0;
if(i >= RAMP_TABLE_SIZE) i = RAMP_TABLE_SIZE-1;
if (i < 0) i = 0;
if (i >= RAMP_TABLE_SIZE) i = RAMP_TABLE_SIZE - 1;
float t = f - (float)i;
Color = ramp_color[i];

@ -477,7 +477,7 @@ static short snap_gpf_nearestsec(bGPDframe *gpf, Scene *scene)
{
float secf = (float)FPS;
if (gpf->flag & GP_FRAME_SELECT)
gpf->framenum = (int)(floor(gpf->framenum / secf + 0.5f) * secf);
gpf->framenum = (int)(floorf(gpf->framenum / secf + 0.5f) * secf);
return 0;
}

@ -265,7 +265,7 @@ static short snap_masklayer_nearestsec(MaskLayerShape *masklay_shape, Scene *sce
{
float secf = (float)FPS;
if (masklay_shape->flag & MASK_SHAPE_SELECT)
masklay_shape->frame = (int)(floor(masklay_shape->frame / secf + 0.5f) * secf);
masklay_shape->frame = (int)(floorf(masklay_shape->frame / secf + 0.5f) * secf);
return 0;
}