From 016f5954e3815e098d4ed9897de13eb424860b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 3 Nov 2019 08:05:47 +0100 Subject: [PATCH] python: exposed framebuffer blit. --- doc/python/pages/changelog.rst | 8 ++++++++ src/python/magnum/gl.cpp | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/doc/python/pages/changelog.rst b/doc/python/pages/changelog.rst index 49e4711..8e18cfc 100644 --- a/doc/python/pages/changelog.rst +++ b/doc/python/pages/changelog.rst @@ -26,9 +26,17 @@ Changelog ######### +:ref-prefix: + corrade + magnum :some_directive: TODO: why can't the title below "just work" and I have to add some bogus content before? +`Changes since 2019.10`_ +======================== + +- Exposed `gl.AbstractFramebuffer.blit()` functions and related enums + `2019.10`_ ========== diff --git a/src/python/magnum/gl.cpp b/src/python/magnum/gl.cpp index f7bc2ec..d4abffa 100644 --- a/src/python/magnum/gl.cpp +++ b/src/python/magnum/gl.cpp @@ -673,12 +673,30 @@ void gl(py::module& m) { .value("STENCIL", GL::FramebufferClear::Stencil); corrade::enumOperators(framebufferClear); + py::enum_ framebufferBlit{m, "FramebufferBlit", "Mask for framebuffer blitting"}; + framebufferBlit + .value("COLOR", GL::FramebufferBlit::Color) + .value("DEPTH", GL::FramebufferBlit::Depth) + .value("STENCIL", GL::FramebufferBlit::Stencil); + corrade::enumOperators(framebufferBlit); + + py::enum_{m, "FramebufferBlitFilter", "Framebuffer blit filtering"} + .value("NEAREST", GL::FramebufferBlitFilter::Nearest) + .value("LINEAR", GL::FramebufferBlitFilter::Linear); + py::class_> abstractFramebuffer{m, "AbstractFramebuffer", "Base for default and named framebuffers"}; abstractFramebuffer /** @todo limit queries */ + /* Using lambdas to supply an enum and not enum set */ + .def_static("blit", [](GL::AbstractFramebuffer& source, GL::AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, GL::FramebufferBlit mask, GL::FramebufferBlitFilter filter) { + GL::AbstractFramebuffer::blit(source, destination, sourceRectangle, destinationRectangle, mask, filter); + }, "Copy a block of pixels", py::arg("source"), py::arg("destination"), py::arg("source_rectangle"), py::arg("destination_rectangle"), py::arg("mask"), py::arg("filter")) + .def_static("blit", [](GL::AbstractFramebuffer& source, GL::AbstractFramebuffer& destination, const Range2Di& rectangle, GL::FramebufferBlit mask) { + GL::AbstractFramebuffer::blit(source, destination, rectangle, mask); + }, "Copy a block of pixels", py::arg("source"), py::arg("destination"), py::arg("rectangle"), py::arg("mask")) .def("bind", &GL::AbstractFramebuffer::bind, "Bind framebuffer for drawing") .def_property("viewport", &GL::AbstractFramebuffer::viewport, &GL::AbstractFramebuffer::setViewport, "Viewport") /* Using lambdas to avoid method chaining getting into signatures */