aboutsummaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorFerenc Arn2017-01-14 14:35:39 -0600
committerFerenc Arn2017-01-16 13:36:33 -0600
commit6f4f9aa6ded6da027c84cc466c767334dc3d3362 (patch)
tree4d45d7e600a069d7feb2a2dae3a70d6b9ddbf884 /servers
parentd13f2f9e25e380496e706b59720cd85eed299ca2 (diff)
downloadgodot-6f4f9aa6ded6da027c84cc466c767334dc3d3362.tar.gz
godot-6f4f9aa6ded6da027c84cc466c767334dc3d3362.tar.zst
godot-6f4f9aa6ded6da027c84cc466c767334dc3d3362.zip
Overloaded basic math funcs (double and float variants). Use real_t rather than float or double in generic functions (core/math) whenever possible.
Also inlined some more math functions.
Diffstat (limited to 'servers')
-rw-r--r--servers/audio/audio_filter_sw.cpp4
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.cpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/servers/audio/audio_filter_sw.cpp b/servers/audio/audio_filter_sw.cpp
index cdfe1a29f..e97eb75d0 100644
--- a/servers/audio/audio_filter_sw.cpp
+++ b/servers/audio/audio_filter_sw.cpp
@@ -142,9 +142,9 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) {
//this one is extra tricky
double hicutoff=resonance;
double centercutoff = (cutoff+resonance)/2.0;
- double bandwidth=(Math::log(centercutoff)-Math::log(hicutoff))/Math::log(2);
+ double bandwidth=(Math::log(centercutoff)-Math::log(hicutoff))/Math::log((double)2);
omega=2.0*Math_PI*centercutoff/sampling_rate;
- alpha = Math::sin(omega)*Math::sinh( Math::log(2)/2 * bandwidth * omega/Math::sin(omega) );
+ alpha = Math::sin(omega)*Math::sinh( Math::log((double)2)/2 * bandwidth * omega/Math::sin(omega) );
a0=1+alpha;
p_coeffs->b0 = alpha;
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
index d2b37319a..8b7a410b3 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
@@ -539,14 +539,14 @@ int BroadPhase2DHashGrid::cull_segment(const Vector2& p_from, const Vector2& p_t
Vector2 max;
if (dir.x<0)
- max.x= (Math::floor(pos.x)*cell_size - p_from.x) / dir.x;
+ max.x= (Math::floor((double)pos.x)*cell_size - p_from.x) / dir.x;
else
- max.x= (Math::floor(pos.x + 1)*cell_size - p_from.x) / dir.x;
+ max.x= (Math::floor((double)pos.x + 1)*cell_size - p_from.x) / dir.x;
if (dir.y<0)
- max.y= (Math::floor(pos.y)*cell_size - p_from.y) / dir.y;
+ max.y= (Math::floor((double)pos.y)*cell_size - p_from.y) / dir.y;
else
- max.y= (Math::floor(pos.y + 1)*cell_size - p_from.y) / dir.y;
+ max.y= (Math::floor((double)pos.y + 1)*cell_size - p_from.y) / dir.y;
int cullcount=0;
_cull<false,true>(pos,Rect2(),p_from,p_to,p_results,p_max_results,p_result_indices,cullcount);