CrystalSpace

Public API Reference

iTextureManager Struct Reference
[3D]

This is the standard texture manager interface. More...

#include <ivideo/txtmgr.h>

Inheritance diagram for iTextureManager:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual csPtr
< iSuperLightmap
CreateSuperLightmap (int width, int height)=0
 Create a new super lightmap with the specified dimensions.
virtual csPtr
< iTextureHandle
CreateTexture (int w, int h, csImageType imagetype, const char *format, int flags, iString *fail_reason=0)=0
 Create a new texture with the given texture format.
virtual void GetMaxTextureSize (int &w, int &h, int &aspect)=0
 Request maximum texture dimensions.
virtual int GetTextureFormat ()=0
 Query the basic format of textures that can be registered with this texture manager.
virtual csPtr
< iTextureHandle
RegisterTexture (iImage *image, int flags, iString *fail_reason=0)=0
 Register a texture.


Detailed Description

This is the standard texture manager interface.

A 3D rasterizer will have to implement a subclass of this one and return a pointer to it in Graphics3D. This class is responsible for receiving all textures from the 3D engine, converting them to an internal format if needed, calculating a palette if needed, and calculating all lookup tables related to the textures. Mipmap creation is also done in this class.

Main creators of instances implementing this interface:

Main ways to get pointers to this interface:

Definition at line 167 of file txtmgr.h.


Member Function Documentation

virtual csPtr<iSuperLightmap> iTextureManager::CreateSuperLightmap ( int  width,
int  height 
) [pure virtual]

Create a new super lightmap with the specified dimensions.

virtual csPtr<iTextureHandle> iTextureManager::CreateTexture ( int  w,
int  h,
csImageType  imagetype,
const char *  format,
int  flags,
iString fail_reason = 0 
) [pure virtual]

Create a new texture with the given texture format.

Parameters:
w Horizontal size of the texture.
h Vertical size of the texture.
imagetype Type of the image.
format A texture format string.
flags Contains one or several of CS_TEXTURE_XXX flags OR'ed together. They define the mode texture is going to be used in.
fail_reason An optional string which will be filled with the reason for failure if there was a failure.
Returns:
A new texture handle or 0 if the texture couldn't be created for some reason. The reason will be put in the optional fail_reason parameter.
See also:
Texture format strings

virtual void iTextureManager::GetMaxTextureSize ( int &  w,
int &  h,
int &  aspect 
) [pure virtual]

Request maximum texture dimensions.

virtual int iTextureManager::GetTextureFormat (  )  [pure virtual]

Query the basic format of textures that can be registered with this texture manager.

It is very likely that the texture manager will reject the texture if it is in an improper format. The alpha channel is optional; the texture can have it and can not have it. Only the bits that fit the CS_IMGFMT_MASK mask matters.

virtual csPtr<iTextureHandle> iTextureManager::RegisterTexture ( iImage image,
int  flags,
iString fail_reason = 0 
) [pure virtual]

Register a texture.

The given input image is IncRef'd and DecRef'ed later when no longer needed. If you want to keep the input image make sure you have called IncRef yourselves.

The texture is not converted immediately. Instead, you can make intermediate calls to iTextureHandle::SetKeyColor ().

This function returns a handle which should be given to the 3D rasterizer or 2D driver when drawing or otherwise using the texture.

The texture manager will reject the texture if it is an inappropiate format (see GetTextureFormat () method).

The texture is unregistered at destruction, i.e. as soon as the last reference to the texture handle is released.

Note! This function will NOT scale the texture to fit hardware restrictions. This is done later before texture is first used.

Parameters:
image is the source image.
flags contains one or several of CS_TEXTURE_XXX flags OR'ed together. They define the mode texture is going to be used in.
fail_reason is an optional string which will be filled with the reason for failure if there was a failure.
Returns:
a new texture handle or 0 if the texture couldn't be created for some reason. The reason will be put in the optional 'fail_reason' parameter.


The documentation for this struct was generated from the following file:
Generated for Crystal Space 1.2.1 by doxygen 1.5.3