Page 2 of 3

Posted: Wed Mar 02, 2005 11:44 pm
by alelink
Hi Jox,
first: thanks for reply.

my app simply crashes when loading lmts mesh.
I post some code with the lmts section:

Code: Select all

//lmts
    io::IFileSystem* fs = irrDevice->getFileSystem();
    scene::CLMTSMeshFileLoader* lmts_loader = new scene::CLMTSMeshFileLoader(fs, driver);
	sceneMgr->addExternalMeshLoader(lmts_loader);
	lmts_loader->setTexturePath("lmtsSample\\");
	printf("tex path loaded\n");
	scene::IAnimatedMesh* mesh = sceneMgr->getMesh("lmtsSample\\prova2.2.lmts");
	printf("map loaded\n");
	scene::IAnimatedMeshSceneNode* node = sceneMgr->addAnimatedMeshSceneNode( mesh );
please let me know something,
I need a better static mesh loader for irrlicht.
thanks
Alelink

Posted: Thu Mar 03, 2005 8:41 pm
by alelink
Hi Jox,
I've notice that if the lmts file I would to load doesn't exists,
my app doesn't crash, but your loader advise about this.

thanks again

Posted: Thu Mar 03, 2005 10:06 pm
by jox
@aelink: one thing: You should only load "*.3.lmts" files into irrlicht (note the 3). The ones with 1 or 2 are not final lmts meshes. Maybe this solves the problem already.

Posted: Thu Mar 03, 2005 11:47 pm
by alelink
tryed...and not working...
sorry

Posted: Fri Mar 04, 2005 12:12 am
by jox
What is the last thing your app prints out? "tex path loaded"?

Posted: Fri Mar 04, 2005 9:45 pm
by alelink
yes,
I've buyed Visual C++ .net standard 2002, it will arrive to me in 2 weeks,
so I'll try with it.
It's strange... anyone tryed the LMTS loader succesfully with Devc++?

Posted: Fri Mar 04, 2005 11:22 pm
by jox
Can't you debug with Devc++? If you can set break points, then try to find out at what point (in the loader) it crashes. Try to isolate the spot.

Another method is: put debug messages all over the place in the lmts-loader code and see what is the last that gets printed out before the crash.

Posted: Sat Mar 05, 2005 1:54 pm
by alelink
Hi Jox,
the problem is in the constructMesh() method, at line 260
there's :

Code: Select all

i<(NumTextures * NumLightMap)
in the for cycle that is equal to 0 zero for me;
both NumTextures and NumLightMap are equal to zero.

Posted: Sat Mar 05, 2005 8:01 pm
by jox
Mh, strange. Try to put the following in the createMesh method after reading the header ("file->read(&Header, sizeof(SLMTSHeader));" before the texture comment ("// TEXTURES"):

Code: Select all

std::cerr << "------------------" << std::endl;
std::cerr << "MagicID=" << Header.MagicID << std::endl;
std::cerr << "Version=" << Header.Version << std::endl;
std::cerr << "HeaderSize=" << Header.HeaderSize << std::endl;
std::cerr << "TextureCount=" << Header.TextureCount << std::endl;
std::cerr << "SubsetCount=" << Header.SubsetCount << std::endl;
std::cerr << "TriangleCount=" << Header.TriangleCount << std::endl;
std::cerr << "------------------" << std::endl;
return NULL;
and see what gets outputted...

Posted: Sun Mar 06, 2005 11:59 am
by alelink
this code prints this output:
MagicID: 1398033740
version: 4
HeaderSize: 25
TexCount: 0
SubsetCount: 1
TriangleCount: 2112

2112...as the Rush's album....

Posted: Sun Mar 06, 2005 6:08 pm
by jox
...and 0 as ground zero...

Zero textures. Your mesh has no textures. Both normal textures and lightmap count as texture. Which lmts file is that info for? Please post the same info for the sample map (map.3.lmts). Becasuse this one definitely has textures.

My docs say: "The mesh must have at least one texture and one lightmap". I think I should update the loader to handle zero textures. But in the end it doesn't make really sense to have lmts files without textures because you use lmts for lightmaps, and lightmaps without textures won't work...

(but of course it does make sense to have the app don't crash with zero textures :) )

Posted: Mon Mar 07, 2005 4:19 pm
by alelink
Hi Jox,
in the map.3.lmts file the textures are 22, so this is'nt the problem.
May app still crash in the 2 for cycle starting at line 296 in constructMesh() method.
So, have you tryed with 0.8 irrlicht version, or only 0.7?
Maybe an interface changes...don't know...


Thanks

Posted: Mon Mar 07, 2005 6:03 pm
by jox
Ok, I found the problem and fixed it! There were 2 things. First, if a subset in a lmts files has no texture or lightmap it gets the number 65535 (0xFFFF). Second my loading routine didn't handle this correctly. I'll release a new version a little later. Theoretically it should then also be possible to load lmts files without any texture.

In the next version I'll also get rid of the cerr's and use the irrlicht Logger. For that the constructor of the loader will change. The Irrlicht device will have to be passed as (the only) parameter.

Thanks alelink for supporting the bug-hunt. :)

Posted: Mon Mar 07, 2005 6:38 pm
by alelink
Great!
and THANKS TO YOU for this usefull loader.
:D

Posted: Sat Mar 12, 2005 6:46 pm
by jox