#include <Texture.h>
Classes | |
class | Sampler |
Public Types | |
enum | Format { UNKNOWN = 0, RGB = GL_RGB, RGBA = GL_RGBA, ALPHA = GL_ALPHA } |
enum | Filter { NEAREST = GL_NEAREST, LINEAR = GL_LINEAR, NEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST, LINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR, LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR } |
enum | Wrap { REPEAT = GL_REPEAT, CLAMP = GL_CLAMP_TO_EDGE } |
enum | Type { TEXTURE_2D = GL_TEXTURE_2D, TEXTURE_CUBE = GL_TEXTURE_CUBE_MAP } |
enum | CubeFace { POSITIVE_X, NEGATIVE_X, POSITIVE_Y, NEGATIVE_Y, POSITIVE_Z, NEGATIVE_Z } |
Public Member Functions | |
void | setData (const unsigned char *data) |
const char * | getPath () const |
Format | getFormat () const |
Type | getType () const |
unsigned int | getWidth () const |
unsigned int | getHeight () const |
void | generateMipmaps () |
bool | isMipmapped () const |
bool | isCompressed () const |
TextureHandle | getHandle () const |
Static Public Member Functions | |
static Texture * | create (const char *path, bool generateMipmaps=false) |
static Texture * | create (Image *image, bool generateMipmaps=false) |
static Texture * | create (Format format, unsigned int width, unsigned int height, const unsigned char *data, bool generateMipmaps=false, Type type=TEXTURE_2D) |
static Texture * | create (TextureHandle handle, int width, int height, Format format=UNKNOWN) |
Defines a standard texture.
Defines a face of a Texture of Type: cube.
Defines the set of supported texture filters.
Defines the set of supported texture formats.
Defines the type of Texture in use.
Defines the set of supported texture wrapping modes.
static Texture* gameplay::Texture::create | ( | const char * | path, |
bool | generateMipmaps = false |
||
) | [static] |
Creates a texture from the given image resource.
Note that for textures that include mipmap data in the source data (such as most compressed textures), the generateMipmaps flags should NOT be set to true.
path | The image resource path. |
generateMipmaps | true to auto-generate a full mipmap chain, false otherwise. |
static Texture* gameplay::Texture::create | ( | Image * | image, |
bool | generateMipmaps = false |
||
) | [static] |
Creates a texture from the given image.
image | The image containing the texture data. |
generateMipmaps | True to generate a full mipmap chain, false otherwise. |
static Texture* gameplay::Texture::create | ( | Format | format, |
unsigned int | width, | ||
unsigned int | height, | ||
const unsigned char * | data, | ||
bool | generateMipmaps = false , |
||
Type | type = TEXTURE_2D |
||
) | [static] |
Creates a texture from the given texture data.
The data in the texture is expected to be tightly packed (no padding at the end of rows).
format | Format of the texture data. |
width | Width of the texture data. If type is TEX_CUBE, then this is the cube face width. |
height | Height of the texture data. If type is TEX_CUBE, then this is the cube face height. |
data | Raw texture data (expected to be tightly packed). If the type parameter is set to TEXTURE_CUBE, then data is expected to be each face stored back contiguously within the array. |
generateMipmaps | True to generate a full mipmap chain, false otherwise. |
type | What type of Texture should be created. |
static Texture* gameplay::Texture::create | ( | TextureHandle | handle, |
int | width, | ||
int | height, | ||
Format | format = UNKNOWN |
||
) | [static] |
Creates a texture object to wrap the specified pre-created native texture handle.
The specified TextureHandle must represent a valid texture that has been created on the underlying renderer and it should not be referenced by any other Texture object. When the returned Texture object is destroyed, the passed in TextureHandle will also be destroyed.
handle | Native texture handle. |
width | The width of the texture represented by 'handle'. |
height | The height of the texture represented by 'handle'. |
format | Optionally, the format of the texture represented by 'handle'. If the format cannot be represented by any of the Texture::Format values, use a value of UNKNOWN. |
void gameplay::Texture::generateMipmaps | ( | ) |
Generates a full mipmap chain for this texture if it isn't already mipmapped.
Format gameplay::Texture::getFormat | ( | ) | const |
Gets the format of the texture.
TextureHandle gameplay::Texture::getHandle | ( | ) | const |
Returns the texture handle.
unsigned int gameplay::Texture::getHeight | ( | ) | const |
Gets the texture height.
const char* gameplay::Texture::getPath | ( | ) | const |
Returns the path that the texture was originally loaded from (if applicable).
Type gameplay::Texture::getType | ( | ) | const |
Gets the texture type.
unsigned int gameplay::Texture::getWidth | ( | ) | const |
Gets the texture width.
bool gameplay::Texture::isCompressed | ( | ) | const |
Determines if this texture is a compressed texture.
bool gameplay::Texture::isMipmapped | ( | ) | const |
Determines if this texture currently contains a full mipmap chain.
void gameplay::Texture::setData | ( | const unsigned char * | data | ) |
Set texture data to replace current texture image.
data | Raw texture data (expected to be tightly packed). If the type parameter is set to TEXTURE_CUBE, then data is expected to be each face stored back contiguously within the array. |