diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-12 12:42:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-12 12:42:30 +0200 |
commit | 5441aaf768d6dd4c3d8465e6b340ae38ddc7db1d (patch) | |
tree | 136ddb200eab2bab9124e4375dad9b435f7d5113 /core/variant_call.cpp | |
parent | e23f5e6415758e4eae0a5ba635afaba7d654c09f (diff) | |
parent | 85f13a0d240114b9d858b7fe9ea53ecab3dcde68 (diff) |
Merge pull request #31228 from aaronfranke/identity-constants
Add Basis constants and format Transform constants
Diffstat (limited to 'core/variant_call.cpp')
-rw-r--r-- | core/variant_call.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 1f6e5bb653..eca5d0567b 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1955,19 +1955,27 @@ void register_variant_methods() { _VariantCall::add_variant_constant(Variant::VECTOR2, "UP", Vector2(0, -1)); _VariantCall::add_variant_constant(Variant::VECTOR2, "DOWN", Vector2(0, 1)); - _VariantCall::add_variant_constant(Variant::TRANSFORM2D, "IDENTITY", Transform2D(1, 0, 0, 1, 0, 0)); + _VariantCall::add_variant_constant(Variant::TRANSFORM2D, "IDENTITY", Transform2D()); _VariantCall::add_variant_constant(Variant::TRANSFORM2D, "FLIP_X", Transform2D(-1, 0, 0, 1, 0, 0)); _VariantCall::add_variant_constant(Variant::TRANSFORM2D, "FLIP_Y", Transform2D(1, 0, 0, -1, 0, 0)); - Transform identity_transform, transform_x, transform_y, transform_z; - identity_transform.set(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0); + Transform identity_transform = Transform(); + Transform flip_x_transform = Transform(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0); + Transform flip_y_transform = Transform(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0); + Transform flip_z_transform = Transform(1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0); _VariantCall::add_variant_constant(Variant::TRANSFORM, "IDENTITY", identity_transform); - transform_x.set(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0); - _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_X", transform_x); - transform_y.set(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0); - _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Y", transform_y); - transform_z.set(1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0); - _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Z", transform_z); + _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_X", flip_x_transform); + _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Y", flip_y_transform); + _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Z", flip_z_transform); + + Basis identity_basis = Basis(); + Basis flip_x_basis = Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1); + Basis flip_y_basis = Basis(1, 0, 0, 0, -1, 0, 0, 0, 1); + Basis flip_z_basis = Basis(1, 0, 0, 0, 1, 0, 0, 0, -1); + _VariantCall::add_variant_constant(Variant::BASIS, "IDENTITY", identity_basis); + _VariantCall::add_variant_constant(Variant::BASIS, "FLIP_X", flip_x_basis); + _VariantCall::add_variant_constant(Variant::BASIS, "FLIP_Y", flip_y_basis); + _VariantCall::add_variant_constant(Variant::BASIS, "FLIP_Z", flip_z_basis); _VariantCall::add_variant_constant(Variant::PLANE, "PLANE_YZ", Plane(Vector3(1, 0, 0), 0)); _VariantCall::add_variant_constant(Variant::PLANE, "PLANE_XZ", Plane(Vector3(0, 1, 0), 0)); |