00001 /* 00002 This file is part of Caelum. 00003 See http://www.ogre3d.org/wiki/index.php/Caelum 00004 00005 Copyright (c) 2006-2007 Caelum team. See Contributors.txt for details. 00006 00007 Caelum is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License as published 00009 by the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 Caelum is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with Caelum. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #include "CaelumPrecompiled.h" 00022 #include "CameraBoundElement.h" 00023 00024 namespace caelum { 00025 const Ogre::Real CameraBoundElement::CAMERA_FAR_DISTANCE_MULTIPLIER = 0.99; 00026 00027 const Ogre::Real CameraBoundElement::CAMERA_NEAR_DISTANCE_MULTIPLIER = 50; 00028 00029 CameraBoundElement::CameraBoundElement(): mAutoRadius(true) { 00030 } 00031 00032 void CameraBoundElement::notifyCameraChanged (Ogre::Camera *cam) { 00033 if (mAutoRadius) { 00034 if (cam->getFarClipDistance () > 0) { 00035 setFarRadius(cam->getFarClipDistance () * CAMERA_FAR_DISTANCE_MULTIPLIER); 00036 } else { 00037 setFarRadius(cam->getNearClipDistance () * CAMERA_NEAR_DISTANCE_MULTIPLIER); 00038 } 00039 } 00040 } 00041 00042 void CameraBoundElement::forceFarRadius (Ogre::Real radius) { 00043 if (radius > 0) { 00044 mAutoRadius = false; 00045 setFarRadius(radius); 00046 } else { 00047 mAutoRadius = true; 00048 } 00049 } 00050 00051 bool CameraBoundElement::getAutoRadius () const { 00052 return mAutoRadius; 00053 } 00054 00055 void CameraBoundElement::setFarRadius(Ogre::Real radius) { 00056 // Pass 00057 } 00058 00059 } // namespace caelum