From 46ec50aecbd32f5f79ff23ecdea8091820c9fd2a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 1 Aug 2013 10:04:05 +0000 Subject: [PATCH] From Sebastian Messerschmidt, "Seems like your re-factoring didn't really 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." --- src/osgPlugins/OpenFlight/PrimaryRecords.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/osgPlugins/OpenFlight/PrimaryRecords.cpp b/src/osgPlugins/OpenFlight/PrimaryRecords.cpp index 74de76721..4c72d7f33 100644 --- a/src/osgPlugins/OpenFlight/PrimaryRecords.cpp +++ b/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 @@ protected: 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));