camera = smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,0,0)); // add camera
node = smgr->addCubeSceneNode();
node->setMaterialTexture(0,driver->getTexture("lvl1.bmp"));
ILightSceneNode* light1 = smgr->addLightSceneNode(0,vector3df(-1.f,0.f,0.f));
light1->getLightData().Type = ELT_DIRECTIONAL;
The problem is that only the Apfelbaum Renderer renders correctly (light coming from the "left"), oGL/d3d8/d3d9 all light the front (no matter what values I enter for the position).
Directional light has no position. Up to now, Irrlicht used the position to calculate a direction from it. You must change it in the SLight structure, though.
The next release will use the position and rotation of the LightSceneNode.
Please read the API for 1.4. It says that you are not supposed to change the position and direction of the SLight structure anymore. You have to position and rotate the LightSceneNode to do this! So since directional light does not care for positions you simply rotate the node such that the positive z-axis points into your desired direction. But it might be also a good idea to change the position to let everyone know that the light is quite far away.
hybrid wrote:Please read the API for 1.4. It says that you are not supposed to change the position and direction of the SLight structure anymore. You have to position and rotate the LightSceneNode to do this! So since directional light does not care for positions you simply rotate the node such that the positive z-axis points into your desired direction. But it might be also a good idea to change the position to let everyone know that the light is quite far away.
Looking at the API for LightSceneNode, it says:
"You can switch the light on and off by making it visible or not, and let it be animated by ordinary scene node animators. If you set the light type to be directional, you will need to set the direction of the light source manually in the SLight structure, the position of the scene node will have no effect on this direction."
Hmm, the docs seems to have gone with the wind. All information about the light direction is and position is lost. I'll update it for the next release.