00001 /* 00002 This file is part of Caelum. 00003 See http://www.ogre3d.org/wiki/index.php/Caelum 00004 00005 Copyright (c) 2006-2008 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 { 00026 const Ogre::Real CameraBoundElement::CAMERA_NEAR_DISTANCE_MULTIPLIER = 10; 00027 00028 CameraBoundElement::CameraBoundElement(): 00029 mAutoRadius(true) 00030 { 00031 } 00032 00033 CameraBoundElement::~CameraBoundElement() 00034 { 00035 } 00036 00037 void CameraBoundElement::notifyCameraChanged (Ogre::Camera *cam) { 00038 if (mAutoRadius) { 00039 if (cam->getFarClipDistance () > 0) { 00040 setFarRadius((cam->getFarClipDistance () + cam->getNearClipDistance ()) / 2); 00041 } else { 00042 setFarRadius(cam->getNearClipDistance () * CAMERA_NEAR_DISTANCE_MULTIPLIER); 00043 } 00044 } 00045 } 00046 00047 void CameraBoundElement::forceFarRadius (Ogre::Real radius) { 00048 if (radius > 0) { 00049 mAutoRadius = false; 00050 setFarRadius(radius); 00051 } else { 00052 mAutoRadius = true; 00053 } 00054 } 00055 00056 bool CameraBoundElement::getAutoRadius () const { 00057 return mAutoRadius; 00058 } 00059 00060 void CameraBoundElement::setAutoRadius () { 00061 forceFarRadius (-1); 00062 } 00063 00064 void CameraBoundElement::setFarRadius(Ogre::Real radius) { 00065 } 00066 }