|
|
|
@ -93,7 +93,6 @@ template<class T, class ...Args> void everyVector(py::class_<T, Args...>& c) { |
|
|
|
.def(py::init(), "Default constructor") |
|
|
|
.def(py::init(), "Default constructor") |
|
|
|
|
|
|
|
|
|
|
|
/* Operators */ |
|
|
|
/* Operators */ |
|
|
|
.def(-py::self, "Negated vector") |
|
|
|
|
|
|
|
.def(py::self += py::self, "Add and assign a vector") |
|
|
|
.def(py::self += py::self, "Add and assign a vector") |
|
|
|
.def(py::self + py::self, "Add a vector") |
|
|
|
.def(py::self + py::self, "Add a vector") |
|
|
|
#ifdef __clang__ |
|
|
|
#ifdef __clang__ |
|
|
|
@ -124,6 +123,10 @@ template<class T, class ...Args> void everyVector(py::class_<T, Args...>& c) { |
|
|
|
.def(typename T::Type{} / py::self, "Divide a vector with a scalar and invert"); |
|
|
|
.def(typename T::Type{} / py::self, "Divide a vector with a scalar and invert"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<class T, class ...Args> void everyVectorSigned(py::class_<T, Args...>& c) { |
|
|
|
|
|
|
|
c.def(-py::self, "Negated vector"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Separate because it needs to be registered after the type conversion
|
|
|
|
/* Separate because it needs to be registered after the type conversion
|
|
|
|
constructors. Needs to be called also for subclasses. */ |
|
|
|
constructors. Needs to be called also for subclasses. */ |
|
|
|
template<class T, class ...Args> void everyVectorBuffer(py::class_<T, Args...>& c) { |
|
|
|
template<class T, class ...Args> void everyVectorBuffer(py::class_<T, Args...>& c) { |
|
|
|
@ -272,10 +275,6 @@ template<class T> void vector2(py::class_<Math::Vector2<T>>& c) { |
|
|
|
.def_static("y_scale", &Math::Vector2<T>::yScale, |
|
|
|
.def_static("y_scale", &Math::Vector2<T>::yScale, |
|
|
|
"Scaling vector in a direction of Y axis (height)", py::arg("scale")) |
|
|
|
"Scaling vector in a direction of Y axis (height)", py::arg("scale")) |
|
|
|
|
|
|
|
|
|
|
|
/* Methods */ |
|
|
|
|
|
|
|
.def("perpendicular", &Math::Vector2<T>::perpendicular, |
|
|
|
|
|
|
|
"Perpendicular vector") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Properties */ |
|
|
|
/* Properties */ |
|
|
|
.def_property("x", |
|
|
|
.def_property("x", |
|
|
|
static_cast<T(Math::Vector2<T>::*)() const>(&Math::Vector2<T>::x), |
|
|
|
static_cast<T(Math::Vector2<T>::*)() const>(&Math::Vector2<T>::x), |
|
|
|
@ -287,6 +286,11 @@ template<class T> void vector2(py::class_<Math::Vector2<T>>& c) { |
|
|
|
"Y component"); |
|
|
|
"Y component"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<class T> void vector2Signed(py::class_<Math::Vector2<T>>& c) { |
|
|
|
|
|
|
|
/* Cast needed because these are enabled only for signed types */ |
|
|
|
|
|
|
|
c.def("perpendicular", static_cast<Math::Vector2<T>(Math::Vector2<T>::*)() const>(&Math::Vector2<T>::perpendicular), "Perpendicular vector"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<class T> void vector3(py::class_<Math::Vector3<T>>& c) { |
|
|
|
template<class T> void vector3(py::class_<Math::Vector3<T>>& c) { |
|
|
|
py::implicitly_convertible<const std::tuple<T, T, T>&, Math::Vector3<T>>(); |
|
|
|
py::implicitly_convertible<const std::tuple<T, T, T>&, Math::Vector3<T>>(); |
|
|
|
|
|
|
|
|
|
|
|
|