mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Initialize Quaternion
variant with identity
This commit is contained in:
parent
db66bd35af
commit
c0e36dc493
1 changed files with 8 additions and 1 deletions
|
@ -54,6 +54,9 @@ public:
|
||||||
case Variant::TRANSFORM2D:
|
case Variant::TRANSFORM2D:
|
||||||
init_transform2d(v);
|
init_transform2d(v);
|
||||||
break;
|
break;
|
||||||
|
case Variant::QUATERNION:
|
||||||
|
init_quaternion(v);
|
||||||
|
break;
|
||||||
case Variant::AABB:
|
case Variant::AABB:
|
||||||
init_aabb(v);
|
init_aabb(v);
|
||||||
break;
|
break;
|
||||||
|
@ -219,7 +222,7 @@ public:
|
||||||
|
|
||||||
// Should be in the same order as Variant::Type for consistency.
|
// Should be in the same order as Variant::Type for consistency.
|
||||||
// Those primitive and vector types don't need an `init_` method:
|
// Those primitive and vector types don't need an `init_` method:
|
||||||
// Nil, bool, float, Vector2/i, Rect2/i, Vector3/i, Plane, Quat, RID.
|
// Nil, bool, float, Vector2/i, Rect2/i, Vector3/i, Plane, RID.
|
||||||
// Object is a special case, handled via `object_reset_data`.
|
// Object is a special case, handled via `object_reset_data`.
|
||||||
_FORCE_INLINE_ static void init_string(Variant *v) {
|
_FORCE_INLINE_ static void init_string(Variant *v) {
|
||||||
memnew_placement(v->_data._mem, String);
|
memnew_placement(v->_data._mem, String);
|
||||||
|
@ -230,6 +233,10 @@ public:
|
||||||
memnew_placement(v->_data._transform2d, Transform2D);
|
memnew_placement(v->_data._transform2d, Transform2D);
|
||||||
v->type = Variant::TRANSFORM2D;
|
v->type = Variant::TRANSFORM2D;
|
||||||
}
|
}
|
||||||
|
_FORCE_INLINE_ static void init_quaternion(Variant *v) {
|
||||||
|
memnew_placement(v->_data._mem, Quaternion);
|
||||||
|
v->type = Variant::QUATERNION;
|
||||||
|
}
|
||||||
_FORCE_INLINE_ static void init_aabb(Variant *v) {
|
_FORCE_INLINE_ static void init_aabb(Variant *v) {
|
||||||
v->_data._aabb = (AABB *)Variant::Pools::_bucket_small.alloc();
|
v->_data._aabb = (AABB *)Variant::Pools::_bucket_small.alloc();
|
||||||
memnew_placement(v->_data._aabb, AABB);
|
memnew_placement(v->_data._aabb, AABB);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue