Compare commits

..

No commits in common. 'dev' and 'master' have entirely different histories.
dev ... master

  1. 14
      src/python/CMakeLists.txt
  2. 47
      src/python/magnum/gl.cpp
  3. 15
      src/python/magnum/scenegraph.cpp

14
src/python/CMakeLists.txt

@ -35,10 +35,16 @@ elseif(NOT pybind11_VERSION)
set(pybind11_VERSION ${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}.${PYBIND11_VERSION_PATCH})
endif()
# Newer pybind11 versions route pybind11_add_module() through FindPython and no
# longer accept SYSTEM as a positional compatibility argument. Keep this empty
# in the Oasis superproject build.
set(pybind11_add_module_SYSTEM)
# In pybind11 2.2.4 and below, pybind11_add_module() added the include
# directories as non-system. That, combined with Corrade's warning level, added
# an insane amount of warnings to the build. Since 2.3 it was possible to
# override that by passing SYSTEM to pybind11_add_module(), HOWEVER since 2.6
# doing so causes an ANNOYING warning because they made that a default. That
# all in a span of barely two years. Can't things just stay stable for a little
# moment?!
if(pybind11_VERSION VERSION_LESS 2.6)
set(pybind11_add_module_SYSTEM SYSTEM)
endif()
# UGH FFS
get_property(CMAKE_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

47
src/python/magnum/gl.cpp

@ -35,8 +35,6 @@
#include <Magnum/GL/AbstractShaderProgram.h>
#include <Magnum/GL/Attribute.h>
#include <Magnum/GL/Buffer.h>
#include <Magnum/GL/BufferTexture.h>
#include <Magnum/GL/BufferTextureFormat.h>
#include <Magnum/GL/Context.h>
#include <Magnum/GL/DefaultFramebuffer.h>
#include <Magnum/GL/Framebuffer.h>
@ -794,43 +792,6 @@ void gl(py::module_& m) {
}, "Set buffer data", py::arg("data"), py::arg("usage") = GL::BufferUsage::StaticDraw)
/** @todo more */;
py::enum_<GL::BufferTextureFormat>{m, "BufferTextureFormat", "Buffer texture internal format"}
.value("R8", GL::BufferTextureFormat::R8)
.value("RG8", GL::BufferTextureFormat::RG8)
.value("RGBA8", GL::BufferTextureFormat::RGBA8)
#ifndef MAGNUM_TARGET_GLES
.value("R16", GL::BufferTextureFormat::R16)
.value("RG16", GL::BufferTextureFormat::RG16)
.value("RGBA16", GL::BufferTextureFormat::RGBA16)
#endif
.value("R8UI", GL::BufferTextureFormat::R8UI)
.value("RG8UI", GL::BufferTextureFormat::RG8UI)
.value("RGBA8UI", GL::BufferTextureFormat::RGBA8UI)
.value("R8I", GL::BufferTextureFormat::R8I)
.value("RG8I", GL::BufferTextureFormat::RG8I)
.value("RGBA8I", GL::BufferTextureFormat::RGBA8I)
.value("R16UI", GL::BufferTextureFormat::R16UI)
.value("RG16UI", GL::BufferTextureFormat::RG16UI)
.value("RGBA16UI", GL::BufferTextureFormat::RGBA16UI)
.value("R16I", GL::BufferTextureFormat::R16I)
.value("RG16I", GL::BufferTextureFormat::RG16I)
.value("RGBA16I", GL::BufferTextureFormat::RGBA16I)
.value("R32UI", GL::BufferTextureFormat::R32UI)
.value("RG32UI", GL::BufferTextureFormat::RG32UI)
.value("RGB32UI", GL::BufferTextureFormat::RGB32UI)
.value("RGBA32UI", GL::BufferTextureFormat::RGBA32UI)
.value("R32I", GL::BufferTextureFormat::R32I)
.value("RG32I", GL::BufferTextureFormat::RG32I)
.value("RGB32I", GL::BufferTextureFormat::RGB32I)
.value("RGBA32I", GL::BufferTextureFormat::RGBA32I)
.value("R16F", GL::BufferTextureFormat::R16F)
.value("RG16F", GL::BufferTextureFormat::RG16F)
.value("RGBA16F", GL::BufferTextureFormat::RGBA16F)
.value("R32F", GL::BufferTextureFormat::R32F)
.value("RG32F", GL::BufferTextureFormat::RG32F)
.value("RGB32F", GL::BufferTextureFormat::RGB32F)
.value("RGBA32F", GL::BufferTextureFormat::RGBA32F);
/* Renderbuffer */
py::enum_<GL::RenderbufferFormat>{m, "RenderbufferFormat", "Internal renderbuffer format"}
#ifndef MAGNUM_TARGET_GLES
@ -1422,14 +1383,6 @@ void gl(py::module_& m) {
texture(texture3D);
#endif
py::class_<GL::BufferTexture, GL::AbstractTexture> bufferTexture{m, "BufferTexture", "Buffer texture"};
bufferTexture
.def(py::init(), "Constructor")
.def("set_buffer", [](GL::BufferTexture& self, GL::BufferTextureFormat internal_format, GL::Buffer& buffer) {
self.setBuffer(internal_format, buffer);
}, "Set buffer texture data", py::arg("internal_format"), py::arg("buffer"))
.def("reset_buffer", &GL::BufferTexture::resetBuffer, "Reset buffer texture data");
/* Framebuffer, needs to be after textures due to attach_texture() */
py::class_<GL::Framebuffer, GL::AbstractFramebuffer, GL::PyFramebufferHolder<GL::Framebuffer>> framebuffer{m,
"Framebuffer", "Framebuffer"};

15
src/python/magnum/scenegraph.cpp

@ -39,13 +39,14 @@ template<UnsignedInt dimensions, class T> struct PyDrawable: SceneGraph::PyFeatu
explicit PyDrawable(SceneGraph::AbstractObject<dimensions, T>& object, SceneGraph::DrawableGroup<dimensions, T>* drawables): SceneGraph::PyFeature<SceneGraph::Drawable<dimensions, T>>{object, drawables} {}
void draw(const MatrixTypeFor<dimensions, T>& transformationMatrix, SceneGraph::Camera<dimensions, T>& camera) override {
py::gil_scoped_acquire gil;
py::function override = py::get_override(static_cast<const PyDrawable*>(this), "draw");
if(!override) {
py::pybind11_fail("Tried to call pure virtual function \"PyDrawable::draw\"");
}
override(transformationMatrix,
py::cast(&camera, py::return_value_policy::reference));
PYBIND11_OVERLOAD_PURE_NAME(
void,
PyDrawable,
"draw",
draw,
transformationMatrix,
camera
);
}
};

Loading…
Cancel
Save