LMTS-MeshFileLoader update (version1.3)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
alelink
Posts: 52
Joined: Tue Jan 20, 2004 8:32 pm
Location: Italy
Contact:

Post 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
alelink
Posts: 52
Joined: Tue Jan 20, 2004 8:32 pm
Location: Italy
Contact:

Post 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
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post 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.
It is like it is. And because it is like it is, things are like they are.
alelink
Posts: 52
Joined: Tue Jan 20, 2004 8:32 pm
Location: Italy
Contact:

Post by alelink »

tryed...and not working...
sorry
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

What is the last thing your app prints out? "tex path loaded"?
It is like it is. And because it is like it is, things are like they are.
alelink
Posts: 52
Joined: Tue Jan 20, 2004 8:32 pm
Location: Italy
Contact:

Post 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++?
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post 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.
It is like it is. And because it is like it is, things are like they are.
alelink
Posts: 52
Joined: Tue Jan 20, 2004 8:32 pm
Location: Italy
Contact:

Post 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.
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post 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...
It is like it is. And because it is like it is, things are like they are.
alelink
Posts: 52
Joined: Tue Jan 20, 2004 8:32 pm
Location: Italy
Contact:

Post 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....
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post 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 :) )
It is like it is. And because it is like it is, things are like they are.
alelink
Posts: 52
Joined: Tue Jan 20, 2004 8:32 pm
Location: Italy
Contact:

Post 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
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post 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. :)
It is like it is. And because it is like it is, things are like they are.
alelink
Posts: 52
Joined: Tue Jan 20, 2004 8:32 pm
Location: Italy
Contact:

Post by alelink »

Great!
and THANKS TO YOU for this usefull loader.
:D
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

It is like it is. And because it is like it is, things are like they are.
Post Reply