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 (c) 2000-2005 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(const Radian& angle); 00079 #ifndef OGRE_FORCE_ANGLE_TYPES 00080 inline void roll(Real angleunits) { 00081 roll ( Angle(angleunits) ); 00082 } 00083 #endif//OGRE_FORCE_ANGLE_TYPES 00084 00087 void pitch(const Radian& angle); 00088 #ifndef OGRE_FORCE_ANGLE_TYPES 00089 inline void pitch(Real angleunits) { 00090 pitch ( Angle(angleunits) ); 00091 } 00092 #endif//OGRE_FORCE_ANGLE_TYPES 00093 00096 void yaw(const Radian& angle); 00097 #ifndef OGRE_FORCE_ANGLE_TYPES 00098 inline void yaw(Real angleunits) { 00099 yaw ( Angle(angleunits) ); 00100 } 00101 #endif//OGRE_FORCE_ANGLE_TYPES 00102 00105 void rotate(const Vector3& axis, const Radian& angle); 00106 #ifndef OGRE_FORCE_ANGLE_TYPES 00107 inline void rotate(const Vector3& axis, Real angleunits) { 00108 rotate ( axis, Angle(angleunits) ); 00109 } 00110 #endif//OGRE_FORCE_ANGLE_TYPES 00111 00114 void rotate(const Quaternion& q); 00115 00116 // ---------------------------------------------- 00117 // The following are methods delegated to Camera 00118 // ---------------------------------------------- 00119 00122 void setProjectionType(ProjectionType pt); 00123 00126 ProjectionType getProjectionType(void) const; 00127 00135 void setPolygonMode(PolygonMode sd); 00136 00139 PolygonMode getPolygonMode(void) const; 00140 00146 void setDirection(Real x, Real y, Real z); 00147 00150 void setDirection(const Vector3& vec); 00151 00152 /* Gets the camera's direction. 00153 */ 00154 Vector3 getDirection(void) const; 00155 00156 00165 void lookAt( const Vector3& targetPoint ); 00178 void lookAt(Real x, Real y, Real z); 00179 00194 void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y ); 00195 00208 void setFOVy(const Radian& fovy); 00209 #ifndef OGRE_FORCE_ANGLE_TYPES 00210 inline void setFOVy(Real fovy) { 00211 setFOVy ( Angle(fovy) ); 00212 } 00213 #endif//OGRE_FORCE_ANGLE_TYPES 00214 00217 const Radian& getFOVy(void) const; 00218 00230 void setNearClipDistance(Real nearDist); 00231 00234 Real getNearClipDistance(void) const; 00235 00252 void setFarClipDistance(Real farDist); 00253 00256 Real getFarClipDistance(void) const; 00257 00266 void setAspectRatio(Real ratio); 00267 00270 Real getAspectRatio(void) const; 00271 00276 const Plane& getFrustumPlane( FrustumPlane plane ); 00277 00289 bool isVisible(const AxisAlignedBox& bound, FrustumPlane* culledBy = 0); 00290 00302 bool isVisible(const Sphere& bound, FrustumPlane* culledBy = 0); 00303 00315 bool isVisible(const Vector3& vert, FrustumPlane* culledBy = 0); 00316 00317 }; 00318 00319 } 00320 00321 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:47 2006