how to load resource in ogre media

caifie

10-05-2010 09:57:28

hi,everyone!

in nxogre1.6 tutorial, there is a code like below,
NxOgre::Mesh* barrel = meshMan->load("file://../../media/NxOgre/barrel.nxs", "barrel");

my question is that, if my barrel.nxs is in the ogre media(in another disk), how should i change the above code.
(if not absolute path.)

thanks in advance.

betajaen

10-05-2010 10:20:25

Ahaha! I was wondering when people would mention this again. In Detritus and the latest Critter release, you can use the Ogre resource system directly!

When you have your World created and Ogre is working, open up a "OgreResourceProtocol" which is a class in Critter:

NxOgre::ResourceSystem::getSingleton()->openProtocol(new Critter::OgreResourceProtocol());

Then access the resources through Ogre, using the "ogre" procotol.

NxOgre::Mesh* barrel = meshMan->load("ogre://General/barrel.nxs", "barrel");

Where "General" refers to the Ogre Resource group name (in the case of General you can omit that), and "barrel.nxs" refers to the file.

It's quite flexible and will make use of the entire of Ogre's Resource System, it even works with files in zip files.

caifie

10-05-2010 10:46:44

ok, thanks so much.

i guess that i'm a newer here, :D and i will ask another newer's question in this post.

where is the nxogre1.6 nxogre.log file, i can not find it in the debug folder. :(

betajaen

10-05-2010 11:10:12

It doesn't write to a log file anymore, any errors it writes to the console.

betajaen

10-05-2010 11:39:36

I just remembered it can, but you have to set it up.

Roughly:

Resource* resource = NxOgre::ResourceSystem::getSingleton->open("file://nxogre.errors.txt", Enums::ResourceAccess_WriteOnly);
NxOgre::ErrorStream::getSingleton()->setLogResource(resource);


Then the errors should have any errors, warnings or notices written into there.

caifie

10-05-2010 13:44:28

ok, you are so cool.

there is nxogre.errors.txt in the debug folder now. though it is zero kb, i think that because it have no errors. :D

by the way, how to use the NxOgreCharacterController in nxogre1.6.

when i open the NxOgreCharacterControllerDescription.h and NxOgreCharacterController.h, the main code are gray

i noticed that in the NxOgreCharacterControllerDescription.h, there is a line below,
#ifdef NxOgreUsePhysXCharacterController
and in the NxOgreCharacterController.h, there is a line,
#if NxOgreUsePhysXCharacterController == 1
so should i predefine NxOgreUsePhysXCharacterController or do something orther?