Caelum::CameraBoundElement Class Reference

A camera-bound element. More...

#include <CameraBoundElement.h>

Inheritance diagram for Caelum::CameraBoundElement:

Caelum::BaseSkyLight Caelum::GroundFog Caelum::ImageStarfield Caelum::PointStarfield Caelum::SkyDome Caelum::Moon Caelum::SphereSun Caelum::SpriteSun

List of all members.

Public Member Functions

 CameraBoundElement ()
 Constructor.
virtual ~CameraBoundElement ()
 Virtual Destructor.
virtual void notifyCameraChanged (Ogre::Camera *cam)=0
 Notify new camera conditions.
void forceFarRadius (Ogre::Real radius)
 Forces the "far" size of the element to a specific radius.
bool getAutoRadius () const
 Checks if this element is in auto-radius mode.
void setAutoRadius ()
 Re-enable auto-radius; if disabled.

Static Public Attributes

static const Ogre::Real CAMERA_FAR_DISTANCE_MULTIPLIER
 Camera distances multiplier for the far clipping distance.
static const Ogre::Real CAMERA_NEAR_DISTANCE_MULTIPLIER = 10
 Camera distances multiplier for the near clipping distance.

Protected Member Functions

virtual void setFarRadius (Ogre::Real radius)
 Abstract method to set the radius for this elements Derived classes should override this and resize their domes.


Detailed Description

A camera-bound element.

This should be used as a base class for domes which follow the camera. It is only meant to be used inside Caelum.

By default this class work in autoradius mode; where it automatically resizes itself for camera near/far clipping radius. It will correctly handle infinite far clip planes.

This is meant to be used with depth_check and depth_write off. Trying to place an object "as far as possible" causes precision troubles; and was removed in version 0.4.

If far clip distance is finite the radius will be (near + far) / 2. If far clip distance is infinite (0) the radius will be 10 * near/

Definition at line 44 of file CameraBoundElement.h.


Constructor & Destructor Documentation

Caelum::CameraBoundElement::CameraBoundElement (  ) 

Constructor.

Sets auto radius to true.

Definition at line 28 of file CameraBoundElement.cpp.


Member Function Documentation

void Caelum::CameraBoundElement::notifyCameraChanged ( Ogre::Camera *  cam  )  [pure virtual]

Notify new camera conditions.

This method notifies that a new camera is about to be used, so this element can follow it or perform other operations. The default implementation calls setRadius if in autoRadius mode.

Parameters:
cam The new camera.

Implemented in Caelum::GroundFog, Caelum::ImageStarfield, Caelum::Moon, Caelum::PointStarfield, Caelum::SkyDome, Caelum::SphereSun, and Caelum::SpriteSun.

Definition at line 37 of file CameraBoundElement.cpp.

References CAMERA_NEAR_DISTANCE_MULTIPLIER, and setFarRadius().

Referenced by Caelum::CaelumSystem::notifyCameraChanged().

void Caelum::CameraBoundElement::forceFarRadius ( Ogre::Real  radius  ) 

Forces the "far" size of the element to a specific radius.

If greater than zero this disables AutoRadius mode and forces a fixed radius. If this is negative or zero the radius is set automatically in notifyCameraChanged.

AutoRadius is turned on by default.

Parameters:
radius The positive radius of the element, or a negative/zero value for AutoRadius mode.

Definition at line 47 of file CameraBoundElement.cpp.

References setFarRadius().

Referenced by setAutoRadius().

bool Caelum::CameraBoundElement::getAutoRadius (  )  const

Checks if this element is in auto-radius mode.

While in autoradius mode the element is automatically resized fit between the near and far radius.

Definition at line 56 of file CameraBoundElement.cpp.

void Caelum::CameraBoundElement::setAutoRadius (  ) 

Re-enable auto-radius; if disabled.

Auto-radius is on by default; but can be disabled. This function can turn it back on.

Definition at line 60 of file CameraBoundElement.cpp.

References forceFarRadius().

void Caelum::CameraBoundElement::setFarRadius ( Ogre::Real  radius  )  [protected, virtual]

Abstract method to set the radius for this elements Derived classes should override this and resize their domes.

The actual radius for the dome is controlled in the base class.

Reimplemented in Caelum::GroundFog, Caelum::ImageStarfield, Caelum::PointStarfield, Caelum::SkyDome, and Caelum::BaseSkyLight.

Definition at line 64 of file CameraBoundElement.cpp.

Referenced by forceFarRadius(), and notifyCameraChanged().


Member Data Documentation

Camera distances multiplier for the far clipping distance.

This threshold will be multiplied with the far clipping distance, if the camera doesn't use an infinite far clipping plane.

Definition at line 95 of file CameraBoundElement.h.

Camera distances multiplier for the near clipping distance.

This threshold will be multiplied with the near clipping distance, if the camera does use an infinite far clipping plane.

Definition at line 101 of file CameraBoundElement.h.

Referenced by notifyCameraChanged().


The documentation for this class was generated from the following files:

Generated on Sun Aug 9 10:24:22 2009 for Caelum by  doxygen 1.5.9