libProcTer::CParentMap< T > Class Template Reference

#include <cparentmap.h>

List of all members.

Public Member Functions

 CParentMap (const CGridPosition &pos, const CTileSurface *const *parents, CTileSurface::eTextureType type)
T * getLandel (int x, int y)

Protected Attributes

CMap< T > * m_Maps [4]
 The map pointers.
pixel shift (child scale) of the child origin w.r.t. m_Maps[0]
unsigned int m_dx
unsigned int m_dy

Detailed Description

template<typename T>
class libProcTer::CParentMap< T >

Convenience class for accessing map data of parent surfaces.

This class can be used in derived classes of CTileSurface, when landscape generation is to be based on map data of parent surfaces. This class accepts pointers to the parent surfaces, and translates pixel coordinates between the different levels to return the correct pixel value from the parent maps.

Constructor & Destructor Documentation

template<typename T >
libProcTer::CParentMap< T >::CParentMap ( const CGridPosition pos,
const CTileSurface *const *  parents,
CTileSurface::eTextureType  type 
) [inline]


pos The grid position of the child tile. Can typically be obtained with CTileSurface::getPosition().
parents Array of pointers to the four parents. Can typically be obtained with CTileSurface::getParents().
type The type of surface that is used. CParentMap calls CTileSurface::getInternalMap on the parent surfaces to get pointers to the map data. As it needs to do some type-unsafe pointer conversions, the user of CParentMap is responsible for making sure that the template type of CParentMap corresponds to the actual data type of the map data in the parents.

Member Function Documentation

template<typename T >
T * libProcTer::CParentMap< T >::getLandel ( int  x,
int  y 
) [inline]

Returns a pointer to the landel ('pixel') in the parent maps that corresponds to the child map coordinates (x,y).

The range of allowed values for x and y is [-PROCTER_TEX_RES, 2*PROCTER_TEX_RES).

As the parent maps have half the resolution of the child map, x and y should be even. If they are not, they are rounded down (e.g. 3 is interpreted as 2, and -1 is interpreted as -2).

Member Data Documentation

template<typename T >
CMap<T>* libProcTer::CParentMap< T >::m_Maps[4] [protected]

The map pointers.

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