Hi

When I tested airport lighting with OpenSceneGraph, the directional light did 
not work the way I expected.
The light was visible a bit outside the defined sector. Especially for the PAPI 
(Precision Approach Path Indicator),
it is important that the angles are correct.

After rewriting a small piece of code in osgSim/Sector.cpp it seemed to work as 
I wanted.

The change made was in the function computeMatrix() as shown below.

void DirectionalSector::computeMatrix()
{
  double heading = atan2(_direction[0], _direction[1]);
  double pitch   = atan2(_direction[2], sqrt(_direction[0]*_direction[0] + 
_direction[1]*_direction[1]));
  double roll    = _rollAngle;

  _local_to_LP = osg::Matrixd::identity();
  _local_to_LP.preMult(osg::Matrix::rotate(heading, 0.0, 0.0, -1.0));
  _local_to_LP.preMult(osg::Matrix::rotate(pitch, 1.0, 0.0, 0.0));
  _local_to_LP.preMult(osg::Matrix::rotate(roll, 0.0, 1.0, 0.0));
}

I am certainly not sure if this change is correct in all aspects, but it solved 
at least the problem for me.

Has anyone else discovered similar problem about light points?

Regards,
Lars Nilsson

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to