ktx-files.bat 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. echo off
  2. REM Create a series of compressed textures versions of the file name passed in. Skips files which already
  3. REM exist, since script can be very long running.
  4. REM arg 1: file
  5. REM arg 2: file without extension
  6. REM arg 3: Y when need alpha, else N
  7. REM arg 4: Q when best image required, else D for developer quality
  8. REM -i specifies the input file passed as the first arg (full path) dos use 1%
  9. REM -pot + indicates force power of 2
  10. REM -m indicates to generate mipmaps
  11. REM -f is the format, variable type (UBN unsigned byte normalized), colorspace
  12. REM -q indicates how much time to spend, varies by encoding type
  13. REM -o specifies output file name, uses arg without extension adds -family.ktx
  14. REM - - - - - - - - - - - - - - - ASTC - - - - - - - - - - - - - - -
  15. echo working with %1
  16. REM all ASTC formats have alpha
  17. IF EXIST %2-astc.ktx GOTO PVRTC
  18. SET quality=astcveryfast
  19. if %4 == 'Q' SET quality=astcexhaustive
  20. echo compressing...
  21. PVRTexToolCLI.exe -i %1 -flip y -pot + -m -f ASTC_8x8,UBN,lRGB -q %quality% -shh -o %2-astc.ktx >junk.txt
  22. echo Saved texture to %2-astc.ktx
  23. REM - - - - - - - - - - - - - - - PVRTC - - - - - - - - - - - - - - -
  24. :PVRTC
  25. REM PVRTC must be square on iOS
  26. IF EXIST %2-pvrtc.ktx GOTO DXT
  27. SET format=PVRTC1_2_RGB
  28. if %3 == 'Y' SET format=PVRTC1_2
  29. SET quality=pvrtcfastest
  30. if %4 == 'Q' SET quality=pvrtcbest
  31. PVRTexToolCLI.exe -i %1 -flip y -pot + -square + -m -f %format%,UBN,lRGB -q %quality% -o %2-pvrtc.ktx
  32. REM - - - - - - - - - - - - - - - DXT - - - - - - - - - - - - - - -
  33. :DXT
  34. IF EXIST %2-dxt.ktx GOTO ETC1
  35. SET format=BC1
  36. if %3 == 'Y' SET format=BC2
  37. PVRTexToolCLI.exe -i %1 -flip y -pot + -m -f %format%,UBN,lRGB -o %2-dxt.ktx
  38. REM - - - - - - - - - - - - - - - ETC1 - - - - - - - - - - - - - - -
  39. REM ETC1 does not have an alpha capable format
  40. :ETC1
  41. IF EXIST %2-etc1.ktx GOTO ETC2
  42. SET quality=etcfast
  43. if %4 == 'Q' SET quality=etcslowperceptual
  44. if %3 == 'N' PVRTexToolCLI.exe -i %1 -flip y -pot + -m -f ETC1,UBN,lRGB -q %quality% -o %2-etc1.ktx
  45. REM - - - - - - - - - - - - - - - ETC2 - - - - - - - - - - - - - - -
  46. :ETC2
  47. IF EXIST %2-etc2.ktx GOTO END
  48. SET format=ETC2_RGB
  49. if %3 == 'Y' SET format=ETC2_RGBA
  50. SET quality=etcfast
  51. if %4 == 'Q' SET quality=etcslowperceptual
  52. PVRTexToolCLI.exe -i %1 -flip y -pot + -m -f %format%,UBN,lRGB -q %quality% -o %2-etc2.ktx
  53. REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  54. :END