summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-06-23 10:00:05 +0200
committerGitHub <noreply@github.com>2016-06-23 10:00:05 +0200
commit60fa2b98151ae2fc87d77ef52372eec82f7754dd (patch)
treecb52e35d2741ef61ac513bfafa4e5c8cea379662 /core
parent9bf3ee7acc144713d8e55d42f29ec0ea6fef7301 (diff)
parentd08092e113bd878f8d3eb4a4f67f305b82df470d (diff)
Merge pull request #5201 from Hinsbart/quat_op
Expose missing Quaternion operators.
Diffstat (limited to 'core')
-rw-r--r--core/variant_op.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 9f706e75cf..e549161de9 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -477,7 +477,7 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
DEFAULT_OP_FAIL(MATRIX32);
DEFAULT_OP_LOCALMEM(+,VECTOR3,Vector3);
DEFAULT_OP_FAIL(PLANE);
- DEFAULT_OP_FAIL(QUAT);
+ DEFAULT_OP_LOCALMEM(+, QUAT, Quat);
DEFAULT_OP_FAIL(_AABB);
DEFAULT_OP_FAIL(MATRIX3);
DEFAULT_OP_FAIL(TRANSFORM);
@@ -535,7 +535,7 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
DEFAULT_OP_FAIL(MATRIX32);
DEFAULT_OP_LOCALMEM(-,VECTOR3,Vector3);
DEFAULT_OP_FAIL(PLANE);
- DEFAULT_OP_FAIL(QUAT);
+ DEFAULT_OP_LOCALMEM(-, QUAT, Quat);
DEFAULT_OP_FAIL(_AABB);
DEFAULT_OP_FAIL(MATRIX3);
DEFAULT_OP_FAIL(TRANSFORM);
@@ -597,6 +597,9 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
_RETURN( *reinterpret_cast<const Quat*>(p_a._data._mem) * *reinterpret_cast<const Quat*>(p_b._data._mem) );
} break;
+ case REAL: {
+ _RETURN( *reinterpret_cast<const Quat*>(p_a._data._mem) * p_b._data._real);
+ } break;
};
r_valid=false;
return;
@@ -699,7 +702,13 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
DEFAULT_OP_FAIL(MATRIX32);
DEFAULT_OP_LOCALMEM_NUM(/,VECTOR3,Vector3);
DEFAULT_OP_FAIL(PLANE);
- DEFAULT_OP_FAIL(QUAT);
+ case QUAT: {
+ if (p_b.type != REAL) {
+ r_valid = false;
+ return;
+ }
+ _RETURN( *reinterpret_cast<const Quat*>(p_a._data._mem) / p_b._data._real);
+ } break;
DEFAULT_OP_FAIL(_AABB);
DEFAULT_OP_FAIL(MATRIX3);
DEFAULT_OP_FAIL(TRANSFORM);