[bloody mess]How to use the ManualMesh?

zillenjack

17-05-2009 12:12:29

I am try to use the ManualMesh to create the TriangleGeometry
Here is my code:
NxOgre::ManualMesh* mesh = new NxOgre::ManualMesh();
mesh->begin(NxOgre::Enums::MeshType::MeshType_Triangle,3,1);
mesh->vertex(NxOgre::Real3(0,0,0));
mesh->vertex(NxOgre::Real3(100,0,0));
mesh->vertex(NxOgre::Real3(0,0,100));
mesh->triangle(0,1,2);
NxOgre::Mesh* mm = mesh->end();
NxOgre::TriangleGeometry* tri = new NxOgre::TriangleGeometry(mm);
NxOgre::Shapes pShapes;
pShapes.insert(tri);
mScene->createSceneGeometry(pShapes, NxOgre::Matrix44(NxOgre::Matrix44::IDENTITY));

Run to the last line show error "mScene->createSceneGeometry...."
How the case?
Thank you!

spacegaier

19-05-2009 16:22:10

Well, I guess your mesh isn't valid (at least it also crashed when trying to access the name of it).

But your code works if I just use one of my TriangleMeshes loaded from an .nxs file instead of your tri.

zillenjack

20-05-2009 03:58:27

I think this is the [bloody mess] bug
Because the ManualMesh::end return 0 forever

betajaen

20-05-2009 10:39:22

I think it's more related to that you have one triangle in the mesh. Try increasing the amount of triangles, so say 3 and see how it goes.

0 is being returned because PhysX had a problem with your vertices and indices.