Resource groups and loading meshes

Diabolikal49

21-02-2011 15:33:28

Hey there folks.

I'd like to know a little more about loading meshes.

In my resources.cfg, I have a custom group called 'Snoogre'
[Snoogre]
FileSystem=C:\Users\Jay\Desktop\Game Resources
FileSystem=C:\Users\Jay\Desktop\Game Resources\Snoogre


How would I go about loading a .nxs file in my project?
NxOgre::Mesh* tablephys = mMeshManager->load("ogre://Snoogre/snookertable_physics.nxs", "tablephys");
mScene->createSceneGeometry(NxOgre::TriangleGeometryDescription(tablephys), NxOgre::Vec3(900,0,1800));


Should this work? (it doesn't)

Any tips would be appreciated, cheers.

P.S. Yes, I'm working on a snooker game.

betajaen

21-02-2011 15:44:17

1. Have you registered the "ogre" Resource System with NxOgre.
2. Have you just tried the filename?

aspilicious

21-02-2011 16:14:36

Woow I had the same problem 1 minute ago.
I get an IO exception while loading any .nxs files even the island.nxs from the examples.

Diabolikal49

21-02-2011 17:04:15

1. Have you registered the "ogre" Resource System with NxOgre.
2. Have you just tried the filename?


I've just been looking through the tutorial code and made a newbie error, thanks betajaen. I hadn't registered the Ogre resource system with NxOgre at all.

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

Diabolikal49

21-02-2011 17:17:12

Just to clarify for anyone else reading this thread:
NxOgre::Mesh* tablephys = mMeshManager->load("ogre://Snoogre/snookertable_physics.nxs", "tablephys");
mScene->createSceneGeometry(NxOgre::TriangleGeometryDescription(tablephys), NxOgre::Vec3(900,0,1800))

and (tutorial)
NxOgre::Mesh* island = mMeshManager->load("ogre://island.nxs", "island");
mScene->createSceneGeometry(NxOgre::TriangleGeometryDescription(island), NxOgre::Vec3::ZERO);


work, but putting just the filename does not, e.g.:
NxOgre::Mesh* island = mMeshManager->load("island.nxs", "island");
mScene->createSceneGeometry(NxOgre::TriangleGeometryDescription(island), NxOgre::Vec3::ZERO);

betajaen

21-02-2011 17:25:55

Nope, without the "ogre://" part, NxOgre doesn't know what method it should use to get at the file, I just meant "ogre://snookertable_physics.nxs".


I did want to ask something. Why use a mesh for the snooker table? A plane would be easier to simulate and more stable to run. The edges and pockets could be modeled by meshes if you wish though.

Diabolikal49

21-02-2011 17:31:53

Nope, without the "ogre://" part, NxOgre doesn't know what method it should use to get at the file, I just meant "ogre://snookertable_physics.nxs".


I did want to ask something. Why use a mesh for the snooker table? A plane would be easier to simulate and more stable to run. The edges and pockets could be modeled by meshes if you wish though.


The snooker table is supposed to be as realistic as possible, with the pocket curvature and sloping of the pockets being fairly difficult to construct out of normal shapes. I have 2 meshes - the table surface (including pocket holes) and the cushions. I've literally spent 10 minutes playing around with the physics and am delighted with how the collision is working.

betajaen

21-02-2011 18:17:08

Fair enough then.