Pvr flipped in cocos2d version 3.2 : dilemma when

2019-03-06 22:35发布

问题:

I am currently porting a game from version 2.1 to 3.2 of cocos2d. We have over 3600 pvr.gz files that are NOT flipped, eg were produced and working under 2.1. We tested out with TexturePacker the option to flipY for pvr images, and sure enough code and animations work fine.

Now, we can go and do this manually for all our files, but ... is there a way i could convince verions 3.2 to use the 'old' pvr rules. This is a port, all our assets have been produced already.

Alternately, any command-line utility/tool i could use and script recursively the pvr conversion in my Resources folder :)

any help greatly appreciated. tia.

回答1:

ok, many thanks to Scott Lembcke of cocos2d for pointing me in the right direction. For posterity, hope this helps someone out there. PVRTexToolCLI did the job for me (from ImgTech.com). Free to download, free to use, you must register on their site.

here is the syntax (for this game's assets strategy)

PVRTexToolCLI -i old_magie_cleanse-hd.pvr -o magie_cleanse-hd.pvr -flip y,flag -f r8g8b8a8 -legacypvr

notes :

  • I am still using pvr v2 format, just because i like to go one change at a time. After I run my tests, i will switch all textures to pvr v3. Cocos2d 3.2 supports pvr v2 and pvr v3, but who knows for how long.
  • format is rgb8888 in our case, you will have to figure out the format of your own. You can use the PVRTextToolGUI and drag one of your existing textures into it to figure out the current encoding/compression.
  • If you have compressed textures, use "-q pvrtcbest" to prevent artefacts. Slow, hogs tons of CPU, but worth it.