Revision: 1727 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1727&view=rev Author: rorlifter Date: 2011-03-03 03:18:57 +0000 (Thu, 03 Mar 2011)
Log Message: ----------- Secton: videocamera - fixed camera yaw orientating to frustrum Modified Paths: -------------- trunk/source/main/gfx/vidcam.cpp Modified: trunk/source/main/gfx/vidcam.cpp =================================================================== --- trunk/source/main/gfx/vidcam.cpp 2011-03-02 21:04:40 UTC (rev 1726) +++ trunk/source/main/gfx/vidcam.cpp 2011-03-03 03:18:57 UTC (rev 1727) @@ -73,7 +73,7 @@ if (cammode != -1) { - // flip the image left<>right to have a mirror and not a cam + // flip the image left<>right to have a mirror and not a cameraimage mat->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureUScale (-1); } @@ -113,8 +113,16 @@ // cammode 1 = mirror if (cammode == 1) { + //avoid the camera roll ( camup orientates to frustrum by default rotating the cam related to truck yaw ) + Vector3 rol=truck->nodes[truck->cameranodepos[0]].smoothpos - truck->nodes[truck->cameranoderoll[0]].smoothpos; + rol.normalise(); + Vector3 dir=truck->nodes[truck->cameranodepos[0]].smoothpos - truck->nodes[truck->cameranodedir[0]].smoothpos; + Vector3 truckupright = dir.crossProduct(-rol); + mVidCam->setFixedYawAxis(true, truckupright); + //rotate the normal of the mirror by user rotation setting so it reflects correct ( easy truck file setup ) normal = rotation * normal; + // merge camera direction and reflect it on our plane mVidCam->setDirection((pos - mCamera->getPosition()).reflect(normal)); } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ Rigsofrods-devel mailing list Rigsofrods-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel