compress.bat 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. set toolpath=C:\texturecompress\texturecompress.exe
  4. echo.
  5. echo Supported compression formats:
  6. echo.
  7. echo 1. DXTC
  8. echo 2. PVRTC
  9. echo 3. ATC
  10. echo.
  11. set /P tchoice=Enter format (1-3):
  12. echo.
  13. if '%tchoice%' == '1' (
  14. set tpath=dxt
  15. set tformat=DXT5
  16. set text=.dds
  17. goto compress
  18. )
  19. if '%tchoice%' == '2' (
  20. set tpath=pvrtc
  21. set tformat=PVRTC4v1
  22. set text=.pvr
  23. goto compress
  24. )
  25. if '%tchoice%' == '3' (
  26. set tpath=atc
  27. set tformat=ATCA
  28. set text=.dds
  29. goto compress
  30. )
  31. echo ERROR: Invalid texture format choice.
  32. echo.
  33. goto end
  34. :compress
  35. dir /B *.png > textures.txt
  36. if not exist ..\%tpath% (
  37. mkdir ..\%tpath%
  38. )
  39. echo aliases > ..\%tpath%\resource.aliases
  40. echo { >> ..\%tpath%\resource.aliases
  41. for /F "tokens=*" %%a in (textures.txt) do (
  42. "%toolpath%" -m -yflip -f%tformat% ".\%%a" "..\%tpath%\%%~na%text%"
  43. echo %%~na = res/%tpath%/%%~na%text% >> ..\%tpath%\resource.aliases
  44. )
  45. echo } >> ..\%tpath%\resource.aliases
  46. del /Q textures.txt
  47. :end
  48. echo.
  49. pause