Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

WPCG::WP_TextureManager Class Reference

#include <WP_TextureManager.h>

List of all members.

Public Methods

 ~WP_TextureManager ()
int getTexture (const string &name, void *owner)
bool removeTextures (void *owner)

Static Public Methods

WP_TextureManager * getInstance ()

Public Attributes

bool mipmapping


Detailed Description

this singleton class is used for managing and storing all textures in such a way that only necessary textures are resident and textures are shared between models (objects). It makes use internally of WP_Texture objects. These texture objects are able to generate a texture from the following image formats:
(.bmp), Cut (.cut), Doom flats and textures, Icon (.ico), Jpeg (.jpg, .jpe, .jpeg), Lbm (.lbm), Pcd (.pcd), ZSoft Pcx (.pcx), Pic (.pic), Portable Anymap (.pbm, .pgm, .ppm), Portable Network Graphics (.png), Sgi (.sgi, .bw, .rgb, .rgba), Truevision Targa (.tga) and Tiff (.tif, .tiff) images
Author:
Copyright (C) 2001 W.P. van Paassen peter@paassen.tmfweb.nl
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


Constructor & Destructor Documentation

WPCG::WP_TextureManager::~WP_TextureManager  
 


Member Function Documentation

WP_TextureManager * WPCG::WP_TextureManager::getInstance   [static]
 

this function is used to obtain a pointer to the only instance of this class (singleton)

Returns:
a pointer to the only instance of this class

int WPCG::WP_TextureManager::getTexture const string &    name,
void *    owner
 

this function returns the texture ID (an OpenGL texture ID) belonging to the queried texture. If the texture is currently not maintained by the texture manager, the manager will load it.

Parameters:
name  the name of the texture, for example texture1.bmp or roof.pcs. For now only the 24 bit .bmp and 24 bit compressed/uncompressed .pcx format are supported
owner  a void pointer to the owner of the texture (e.g. an object). This is used to internally keep track of how many objects use a particular texture
Returns:
a texture ID with can be directly used in OpenGL's glBindTexture call, 0 in case of failure

bool WPCG::WP_TextureManager::removeTextures void *    owner
 

this function removes all textures belonging to this object. In fact it only removes this object from the textures' internal owner list. Only if this list is empty, the texture is removed from the texture manager. It should be called when an object is destroyed

Parameters:
owner  a void pointer to an object of which all textures are removed
Returns:
a boolean indicating the success or failure of this function


Member Data Documentation

bool WPCG::WP_TextureManager::mipmapping
 

this boolean indicates if mipmapping should be used for textures


The documentation for this class was generated from the following files:
Generated on Tue Jan 28 20:26:43 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002