00001 /****************************************************************************** 00002 * This file is part of the Gluon Development Platform 00003 * Copyright (C) 2008 Rivo Laks <rivolaks@hot.ee> 00004 * Copyright (C) 2008 Sacha Schutz <istdasklar@free.fr> 00005 * Copyright (C) 2008 Olivier Gueudelot <gueudelotolive@gmail.com> 00006 * Copyright (C) 2008 Charles Huet <packadal@gmail.com> 00007 * Copyright (c) 2010 Arjen Hiemstra <ahiemstra@heimr.nl> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #include "camera.h" 00025 #include <math.h> 00026 00027 #include <core/debughelper.h> 00028 #include "frustrum.h" 00029 #include "engine.h" 00030 #include "viewport.h" 00031 00032 using namespace GluonGraphics; 00033 00034 class Camera::CameraPrivate 00035 { 00036 public: 00037 Frustrum* frustrum; 00038 QMatrix4x4 viewMatrix; 00039 }; 00040 00041 Camera::Camera( QObject* parent ) 00042 : QObject( parent ), 00043 d( new CameraPrivate ) 00044 { 00045 d->frustrum = new Frustrum; 00046 } 00047 00048 Camera::Camera( Frustrum* frustum, QObject* parent ) 00049 : QObject( parent ), 00050 d( new CameraPrivate ) 00051 { 00052 d->frustrum = frustum; 00053 } 00054 00055 Camera::~Camera() 00056 { 00057 delete d; 00058 } 00059 00060 Frustrum* 00061 Camera::frustrum() 00062 { 00063 return d->frustrum; 00064 } 00065 00066 QMatrix4x4 00067 Camera::viewMatrix() 00068 { 00069 return d->viewMatrix; 00070 } 00071 00072 void 00073 Camera::setFrustrum( Frustrum* frustrum ) 00074 { 00075 d->frustrum = frustrum; 00076 } 00077 00078 void 00079 Camera::setViewMatrix( const QMatrix4x4& matrix ) 00080 { 00081 d->viewMatrix = matrix; 00082 } 00083 00084 #include "camera.moc"