3

我正在使用我今天下载的最新的 pvrtextoolCL。

问题是它产生的标题与苹果的 texturetool 或它的在线文档中的标题不同。如果我在 gui 工具中使用旧版保存,它可以工作,但我需要命令行工具的选项。

还有其他人有这个问题吗?我能做些什么来解决它?

4

2 回答 2

9

如果 Legacy Save As 选项适合您,则您的代码正在解析版本 2 PVR 纹理标头。最新的 PVRTexTool 和 PVRTexToolCL 都使用版本 3 标头格式 V3。

如果你需要命令行,你可以

A) 使用 -pvrlegacy 作为命令行参数

B)使用Apple提供的texturetool和XCode来压缩你的纹理

C) 更新您的代码以解析版本 3 PVR 纹理标头

版本 2 PVR 纹理标题

typedef struct _PVRTexHeader
{
    uint32_t headerLength;
    uint32_t height;
    uint32_t width;
    uint32_t numMipmaps;
    uint32_t flags;
    uint32_t dataLength;
    uint32_t bpp;
    uint32_t bitmaskRed;
    uint32_t bitmaskGreen;
    uint32_t bitmaskBlue;
    uint32_t bitmaskAlpha;
    uint32_t pvrTag;
    uint32_t numSurfs;
} PVRTexHeader;

版本 3 PVR 纹理标题

typedef struct _PVRTexHeaderV3{
    uint32_t    version;            
    uint32_t    flags;          
    uint64_t    pixelFormat;        
    uint32_t    colourSpace;        
    uint32_t    channelType;        
    uint32_t    height;         
    uint32_t    width;          
    uint32_t    depth;          
    uint32_t    numSurfaces;        
    uint32_t    numFaces;       
    uint32_t    numMipmaps;     
    uint32_t    metaDataSize;   
} PVRTexHeaderV3;

如果您要解析版本​​ 3 纹理标头,请从以下位置获取 PowerVR SDK:

http://www.imgtec.com/powervr/insider/sdkdownloads/index.asp

并查看 PVRTTexture.h 标头。它将具有定义标志的所有枚举,以及元数据的其他结构。SDK 中还有用于读取文件并将其加载到 OpenGL 中的示例代码。

于 2012-03-29T14:30:35.363 回答
0

为了补充@Snickers 方便的帖子,这里有一个在 GitHub 上发现的用于添加 PVRv3 解析的要点。它是为 Cocos2D 准备的,但看起来它主要是从 PVR SDK 中获取的?

https://gist.github.com/robertjpayne/2928080

于 2013-06-25T00:57:07.287 回答