#include <txtmgr.h>
Inheritance diagram for iTextureManager:
Public Methods | |
virtual iTextureHandle* | RegisterTexture (iImage *image, int flags)=0 |
Register a texture. More... | |
virtual void | UnregisterTexture (iTextureHandle *texhand)=0 |
Unregister texture. More... | |
virtual void | PrepareTextures ()=0 |
After all textures have been added, this function does all needed calculations (palette, lookup tables, mipmaps, ...). More... | |
virtual void | FreeImages ()=0 |
Call this function if you want to release all iImage's as given to this texture manager. More... | |
virtual iMaterialHandle* | RegisterMaterial (iMaterial *material)=0 |
Register a material. More... | |
virtual iMaterialHandle* | RegisterMaterial (iTextureHandle *txthandle)=0 |
Register a material based on a texture handle. More... | |
virtual void | UnregisterMaterial (iMaterialHandle *mathand)=0 |
Unregister material. More... | |
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 void | ResetPalette ()=0 |
Reset all reserved colors in palette. More... | |
virtual void | ReserveColor (int r, int g, int b)=0 |
Reserve RGB. More... | |
virtual int | FindRGB (int r, int g, int b)=0 |
Return a color. More... | |
virtual void | SetPalette ()=0 |
Switch to the new palette. More... | |
virtual void | SetVerbose (bool vb)=0 |
Set verbose mode on/off. More... | |
virtual int | GetTextureFormat ()=0 |
Query the basic format of textures that can be registered with this texture manager. More... |
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.
|
Return a color. Find the color in palette and return the palette index that contains the nearest color. For 15-, 16- and 32-bit modes this returns a encoded RGB color as needed by both 2D and 3D drivers. |
|
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. |
|
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. |
|
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. |
|
Register a material based on a texture handle. This is a short-cut to quickly make materials based on a single texture. |
|
Register a material. The input material wrapper 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. |
|
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). |
|
Reserve RGB. Call this function to reserve a color from the palette (if any). This function only takes effect after the next call to Prepare (). Note that black (0) and white (255) are already preallocated colors. |
|
Reset all reserved colors in palette. This function should be called if you want to reverse the effect of all ReserveColor() calls. The function will have effect on next call to PrepareTextures (). |
|
Switch to the new palette. This function should be called after you called the PrepareTextures() method which will compute a optimal palette for all textures. Of course, it is not neccessarily to call it directly after PrepareTextures() but you should call it before using any texture, otherwise they will look garbled. |
|
Set verbose mode on/off. In verbose mode, texture manager will Printf() through the system driver during all initialization and preparation operations. |
|
Unregister material. Remember, if you use these, you MUST have a reference on the handle. Release your reference after unregistering |
|
Unregister texture. Remember, if you use this, you MUST have a reference on the handle. Release your reference after unregistering |