Browse Source

python: do as little as possible in PYBIND11_MODULE.

pull/2/head
Vladimír Vondruš 7 years ago
parent
commit
21ee51fd96
  1. 3
      src/python/corrade/containers.cpp
  2. 4
      src/python/magnum/gl.cpp
  3. 4
      src/python/magnum/meshtools.cpp
  4. 4
      src/python/magnum/platform/egl.cpp
  5. 4
      src/python/magnum/platform/glfw.cpp
  6. 4
      src/python/magnum/platform/glx.cpp
  7. 4
      src/python/magnum/platform/sdl2.cpp
  8. 4
      src/python/magnum/primitives.cpp
  9. 10
      src/python/magnum/scenegraph.cpp
  10. 4
      src/python/magnum/shaders.cpp
  11. 4
      src/python/magnum/trade.cpp

3
src/python/corrade/containers.cpp

@ -402,6 +402,8 @@ template<class T> void mutableStridedArrayView3D(py::class_<PyStridedArrayView<3
}
void containers(py::module& m) {
m.doc() = "Corrade containers module";
py::class_<PyArrayView<const char>> arrayView_{m,
"ArrayView", "Array view", py::buffer_protocol{}};
arrayView(arrayView_);
@ -446,6 +448,5 @@ void containers(py::module& m) {
}}
PYBIND11_MODULE(containers, m) {
m.doc() = "Corrade containers module";
corrade::containers(m);
}

4
src/python/magnum/gl.cpp

@ -42,6 +42,8 @@
namespace magnum { namespace {
void gl(py::module& m) {
m.doc() = "OpenGL wrapping layer";
py::module::import("corrade.containers");
/* Abstract shader program */
@ -303,7 +305,5 @@ void gl(py::module& m) {
}}
PYBIND11_MODULE(gl, m) {
m.doc() = "OpenGL wrapping layer";
magnum::gl(m);
}

4
src/python/magnum/meshtools.cpp

@ -35,6 +35,8 @@
namespace magnum { namespace {
void meshtools(py::module& m) {
m.doc() = "Mesh tools";
py::module::import("magnum.gl");
py::module::import("magnum.trade");
@ -50,7 +52,5 @@ void meshtools(py::module& m) {
}}
PYBIND11_MODULE(meshtools, m) {
m.doc() = "Mesh tools";
magnum::meshtools(m);
}

4
src/python/magnum/platform/egl.cpp

@ -34,6 +34,8 @@ namespace magnum { namespace platform { namespace {
int argc = 0;
void egl(py::module& m) {
m.doc() = "EGL-based platform integration";
struct PyWindowlessApplication: Platform::WindowlessApplication {
explicit PyWindowlessApplication(const Configuration& configuration = Configuration{}): Platform::WindowlessApplication{Arguments{argc, nullptr}, configuration} {}
@ -54,7 +56,5 @@ void egl(py::module& m) {
}}}
PYBIND11_MODULE(egl, m) {
m.doc() = "EGL-based platform integration";
magnum::platform::egl(m);
}

4
src/python/magnum/platform/glfw.cpp

@ -34,6 +34,8 @@ namespace magnum { namespace platform { namespace {
int argc = 0;
void glfw(py::module& m) {
m.doc() = "GLFW-based platform integration";
struct PublicizedApplication: Platform::Application {
explicit PublicizedApplication(const Configuration& configuration, const GLConfiguration& glConfiguration): Platform::Application{Arguments{argc, nullptr}, configuration, glConfiguration} {}
@ -106,7 +108,5 @@ void glfw(py::module& m) {
}}}
PYBIND11_MODULE(glfw, m) {
m.doc() = "GLFW-based platform integration";
magnum::platform::glfw(m);
}

4
src/python/magnum/platform/glx.cpp

@ -34,6 +34,8 @@ namespace magnum { namespace platform { namespace {
int argc = 0;
void glx(py::module& m) {
m.doc() = "GLX-based platform integration";
struct PyWindowlessApplication: Platform::WindowlessApplication {
explicit PyWindowlessApplication(const Configuration& configuration = Configuration{}): Platform::WindowlessApplication{Arguments{argc, nullptr}, configuration} {}
@ -54,7 +56,5 @@ void glx(py::module& m) {
}}}
PYBIND11_MODULE(glx, m) {
m.doc() = "GLX-based platform integration";
magnum::platform::glx(m);
}

4
src/python/magnum/platform/sdl2.cpp

@ -34,6 +34,8 @@ namespace magnum { namespace platform { namespace {
int argc = 0;
void sdl2(py::module& m) {
m.doc() = "SDL2-based platform integration";
struct PublicizedApplication: Platform::Application {
explicit PublicizedApplication(const Configuration& configuration, const GLConfiguration& glConfiguration): Platform::Application{Arguments{argc, nullptr}, configuration, glConfiguration} {}
@ -114,7 +116,5 @@ void sdl2(py::module& m) {
}}}
PYBIND11_MODULE(sdl2, m) {
m.doc() = "SDL2-based platform integration";
magnum::platform::sdl2(m);
}

4
src/python/magnum/primitives.cpp

@ -34,6 +34,8 @@
namespace magnum { namespace {
void primitives(py::module& m) {
m.doc() = "Primitive library";
py::module::import("magnum.trade");
py::enum_<Primitives::SquareTextureCoords>{m, "SquareTextureCoords", "Whether to generate square texture coordinates"}
@ -52,7 +54,5 @@ void primitives(py::module& m) {
}}
PYBIND11_MODULE(primitives, m) {
m.doc() = "Primitive library";
magnum::primitives(m);
}

10
src/python/magnum/scenegraph.cpp

@ -121,6 +121,8 @@ template<UnsignedInt dimensions, class T> void camera(py::class_<SceneGraph::Cam
}
void scenegraph(py::module& m) {
m.doc() = "Scene graph library";
/* Abstract objects. Returned from feature.object, so need to be registered
as well. */
{
@ -159,14 +161,14 @@ void scenegraph(py::module& m) {
camera(camera2D);
camera(camera3D);
}
/* Concrete transformation implementations */
magnum::scenegraphMatrix(m);
magnum::scenegraphTrs(m);
}
}}
PYBIND11_MODULE(scenegraph, m) {
m.doc() = "Scene graph library";
magnum::scenegraph(m);
magnum::scenegraphMatrix(m);
magnum::scenegraphTrs(m);
}

4
src/python/magnum/shaders.cpp

@ -61,6 +61,8 @@ template<UnsignedInt dimensions> void vertexColor(NonDestructibleBase<Shaders::V
}
void shaders(py::module& m) {
m.doc() = "Builtin shaders";
py::module::import("magnum.gl");
/* 2D/3D vertex color shader */
@ -152,7 +154,5 @@ void shaders(py::module& m) {
}}
PYBIND11_MODULE(shaders, m) {
m.doc() = "Builtin shaders";
magnum::shaders(m);
}

4
src/python/magnum/trade.cpp

@ -38,6 +38,8 @@ template<class T> void meshData(py::class_<T>& c) {
}
void trade(py::module& m) {
m.doc() = "Data format exchange";
py::class_<Trade::MeshData2D> meshData2D{m, "MeshData2D", "Two-dimensional mesh data"};
py::class_<Trade::MeshData3D> meshData3D{m, "MeshData3D", "Three-dimensional mesh data"};
meshData(meshData2D);
@ -47,7 +49,5 @@ void trade(py::module& m) {
}}
PYBIND11_MODULE(trade, m) {
m.doc() = "Data format exchange";
magnum::trade(m);
}

Loading…
Cancel
Save