-
Notifications
You must be signed in to change notification settings - Fork 11
/
cook.ini
219 lines (180 loc) Β· 10.1 KB
/
cook.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
; this is where you specify and configure the FWK pipeline.
; tweak the pipeline and add new importers just by editing this file.
; there is no flow control in this script file: lines are parsed and evaluated, from top to bottom.
; ------------------------------------------------------------------------------
; let's create a symbol. symbols are uppercase words always.
; syntax: symbols are defined in KEY=value form, as seen below.
TOOLS=./ ; folder where our pipeline tools are located
ART=../demos/art/,../engine/art/,../editor/art/ ; comma-separated folder(s) that store all our asset files
; lines starting with @windows, @linux or @osx will be processed only where OS matches.
; we are defining here some symbols differently for each platform.
; syntax: lines starting with @keyword. valid keywords are win/dows, lin/ux, and osx.
@linux NUL=/dev/null
@osx NUL=/dev/null
@window NUL=NUL
@linux .EXE=.linux
@osx .EXE=.osx
@windows .EXE=.exe
; you can invoke shell commands directly with `command` at anytime.
; also, once a symbol is found, it is replaced by its value always.
; some predefined symbols: INPUT (input filename), OUTPUT (output filename), PRETTY (clean input filename), PROGRESS (cook progress).
;@windows `echo Cooking PROGRESS% PRETTY...`
;@linux `echo "Cooking PROGRESS% PRETTY..."`
;@osx `echo "Cooking PROGRESS% PRETTY..."`
; ------------------------------------------------------------------------------
; groups below are collection of files that we want to cook, and then package.
; by default, no assets are cooked unless explictly listed below.
; syntax: group=ext1,ext2[...]
[cook]
icon=ico
image=jpg,jpeg,png,bmp,psd,pic,pnm,hdr
texture=pvr,ktx,ktx2,dds,astc,basis,tga
anim=fbx
model=iqm,iqe,gltf,gltf2,glb,fbx,obj,dae,usdc,md3,md5,ms3d,smd,x,3ds,bvh,dxf,lwo
audio=wav,flac,ogg,mp1,mp3,mid,sfxr ; ,mod,xm
audio-module=mod,xm,s3m,it
audio-furnace=fur
font=ttf,ttc,otf
text=json,xml,csv,ini,cfg,doc,txt,md,c,h,inl,cpp,hpp,htm,html
shader=hlsl,fx,dxil,dxbc,glsl,vert,frag,geom,tese,tesc,comp,vs,fs,gs,ts,cs,spirv,spv,slang
script=lua,tl
video=mp4,ogv,avi,mkv,wmv,mpg,mpeg
tiled=tmx,tsx
atlas=ase,aseprite
;excel=xlsx
; ------------------------------------------------------------------------------
; let's convert mod,s3m,xm,it and flac as streamable ogg files
;
; hint: remember that both INPUT and OUTPUT symbols are automatically provided.
; hint: the ->ogg and ->wav parts below do signal the pipeline that the commands we are about
; to execute are performing a data conversion (from flac to ogg for example).
[cook audio-module]
TOOLS/mod2wav.EXE INPUT OUTPUT -> wav
TOOLS/ffmpeg.EXE -hide_banner -nostdin -loglevel fatal -y -i INPUT -threads 1 -f ogg -b:a 192k OUTPUT -> ogg ; -stats
[cook flac]
TOOLS/ffmpeg.EXE -hide_banner -nostdin -loglevel fatal -y -i INPUT -threads 1 -f ogg -b:a 384k OUTPUT -> ogg ; -stats
; cook midis as wavs here
[cook audio && mid]
SOUNDBANK=AweROMGM.sf3 ; note: GeneralUser_GS_v1_471.sf3 or FluidR3.sf3 likely to produce better results
TOOLS/mid2wav.EXE INPUT OUTPUT TOOLS/SOUNDBANK -> wav
; and furs as wavs...
[cook audio-furnace]
TOOLS/furnace.EXE INPUT -output OUTPUT 2> NUL -> wav
; ...and sxfrs as wavs
[cook audio && sfxr]
TOOLS/sfxr2wav.EXE INPUT OUTPUT -> wav
; then any audio (except mp3 and ogg) gets converted into adpcm_ms finally
; note that all the recently generated wav files from previous steps are included in here as well (like those from the flac->wav recipe above).
[cook audio && !mp3 && !ogg]
TOOLS/ffmpeg.EXE -hide_banner -nostdin -loglevel fatal -y -i INPUT -threads 1 -f wav -acodec adpcm_ms OUTPUT -> wav ; -stats
; ------------------------------------------------------------------------------
; cook all videos that are not mpeg, into mpeg.
; FLAGS symbols contain the default encoding options when cooking videos.
;
; hint: we're checking that ffmpeg is returning 0 exitcode (see `==0` below)
[cook video && !mpg]
FLAGS1+=-hide_banner -nostdin -loglevel fatal -y ; -stats
FLAGS2+=-qscale:v 4 -y -c:v mpeg1video -c:a mp2 -ac 1 -b:a 128k -ar 44100 -format mpeg
;FLAGS_EXTRA_QUALITY=-vf scale=iw*2:ih*2
TOOLS/ffmpeg.EXE FLAGS1 -i INPUT -threads 1 FLAGS2 OUTPUT ==0 -> mpg
; ------------------------------------------------------------------------------
; let's cook all images into ktx
[cook image && !png && !jpg && !jpeg && !hdr]
;TOOLS/cuttlefish.EXE -q -i INPUT -o OUTPUT -f R8G8B8A8 -> ktx
TOOLS/PVRTexToolCLI.EXE -noout -m -i INPUT -o OUTPUT -> png
[cook texture && tga]
TOOLS/cuttlefish.EXE -q -m -i INPUT -o OUTPUT -f BC1_RGB -> ktx
[cook texture && !dds && !ktx]
TOOLS/PVRTexToolCLI.EXE -noout -m -i INPUT -o OUTPUT -> dds
[cook dds]
; @todo: support per-asset options. ie, you can override
; or expand the FLAGS symbol, per asset basis. let's say that for each input `file.ext`
; asset, there could be a sibling `file.ext.ini` file that would contain all the
; initial symbols and flags. then, we can merge (+=), remove (-=) or replace (=) them.
; FLAGS+=-quality 75.00 -p ; merge (+=) these flags on top of any existing per-asset flags.
TOOLS/cuttlefish.EXE -q -m -i INPUT -o OUTPUT -f BC1_RGBA -> ktx
; # Compatibility and modes. What to choose.
; - iOS: PVRTC1_4_RGB or PVRTC1_4 (RGBA) with q:pvrtcnormal.
; - Desktop (OSX/Linux/Windows): BC1, BC1a or BC3 with q:normal.
; - Android: ETC2_RGB or ETC2_RGBA with q:etcfast. ASTC_4x4 or ASTC_8x8 with q:astcmedium, as a fallback.
; - [ref] https://www.reedbeta.com/blog/understanding-bcn-texture-compression-formats/
;
; PVRTexToolCLI > DDS
; PVR, KTX, KTX2, [DDS,] ASTC or BASIS
;
; Cuttlefish > KTX
; BMP,CUT,DDS,EXR,G3,GIF,HDR,ICO,IFF,JBIG,JNG,JPEG,JPEG2K,JPEGXR,KOALA,MNG,PCD,
; PCX,PBM/PGM/PPM,PFM,PNG,PIC,PSD,RAW,RAS,SGI,TARGA,TIFF,WBMP,WebP,XBM,XPM
;
; >> bin\cuttlefish -i uv_checker_1k.png -o uv_checker_1k.png.ktx -f bc1_rgba
; R4G4,R4G4B4A4,B4G4R4A4,A4R4G4B4,R5G6B5,B5G6R5,R5G5B5A1,B5G5R5A1,A1R5G5B5,R8,R8G8,R8G8B8,B8G8R8,R8G8B8A8,B8G8R8A8,A8B8G8R8,
; A2R10G10B10,A2B10G10R10,R16,R16G16,R16G16B16,R16G16B16A16,R32,R32G32,R32G32B32,R32G32B32A32,B10G11R11_UFloat,E5B9G9R9_UFloat,
; BC1_RGB,BC1_RGBA,BC2,BC3,BC4,BC5,BC6H,BC7,ETC1,ETC2_R8G8B8,ETC2_R8G8B8A1,ETC2_R8G8B8A8,EAC_R11,EAC_R11G11,
; ASTC_4x4,ASTC_5x4,ASTC_5x5,ASTC_6x5,ASTC_6x6,ASTC_8x5,ASTC_8x6,ASTC_8x8,ASTC_10x5,ASTC_10x6,ASTC_10x8,ASTC_10x10,ASTC_12x10,ASTC_12x12,
; PVRTC1_RGB_2BPP,PVRTC1_RGBA_2BPP,PVRTC1_RGB_4BPP,PVRTC1_RGBA_4BPP,PVRTC2_RGBA_2BPP,PVRTC2_RGBA_4BPP,
;
; >> bin\PVRTexToolCLI -i uv_checker_1k.png -o uv_checker_1k.png.ktx -f bc1
; PVRTC1_2, PVRTC1_4, PVRTC1_2_RGB, PVRTC1_4_RGB, PVRTC2_2, PVRTC2_4, PVRTC1_HDR_6, PVRTC1_HDR_8, PVRTC2_HDR_6, PVRTC2_HDR_8,
; ETC1, BC1, DXT2, BC2, DXT4, BC3, BC4, BC5, UYVY, YUY2, 1BPP, RGBE9995, RGBG8888, GRGB8888, ETC2_RGB, ETC2_RGBA, ETC2_RGB_A1, EAC_R11, EAC_RG11,
; ASTC_4x4, ASTC_5x4, ASTC_5x5, ASTC_6x5, ASTC_6x6, ASTC_8x5, ASTC_8x6, ASTC_8x8, ASTC_10x5, ASTC_10x6, ASTC_10x8, ASTC_10x10, ASTC_12x10, ASTC_12x12,
; ASTC_3x3x3, ASTC_4x3x3, ASTC_4x4x3, ASTC_4x4x4, ASTC_5x4x4, ASTC_5x5x4, ASTC_5x5x5, ASTC_6x5x5, ASTC_6x6x5, ASTC_6x6x6, BASISU_ETC1S, BASISU_UASTC, RGBM, RGBD
;
; -f [UB, UBN, SB, SBN, US, USN, SS, SSN, UI, UIN, SI, SIN, UF, SF]
; -f [lRGB, sRGB]
; -q [pvrtcfastest,pvrtcfast,pvrtcnormal,pvrtchigh,pvrtcbest]
; -q [etcfast,etcslow,etcfastperceptual,etcslowperceptual]
; -q [astcveryfast,astcfast,astcmedium,astcthorough,astcexhaustive]
;
; -m 16 -mfilter cubic ;; mipmaps
; -c ;; debug mipmap tail chain with saturated colours: truncate upper mipmaps if dont see any original colors
;
; -l ;; bleed
; -flip y,flag ;; flip
; -p ;; premultiply
; -r 512,256 -rfilter cubic ;; resize
; -rotate 0 ;; rotate
; -dither ;; dither
;
; ------------------------------------------------------------------------------
; finally, let's cook all models. the logic here is:
; 1. cook all models into iqe (ass2iqe), then into iqm (iqe2iqm): any -> iqe -> iqm
; 2. unless input is iqe. these models will run iqe2iqm only (no ass2iqe): iqe -> iqm.
; 3. unless input is iqm. these models will not run any conversion at all: iqm.
; 4. also, dae models need to flip their UVs coordinates (see -U flag below).
[cook model && dae] ; pass dae, reject iqm,iqe or any other model
FLAGS=-U
TOOLS/ass2iqe.EXE FLAGS -o OUTPUT INPUT 2> NUL -> iqe
[cook model && fbx] ; pass fbx, reject iqm,iqe or any other model
FLAGS=-Z
TOOLS/ass2iqe.EXE FLAGS -o OUTPUT INPUT 2> NUL -> iqe
[cook model && !dae && !fbx && !iqm && !iqe] ; pass anything which is not iqm,iqe,fbx or dae
FLAGS=
TOOLS/ass2iqe.EXE FLAGS -o OUTPUT INPUT 2> NUL -> iqe
[cook model && !iqm]
TOOLS/iqe2iqm.EXE OUTPUT INPUT > NUL -> iqm
[cook anim]
FLAGS=
TOOLS/ass2iqe.EXE FLAGS -L -o OUTPUT INPUT 2> NUL -> animlist.txt
; ------------------------------------------------------------------------------
; cook localization files
;[cook excel]
;TOOLS/xlsx2ini.EXE INPUT OUTPUT -> ini
; ------------------------------------------------------------------------------
; cook sprites
[cook atlas]
TOOLS/ase2ini.EXE "INPUT" > OUTPUT
; ------------------------------------------------------------------------------
; assets that need to be compressed at end of whole pipeline process are specified here.
; by default, no assets are compressed unless explictly listed below.
; supported compressors: DEFLATE (default), LZMA, LZ4, ULZ, BALZ, BCM, CRUSH, LZW3, LZSS and PPP.
; syntax: compression quality[0..15]|optional_compressor on the left, and type names on the right.
; where: level [0:fastest compression .. 10 max level .. anything >=11 is expensive ... 15 is uber]
;
; valid examples: 0, 3, 4, 6|LZMA, 6|DEFLATE, 6|ULZ, 9|ULZ, 9|LZ4, 2|BALZ, 3|BCM, 1|CRUSH, ...
;
; hint: use plain `0` to exclude non-compressible files (jpg,png,...)
; hint: use plain `0` to exclude those usually large files that compress poorly (<1%) (like mpg)
; hint: use plain `0` to exclude those files we would like to directly stream within the final zipfile (flac,mp3,adpcm wav,...)
[compress]
0|ULZ=texture,image,model,audio,font,text,shader,script
0=video,flac,ogg,wav,mp1,mp3,jpg,png,atlas,tiled