Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes

psTextureFactory Class Reference

This class reads in the xml file defining regions and maintains the preload list of textures. More...

#include <texfactory.h>

List of all members.

Public Member Functions

csPtr< iImage > CreateTextureImage (const char *xmlspec)
 Takes an xml string specifying race textures and part textures, finds the relevant regions and images, and overlays the regions onto the base texture.
bool Initialize (iObjectRegistry *object_reg, const char *xmlfilename)
 This function loads the xml file and cycles through the race tags, calling LoadRace() for each one to parse the region lists.
 psTextureFactory ()
 ~psTextureFactory ()

Protected Member Functions

csPtr< iImage > GetImage (const char *race, const char *filename)
 Returns a pointer to an iImage specified by the race and filename.
psImageRegionGetRegion (const char *race, const char *part)
 Returns a pointer to a race-specific texture region.
bool LoadRace (iDocumentNode *raceNode)
 Loads an XML section of zero or more region tags.

Protected Attributes

csPDelArray< iImage > imagecache
iObjectRegistry * object_reg
csPDelArray< psImageRegionregions

Detailed Description

This class reads in the xml file defining regions and maintains the preload list of textures.

When a new player texture is required, the xml string specifying the parts to be merged is passed to this class and this class fabricates the new texture from it.

Definition at line 41 of file texfactory.h.


Constructor & Destructor Documentation

psTextureFactory::psTextureFactory ( )
psTextureFactory::~psTextureFactory ( )

Member Function Documentation

csPtr<iImage> psTextureFactory::CreateTextureImage ( const char *  xmlspec)

Takes an xml string specifying race textures and part textures, finds the relevant regions and images, and overlays the regions onto the base texture.

If this is all successful, a new iImage ptr is returned to the caller. Otherwise, NULL.

csPtr<iImage> psTextureFactory::GetImage ( const char *  race,
const char *  filename 
) [protected]

Returns a pointer to an iImage specified by the race and filename.

This function searches the existing image file list for the name. If it is found in memory already, the ptr is returned immediately, otherwise the image is loaded, added to the cache list, and returned.

psImageRegion* psTextureFactory::GetRegion ( const char *  race,
const char *  part 
) [protected]

Returns a pointer to a race-specific texture region.

This pointer can be passed into psTextureFactory to overlay the image.

bool psTextureFactory::Initialize ( iObjectRegistry *  object_reg,
const char *  xmlfilename 
)

This function loads the xml file and cycles through the race tags, calling LoadRace() for each one to parse the region lists.

bool psTextureFactory::LoadRace ( iDocumentNode *  raceNode) [protected]

Loads an XML section of zero or more region tags.

Each region is added to the regions list for fast future access.


Member Data Documentation

csPDelArray<iImage> psTextureFactory::imagecache [protected]

Definition at line 48 of file texfactory.h.

iObjectRegistry* psTextureFactory::object_reg [protected]

Definition at line 45 of file texfactory.h.

csPDelArray<psImageRegion> psTextureFactory::regions [protected]

Definition at line 47 of file texfactory.h.


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