This reference page is linked to from the following overview topics: New Classes and Methods, Low-level Device API.
#include <TextureHandle.h>
This is texture class to support texture for material, such as TextureMaterialHandle.
How to use:
TextureHandlep hTexture; hTexture.Initialize(100, 100, TextureFormatA8R8G8B8); LockedRect lockedRect; hTexture.LockRect(0, lockedRect, NULL); if (NULL != lockedRect.pBits ) { memset(lockedRect.pBits, 0xff, lockedRect.pitch * 100); // fill data to locked address } hTexture.UnlockRect(); TextureMaterialHandle hMaterial; hMaterial.Initialize(); hMaterial.SetTexture(hTexture);
Public Member Functions |
|
GraphicsDriverAPI | TextureHandle () |
GraphicsDriverAPI | TextureHandle (const TextureHandle &from) |
GraphicsDriverAPI TextureHandle & | operator= (const TextureHandle &from) |
virtual GraphicsDriverAPI | ~TextureHandle () |
GraphicsDriverAPI bool | Initialize (size_t width, size_t height, TextureFormat format) |
Initialize the instance of a 2D texture.
|
|
GraphicsDriverAPI bool | Initialize (TextureType type, size_t width, size_t height, size_t depth, size_t slice, size_t mipmaplevels, TextureFormat format, ResourceUsage usage) |
Initialize the instance of specified type
texture. |
|
GraphicsDriverAPI bool | Initialize (const MSTR &filename) |
Initialize the instance of texture from
file. |
|
GraphicsDriverAPI TextureFormat | GetFormat () const |
Gets the format of texture. |
|
GraphicsDriverAPI bool | WriteOnlyLockRectangle (UINT subTargetIndex, LockedRect &lockedRect, CONST RECT *pRectangle) |
locking the Texture Target makes the target
writable. |
|
GraphicsDriverAPI bool | WriteOnlyUnlockRectangle () |
Unlocks a rectangle on a texture resource.
|
|
GraphicsDriverAPI size_t | GetSubTargetCount () |
Get number of sub-targets. |
|
GraphicsDriverAPI TargetHandle | GetSubTarget (size_t subIndex) |
Get sub target of the texture. |
GraphicsDriverAPI TextureHandle | ( | ) |
GraphicsDriverAPI TextureHandle | ( | const TextureHandle & | from | ) |
virtual GraphicsDriverAPI ~TextureHandle | ( | ) | [virtual] |
GraphicsDriverAPI TextureHandle& operator= | ( | const TextureHandle & | from | ) |
GraphicsDriverAPI bool Initialize | ( | size_t | width, |
size_t | height, | ||
TextureFormat | format | ||
) |
Initialize the instance of a 2D texture.
A TextureHandle should be initialized before it's used
[in] | width | the width of texture. |
[in] | height | the height of texture. |
[in] | format | member of the TextureFormat enumerated type, describing the pixel format of the texture. |
GraphicsDriverAPI bool Initialize | ( | TextureType | type, |
size_t | width, | ||
size_t | height, | ||
size_t | depth, | ||
size_t | slice, | ||
size_t | mipmaplevels, | ||
TextureFormat | format, | ||
ResourceUsage | usage | ||
) |
Initialize the instance of specified type texture.
A TextureHandle should be initialized before it's used
[in] | type | type of the texture |
[in] | width | the width of texture. |
[in] | height | the height of texture. |
[in] | depth | the depth of texture. Used for volume texture. |
[in] | slice | number of sub textures. Used for texture array in DX11. For single texture, specify "1". DX9 ignores this parameter. |
[in] | mipmap | level number of texture. If this value is zero, a complete mipmap chain is created. |
[in] | format | member of the TextureFormat enumerated type, describing the pixel format of the texture. |
[in] | usage | resource usage of the texture |
GraphicsDriverAPI bool Initialize | ( | const MSTR & | filename | ) |
Initialize the instance of texture from file.
A TextureHandle should be initialized before it's used.
[in] | filename | filename of the texture. Supported format: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. |
GraphicsDriverAPI TextureFormat GetFormat | ( | ) | const |
GraphicsDriverAPI bool WriteOnlyLockRectangle | ( | UINT | subTargetIndex, |
LockedRect & | lockedRect, | ||
CONST RECT * | pRectangle | ||
) |
locking the Texture Target makes the target writable.
When a developer has finished writing to the target they should always call Unlock.
[in] | subTargetIndex | it specifies the index of sub-target in the cube texture to lock. For non-cube texture, use 0. |
[out] | lockedRect | store the returned locked rectangle information. |
[in] | pRectangle | pointer to a rectangle to lock. Specified by a pointer to a RECT structure. Specifying NULL for this parameter expands the dirty region to cover the entire texture. |
GraphicsDriverAPI bool WriteOnlyUnlockRectangle | ( | ) |
Unlocks a rectangle on a texture resource.
GraphicsDriverAPI size_t GetSubTargetCount | ( | ) |
Get number of sub-targets.
GraphicsDriverAPI TargetHandle GetSubTarget | ( | size_t | subIndex | ) |
Get sub target of the texture.
For standard 1D, 2D, 3D texture, only "0" is valid. For cube texture, valid value is 0-5. For Volume texture, valid value depends on creation parameter.
[in] | subIndex | sub target index |