diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-20 19:24:49 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-20 19:24:49 -0300 |
commit | ee0f53df52d88ca57079579f3f3e943e7e40f53a (patch) | |
tree | fcf670f1e8aec411c6deaf97e9fc77bf5c195f31 /tools | |
parent | 72a02555850016ab792cf498c5370983d3b72832 (diff) | |
parent | 6f4f9aa6ded6da027c84cc466c767334dc3d3362 (diff) |
Merge pull request #7528 from tagcup/real_t_float_fixes
Use real_t rather than float or double in generic functions (core/mat…
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/animation_editor.cpp | 16 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_font_import_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_sample_import_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/multimesh_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/property_editor.cpp | 4 | ||||
-rw-r--r-- | tools/editor/script_editor_debugger.cpp | 2 | ||||
-rw-r--r-- | tools/editor/spatial_editor_gizmos.cpp | 28 |
7 files changed, 28 insertions, 28 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 759d33dea8..f256e351ae 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -179,12 +179,12 @@ private: bool sg = val < 0; val = Math::absf(val); - val = Math::log(val)/Math::log(2); + val = Math::log(val)/Math::log((float)2.0); //logspace val+=rel*0.05; // - val = Math::pow(2,val); + val = Math::pow((float)2.0,val); if (sg) val=-val; @@ -1055,9 +1055,9 @@ float AnimationKeyEditor::_get_zoom_scale() const { float zv = zoom->get_value(); if (zv<1) { zv = 1.0-zv; - return Math::pow(1.0+zv,8.0)*100; + return Math::pow(1.0f+zv,8.0f)*100; } else { - return 1.0/Math::pow(zv,8.0)*100; + return 1.0/Math::pow(zv,8.0f)*100; } } @@ -1487,8 +1487,8 @@ void AnimationKeyEditor::_track_editor_draw() { //draw the keys; int tt = animation->track_get_type(idx); - float key_vofs = Math::floor((h - type_icon[tt]->get_height())/2); - float key_hofs = -Math::floor(type_icon[tt]->get_height()/2); + float key_vofs = Math::floor((float)(h - type_icon[tt]->get_height())/2); + float key_hofs = -Math::floor((float)type_icon[tt]->get_height()/2); int kc=animation->track_get_key_count(idx); bool first=true; @@ -1592,8 +1592,8 @@ void AnimationKeyEditor::_track_editor_draw() { continue; int y = h+i*h+sep; - float key_vofs = Math::floor((h - type_selected->get_height())/2); - float key_hofs = -Math::floor(type_selected->get_height()/2); + float key_vofs = Math::floor((float)(h - type_selected->get_height())/2); + float key_hofs = -Math::floor((float)type_selected->get_height()/2); float time = animation->track_get_key_time(idx,E->key().key); float diff = time-from_t; diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index ada6000d82..0deb5cbbfa 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -1473,7 +1473,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe sum+=w2[ofs_l]; } - wa[ofs]=Math::pow(float(sum/(r*2+1))/255.0,tr)*255.0; + wa[ofs]=Math::pow(float(sum/(r*2+1))/255.0f,tr)*255.0f; } } diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index ca873cab72..631291ec1b 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -541,7 +541,7 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI int first=0; int last=(len*chans)-1; bool found=false; - float limit = Math::db2linear(-30); + float limit = Math::db2linear((float)-30); for(int i=0;i<data.size();i++) { float amp = Math::abs(data[i]); diff --git a/tools/editor/plugins/multimesh_editor_plugin.cpp b/tools/editor/plugins/multimesh_editor_plugin.cpp index 80765be6c0..6259ddf473 100644 --- a/tools/editor/plugins/multimesh_editor_plugin.cpp +++ b/tools/editor/plugins/multimesh_editor_plugin.cpp @@ -216,7 +216,7 @@ void MultiMeshEditor::_populate() { for(int i=0;i<instance_count;i++) { - float areapos = Math::random(0,area_accum); + float areapos = Math::random(0.0f,area_accum); Map<float,int>::Element *E = triangle_area_map.find_closest(areapos); ERR_FAIL_COND(!E) diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 5326671f41..ab850ba1a7 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -1503,12 +1503,12 @@ void CustomPropertyEditor::_drag_easing(const InputEvent& p_ev) { bool sg = val < 0; val = Math::absf(val); - val = Math::log(val)/Math::log(2); + val = Math::log(val)/Math::log((float)2.0); //logspace val+=rel*0.05; // - val = Math::pow(2,val); + val = Math::pow(2.0f,val); if (sg) val=-val; diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 42ab234d4b..d5cca06820 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -826,7 +826,7 @@ void ScriptEditorDebugger::_performance_draw() { Ref<StyleBox> graph_sb = get_stylebox("normal","TextEdit"); Ref<Font> graph_font = get_font("font","TextEdit"); - int cols = Math::ceil(Math::sqrt(which.size())); + int cols = Math::ceil(Math::sqrt((float)which.size())); int rows = (which.size()+1)/cols; if (which.size()==1) rows=1; diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index adbac4b12b..c670245282 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -839,8 +839,8 @@ void LightSpatialGizmo::redraw() { for(int i=0;i<=360;i++) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+1); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+1); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*r; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*r; @@ -881,8 +881,8 @@ void LightSpatialGizmo::redraw() { for(int i=0;i<360;i++) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+1); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+1); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*w; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*w; @@ -1519,8 +1519,8 @@ void VehicleWheelSpatialGizmo::redraw() { const int skip=10; for(int i=0;i<=360;i+=skip) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+skip); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+skip); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*r; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*r; @@ -1826,8 +1826,8 @@ void CollisionShapeSpatialGizmo::redraw(){ for(int i=0;i<=360;i++) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+1); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+1); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*r; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*r; @@ -1907,8 +1907,8 @@ void CollisionShapeSpatialGizmo::redraw(){ Vector3 d(0,0,height*0.5); for(int i=0;i<360;i++) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+1); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+1); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*radius; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*radius; @@ -2844,8 +2844,8 @@ void ConeTwistJointSpatialGizmo::redraw() { //swing for(int i=0;i<360;i+=10) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+10); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+10); Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*w; Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*w; @@ -2876,8 +2876,8 @@ void ConeTwistJointSpatialGizmo::redraw() { for(int i=0;i<int(ts);i+=5) { - float ra=Math::deg2rad(i); - float rb=Math::deg2rad(i+5); + float ra=Math::deg2rad((float)i); + float rb=Math::deg2rad((float)i+5); float c = i/720.0; float cn = (i+5)/720.0; Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*w*c; |