Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-28 21:08:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-28 21:08:33 +0400
commit9b9c4184c88c49ff96f3f23cbfbd00f6811d7301 (patch)
tree4c5aaf763f28710d07b3ec364088a98de8ae9794
parentfaf07c3e2b6cb180d1580b4160ff6534b4754b76 (diff)
misc nodes & editors: floats were being implicitly promoted to doubles, adjust to use floats.
+ minor update to demo_mode
-rw-r--r--intern/mikktspace/mikktspace.c2
-rw-r--r--source/blender/editors/armature/meshlaplacian.c20
-rw-r--r--source/blender/editors/physics/particle_edit.c6
-rw-r--r--source/blender/editors/render/render_internal.c6
-rw-r--r--source/blender/editors/screen/screen_ops.c2
-rw-r--r--source/blender/editors/space_info/info_ops.c16
-rw-r--r--source/blender/editors/space_node/node_edit.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c4
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_invert.c2
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_checker.c6
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c6
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_math.c4
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_rotate.c4
-rw-r--r--source/blender/python/generic/mathutils_Vector.c30
14 files changed, 55 insertions, 55 deletions
diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c
index 8ccb19e35e6..e997bafde25 100644
--- a/intern/mikktspace/mikktspace.c
+++ b/intern/mikktspace/mikktspace.c
@@ -243,7 +243,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
int iNrActiveGroups = 0, index = 0;
const int iNrFaces = pContext->m_pInterface->m_getNumFaces(pContext);
tbool bRes = TFALSE;
- const float fThresCos = (const float) cos((fAngularThreshold*M_PI)/180);
+ const float fThresCos = (const float) cos((fAngularThreshold*(float)M_PI)/180.0f);
// verify all call-backs have been set
if( pContext->m_pInterface->m_getNumFaces==NULL ||
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 720413650fa..67773d358d0 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -182,16 +182,16 @@ static void laplacian_triangle_area(LaplacianSystem *sys, int i1, int i2, int i3
t2= cotan_weight(v2, v3, v1);
t3= cotan_weight(v3, v1, v2);
- if(RAD2DEG(angle_v3v3v3(v2, v1, v3)) > 90) obtuse= 1;
- else if(RAD2DEG(angle_v3v3v3(v1, v2, v3)) > 90) obtuse= 2;
- else if(RAD2DEG(angle_v3v3v3(v1, v3, v2)) > 90) obtuse= 3;
+ if(RAD2DEGF(angle_v3v3v3(v2, v1, v3)) > 90) obtuse= 1;
+ else if(RAD2DEGF(angle_v3v3v3(v1, v2, v3)) > 90) obtuse= 2;
+ else if(RAD2DEGF(angle_v3v3v3(v1, v3, v2)) > 90) obtuse= 3;
if (obtuse > 0) {
area= area_tri_v3(v1, v2, v3);
- varea[i1] += (obtuse == 1)? area: area*0.5;
- varea[i2] += (obtuse == 2)? area: area*0.5;
- varea[i3] += (obtuse == 3)? area: area*0.5;
+ varea[i1] += (obtuse == 1)? area: area*0.5f;
+ varea[i2] += (obtuse == 2)? area: area*0.5f;
+ varea[i3] += (obtuse == 3)? area: area*0.5f;
}
else {
len1= len_v3v3(v2, v3);
@@ -492,7 +492,7 @@ static int heat_ray_source_visible(LaplacianSystem *sys, int vertex, int source)
sub_v3_v3v3(data.vec, end, data.start);
madd_v3_v3v3fl(data.start, data.start, data.vec, 1e-5);
- mul_v3_fl(data.vec, 1.0f - 2e-5);
+ mul_v3_fl(data.vec, 1.0f - 2e-5f);
/* pass normalized vec + distance to bvh */
hit.index = -1;
@@ -1041,9 +1041,9 @@ void rigid_deform_end(int cancel)
#define MESHDEFORM_TAG_INTERIOR 2
#define MESHDEFORM_TAG_EXTERIOR 3
-#define MESHDEFORM_LEN_THRESHOLD 1e-6
+#define MESHDEFORM_LEN_THRESHOLD 1e-6f
-#define MESHDEFORM_MIN_INFLUENCE 0.0005
+#define MESHDEFORM_MIN_INFLUENCE 0.0005f
static int MESHDEFORM_OFFSET[7][3] =
{{0,0,0}, {1,0,0}, {-1,0,0}, {0,1,0}, {0,-1,0}, {0,0,1}, {0,0,-1}};
@@ -1146,7 +1146,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
isectco[1]= (1.0f - u - v)*vert0[1] + u*vert1[1] + v*vert2[1];
isectco[2]= (1.0f - u - v)*vert0[2] + u*vert1[2] + v*vert2[2];
- uvw[0]= 1.0 - u - v;
+ uvw[0]= 1.0f - u - v;
uvw[1]= u;
uvw[2]= v;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 697f016f2d4..3f2fcaab94a 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -430,7 +430,7 @@ static int key_test_depth(PEData *data, float co[3])
}
#endif
- if((float)uz - 0.00001 > depth)
+ if((float)uz - 0.00001f > depth)
return 0;
else
return 1;
@@ -3246,7 +3246,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa
if(isect_line_tri_v3(co1, co2, v1, v2, v3, &cur_d, cur_uv)){
if(cur_d<*min_d){
*min_d=cur_d;
- min_w[0]= 1.0 - cur_uv[0] - cur_uv[1];
+ min_w[0]= 1.0f - cur_uv[0] - cur_uv[1];
min_w[1]= cur_uv[0];
min_w[2]= cur_uv[1];
min_w[3]= 0.0f;
@@ -3260,7 +3260,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa
if(isect_line_tri_v3(co1, co2, v1, v3, v4, &cur_d, cur_uv)){
if(cur_d<*min_d){
*min_d=cur_d;
- min_w[0]= 1.0 - cur_uv[0] - cur_uv[1];
+ min_w[0]= 1.0f - cur_uv[0] - cur_uv[1];
min_w[1]= 0.0f;
min_w[2]= cur_uv[0];
min_w[3]= cur_uv[1];
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 956618eb1bb..39def19aa17 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -147,12 +147,12 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
float *rf= rectf;
float srgb[3];
char *rc= rectc;
- const float dither = ibuf->dither / 255.0;
+ const float dither = ibuf->dither / 255.0f;
/* XXX temp. because crop offset */
if( rectc >= (char *)(ibuf->rect)) {
for(x1= 0; x1<xmax; x1++, rf += 4, rc+=4) {
- const float d = (BLI_frand()-0.5)*dither;
+ const float d = (BLI_frand()-0.5f)*dither;
srgb[0]= d + linearrgb_to_srgb(rf[0]);
srgb[1]= d + linearrgb_to_srgb(rf[1]);
srgb[2]= d + linearrgb_to_srgb(rf[2]);
@@ -176,7 +176,7 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
/* XXX temp. because crop offset */
if( rectc >= (char *)(ibuf->rect)) {
for(x1= 0; x1<xmax; x1++, rf += 4, rc+=4) {
- const float d = (BLI_frand()-0.5)*dither;
+ const float d = (BLI_frand()-0.5f)*dither;
rgb[0] = d + rf[0];
rgb[1] = d + rf[1];
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index d07cc61e680..289296fd817 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2766,7 +2766,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
else sync= (scene->flag & SCE_FRAME_DROP);
if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE) && finite(time = sound_sync_scene(scene)))
- scene->r.cfra = time * FPS + 0.5;
+ scene->r.cfra = (double)time * FPS + 0.5;
else
{
if (sync) {
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 701b0fc1de7..d58fb7b11f0 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -322,11 +322,11 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
* inactive regions, so use this for now. --matt
*/
-#define INFO_TIMEOUT 5.0
-#define INFO_COLOR_TIMEOUT 3.0
-#define ERROR_TIMEOUT 10.0
-#define ERROR_COLOR_TIMEOUT 6.0
-#define COLLAPSE_TIMEOUT 0.25
+#define INFO_TIMEOUT 5.0f
+#define INFO_COLOR_TIMEOUT 3.0f
+#define ERROR_TIMEOUT 10.0f
+#define ERROR_COLOR_TIMEOUT 6.0f
+#define COLLAPSE_TIMEOUT 0.25f
static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
wmWindowManager *wm= CTX_wm_manager(C);
@@ -353,7 +353,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
color_timeout = (report->type & RPT_ERROR_ALL)?ERROR_COLOR_TIMEOUT:INFO_COLOR_TIMEOUT;
/* clear the report display after timeout */
- if (reports->reporttimer->duration > timeout) {
+ if ((float)reports->reporttimer->duration > timeout) {
WM_event_remove_timer(wm, NULL, reports->reporttimer);
reports->reporttimer = NULL;
@@ -381,8 +381,8 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
rti->widthfac=1.0;
}
- progress = reports->reporttimer->duration / timeout;
- color_progress = reports->reporttimer->duration / color_timeout;
+ progress = (float)reports->reporttimer->duration / timeout;
+ color_progress = (float)reports->reporttimer->duration / color_timeout;
/* save us from too many draws */
if(color_progress <= 1.0f) {
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index f37c62de473..3877e7abf5e 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1175,7 +1175,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
fx = (bufx > 0.0f ? ((float)mx - 0.5f*ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
fy = (bufy > 0.0f ? ((float)my - 0.5f*ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
- if(fx>=0.0 && fy>=0.0 && fx<1.0 && fy<1.0) {
+ if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
float *fp;
char *cp;
int x= (int)(fx*ibuf->x), y= (int)(fy*ibuf->y);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
index dd09b4e1b70..91fd995dbbe 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
@@ -52,12 +52,12 @@ static bNodeSocketType sh_node_hue_sat_out[]= {
/* note: it would be possible to use CMP version for both nodes */
static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac)
{
- if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0 || *val!=1.0)) {
+ if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) {
float col[3], hsv[3], mfac= 1.0f - *fac;
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
hsv[0]+= (*hue - 0.5f);
- if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0;
+ if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f;
hsv[1]*= *sat;
hsv[2]*= *val;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c
index 888d1514146..f8d6e54859e 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c
@@ -59,7 +59,7 @@ bNodeStack **out)
/* if fac, blend result against original input */
if (in[0]->vec[0] < 1.0f) {
- facm = 1.0 - in[0]->vec[0];
+ facm = 1.0f - in[0]->vec[0];
col[0] = in[0]->vec[0]*col[0] + (facm*in[1]->vec[0]);
col[1] = in[0]->vec[0]*col[1] + (facm*in[1]->vec[1]);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
index b2da0d60570..305d7094f57 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
@@ -53,9 +53,9 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **
float sz = tex_input_value(in[2], p, thread);
/* 0.00001 because of unit sized stuff */
- int xi = (int)fabs(floor(0.00001 + x / sz));
- int yi = (int)fabs(floor(0.00001 + y / sz));
- int zi = (int)fabs(floor(0.00001 + z / sz));
+ int xi = (int)fabs(floor(0.00001f + x / sz));
+ int yi = (int)fabs(floor(0.00001f + y / sz));
+ int zi = (int)fabs(floor(0.00001f + z / sz));
if( (xi % 2 == yi % 2) == (zi % 2) ) {
tex_input_rgba(out, in[0], p, thread);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
index 52e88cbc2d9..70c5d25e1eb 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
@@ -54,11 +54,11 @@ static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
hsv[0]+= (hue - 0.5f);
- if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0;
+ if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f;
hsv[1]*= sat;
- if(hsv[1]>1.0) hsv[1]= 1.0; else if(hsv[1]<0.0) hsv[1]= 0.0;
+ if(hsv[1]>1.0f) hsv[1]= 1.0f; else if(hsv[1]<0.0f) hsv[1]= 0.0f;
hsv[2]*= val;
- if(hsv[2]>1.0) hsv[2]= 1.0; else if(hsv[2]<0.0) hsv[2]= 0.0;
+ if(hsv[2]>1.0f) hsv[2]= 1.0f; else if(hsv[2]<0.0f) hsv[2]= 0.0f;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
out[0]= mfac*in[0] + fac*col[0];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_math.c b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
index a84573f1d09..1652ba10e48 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_math.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
@@ -116,8 +116,8 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
out[0]= pow(in0, in1);
} else {
float y_mod_1 = fmod(in1, 1);
- if (y_mod_1 > 0.999 || y_mod_1 < 0.001) {
- *out = pow(in0, floor(in1 + 0.5));
+ if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
+ *out = pow(in0, floor(in1 + 0.5f));
} else {
*out = 0.0;
}
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
index c31fc25bea2..8f7793ddaaf 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
@@ -53,8 +53,8 @@ static void rotate(float new_co[3], float a, float ax[3], float co[3])
float perp[3];
float cp[3];
- float cos_a = cos(a * 2 * M_PI);
- float sin_a = sin(a * 2 * M_PI);
+ float cos_a = cos(a * (float)(2*M_PI));
+ float sin_a = sin(a * (float)(2*M_PI));
// x' = xcosa + n(n.x)(1-cosa) + (x*n)sina
diff --git a/source/blender/python/generic/mathutils_Vector.c b/source/blender/python/generic/mathutils_Vector.c
index f1e417b154e..912d1310967 100644
--- a/source/blender/python/generic/mathutils_Vector.c
+++ b/source/blender/python/generic/mathutils_Vector.c
@@ -552,7 +552,7 @@ static PyObject *Vector_dot(VectorObject *self, PyObject *value)
return NULL;
for(x = 0; x < self->size; x++) {
- dot += self->vec[x] * tvec[x];
+ dot += (double)(self->vec[x] * tvec[x]);
}
return PyFloat_FromDouble(dot);
@@ -591,8 +591,8 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
return NULL;
for(x = 0; x < size; x++) {
- test_v1 += self->vec[x] * self->vec[x];
- test_v2 += tvec[x] * tvec[x];
+ test_v1 += (double)(self->vec[x] * self->vec[x]);
+ test_v2 += (double)(tvec[x] * tvec[x]);
}
if (!test_v1 || !test_v2){
/* avoid exception */
@@ -608,7 +608,7 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
//dot product
for(x = 0; x < self->size; x++) {
- dot += self->vec[x] * tvec[x];
+ dot += (double)(self->vec[x] * tvec[x]);
}
dot /= (sqrt(test_v1) * sqrt(test_v2));
@@ -679,13 +679,13 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value)
//get dot products
for(x = 0; x < size; x++) {
- dot += self->vec[x] * tvec[x];
- dot2 += tvec[x] * tvec[x];
+ dot += (double)(self->vec[x] * tvec[x]);
+ dot2 += (double)(tvec[x] * tvec[x]);
}
//projection
dot /= dot2;
for(x = 0; x < size; x++) {
- vec[x] = (float)(dot * tvec[x]);
+ vec[x] = (float)dot * tvec[x];
}
return newVectorObject(vec, size, Py_NEW, Py_TYPE(self));
}
@@ -1034,7 +1034,7 @@ static int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject
for(x = 0; x < mat->col_size; x++) {
for(y = 0; y < mat->row_size; y++) {
- dot += mat->matrix[y][x] * vec_cpy[y];
+ dot += (double)(mat->matrix[y][x] * vec_cpy[y]);
}
rvec[z++] = (float)dot;
dot = 0.0f;
@@ -1079,7 +1079,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
/*dot product*/
for(i = 0; i < vec1->size; i++) {
- dot += vec1->vec[i] * vec2->vec[i];
+ dot += (double)(vec1->vec[i] * vec2->vec[i]);
}
return PyFloat_FromDouble(dot);
}
@@ -1257,7 +1257,7 @@ static double vec_magnitude_nosqrt(float *data, int size)
int i;
for(i=0; i<size; i++){
- dot += data[i];
+ dot += (double)data[i];
}
/*return (double)sqrt(dot);*/
/* warning, line above removed because we are not using the length,
@@ -1273,7 +1273,7 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
{
VectorObject *vecA = NULL, *vecB = NULL;
int result = 0;
- float epsilon = .000001f;
+ double epsilon = .000001f;
double lenA, lenB;
if (!VectorObject_Check(objectA) || !VectorObject_Check(objectB)){
@@ -1499,7 +1499,7 @@ static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure))
return NULL;
for(i = 0; i < self->size; i++){
- dot += (self->vec[i] * self->vec[i]);
+ dot += (double)(self->vec[i] * self->vec[i]);
}
return PyFloat_FromDouble(sqrt(dot));
}
@@ -1517,17 +1517,17 @@ static int Vector_setLength(VectorObject *self, PyObject *value)
return -1;
}
- if (param < 0.0f) {
+ if (param < 0.0) {
PyErr_SetString(PyExc_TypeError, "cannot set a vectors length to a negative value");
return -1;
}
- if (param == 0.0f) {
+ if (param == 0.0) {
fill_vn(self->vec, self->size, 0.0f);
return 0;
}
for(i = 0; i < self->size; i++){
- dot += (self->vec[i] * self->vec[i]);
+ dot += (double)(self->vec[i] * self->vec[i]);
}
if (!dot) /* cant sqrt zero */