Browse files

From Sebastian Messerschmidt, "Seems like your re-factoring didn't re…

…ally produces the correct results.

You can check with the tester2.flt provided earlier and check with the result image.
I double checked this with OpenFlight creator, and it seems the yaw is broken.

With my initial quaternion version is seems correct and if I change the


float cos_yaw = cosf(osg::inDegrees(yaw));
float sin_yaw = sinf(osg::inDegrees(yaw));

to be
float cos_yaw = cosf(osg::inDegrees(-yaw));
float sin_yaw = sinf(osg::inDegrees(-yaw));

it seems to work as well."
  • Loading branch information...
1 parent 89fb1f4 commit eb4d5dc7115294bad94fb555415eb4774691a41b @osg-training-guest osg-training-guest committed Aug 1, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/osgPlugins/OpenFlight/PrimaryRecords.cpp
View
8 src/osgPlugins/OpenFlight/PrimaryRecords.cpp
@@ -12,7 +12,7 @@
*/
//
-// OpenFlight® loader for OpenSceneGraph
+// OpenFlight loader for OpenSceneGraph
//
// Copyright (C) 2005-2007 Brede Johansen
//
@@ -1030,9 +1030,9 @@ class LightSource : public PrimaryRecord
if ((w==0.0) || (light->getSpotCutoff()<180.0))
{
// assume yaw is zero along y axis, increase positive clockwise
- // assume patch is zero along xy plane, increase positive upwards
- float cos_yaw = cosf(osg::inDegrees(yaw));
- float sin_yaw = sinf(osg::inDegrees(yaw));
+ // assume pitch is zero along xy plane, increase positive upwards
+ float cos_yaw = cosf(osg::inDegrees(-yaw));
+ float sin_yaw = sinf(osg::inDegrees(-yaw));
float cos_pitch = cosf(osg::inDegrees(pitch));
float sin_pitch = sinf(osg::inDegrees(pitch));
light->setDirection(osg::Vec3(sin_yaw*cos_pitch, cos_yaw*cos_pitch, sin_pitch));

0 comments on commit eb4d5dc

Please sign in to comment.