jchmack
25-08-2007 23:16:48
Whenever i load a character for the first time i get a long frameskip. And a message in the console saying "loading mmerc1.mesh". After the initial load it works fine speed-wise. Is there a way i can preload this mesh at the start of my program so i dont get these odd stops?
betajaen
25-08-2007 23:47:19
Yep. I've prototyped and half-written a MeshManager class for NxOgre. You'll be able to pre-load meshes with that. Should be around in a few commits time.
jchmack
26-08-2007 02:15:13
Yep. I've prototyped and half-written a MeshManager class for NxOgre. You'll be able to pre-load meshes with that. Should be around in a few commits time.
nice =). NxOgre is going to have so many great features.
jchmack, do you add your character to the world:
1. at runtime(while being in-world, during simulation)
or
2. when creating world(and you start simulating it when all is created)?
I assume 1, because you wouldn't bother with frameskips during loading of your level
The easiest solution for now is to load the meshes that will be needed later before you start simulation. You can do it with MeshManager::load or even something lazy like creating entity and deleting it - that way you will load mesh+textures ready to use for later.
This is pretty much simple manual solution, but maybe it will help someone
jchmack
29-08-2007 07:27:24
jchmack, do you add your character to the world:
1. at runtime(while being in-world, during simulation)
or
2. when creating world(and you start simulating it when all is created)?
I assume 1, because you wouldn't bother with frameskips during loading of your level
The easiest solution for now is to load the meshes that will be needed later before you start simulation. You can do it with MeshManager::load or even something lazy like creating entity and deleting it - that way you will load mesh+textures ready to use for later.
This is pretty much simple manual solution, but maybe it will help someone
This is what i ended up doing for now (loading the mesh at startup). And it works =). But later i would like the ability to load/unload meshes from memory as well as have physX use the same collision mesh for multiple models.
Playing with meshes (loading/preloading etc) is basically a task of the graphics engine.... not the NxOgre (even if it so kind to load them for you).
So my advice is use Ogre to do this ! If you're sure that you'll always load a mesh you could preload it using standard Ogre functions...
pseudo code (i dont have ogre here so the methods name could be wrong):
// keep the mEntity pointer somewhere in you code and then remove it in the destructor
// load it at the begining of you app doing something like this:
mEntity_heavy2Load = mSceneManager->greateEntity( "myheavymesh.mesh", "mypreoloaded bigmesh" );
// once you need to put in scene or use it with nxogre you just clone it:
Entity *E = mEntity_heavy2Load->clone( "mycloned entity" );
// then you could use it in a NxOgre body using this:
mBody->getNode()->attachObject( E );
Cloning entities is faster and is in fact a technic to preload them, you will also reduce the memory usage in you application if this entity is repeated or used many times... like for example: missiles, wheels.... etc.
betajaen
29-08-2007 09:25:52
We are talking about PhysX meshes Luis; Skeletons, Convexes, TriangleMeshs, SoftBodyMeshes, etc.
We are talking about PhysX meshes Luis; Skeletons, Convexes, TriangleMeshs, SoftBodyMeshes, etc.
then forget my post ! this morning i was asleep, I need vacations......