The center isn't stored in the matrix, of course. Once the matrix is
constructed, the center could be any random point along the view direction
vector. You'll need to specify an eye distance, or scale the value yourself.
   -Paul
 


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Renan
Mendes
Sent: Monday, October 27, 2008 7:46 AM
To: OSG Mailing List
Subject: [osg-users] setViewMatrixAsLook at and getViewMatrixAsLookAt


Hi,

     I am using these two methods: setViewMatrixAsLookAt(eye, center, up)
and getViewMatrixAsLookAt(&eye, &center, &up) with the viewer's camera in
this order and WITHOUT manipulating the camera elsewhere in my code. I don't
have much experience with OSG but isn't the last method supposed to return
in the eye, center and up objects the same parameters that I have used to
set the view matrix before? I've made a simple test:

    viewer.getCamera()->setViewMatrixAsLookAt(osg::Vec3f(10., -10., 2.),
osg::Vec3f(0., 0., 0.), osg::Z_AXIS);
    
    osg::Vec3f eye;
    osg::Vec3f center;
    osg::Vec3f up;
    viewer.getCamera()->getViewMatrixAsLookAt(eye, center, up);

    cout << "eye " << eye.x() << " " << eye.y() << " " << eye.z() << endl;
    cout << "center " << center.x() << " " << center.y() << " " <<
center.z() << endl;
    cout << "up " << up.x() << " " << up.y() << " " << up.z() << endl;

    And what I've got from the cout's was:

    eye: 10 -10 2 (OK)
    center: 9.29986 -9.29986 1.85997
    up: -0.0990148 0.0990148 0.990148

    What am I doing wrong here? Did I misunderstand the purpose of the
method?

               Renan M Z Mendes


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

Reply via email to