Caelum
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Caelum::PointStarfield Class Reference

Point starfield class. More...

#include <PointStarfield.h>

Inheritance diagram for Caelum::PointStarfield:
Caelum::CameraBoundElement

Classes

struct  Star
 Struct representing one star inside PointStarfield. More...
 

Public Types

typedef std::vector< Star > StarVector
 A vector of Star.
 

Public Member Functions

 PointStarfield (Ogre::SceneManager *sceneMgr, Ogre::SceneNode *caelumRootNode, bool initWithCatalogue=true)
 Constructor. More...
 
virtual ~PointStarfield ()
 Destructor.
 
StarVector & getStarVector ()
 Get a reference to the vector of stars. More...
 
void notifyStarVectorChanged ()
 You must call this if you change the star vector by hand.
 
void clearAllStars ()
 Clear any and all stars.
 
void addRandomStars (int count)
 Add a bunch of random stars.
 
void addStar (const BrightStarCatalogueEntry &entry)
 Add one star from the bright star catalogue.
 
void addBrightStarCatalogue (int count=BrightStarCatalogueSize)
 Add stars from the bright star catalogue. More...
 
void _update (float time)
 Update function; called from CaelumSystem::updateSubcomponents. More...
 
void setMagnitudeScale (Ogre::Real value)
 Magnitude power scale. More...
 
Ogre::Real getMagnitudeScale () const
 
void setMag0PixelSize (Ogre::Real value)
 
Ogre::Real getMag0PixelSize () const
 
void setMinPixelSize (Ogre::Real value)
 
Ogre::Real getMinPixelSize () const
 
void setMaxPixelSize (Ogre::Real value)
 
Ogre::Real getMaxPixelSize () const
 
void setObserverLatitude (Ogre::Degree value)
 
Ogre::Degree getObserverLatitude () const
 
void setObserverLongitude (Ogre::Degree value)
 
Ogre::Degree getObserverLongitude () const
 
Ogre::Degree getObserverPositionRebuildDelta () const
 Moving the observer position around causes a starfield rebuild. More...
 
void setObserverPositionRebuildDelta (Ogre::Degree value)
 
virtual void notifyCameraChanged (Ogre::Camera *cam)
 Handle camera change.
 
void setQueryFlags (uint flags)
 
uint getQueryFlags () const
 
void setVisibilityFlags (uint flags)
 
uint getVisibilityFlags () const
 
- Public Member Functions inherited from Caelum::CameraBoundElement
 CameraBoundElement ()
 Constructor. More...
 
virtual ~CameraBoundElement ()
 Virtual Destructor.
 
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::Degree DEFAULT_OBSERVER_POSITION_REBUILD_DELTA = Ogre::Degree(0.1)
 
static const Ogre::String STARFIELD_MATERIAL_NAME = "Caelum/StarPoint"
 Material used to draw all the points.
 
- Static Public Attributes inherited from Caelum::CameraBoundElement
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 = 10
 Camera distances multiplier for the near clipping distance. More...
 

Protected Member Functions

virtual void setFarRadius (Ogre::Real radius)
 Handle far radius.
 

Detailed Description

Point starfield class.

An Ogre::ManualObject is used for drawing because billboards are too slow.

Stars are sized in pixels; this seems to work a lot better than relative sizes. Stars could be made even smaller but it would require hinting (nudging pixel coordinates to match actual screen pixels). Points are hard.

Loading a bright-star catalogue is supported but star positions are likely only correct relative to each other. External rotation is probably wrong.

Definition at line 60 of file PointStarfield.h.

Constructor & Destructor Documentation

Caelum::PointStarfield::PointStarfield ( Ogre::SceneManager *  sceneMgr,
Ogre::SceneNode *  caelumRootNode,
bool  initWithCatalogue = true 
)

Constructor.

By default this loads some reasonable defaults and the bright star catalogue.

Definition at line 34 of file PointStarfield.cpp.

Member Function Documentation

StarVector& Caelum::PointStarfield::getStarVector ( )
inline

Get a reference to the vector of stars.

You can freely modify this; but you need to updateStars when you're done.

Definition at line 89 of file PointStarfield.h.

void Caelum::PointStarfield::addBrightStarCatalogue ( int  count = BrightStarCatalogueSize)

Add stars from the bright star catalogue.

Parameters
countNumber of stars to add (in order of brightness).

Definition at line 137 of file PointStarfield.cpp.

References Caelum::BrightStarCatalogue, and Caelum::BrightStarCatalogueSize.

void Caelum::PointStarfield::_update ( float  time)

Update function; called from CaelumSystem::updateSubcomponents.

Parameters
timeTime of the day.

Definition at line 259 of file PointStarfield.cpp.

void Caelum::PointStarfield::setMagnitudeScale ( Ogre::Real  value)
inline

Magnitude power scale.

Star magnitudes are logarithming; one magnitude difference means a star is 2.512 times brighter. This property allows tweaking that value.

Definition at line 144 of file PointStarfield.h.

Ogre::Degree Caelum::PointStarfield::getObserverPositionRebuildDelta ( ) const
inline

Moving the observer position around causes a starfield rebuild.

Default value (DEFAULT_OBSERVER_POSITION_REBUILD_DELTA) is 0.1 degrees which is equivalent to around 170 meters on the earth.

This only matters if you compute the observer position every frame. Caelum doesn't contain code for that.

Definition at line 173 of file PointStarfield.h.


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