/*
Another type of picking supported by the Irrlicht Engine is scene node picking
based on bouding boxes. Every scene node has got a bounding box, and because of
that, it's very fast for example to get the scene node which the camera looks
at. Again, we ask the collision manager for this, and if we've got a scene node,
we highlight it by disabling Lighting in its material, if it is not the
billboard or the quake 3 level.
*/
selectedSceneNode = smgr->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera);
if (lastSelectedSceneNode)
lastSelectedSceneNode->setMaterialFlag(video::EMF_LIGHTING, true);
if (selectedSceneNode == q3node || selectedSceneNode == bill)
selectedSceneNode = 0;
if (selectedSceneNode)
selectedSceneNode->setMaterialFlag(video::EMF_LIGHTING, false);
lastSelectedSceneNode = selectedSceneNode;
/*
That's it, we just have to finish drawing.
*/
Not really met the intention of that code
It handles the effect which is desired to mark the mesh the camera view's center is pointing on (i.e. the view straight ahead). First it gets the eselcted node. Then it disables lighting on the previously selected node (if there was one, lighting toggle is the mean to show the selected node). Then it avoids to select the static level and the flying billboard. If there is still a selected node it disables lighting (and thereby highlights the node, although it sounds weird). And finally it stores the highlighted node to disbale lighting later on.
If the texture is lighted only the light strength will define how dark/lit the texture is. If lighting is off the texture will be completely visible and show with the texture colors without darkening. That's why it looks highlighted (the light in the example is somewhat farther away, and the back is always unlit with light being enabled).
it was basically done to simulate the tutorial that a ray frm the screen is send to the 3d space and is hittin an object... if its collidin then lit the object so that the user can understand that this is the object thats gettin hit by the camera ray... just a tut to make u understand the ray collision... thats all..