CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

iTextureManager Struct Reference
[3D]

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

#include <txtmgr.h>

Inheritance diagram for iTextureManager:

iBase List of all members.

Public Methods

virtual csPtr< iTextureHandleRegisterTexture (iImage *image, int flags)=0
 Register a texture.

virtual csPtr< iTextureHandleRegisterTexture (iImageVector *image, int flags, int target)=0
 Register a texture.

virtual void PrepareTextures ()=0
 After all textures have been added, this function does all needed calculations (palette, lookup tables, mipmaps, ...).

virtual void FreeImages ()=0
 Call this function if you want to release all iImage's as given to this texture manager.

virtual csPtr< iMaterialHandleRegisterMaterial (iMaterial *material)=0
 Register a material.

virtual csPtr< iMaterialHandleRegisterMaterial (iTextureHandle *txthandle)=0
 Register a material based on a texture handle.

virtual void PrepareMaterials ()=0
 Prepare all materials.

virtual void FreeMaterials ()=0
 Call this function if you want to release all iMaterial's as given to this texture manager.

virtual int GetTextureFormat ()=0
 Query the basic format of textures that can be registered with this texture manager.

virtual csPtr< iSuperLightmapCreateSuperLightmap (int width, int height)=0
 Create a new super lightmap with the specified dimensions.

virtual void GetMaxTextureSize (int &w, int &h, int &aspect)=0
 Request maximum texture dimensions.

virtual void GetLightmapRendererCoords (int slmWidth, int slmHeight, int lm_x1, int lm_y1, int lm_x2, int lm_y2, float &lm_u1, float &lm_v1, float &lm_u2, float &lm_v2)=0
 Retrieve the coordinates of a lightmap in the its superlightmap, in a system the renderer uses internally.


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 144 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 void iTextureManager::FreeImages   [pure virtual]
 

Call this function if you want to release all iImage's as given to this texture manager.

After FreeImages() has been called it is no longer allowed to call Prepare() again. So the advantage of calling FreeImages() is that you gain memory (may be a lot) but the disadvantage is that when you want to add textures later you have to reload them all and start all over.

virtual void iTextureManager::FreeMaterials   [pure virtual]
 

Call this function if you want to release all iMaterial's as given to this texture manager.

virtual void iTextureManager::GetLightmapRendererCoords int    slmWidth,
int    slmHeight,
int    lm_x1,
int    lm_y1,
int    lm_x2,
int    lm_y2,
float &    lm_u1,
float &    lm_v1,
float &    lm_u2,
float &    lm_v2
[pure virtual]
 

Retrieve the coordinates of a lightmap in the its superlightmap, in a system the renderer uses internally.

Calculate lightmap U/Vs within this bounds when they are intended to be passed to the renderer.

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 void iTextureManager::PrepareMaterials   [pure virtual]
 

Prepare all materials.

virtual void iTextureManager::PrepareTextures   [pure virtual]
 

After all textures have been added, this function does all needed calculations (palette, lookup tables, mipmaps, ...).

PrepareTextures () must be able to handle being called twice or more without ill effects. Note that it is in this stage that the original image that is attached to a texture is scaled so that it fits hardware requirements. So it is important to realize that calling this function may actually change the images from which you created the textures!

virtual csPtr<iMaterialHandle> iTextureManager::RegisterMaterial iTextureHandle   txthandle [pure virtual]
 

Register a material based on a texture handle.

This is a short-cut to quickly make materials based on a single texture.

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

virtual csPtr<iMaterialHandle> iTextureManager::RegisterMaterial iMaterial   material [pure virtual]
 

Register a material.

The input material is IncRef'd and DecRef'ed later when FreeMaterials () is called or the material handle is destroyed by calling DecRef on it enough times. If you want to keep the input material make sure you have called IncRef yourselves.

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

virtual csPtr<iTextureHandle> iTextureManager::RegisterTexture iImageVector *    image,
int    flags,
int    target
[pure virtual]
 

Register a texture.

The given input image is IncRef'd and DecRef'ed later when FreeImages () is called. 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 (). Finally, if you want to merge the texture into the current environment, you should call txt->Prepare(). Alternatively you can call the PrepareTextures () method to compute a optimal palette and convert all the textures into the internal format.

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

The `flags' contains one or several of CS_TEXTURE_XXX flags OR'ed together. They define the mode texture is going to be used in.

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.

Param target specifies the texture target. Defines for that can be found in ivideo/texture.h

Note! This function will NOT scale the texture to fit hardware restrictions. This is done later when Prepare() is called.

virtual csPtr<iTextureHandle> iTextureManager::RegisterTexture iImage   image,
int    flags
[pure virtual]
 

Register a texture.

The given input image is IncRef'd and DecRef'ed later when FreeImages () is called. 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 (). Finally, if you want to merge the texture into the current environment, you should call txt->Prepare(). Alternatively you can call the PrepareTextures () method to compute a optimal palette and convert all the textures into the internal format.

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

The `flags' contains one or several of CS_TEXTURE_XXX flags OR'ed together. They define the mode texture is going to be used in.

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 when Prepare() is called.


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