libProcTer::CPlanet Class Reference

#include <cplanet.h>

List of all members.

Public Member Functions

 CPlanet (double radius)
virtual ~CPlanet ()
double getRadius () const
CTileManager * getTileManager ()
 Used internally in libProcTer.
void update ()
virtual CTileSurfacecreateSurface (const CGridPosition &pos, CTileSurface **parents) const =0

Public Attributes

std::vector< CCameraContextm_Contexts

Detailed Description

CJP <>
This is the planet base-class of libProcTer. If you want to integrate libProcTer in an application, you should make a derived class from this.

As a minimum, your derived class should implement the createSurface method. Your derived class might also be an appropriate place for rendering code. libProcTer makes no assumptions on what rendering target you use, so it's up to you to implement the translation from libProcter's mesh structures to your target platform (OpenGL, DirectX or whatever you like).

Constructor & Destructor Documentation

libProcTer::CPlanet::CPlanet ( double  radius  ) 


radius the radius of the planet, in meters.

virtual libProcTer::CPlanet::~CPlanet (  )  [virtual]


Member Function Documentation

virtual CTileSurface* libProcTer::CPlanet::createSurface ( const CGridPosition pos,
CTileSurface **  parents 
) const [pure virtual]

libProcTer calls this function to create new surface tiles. You should provide your own implementation in a derived class.

When implementing this function, please be aware that libProcTer might call it from a different thread than the one that created the CPlanet object. In case you wish to share resources with the main thread, take the proper precautions to create thread-safety. For instance, use the CCriticalSection class when appropriate.

libProcTer calls this function in two situations:

In other cases, surfaces are loaded by the overloaded implementation of CTileSurface::createChildSurface of the parent tile.

pos The grid position of the surface tile. This is the position of the lower left corner of the tile. This can usually be passed directly to the CTileSurface constructor.
parents The four parent surfaces of this surface. This can usually be passed directly to the CTileSurface constructor.
A pointer to a new CTileSurface object. The object should be allocated with the 'new' statement. The returned object should already be loaded by calling CTileSurface::load before returning it.

double libProcTer::CPlanet::getRadius (  )  const [inline]

the radius of the planet, in meters.

CTileManager* libProcTer::CPlanet::getTileManager (  )  [inline]

Used internally in libProcTer.

void libProcTer::CPlanet::update (  ) 

This method to updates the meshes of the planet. You should call this method at regular intervals, to keep the meshes up-to-date. For instance, a typical usage pattern is to call it once in each iteration of the application main loop.

This method reads the positions of all camera contexts in m_Contexts, and updates the meshes in m_Contexts.

See also: m_Contexts

Member Data Documentation

The camera contexts associated to this planet. You can add and remove contexts from here at any time. Make sure that at least one context is present when calling update().

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

Generated on Sun Aug 2 13:23:11 2009 for libprocter by  doxygen 1.5.8