root/OpenSceneGraph/trunk/src/osg/CameraView.cpp @ 13041

Revision 13041, 1.5 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13#include <osg/CameraView>
14
15using namespace osg;
16
17CameraView::CameraView():
18    _fieldOfView(60.0),
19    _fieldOfViewMode(VERTICAL),
20    _focalLength(0.0)
21{
22}
23
24bool CameraView::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
25{
26    if (_referenceFrame==RELATIVE_RF)
27    {
28        matrix.preMultTranslate(_position);
29        matrix.preMultRotate(_attitude);
30    }
31    else // absolute
32    {
33        matrix.makeRotate(_attitude);
34        matrix.postMultTranslate(_position);
35    }
36    return true;
37}
38
39
40bool CameraView::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
41{
42    if (_referenceFrame==RELATIVE_RF)
43    {
44        matrix.postMultTranslate(-_position);
45        matrix.postMultRotate(_attitude.inverse());
46    }
47    else // absolute
48    {
49        matrix.makeRotate(_attitude.inverse());
50        matrix.preMultTranslate(-_position);
51    }
52    return true;
53}
Note: See TracBrowser for help on using the browser.