LMTSFileLoader (lightmaps in Irrlicht)
i think i found an error in the loader.
from the docs:
so you have to ignore those.
i fixed it by adding
after
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() !!
from the docs:
Code: Select all
(*) If no texture or lightmap is used the index value is 0xFFFF.
i fixed it by adding
Code: Select all
if(Subsets[i].TextID1 != 0xFFFF && Subsets[i].TextID2 != 0xFFFF) {
Code: Select all
for (i=0; i<Header.SubsetCount; i++) {
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() !!
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
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
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...)
-Press the "compile and run" button (F9)
-Enjoy
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
-did you use Version 1.1 of the CLMTSMeshFileLoader that Jox released?I only got the weird textures problem.
-did you resaved (using photoshop, Irfanview or another program) the .tga files as Jox said?
I didn't test it but I think it would work, because both bsp and lmts maps are only loaded as simple meshes...And I still got my final question, will collision work on lmts files?
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...
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...