[BloodyMess] Load a Mesh using MeshManager

peeman

30-04-2009 15:49:53

I am trying to use a mesh or a heighfield to create terrain. So I tried to load a mesh, or even an heighfield, but it breaks on running

I just do this simple code:

NxOgre::HeightField* northLondon = NxOgre::HeightFieldManager::getSingleton()->load("teste.xhf");
NxOgre::Mesh* meshTest = NxOgre::MeshManager::getSingleton()->load("landscape.mesh");


It breaks here: (Mesh* MeshManager::load - nxogremeshmanager.cpp)

Resource* resource = ResourceSystem::getSingleton()->open(ari, NxOgre::Enums::ResourceAccess_ReadOnly);

Do you know Why or can I solve it?

Thanks*

betajaen

30-04-2009 16:24:43

You haven't given an archive name in your ArchiveResourceIdentifier in the first line.

It should be something like;

NxOgre::HeightField* northLondon = NxOgre::HeightFieldManager::getSingleton()->load("media:teste.xhf");

Where media is the name of the archive that you created earlier.

peeman

30-04-2009 16:49:04

I tried that, and its still breaking. I include the media folder and although tried to put all the path "C:\OgreSDK\media\teste.xhf"
Anything works!

betajaen

30-04-2009 17:42:25

The full path won't work.

Just to clarify, you have, these lines of code in your application in the right order?

ResourceSystem::getSingleton()->openArchive("media", "file:C:\OgreSDK\media\");
NxOgre::HeightField* teste = NxOgre::HeightFieldManager::getSingleton()->load("media:teste.xhf");


If so. Can you copy and paste what NxOgre says when it throws an error in the console window?

peeman

01-05-2009 01:30:07

I only do
NxOgre::HeightField* teste = NxOgre::HeightFieldManager::getSingleton()->load("media:teste.xhf");

The thing you said I dont do, you already do it when you do this load.
ResourceSystem::getSingleton()->openArchive("media", "file:C:\OgreSDK\media\");

Unhandled exception at 0x011d38b6 (NxOgre_Debug.dll)

It breaks exactly here:
nxogrearray.h (ln 694)

return TRead::size(_T);

betajaen

01-05-2009 09:43:45

The thing you said I dont do, you already do it when you do this load.
ResourceSystem::getSingleton()->openArchive("media", "file:C:\OgreSDK\media\");

Unhandled exception at 0x011d38b6 (NxOgre_Debug.dll)

It breaks exactly here:
nxogrearray.h (ln 694)

return TRead::size(_T);



I really don't understand what you mean. Do you have that line of code in your application or not. Because you do need an archive for NxOgre to know where your file is, and what protocol to use. That error there indicates that the file wasn't opened or the file-size is zero. Most likely the former.

spacegaier

01-05-2009 10:23:05

You need these two lines in the same order as betajaen told you:
ResourceSystem::getSingleton()->openArchive("media", "file:C:\OgreSDK\media\");
NxOgre::HeightField* hf = NxOgre::HeightFieldManager::getSingleton()->load("media:teste.xhf");


In the first one, you tell NxOgre a archive (a folder in this case) from which you later want to load data and connect it with some kind of alias ("media"). From this line on, you can now use "media" to tell NxOgre via "media:my_file.xhf", from which archive the data should be taken.

With some more lines, your Heightfield is working then:
HeightFieldGeometry* hfg = new HeightFieldGeometry(hf, Real3(1000, 10, 1000));
hfg->mTerrainCentering = Enums::TerrainCentering_CenterAbove;
m_pScene->createSceneGeometry(hfg);

peeman

01-05-2009 15:50:05

I understand what you are saying! I'm only doing this:

NxOgre::ResourceSystem::getSingleton()->openArchive("media", "file:C:\OgreSDK\media");

And it breaks here: (nxogrearray.h - ln 473)

_T = other._T;

Now what am I doing wrong? the path exists!

spacegaier

01-05-2009 16:34:43

Ahh..try to use "/" instead of "\" .

peeman

01-05-2009 17:03:12

Not working! :S

betajaen

01-05-2009 17:29:39

Let's go over this one more time.

You have a file that is more than 0 bytes created by flour in a directory somewhere?

In your source code, you have two lines similar to this (note the direction of slashes) in the correct order but not necessarily together?

NxOgre::ResourceSystem::getSingleton()->openArchive("media", "file:C:/OgreSDK/media/");
NxOgre::HeightField* hf = NxOgre::HeightFieldManager::getSingleton()->load("media:myFile.xhf");

peeman

01-05-2009 17:49:13

Yes, exactly like that!
And it breaks where I told you!

spacegaier

01-05-2009 18:02:59

Could you temporarily upload the files created by Flour so we can check whether they are valid?

peeman

01-05-2009 18:14:26

I Can, but the problem isn't the load, it seems that the problem start when I open the archive.
But you can also check if the file is correct or not please. I have uploaded.

ladybird87

02-06-2010 14:25:13

I have a same problem in the load of terrain (fail when execute de program).

Any sugestion to resolv this problem?

tks