cocos2d-x 3.0rc 支持带alpha通道的贴图是哪种格式?

如题
cocos2d-x 3.0rc 支持带alpha通道的贴图是哪种格式?

自己解决了
使用tga lib 的tgaLoad接口加载,代码如下
Texture2D * TextureCache::addImage(const char * path)
{
CCASSERT(path != NULL, “TextureCache: fileimage MUST not be NULL”);

Texture2D * texture = NULL;
Image* pImage = NULL;
// Split up directory and filename
// MUTEX:
// Needed since addImageAsync calls this method from a different thread

std::string pathKey = path;

pathKey = FileUtils::getInstance()->fullPathForFilename(pathKey.c_str());
if (pathKey.size() == 0)
{
    return NULL;
}
texture = static_cast<Texture2D*>(_textures->objectForKey(pathKey.c_str()));

std::string fullpath = pathKey;
if (! texture) 
{
    std::string lowerCase(pathKey);
    for (unsigned int i = 0; i < lowerCase.length(); ++i)
    {
        lowerCase* = tolower(lowerCase*);
    }
    // all images are handled by UIImage except PVR extension that is handled by our own handler
    do 
    {
        if (std::string::npos != lowerCase.find(".pvr"))
        {
            texture = this->addPVRImage(fullpath.c_str());
        }
        else if (std::string::npos != lowerCase.find(".pkm"))
        {
            // ETC1 file format, only supportted on Android
            texture = this->addETCImage(fullpath.c_str());
        }
        else if (std::string::npos != lowerCase.find(".tga"))
        {
            tImageTGA * pTga = tgaLoad(pathKey.c_str());
            if( pTga->pixelDepth == 24 || pTga->pixelDepth == 32 )
            {
                texture = new Texture2D();
                if( texture &&
                    texture->initWithData(pTga->imageData, pTga->pixelDepth == 24 ? Texture2D::PixelFormat::RGB888 : Texture2D::PixelFormat::RGBA8888, pTga->width, pTga->height, Size(pTga->width, pTga->height)) )
                {

#if CC_ENABLE_CACHE_TEXTURE_DATA
// cache the texture file name
VolatileTexture::addImageTexture(texture, fullpath.c_str(), eImageFormat);
#endif
_textures->setObject(texture, pathKey.c_str());
texture->release();
}
else
{
CCLOG(“cocos2d: Couldn’t create texture for file:%s in TextureCache”, path);
}
}
else
{
CCLOG(“cocos2d: Couldn’t create texture for file:%s in TextureCache”, path);
}
}
else
{
Image::Format eImageFormat = Image::Format::UNKOWN;
if (std::string::npos != lowerCase.find(".png"))
{
eImageFormat = Image::Format::PNG;
}
else if (std::string::npos != lowerCase.find(".jpg") || std::string::npos != lowerCase.find(".jpeg"))
{
eImageFormat = Image::Format::JPG;
}
else if (std::string::npos != lowerCase.find(".tif") || std::string::npos != lowerCase.find(".tiff"))
{
eImageFormat = Image::Format::TIFF;
}
else if (std::string::npos != lowerCase.find(".webp"))
{
eImageFormat = Image::Format::WEBP;
}

            pImage = new Image();
            CC_BREAK_IF(NULL == pImage);

            bool bRet = pImage->initWithImageFile(fullpath.c_str(), eImageFormat);
            CC_BREAK_IF(!bRet);

            texture = new Texture2D();
            
            if( texture &&
                texture->initWithImage(pImage) )
            {

#if CC_ENABLE_CACHE_TEXTURE_DATA
// cache the texture file name
VolatileTexture::addImageTexture(texture, fullpath.c_str(), eImageFormat);
#endif
_textures->setObject(texture, pathKey.c_str());
texture->release();
}
else
{
CCLOG(“cocos2d: Couldn’t create texture for file:%s in TextureCache”, path);
}
}
} while (0);
}

CC_SAFE_RELEASE(pImage);

return texture;

}**