baseVertexPointerToElement() problem

nathan75

01-11-2006 04:50:54

vertexData = mesh.sharedVertexData
vD = vertexData.vertexDeclaration
vE = vD.findElementBySemantic(ogre.VES_POSITION)
print vE.getSource()
vBB = vertexData.vertexBufferBinding
buffer = vBB.getBuffer(vE.getSource())
lock = buffer.lock(vD,buffer.HBL_READ_ONLY)
elem = vE.baseVertexPointerToElement(lock,pReal)


system said

No matching function for overloaded 'VertexElement_baseVertexPointerToElement'

Is it meaning that the function is not supported by pyogre?

i saw ogre.py

class VertexElement(object):

_def baseVertexPointerToElement(*args):
__"""
__baseVertexPointerToElement(self, void pBase, void pElem)
__baseVertexPointerToElement(self, void pBase, float pElem)
__baseVertexPointerToElement(self, void pBase, RGBA pElem)
__baseVertexPointerToElement(self, void pBase, unsigned char pElem)
__baseVertexPointerToElement(self, void pBase, unsigned short pElem)
__"""
__return _ogre.VertexElement_baseVertexPointerToElement(*args)



Thank you very much!

jintal

21-11-2006 15:09:39

i have the exact same problem. somebody help pls. thanks!

jintal

21-11-2006 15:25:20

haven't tested this though, but this might be the solution!

use the snippet for loading vertices and indices data from xml here:
http://www.ogre3d.org/phpBB2addons/view ... rtoelement

use the ogre commandtools to convert .mesh to .xml

dermont

21-11-2006 16:58:44

You can obtain the vertices and indices from the submesh as indicated in the last post from the thread you reference.

You just need to test if the submesh uses shared vertices. If it does "vertices" returns the mesh sharedVertexData, otherwise "vertices" returns the submesh vertexData.

Something along the lines of (not tested):

mesh = entity.mesh
verts = []
indices = []
useShared = False
for i in range(mesh.numSubMeshes):
print "SubMesh",i, mesh.getSubMesh(i).useSharedVertices, len(mesh.getSubMesh(i).vertices),len(mesh.getSubMesh(i).indices)

if not useShared:
verts+= mesh.getSubMesh(i).vertices
useShared = mesh.getSubMesh(i).useSharedVertices

indices+=mesh.getSubMesh(i).indices
print "----------------"
print "Total Vertices %i Indices %i" % (len(verts), len(indices))
print "----------------"