Skip to content

Conversation

@mattebb
Copy link

@mattebb mattebb commented Jan 4, 2013

This adds two new methods to the python API to retrieve and set particle attribute data with NumPy arrays. Not only is it much, much faster than iterating over each particle with get(), but it's more memory efficient too, especially if the intended destination for the particles is a NumPy array.

I've been using this for a point cloud/particle system viewer I've made* using pyglet for OpenGL drawing. Using this addion, in my app, memory for the NumPy array is allocated once in the partio API, and passed directly through to an OpenGL vertex buffer object, with no additional copying. Load time is similar (just a little bit slower) to the builtin partview C++ demo app, which is not bad for python!

I've added in NumPy support to the cmake build system, which seems to work fine here on CentOS 6.2, but don't know about any other OSes yet.

cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants