Page 2 of 4
Posted: Fri Jul 30, 2004 9:24 am
by Guest
could someone please post the sourcecode for loading the samplemap?..i always get a windows-error when trying to run my app for loading the lmts file :/
Posted: Fri Jul 30, 2004 11:57 am
by mm765
i think i found an error in the loader.
from the docs:
Code: Select all
(*) If no texture or lightmap is used the index value is 0xFFFF.
so you have to ignore those.
i fixed it by adding
Code: Select all
if(Subsets[i].TextID1 != 0xFFFF && Subsets[i].TextID2 != 0xFFFF) {
after
Code: Select all
for (i=0; i<Header.SubsetCount; i++) {
in the constructMesh method in CLMTSMeshFileLoader.cpp.
I dont know if this is correct but it helps for now so that at least the map.3.lmts from the samples works. map.1.lmts at least doesnt crash anymore. though it doesnt display anything (here).
p.s.: dont forget to add the closing } for the if() !!
Posted: Sat Jul 31, 2004 3:40 am
by afecelis
Jox:
Would it be possible to get a more step-by-step tutorial on how to add your .cpp and .h files to my project?
I tried to do it following the instructions but then I didn't know if I had to add the files to my project or copy them into Irrlicht's source and recompile the dll, etc etc etc.
In other words, a tut for the newbiest of the noobs... like me!!!
ps. Creating the lightmaps was no problem, I only had problems in Irrlicht.
thnx
Gracias Jox, perdona todo el problema en que te pongo pero me parece que tu lightmapper esta de p... madre! te felicito. Espero poder utilizarlo como alternativa en nuestro proyecto, Goretek. Un saludo
Posted: Sat Jul 31, 2004 3:45 am
by afecelis
Jox, sorry for the Spanish part, I thought you were Lord Trancos. Anyway, the need for the tut is still there!

Posted: Sat Jul 31, 2004 2:15 pm
by nitroman
afecelis:
it's not very difficult... you don't need to recompile the dll because it is an external loader.
this is how I did it (I'm a newbe too) with dev-cpp:
-create a folder for your work
-just copy the CLMTSMeshFileLoader.cpp and CLMTSMeshFileLoader.h to this folder.
-Create a subfolder inside your work folder called Map . Copy your lmts map and the textures inside.
-open dev-cpp and create a new empty project.
-Configure your project as you do for other Irrlicht projects. (Go to the project options (alt+p), in the Parameters tab, in the linker part add -lIrrlicht -ljpeg -lz you can also put -s in the linker to stip the size of your executable. In the C++ compiler add -O2 to enable optimizations (-O3 is supposed to be better, but I sometime get problems))
-create a new souce file. Save it to something.cpp . Add the following code:
(sorry if the comments are in french...

Anyway there is nothing complicated...)
Code: Select all
//loader de map lmts avec Irrlicht
//par Benoit Plante (nitroman)
#include <irrlicht.h>
#include "CLMTSMeshFileLoader.h"
//Les namespaces utilisés par Irrlicht
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
//la fonction main()
int main()
{
//création du moteur graphique
IrrlichtDevice *moteur =
createDevice(EDT_OPENGL, //utilisation de opengl
dimension2d<s32>(800, 600), //dimensions de la fenêtre
32, //résolution (bits)
true, //mode fullscreen
false, //stencil buffer
0); //event
//Titre de la fenêtre
moteur -> setWindowCaption(L"Irrlicht ");
//pointeurs vers le driveur, le Scene Manager et le GUI
IVideoDriver* driver = moteur->getVideoDriver();
ISceneManager* s_manager = moteur->getSceneManager();
IFileSystem* fs = moteur->getFileSystem();
//paramètre de Qualité
driver->setTextureCreationFlag(video::ETCF_OPTIMIZED_FOR_QUALITY, true);
//Ajouter le module de chargement de map lmts
scene::CLMTSMeshFileLoader* lmts_loader = new scene::CLMTSMeshFileLoader(fs, driver);
s_manager->addExternalMeshLoader(lmts_loader);
//dossier contenant les textures
lmts_loader->setTexturePath("map\\");
//charger la map
IAnimatedMesh* mesh = s_manager->getMesh("map\\map.3.lmts");
//ajouter la map à la scène
IAnimatedMeshSceneNode* node = s_manager->addAnimatedMeshSceneNode( mesh );
//Ajouter une caméra
scene::ICameraSceneNode* camera = s_manager -> addCameraSceneNodeFPS();
camera->setFOV(3.1415f/2.0f);
//effacer le curseur
moteur->getCursorControl()->setVisible(false);
//boucle principale
while(moteur->run())
{
//effacer l'écran
driver -> beginScene(true, true, SColor(200,10,10,100));
//tout dessiner
s_manager -> drawAll();
//gui_env -> drawAll();
//afficher à l'écran
driver -> endScene();
}
//le programme se termine
//destruction du moteur
moteur -> drop();
return 0;
}
-Press the "compile and run" button (F9)
-Enjoy

Posted: Sat Jul 31, 2004 2:18 pm
by nitroman
also you will surely get errors during the compilation of CLMTSMeshFileLoader.cpp because the compiler can't find "os.h"
check my previous post in this page to know how I fixed this... I just changed <os.h> to <iostream> and added using namespace std;
not very difficult...
Hope it helps!

Posted: Sat Jul 31, 2004 4:13 pm
by afecelis
merci Nitroman!
I'll give it a try now.
One last q, will colision work when loading lmts files?
Posted: Sat Jul 31, 2004 5:10 pm
by afecelis
I placed everything as you told me, added all the necesary files, paths are ok, it compiles ok but I get the following message on the Irrlicht window:
Could not load mesh, file format seems to be unsupported: data\level.3.lmts
I'm using data as my folder instead of "map"
any ideas?
Posted: Sat Jul 31, 2004 5:54 pm
by afecelis
Sorry Nitroman, my bad! I was using the wrong dll. I replaced it and it worked!
I only got the weird textures problem. Gonna resave them to see if they get corrected.
And I still got my final question, will collision work on lmts files?
cheers!
Posted: Sat Jul 31, 2004 7:07 pm
by nitroman
I only got the weird textures problem.
-did you use Version 1.1 of the CLMTSMeshFileLoader that Jox released?
-did you resaved (using photoshop, Irfanview or another program) the .tga files as Jox said?
And I still got my final question, will collision work on lmts files?
I didn't test it but I think it would work, because both bsp and lmts maps are only loaded as simple meshes...
Posted: Sat Jul 31, 2004 7:19 pm
by nitroman
I started to read the collision example source...
I will test it...
maybe we should use addOctTreeSceneNode at the place of addAnimatedMeshSceneNode in my source code to load the map...
I think it's the only difference...
then we need to create a triangle selector as the tutorial explained...
It should work...
I will give you an answer in a few hours...
Posted: Sat Jul 31, 2004 7:39 pm
by afecelis
yep, I resaved my tgas. If I don't, textures don't even show up. And yup, I got version 1.1 of the loader but I'm still getting weird lightmaps:
Pulsar tools view:
Irrlicht:
dunno
Meanwhile I'll also try to add collision detection.
Ps. do you get colored lights to work as well?
Posted: Sat Jul 31, 2004 7:41 pm
by Fussel
did you try:
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT,true);
or
driver->setTextureCreationFlag(video::ETCF_OPTIMIZED_FOR_QUALITY, true);
Posted: Sat Jul 31, 2004 7:53 pm
by afecelis
indeed
I'm going to re-check the files I used to see if they're version 1.0 or 1.1
brb
Posted: Sat Jul 31, 2004 8:13 pm
by nitroman
strange... I don't have this problem...
did you try to load the sample map? Do you get the same problem?