Crazy results from Mesh.generateLodLevels

Borogove

08-08-2007 03:58:07

I'm trying to call Mesh.generateLodLevels with code that looks like this lodDistances = [30.0,60.0,120.0]
ent.getMesh().generateLodLevels( lodDistances, ogre.ProgressiveMesh.VertexReductionQuota.VRQ_PROPORTIONAL, 0.5)
and getting this error:
Boost.Python.ArgumentError: Python argument types in
Mesh.generateLodLevels(Mesh, list, VertexReductionQuota, float) did not match C++ signature:
generateLodLevels(class Ogre::Mesh {lvalue}, class std::vector<float,class std::allocator<float> > lodDistances, enum Ogre::ProgressiveMesh::VertexReductionQuota reductionMethod, float reductionValue)


What's the correct Python type to send to an Ogre method expecting std::vector<float> ? Neither list nor tuple worked.

dermont

08-08-2007 06:57:42

I think it's "ogre.LodDistanceList" your looking for.


lodDistances = [530.0,560.0,5120.0]
lod = ogre.LodDistanceList()
for i in lodDistances:
lod.append(i)

mesh.generateLodLevels( lod, ogre.ProgressiveMesh.VertexReductionQuota.VRQ_PROPORTIONAL, 0.5)

Borogove

08-08-2007 07:46:33

I think it's "ogre.LodDistanceList" your looking for.

Ahh, thank you. That at least got it running.

Have you, or has anyone else, had good results from the automatic lod level generation on meshes made of triangle strips? I'm getting what looks like inverted normals or something when it switches to the lower LODs - my flying saucers turn inside out. (Changed topic.)

UPDATE: Doesn't work on my terrain, which is triangle lists rather than triangle strips, either -- leaves gaps between rows of triangles:


Guess I'll generate LODs manually -- since all my mesh generation is procedural, it shouldn't be hard.