Browse Source

python: add off-center variants of 2D/3D orthographic projection.

Which also fixes the build against latest Magnum master, as the
overloads are now ambiguous.
pull/12/head
Vladimír Vondruš 5 years ago
parent
commit
d66b581e73
  1. 3
      doc/python/pages/changelog.rst
  2. 8
      src/python/magnum/math.matrix.h

3
doc/python/pages/changelog.rst

@ -41,6 +41,9 @@ Changelog
/ :ref:`Matrix4.from_()` because :py:`from` is a Python keyword and it / :ref:`Matrix4.from_()` because :py:`from` is a Python keyword and it
would be silly to have to write :py:`getattr(Matrix4, 'from')` just to use would be silly to have to write :py:`getattr(Matrix4, 'from')` just to use
these APIs these APIs
- Exposed newly added off-center variants of
:ref:`Matrix4.orthographhic_projection()` and
:ref:`Matrix3.projection()`
- Exposed :ref:`gl.Renderer.set_blend_function()`, - Exposed :ref:`gl.Renderer.set_blend_function()`,
:ref:`gl.Renderer.set_blend_equation()` and related enums (see :gh:`mosra/magnum-bindings#9`) :ref:`gl.Renderer.set_blend_equation()` and related enums (see :gh:`mosra/magnum-bindings#9`)
- Exposed :ref:`gl.Renderer.Feature.CLIP_DISTANCEn <gl.Renderer.Feature.CLIP_DISTANCE0>` - Exposed :ref:`gl.Renderer.Feature.CLIP_DISTANCEn <gl.Renderer.Feature.CLIP_DISTANCE0>`

8
src/python/magnum/math.matrix.h

@ -558,8 +558,10 @@ template<class T> void matrices(
"2D shearing matrix along the X axis", py::arg("amount")) "2D shearing matrix along the X axis", py::arg("amount"))
.def_static("shearing_y", &Math::Matrix3<T>::shearingY, .def_static("shearing_y", &Math::Matrix3<T>::shearingY,
"2D shearning matrix along the Y axis", py::arg("amount")) "2D shearning matrix along the Y axis", py::arg("amount"))
.def_static("projection", &Math::Matrix3<T>::projection, .def_static("projection", static_cast<Math::Matrix3<T>(*)(const Math::Vector2<T>&)>(&Math::Matrix3<T>::projection),
"2D projection matrix", py::arg("size")) "2D projection matrix", py::arg("size"))
.def_static("projection", static_cast<Math::Matrix3<T>(*)(const Math::Vector2<T>&, const Math::Vector2<T>&)>(&Math::Matrix3<T>::projection),
"2D off-center projection matrix", py::arg("bottom_left"), py::arg("top_right"))
.def_static("from_", static_cast<Math::Matrix3<T>(*)(const Math::Matrix2x2<T>&, const Math::Vector2<T>&)>(&Math::Matrix3<T>::from), .def_static("from_", static_cast<Math::Matrix3<T>(*)(const Math::Matrix2x2<T>&, const Math::Vector2<T>&)>(&Math::Matrix3<T>::from),
"Create a matrix from a rotation/scaling part and a translation part", "Create a matrix from a rotation/scaling part and a translation part",
py::arg("rotation_scaling"), py::arg("translation")) py::arg("rotation_scaling"), py::arg("translation"))
@ -747,8 +749,10 @@ Overloaded function.
"3D shearning matrix along the XZ plane", py::arg("amount_x"), py::arg("amount_z")) "3D shearning matrix along the XZ plane", py::arg("amount_x"), py::arg("amount_z"))
.def_static("shearing_yz", &Math::Matrix4<T>::shearingYZ, .def_static("shearing_yz", &Math::Matrix4<T>::shearingYZ,
"3D shearing matrix along the YZ plane", py::arg("amount_y"), py::arg("amount_z")) "3D shearing matrix along the YZ plane", py::arg("amount_y"), py::arg("amount_z"))
.def_static("orthographic_projection", &Math::Matrix4<T>::orthographicProjection, .def_static("orthographic_projection", static_cast<Math::Matrix4<T>(*)(const Math::Vector2<T>&, T, T)>(&Math::Matrix4<T>::orthographicProjection),
"3D orthographic projection matrix", py::arg("size"), py::arg("near"), py::arg("far")) "3D orthographic projection matrix", py::arg("size"), py::arg("near"), py::arg("far"))
.def_static("orthographic_projection", static_cast<Math::Matrix4<T>(*)(const Math::Vector2<T>&, const Math::Vector2<T>&, T, T)>(&Math::Matrix4<T>::orthographicProjection),
"3D off-center orthographic projection matrix", py::arg("bottom_left"), py::arg("top_right"), py::arg("near"), py::arg("far"))
.def_static("perspective_projection", .def_static("perspective_projection",
static_cast<Math::Matrix4<T>(*)(const Math::Vector2<T>&, T, T)>(&Math::Matrix4<T>::perspectiveProjection), static_cast<Math::Matrix4<T>(*)(const Math::Vector2<T>&, T, T)>(&Math::Matrix4<T>::perspectiveProjection),
"3D perspective projection matrix", py::arg("size"), py::arg("near"), py::arg("far")) "3D perspective projection matrix", py::arg("size"), py::arg("near"), py::arg("far"))

Loading…
Cancel
Save