ktx-build-0.1.0.0: app/Build/Ktx2.hs
module Build.Ktx2 where
import Data.List (isSuffixOf)
import Development.Shake
ktxCreate :: FilePath -> String -> FilePath -> Action ()
ktxCreate png format uastc = do
let tf = if "_SRGB" `isSuffixOf` format then "srgb" else "linear"
cmd_
(Traced "ktx-create")
[ "ktx", "create"
, "--encode", "uastc"
, "--uastc-quality", "4"
, "--uastc-rdo"
, "--assign-tf", tf
, "--convert-tf", tf
, "--format", format
, "--zstd", "3"
, png
, uastc
]
ktxCreateRaw :: FilePath -> String -> Int -> Int -> FilePath -> Action ()
ktxCreateRaw raw format width height ktx2 = do
cmd_
(Traced "ktx-create-raw")
[ "ktx", "create"
, "--raw"
, "--format", format
, "--width", show width
, "--height", show height
, "--zstd", "19"
, raw
, ktx2
]
ktxTranscode :: FilePath -> String -> FilePath -> Action ()
ktxTranscode uastc target ktx2 = do
cmd_
(Traced "ktx-transcode")
[ "ktx", "transcode"
, "--target", target
, "--zstd", "22"
, uastc
, ktx2
]