Cocos2d-x  4.0.0
Static Public Member Functions | List of all members
Utils Class Reference

create and manager default depth and stencil attachment. More...

Static Public Member Functions

static void updateDefaultColorAttachmentTexture (id< MTLTexture > texture)
 Update default color attachment texture.
 
static MTLPixelFormat getDefaultDepthStencilAttachmentPixelFormat ()
 Get the default combined depth and stencil attachment pixel format.
 
static MTLPixelFormat getDefaultColorAttachmentPixelFormat ()
 Get the default color attachment pixel format.
 
static id< MTLTexture > getDefaultDepthStencilTexture ()
 Get the default combined depth and stencil texture.
 
static MTLPixelFormat toMTLPixelFormat (PixelFormat textureFormat)
 Convert backend::PixelFormat to MTLPixelFormat.
 
static void generateMipmaps (id< MTLTexture > texture)
 Generate a complete set of mipmaps in given texture.
 
static void getTextureBytes (std::size_t origX, std::size_t origY, std::size_t rectWidth, std::size_t rectHeight, id< MTLTexture > texture, std::function< void(const unsigned char *, std::size_t, std::size_t)> callback)
 Read a block of pixels from the given texture.
 
static void swizzleImage (unsigned char *image, std::size_t width, std::size_t height, MTLPixelFormat format)
 Swizzle the iamge form the given format to MTLPixelFormatRGBA8Unorm.
 

Detailed Description

create and manager default depth and stencil attachment.

generate mipmaps. read pixles from texture.

Member Function Documentation

static void updateDefaultColorAttachmentTexture ( id< MTLTexture >  texture)
static

Update default color attachment texture.

Parameters
textureSpecifies the texture to be setted to the color attachemnt.
static MTLPixelFormat getDefaultDepthStencilAttachmentPixelFormat ( )
static

Get the default combined depth and stencil attachment pixel format.

Returns
The default combined depth and stencil attachment pixel format.
static MTLPixelFormat getDefaultColorAttachmentPixelFormat ( )
static

Get the default color attachment pixel format.

Returns
The default color attachment pixel format.
static id<MTLTexture> getDefaultDepthStencilTexture ( )
static

Get the default combined depth and stencil texture.

Returns
The default combined depth and stencil texture.
static MTLPixelFormat toMTLPixelFormat ( PixelFormat  textureFormat)
static

Convert backend::PixelFormat to MTLPixelFormat.

Parameters
textureFormatSpecifies a pixel format to be converted.
Returns
A MTLPixelFormat.
static void generateMipmaps ( id< MTLTexture >  texture)
static

Generate a complete set of mipmaps in given texture.

Parameters
textureSpecifies a texture to generate mipmap.
static void getTextureBytes ( std::size_t  origX,
std::size_t  origY,
std::size_t  rectWidth,
std::size_t  rectHeight,
id< MTLTexture >  texture,
std::function< void(const unsigned char *, std::size_t, std::size_t)>  callback 
)
static

Read a block of pixels from the given texture.

Parameters
origX,origYSpecify the window coordinates of the first pixel that is read from the given texture. This location is the lower left corner of a rectangular block of pixels.
rectWidth,rectHeightSpecify the dimensions of the pixel rectangle. rectWidth and rectHeight of one correspond to a single pixel.
textureSpecifies the texture to get the image.
callbackSpecifies a call back function to deal with the image.
static void swizzleImage ( unsigned char *  image,
std::size_t  width,
std::size_t  height,
MTLPixelFormat  format 
)
static

Swizzle the iamge form the given format to MTLPixelFormatRGBA8Unorm.

Parameters
imageSpecifies the image to be swizzled.
widthSpecifies the width of the image.
heigthSpecifies the height of the image.
formatSpecifies the format of the image.

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