csTextureHandle Class Reference
This class is the top-level representation of a texture. More...
#include <csplugincommon/render3d/txtmgr.h>
Inheritance diagram for csTextureHandle:
Public Member Functions | |
void | AdjustSizePo2 (int width, int height, int depth, int &newwidth, int &newheight, int &newdepth) |
Adjusts the textures size, to ensure some restrictions like power of two dimension are met. | |
virtual bool | GetAlphaMap () |
Query if the texture has an alpha channel. | |
virtual csAlphaMode::AlphaType | GetAlphaType () const |
Get the type of alpha associated with the texture. | |
int | GetFlags () const |
--------------------- iTextureHandle implementation ---------------------- | |
virtual void | GetKeyColor (uint8 &r, uint8 &g, uint8 &b) const |
Get the transparent color. | |
virtual bool | GetKeyColor () const |
Get the transparent status (false if no transparency, true if transparency). | |
virtual void * | GetPrivateObject () |
Get the csTextureHandle object associated with the texture handle. | |
virtual const char * | GetTextureClass () |
Get the "class" of a texture. | |
virtual void | SetAlphaType (csAlphaMode::AlphaType alphaType) |
Set the type of alpha associated with the texture. | |
virtual void | SetKeyColor (uint8 red, uint8 green, uint8 blue) |
Set the transparent color. | |
virtual void | SetKeyColor (bool Enable) |
Enable transparent color. | |
virtual void | SetTextureClass (const char *className) |
Set the "class" of this texture. | |
Static Public Member Functions | |
static void | CalculateNextBestPo2Size (int flags, const int orgDim, int &newDim) |
Given a texture width and height, it tries to 'guesstimate' the po2 size that causes the least quality reduction: it calculates how many rows/columns would be added/removed when sizing up/down, and takes the one with the smaller number. | |
Protected Attributes | |
csAlphaMode::AlphaType | alphaType |
int | flags |
Texture usage flags: 2d/3d/etc. | |
csStringID | texClass |
csRef< csTextureManager > | texman |
Parent texture manager. | |
bool | transp |
Does color 0 mean "transparent" for this texture? | |
csRGBpixel | transp_color |
The transparent color. |
Detailed Description
This class is the top-level representation of a texture.It contains a number of csTexture objects that represents each a single image. A csTexture object is created for each mipmap and for the 2D texture. This class is responsible for creating these textures and filling them with the correct info. The csTextureHandle class is private to the 3D driver, the driver clients see just the iTextureHandle interface.
The handle is initialized by giving the 3D driver a iImage object. Later the renderer will create mipmaps and 2D textures are created. The texture manager will release its reference to the image when no longer needed.
Definition at line 60 of file txtmgr.h.
Member Function Documentation
void csTextureHandle::AdjustSizePo2 | ( | int | width, | |
int | height, | |||
int | depth, | |||
int & | newwidth, | |||
int & | newheight, | |||
int & | newdepth | |||
) |
Adjusts the textures size, to ensure some restrictions like power of two dimension are met.
static void csTextureHandle::CalculateNextBestPo2Size | ( | int | flags, | |
const int | orgDim, | |||
int & | newDim | |||
) | [static] |
Given a texture width and height, it tries to 'guesstimate' the po2 size that causes the least quality reduction: it calculates how many rows/columns would be added/removed when sizing up/down, and takes the one with the smaller number.
In case of a tie, it'll size up.
virtual bool csTextureHandle::GetAlphaMap | ( | ) | [inline, virtual] |
Query if the texture has an alpha channel.
This depends both on whenever the original image had an alpha channel and of the fact whenever the renderer supports alpha maps at all.
Implements iTextureHandle.
virtual csAlphaMode::AlphaType csTextureHandle::GetAlphaType | ( | ) | const [inline, virtual] |
int csTextureHandle::GetFlags | ( | ) | const [inline, virtual] |
--------------------- iTextureHandle implementation ----------------------
Implements iTextureHandle.
virtual bool csTextureHandle::GetKeyColor | ( | ) | const [virtual] |
Get the transparent status (false if no transparency, true if transparency).
Implements iTextureHandle.
virtual void* csTextureHandle::GetPrivateObject | ( | ) | [inline, virtual] |
virtual const char* csTextureHandle::GetTextureClass | ( | ) | [virtual] |
virtual void csTextureHandle::SetAlphaType | ( | csAlphaMode::AlphaType | alphaType | ) | [inline, virtual] |
Set the type of alpha associated with the texture.
Usually, the alpha mode is auto-detected (alphaSmooth on images with alpha channels, alphaBinary on keycolored images, alphaNone otherwise), but can be overridden with this method.
Implements iTextureHandle.
virtual void csTextureHandle::SetKeyColor | ( | bool | Enable | ) | [virtual] |
virtual void csTextureHandle::SetTextureClass | ( | const char * | className | ) | [virtual] |
Set the "class" of this texture.
A texture class is used to set some characteristics on how a texture is handled at runtime. For example, graphics hardware usually offers texture compression, but it can cause a loss of quality and precision and thus may not be desireable for all data. In this case, a class can be set on the texture that instructs the renderer to not apply texture compression.
- Remarks:
- Not all renderers may support texture classes.
- See also:
- GetTextureClass
Implements iTextureHandle.
Member Data Documentation
int csTextureHandle::flags [protected] |
csRef<csTextureManager> csTextureHandle::texman [protected] |
bool csTextureHandle::transp [protected] |
csRGBpixel csTextureHandle::transp_color [protected] |
The documentation for this class was generated from the following file:
- csplugincommon/render3d/txtmgr.h
Generated for Crystal Space by doxygen 1.4.7