00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of the OGRE Reference Application, a layer built 00004 on top of OGRE(Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2003 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef __REFAPP_COLLIDECAMERA_H__ 00026 #define __REFAPP_COLLIDECAMERA_H__ 00027 00028 #include "OgreRefAppPrerequisites.h" 00029 #include "OgreCamera.h" 00030 #include "OgreRefAppApplicationObject.h" 00031 00032 namespace OgreRefApp { 00033 00035 class _OgreRefAppExport CollideCamera : public ApplicationObject 00036 { 00037 protected: 00039 /* Note that I choose to contain Camera rather than subclass because the 00040 multiple inheritence would get very nasty (lots of method name clashes) 00041 and it's better that we can hide a few non-relevant methods this way. 00042 ApplicationObject needs to be the top-level interface anyway. */ 00043 Camera *mCamera; 00045 void setUp(const String& name); 00047 void nearDistChanged(void); 00048 public: 00049 CollideCamera(const String& name); 00050 00052 Camera* getRealCamera(void) { return mCamera; } 00053 00054 // ---------------------------------------------- 00055 // Overridden methods from ApplicationObject 00056 // Note that we position the camera using the node 00057 // But we orient the camera on it's own rotation 00058 // ---------------------------------------------- 00059 00062 void _notifyCollided(SceneQuery::WorldFragment* wf, const CollisionInfo& info); 00064 void setOrientation(const Quaternion& orientation); 00066 const Quaternion& getOrientation(void); 00067 00075 void translate(const Vector3& d); 00078 void roll(Real angleunits); 00079 00082 void pitch(Real angleunits); 00083 00086 void yaw(Real angleunits); 00087 00090 void rotate(const Vector3& axis, Real angleunits); 00091 00094 void rotate(const Quaternion& q); 00095 00096 // ---------------------------------------------- 00097 // The following are methods delegated to Camera 00098 // ---------------------------------------------- 00099 00102 void setProjectionType(ProjectionType pt); 00103 00106 ProjectionType getProjectionType(void) const; 00107 00115 void setDetailLevel(SceneDetailLevel sd); 00116 00119 SceneDetailLevel getDetailLevel(void) const; 00120 00126 void setDirection(Real x, Real y, Real z); 00127 00130 void setDirection(const Vector3& vec); 00131 00132 /* Gets the camera's direction. 00133 */ 00134 Vector3 getDirection(void) const; 00135 00136 00145 void lookAt( const Vector3& targetPoint ); 00158 void lookAt(Real x, Real y, Real z); 00159 00174 void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y ); 00175 00188 void setFOVy(Real fovy); 00189 00192 Real getFOVy(void) const; 00193 00205 void setNearClipDistance(Real nearDist); 00206 00209 Real getNearClipDistance(void) const; 00210 00227 void setFarClipDistance(Real farDist); 00228 00231 Real getFarClipDistance(void) const; 00232 00241 void setAspectRatio(Real ratio); 00242 00245 Real getAspectRatio(void) const; 00246 00251 const Plane& getFrustumPlane( FrustumPlane plane ); 00252 00264 bool isVisible(const AxisAlignedBox& bound, FrustumPlane* culledBy = 0); 00265 00277 bool isVisible(const Sphere& bound, FrustumPlane* culledBy = 0); 00278 00290 bool isVisible(const Vector3& vert, FrustumPlane* culledBy = 0); 00291 00292 }; 00293 00294 } 00295 00296 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:24 2004