Quiet float conversion warnings when building cycles standalone

This commit is contained in:
Campbell Barton 2014-05-04 03:15:20 +10:00
parent 08d899d1e7
commit 95d885b3f4
4 changed files with 14 additions and 10 deletions

View File

@ -208,11 +208,11 @@ static void motion(int x, int y, int button)
/* Rotate */
else if(button == 2) {
float4 r1= make_float4(x * 0.1f, 0.0f, 1.0f, 0.0f);
matrix = matrix * transform_rotate(r1.x * M_PI/180.0f, make_float3(r1.y, r1.z, r1.w));
float4 r1= make_float4((float)x * 0.1f, 0.0f, 1.0f, 0.0f);
matrix = matrix * transform_rotate(DEG2RADF(r1.x), make_float3(r1.y, r1.z, r1.w));
float4 r2 = make_float4(y * 0.1, 1.0f, 0.0f, 0.0f);
matrix = matrix * transform_rotate(r2.x * M_PI/180.0f, make_float3(r2.y, r2.z, r2.w));
float4 r2 = make_float4(y * 0.1f, 1.0f, 0.0f, 0.0f);
matrix = matrix * transform_rotate(DEG2RADF(r2.x), make_float3(r2.y, r2.z, r2.w));
}
/* Update and Reset */

View File

@ -105,7 +105,7 @@ static bool xml_read_float(float *value, pugi::xml_node node, const char *name)
pugi::xml_attribute attr = node.attribute(name);
if(attr) {
*value = atof(attr.value());
*value = (float)atof(attr.value());
return true;
}
@ -121,7 +121,7 @@ static bool xml_read_float_array(vector<float>& value, pugi::xml_node node, cons
string_split(tokens, attr.value());
foreach(const string& token, tokens)
value.push_back(atof(token.c_str()));
value.push_back((float)atof(token.c_str()));
return true;
}
@ -322,7 +322,7 @@ static void xml_read_camera(const XMLReadState& state, pugi::xml_node node)
xml_read_int(&cam->height, node, "height");
if(xml_read_float(&cam->fov, node, "fov"))
cam->fov *= M_PI/180.0f;
cam->fov = DEG2RADF(cam->fov);
xml_read_float(&cam->nearclip, node, "nearclip");
xml_read_float(&cam->farclip, node, "farclip");
@ -1032,7 +1032,7 @@ static void xml_read_transform(pugi::xml_node node, Transform& tfm)
if(node.attribute("rotate")) {
float4 rotate = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
xml_read_float4(&rotate, node, "rotate");
tfm = tfm * transform_rotate(rotate.x*M_PI/180.0f, make_float3(rotate.y, rotate.z, rotate.w));
tfm = tfm * transform_rotate(DEG2RADF(rotate.x), make_float3(rotate.y, rotate.z, rotate.w));
}
if(node.attribute("scale")) {

View File

@ -23,6 +23,10 @@ class Scene;
void xml_read_file(Scene *scene, const char *filepath);
/* macros for importing */
#define RAD2DEGF(_rad) ((_rad) * (float)(180.0 / M_PI))
#define DEG2RADF(_deg) ((_deg) * (float)(M_PI / 180.0))
CCL_NAMESPACE_END
#endif /* __CYCLES_XML__ */

View File

@ -80,8 +80,8 @@ void view_display_info(const char *info)
void view_display_help()
{
const int w = V.width / 1.15;
const int h = V.height / 1.15;
const int w = (int)((float)V.width / 1.15f);
const int h = (int)((float)V.height / 1.15f);
const int x1 = (V.width - w) / 2;
const int x2 = x1 + w;