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>2014-05-03 21:15:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-03 21:15:20 +0400
commit95d885b3f431284b2e1eb8640771cab00b201437 (patch)
treefb4e510adcab167b59032c04461ac819e1d46e38 /intern/cycles/app
parent08d899d1e7fe0c669954b197fef0e57269edfb79 (diff)
Quiet float conversion warnings when building cycles standalone
Diffstat (limited to 'intern/cycles/app')
-rw-r--r--intern/cycles/app/cycles_standalone.cpp8
-rw-r--r--intern/cycles/app/cycles_xml.cpp8
-rw-r--r--intern/cycles/app/cycles_xml.h4
3 files changed, 12 insertions, 8 deletions
diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp
index 839275e47f5..074d6404f07 100644
--- a/intern/cycles/app/cycles_standalone.cpp
+++ b/intern/cycles/app/cycles_standalone.cpp
@@ -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 */
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 1faf290f0ea..d5ef30e5c6f 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -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")) {
diff --git a/intern/cycles/app/cycles_xml.h b/intern/cycles/app/cycles_xml.h
index 1e3ed411312..2d225f3a013 100644
--- a/intern/cycles/app/cycles_xml.h
+++ b/intern/cycles/app/cycles_xml.h
@@ -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__ */