Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python bindings #1

Draft
wants to merge 28 commits into
base: master
from

Conversation

2 participants
@mosra
Copy link
Owner

commented May 1, 2019

Split from mosra/magnum#228. Things to do:

  • everything reasonable base from the Math lib
    • testing basic functionality from python
    • setting up Travis build
    • think about the underscore policy (xaxis() might be okay but shearxz() definitely isn't) -- went back to all underscores, everything else is inconsistent
    • convince Python that it can have a single method that's both static and instance (Matrix3.scaling() vs mat.scaling())
    • convince Python that it can have a property and static method of the same name (Matrix3.translation() vs mat.translation)
  • basic stuff from Platform
    • solve protected destructors and such -- my own deleter
    • how to support overriding virtual functions to subclass Platform::Application classes? -- pybind is nice
  • ffs, $<TARGET_EXISTS> doesn't exist until CMake 3.12, need other solution
  • basic stuff from GL (render a cube) in progress
    • how to support variadic templates (in particular Mesh::addVertexBuffer())? *args?
  • basic stuff from Shaders in progress
  • basic stuff from SceneGraph (render a cube using scenegraph)
  • solve inter-module dependencies (currently it's implicit and doesn't really work) it "just works" now
  • how to document this? mosra/m.css#98
  • solve compile times (I barely started and this adds 20 seconds to compile times...)
  • how to pass big chunks of binary data through fast?

@mosra mosra added this to TODO in Python via automation May 1, 2019

@codecov-io

This comment has been minimized.

Copy link

commented May 1, 2019

Codecov Report

❗️ No coverage uploaded for pull request base (master@f7d5d91). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##             master     #1   +/-   ##
=======================================
  Coverage          ?   100%           
=======================================
  Files             ?      2           
  Lines             ?     16           
  Branches          ?      0           
=======================================
  Hits              ?     16           
  Misses            ?      0           
  Partials          ?      0
Impacted Files Coverage Δ
src/python/__init__.py 100% <100%> (ø)
src/python/platform/__init__.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f7d5d91...8629764. Read the comment docs.

@mosra mosra added this to the 2019.0b milestone May 1, 2019

@mosra mosra self-assigned this May 1, 2019

@mosra mosra referenced this pull request May 1, 2019

Merged

Python bindings #228

3 of 3 tasks complete

@mosra mosra moved this from TODO to In Progress in Python May 1, 2019

@mosra mosra force-pushed the python branch 2 times, most recently from 1eadca7 to e88148a May 2, 2019

mosra added some commits Apr 21, 2019

Initial code for the Python bindings, adding math angle types.
Only the double ones, exposed as floats, because the extra ALU required
by doubles is negligible to function call overhead. It'll be different
for non-scalar types, but here I use this.
python: expose Constants.
Only the double variants (since Python doesn't really differentiate
between 32bit and 64bit floats) and directly into math to mimic Python's
math module.
python: expose matrix types.
Not the Matrix4 / Matrix3 transformation types yet, though.
python: expose Matrix3 and Matrix4.
The clash of static constructors and members / properties is ...
unfortunate. This is resolved using a minor hack, but I think that's
warranted if it preserves C++/Python API compatibility. The
translation() static constructor and property is not done yet, tho.
python: expose ArrayView and StridedArrayView.
Wow. This took a while and still is far from ideal.
python: expose Windowless{Glx,Egl}Application in platform.{glx,egl}.
One of them is then available through the platform.WindowlessApplication
alias. The selection is a bit arbitrary now, but has to suffice.
python: expose minimum of GL::DefaultFramebuffer.
Some non-trivial tricks had to be done in order to expose the
GL::defaultFramebuffer variable without causing leaks or double frees.
Also, the AbstractFramebuffer has a protected destructor so this needs
another special handling.
python: expose the GL::AbstractShaderProgram type.
The type needs to be known for Mesh::draw() and shaders later.
python: very barebones SDL2 & GLFW applications.
Similarly to the windowless ones, one of them gets picked up to be
platform.Application.

@mosra mosra force-pushed the python branch from e88148a to 8629764 May 14, 2019

@mosra mosra referenced this pull request May 21, 2019

Open

2019.07 release #340

0 of 12 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.