Caelum  0.6.3
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Caelum::CameraBoundElement Class Referenceabstract

A camera-bound element. More...

#include <CameraBoundElement.h>

Inheritance diagram for Caelum::CameraBoundElement:
Inheritance graph
[legend]

Public Member Functions

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

Static Public Attributes

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

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. More...
 

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/

Constructor & Destructor Documentation

Caelum::CameraBoundElement::CameraBoundElement ( )

Constructor.

Sets auto radius to true.

Member Function Documentation

virtual 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
camThe new camera.

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

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
radiusThe positive radius of the element, or a negative/zero value for AutoRadius mode.
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.

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.

virtual void Caelum::CameraBoundElement::setFarRadius ( Ogre::Real  radius)
protectedvirtual

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::PointStarfield, Caelum::GroundFog, Caelum::BaseSkyLight, Caelum::SkyDome, and Caelum::ImageStarfield.

Member Data Documentation

const Ogre::Real Caelum::CameraBoundElement::CAMERA_FAR_DISTANCE_MULTIPLIER
static

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.

const Ogre::Real Caelum::CameraBoundElement::CAMERA_NEAR_DISTANCE_MULTIPLIER
static

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.


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