I've only been working with the Irrlicht engine for about two weeks, and I havent done any programming for about two years, so I'm pretty rusty.
What I'm making isn't a game, as such. It's more like an interactive floorplan. All I need is a camera I can walk arround with, in a completely static environment.
I'm loading in *.obj files exported from Maya with addAnimatedMeshSceneNode:
Code: Select all
IAnimatedMesh* mesh = smgr->getMesh("plan1.obj");
ground = smgr->addAnimatedMeshSceneNode(mesh);
ground->setMaterialType(EMT_SOLID);
No reason really. I was just looking at the examples when I started, and I don't have time to change it now.
Anyways...
To be able to load the texture with the corresponding *.mtl file, I had to erase "-s 0.05 0.05" from in front of every *.jpg that was listed in the file, otherwise Irrlicht tries to load a texture called -s etc.
So that's the background, now for the trouble...
I'm having trouble lighting the geometry.
If I turn lighting of "ground->setMaterialFlag(EMF_LIGHTING, false);" I can see the textures, but nothing, of course, has any depth.
When I turn lighting on, I can't see the textures. I only see a greyscale world!?
This is how I flip the lightswitch:
Code: Select all
ground->setMaterialFlag(EMF_LIGHTING, true);"
...
ILightSceneNode* sun = smgr->addLightSceneNode(ground, vector3df(0,15,0), SColorf(2.0f, 2.0f, 2.0f), 40.0f, 1);
SLight& sunData = sun->getLightData();
sunData.Type = ELT_POINT;
sunData.CastShadows = true;
sunData.DiffuseColor = SColorf(0, 0, 0);
...
//Back- and Z-Buffer is on
driver->beginScene(true, true, SColor(255, 160, 160, 160));
What am I doing wrong?
Do I need to fix the *.mtl file some more? or specify the meshmaterial manually somehow?
Speedy help appreciated, as It's due next Monday
Thnx