summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-07-15 01:23:10 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-07-15 08:32:34 -0300
commit2e73be99d8d86d9dad7bcb99518a4d3cbb5c373c (patch)
treed863db50852afe5d4b0bc15b8452054498004cb1 /core/math
parente64b82ebfcc3475c7a7d2a9196bfe20d6c9e3614 (diff)
Lots of work on Audio & Physics engine:
-Added new 3D stream player node -Added ability for Area to capture sound from streams -Added small features in physics to be able to properly guess distance to areas for sound -Fixed 3D CollisionObject so shapes are added the same as in 2D, directly from children -Fixed KinematicBody API to make it the same as 2D.
Diffstat (limited to 'core/math')
-rw-r--r--core/math/audio_frame.h10
-rw-r--r--core/math/vector3.h6
2 files changed, 16 insertions, 0 deletions
diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h
index 5ccc9d9e5e..d54f622197 100644
--- a/core/math/audio_frame.h
+++ b/core/math/audio_frame.h
@@ -102,6 +102,16 @@ struct AudioFrame {
r = ::undenormalise(r);
}
+ _FORCE_INLINE_ AudioFrame linear_interpolate(const AudioFrame &p_b, float p_t) const {
+
+ AudioFrame res = *this;
+
+ res.l += (p_t * (p_b.l - l));
+ res.r += (p_t * (p_b.r - r));
+
+ return res;
+ }
+
_ALWAYS_INLINE_ AudioFrame(float p_l, float p_r) {
l = p_l;
r = p_r;
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 7dfcedd0da..6a7974681e 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -100,6 +100,7 @@ struct Vector3 {
_FORCE_INLINE_ Vector3 abs() const;
_FORCE_INLINE_ Vector3 floor() const;
+ _FORCE_INLINE_ Vector3 sign() const;
_FORCE_INLINE_ Vector3 ceil() const;
_FORCE_INLINE_ real_t distance_to(const Vector3 &p_b) const;
@@ -187,6 +188,11 @@ Vector3 Vector3::abs() const {
return Vector3(Math::abs(x), Math::abs(y), Math::abs(z));
}
+Vector3 Vector3::sign() const {
+
+ return Vector3(SGN(x), SGN(y), SGN(z));
+}
+
Vector3 Vector3::floor() const {
return Vector3(Math::floor(x), Math::floor(y), Math::floor(z));