Caelum
CameraBoundElement.cpp
1 /*
2 This file is part of Caelum.
3 See http://www.ogre3d.org/wiki/index.php/Caelum
4 
5 Copyright (c) 2006-2008 Caelum team. See Contributors.txt for details.
6 
7 Caelum is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Caelum is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with Caelum. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #include "CaelumPrecompiled.h"
22 #include "CameraBoundElement.h"
23 
24 namespace Caelum
25 {
27 
29  mAutoRadius(true)
30  {
31  }
32 
34  {
35  }
36 
37  void CameraBoundElement::notifyCameraChanged (Ogre::Camera *cam) {
38  if (mAutoRadius) {
39  if (cam->getFarClipDistance () > 0) {
40  setFarRadius((cam->getFarClipDistance () + cam->getNearClipDistance ()) / 2);
41  } else {
42  setFarRadius(cam->getNearClipDistance () * CAMERA_NEAR_DISTANCE_MULTIPLIER);
43  }
44  }
45  }
46 
47  void CameraBoundElement::forceFarRadius (Ogre::Real radius) {
48  if (radius > 0) {
49  mAutoRadius = false;
50  setFarRadius(radius);
51  } else {
52  mAutoRadius = true;
53  }
54  }
55 
57  return mAutoRadius;
58  }
59 
61  forceFarRadius (-1);
62  }
63 
64  void CameraBoundElement::setFarRadius(Ogre::Real radius) {
65  }
66 }
void forceFarRadius(Ogre::Real radius)
Forces the "far" size of the element to a specific radius.
virtual void notifyCameraChanged(Ogre::Camera *cam)=0
Notify new camera conditions.
static const Ogre::Real CAMERA_NEAR_DISTANCE_MULTIPLIER
Camera distances multiplier for the near clipping distance.
virtual ~CameraBoundElement()
Virtual Destructor.
void setAutoRadius()
Re-enable auto-radius; if disabled.
bool getAutoRadius() const
Checks if this element is in auto-radius mode.
virtual void setFarRadius(Ogre::Real radius)
Abstract method to set the radius for this elements Derived classes should override this and resize t...
Caelum namespace.
Definition: Astronomy.cpp:24