Manipulating vertex data?

skullmunky

20-10-2008 06:54:19

Is it possible to directly manipulate vertex data from python-ogre? I'm working with trying to convert the "getMeshInformation" example from c++, and I've gotten stuck on the part where (if I understand this right) you get the actual data from the buffer.

In the C++ snippet, it does this:


posElem->baseVertexPointerToElement(vertex, &pReal);


but there is no baseVertexPointerToElement function in the python binding to VertexElement that I can see. Is there another way to get at, and change, the vertex data?

thanks,

--skullmunky

SomeFusion

20-10-2008 16:50:34

Take a look at how I retrieve the vertex data in my project. Its a slightly modified version from the PO Ode demo. Search for a method named getMeshInformation. Actually I should have creditet Andy for his code in there, sorry I will add a comment on the next commit :)

http://svn.berlios.de/viewcvs/dsa-hl/rl/trunk/editors/Lockenwickler/src/ModuleManager.py?view=markup

skullmunky

20-10-2008 23:35:44

thanks! works great. did have to change one thing:


worldTransformMatrix = ogre.Matrix4()
entity.getParentNode().getWorldTransforms (worldTransformMatrix)


instead of using the functions to get position, orientation and scale independently; maybe those are deprecated in Ogre now?

off to spend the evening deforming meshes like crazy ... :D

andy

21-10-2008 05:23:01

The Grass and Bezier demos also do some creative Vertex management and there are a few helper functions that can be used..

Look at the createGrassMesh function in Demo_grass.py

regards
Andy