Cocos2d-x  4.0.0
Public Member Functions | List of all members
Texture2DBackend Class Referenceabstract

A 2D texture. More...

Inherits TextureBackend.

Inherited by Texture2DGL, and TextureMTL.

Public Member Functions

virtual void updateData (uint8_t *data, std::size_t width, std::size_t height, std::size_t level)=0
 Update a two-dimensional texture image.
 
virtual void updateCompressedData (uint8_t *data, std::size_t width, std::size_t height, std::size_t dataLen, std::size_t level)=0
 Update a two-dimensional texture image in a compressed format.
 
virtual void updateSubData (std::size_t xoffset, std::size_t yoffset, std::size_t width, std::size_t height, std::size_t level, uint8_t *data)=0
 Update a two-dimensional texture subimage.
 
virtual void updateCompressedSubData (std::size_t xoffset, std::size_t yoffset, std::size_t width, std::size_t height, std::size_t dataLen, std::size_t level, uint8_t *data)=0
 Update a two-dimensional texture subimage in a compressed format.
 
std::size_t getWidth () const
 Get texture width.
 
std::size_t getHeight () const
 Get texture height.
 
- Public Member Functions inherited from TextureBackend
virtual void updateSamplerDescriptor (const SamplerDescriptor &sampler)=0
 Update sampler.
 
virtual void getBytes (std::size_t x, std::size_t y, std::size_t width, std::size_t height, bool flipImage, std::function< void(const unsigned char *, std::size_t, std::size_t)> callback)=0
 Read a block of pixels from the drawable texture.
 
virtual void generateMipmaps ()=0
 Generate mipmaps.
 
virtual void updateTextureDescriptor (const TextureDescriptor &descriptor)
 Update texture description.
 
PixelFormat getTextureFormat () const
 Get texture format.
 
TextureUsage getTextureUsage () const
 Get texture usage.
 
TextureType getTextureType () const
 Get texture type.
 
bool hasMipmaps () const
 Check if mipmap had generated before.
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership.
 
void release ()
 Releases the ownership immediately.
 
Refautorelease ()
 Releases the ownership sometime soon automatically.
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count.
 
virtual ~Ref ()
 Destructor.
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

A 2D texture.

Member Function Documentation

virtual void updateData ( uint8_t *  data,
std::size_t  width,
std::size_t  height,
std::size_t  level 
)
pure virtual

Update a two-dimensional texture image.

Parameters
dataSpecifies a pointer to the image data in memory.
widthSpecifies the width of the texture image.
heightSpecifies the height of the texture image.
levelSpecifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

Implemented in Texture2DGL, and TextureMTL.

virtual void updateCompressedData ( uint8_t *  data,
std::size_t  width,
std::size_t  height,
std::size_t  dataLen,
std::size_t  level 
)
pure virtual

Update a two-dimensional texture image in a compressed format.

Parameters
dataSpecifies a pointer to the compressed image data in memory.
widthSpecifies the width of the texture image.
heightSpecifies the height of the texture image.
dataLenSpecifies the totoal size of compressed image in bytes.
levelSpecifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

Implemented in Texture2DGL, and TextureMTL.

virtual void updateSubData ( std::size_t  xoffset,
std::size_t  yoffset,
std::size_t  width,
std::size_t  height,
std::size_t  level,
uint8_t *  data 
)
pure virtual

Update a two-dimensional texture subimage.

Parameters
xoffsetSpecifies a texel offset in the x direction within the texture array.
yoffsetSpecifies a texel offset in the y direction within the texture array.
widthSpecifies the width of the texture subimage.
heightSpecifies the height of the texture subimage.
levelSpecifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.
dataSpecifies a pointer to the image data in memory.

Implemented in Texture2DGL, and TextureMTL.

virtual void updateCompressedSubData ( std::size_t  xoffset,
std::size_t  yoffset,
std::size_t  width,
std::size_t  height,
std::size_t  dataLen,
std::size_t  level,
uint8_t *  data 
)
pure virtual

Update a two-dimensional texture subimage in a compressed format.

Parameters
xoffsetSpecifies a texel offset in the x direction within the texture array.
yoffsetSpecifies a texel offset in the y direction within the texture array.
widthSpecifies the width of the texture subimage.
heightSpecifies the height of the texture subimage.
dataLenSpecifies the totoal size of compressed subimage in bytes.
levelSpecifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.
dataSpecifies a pointer to the compressed image data in memory.

Implemented in Texture2DGL, and TextureMTL.

std::size_t getWidth ( ) const
inline

Get texture width.

Returns
Texture width.
std::size_t getHeight ( ) const
inline

Get texture height.

Returns
Texture height.

The documentation for this class was generated from the following file: