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:
|
;;; Requires GIMP 2.4+ and the latest version of the normalmap and dds plugins.
(define (generate-normalmaps pattern)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(save_filename (string-append (substring filename 0 (- (string-length filename) 4))
"_n.dds"))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(plug-in-normalmap RUN-NONINTERACTIVE
image
drawable
8 ;9x9 filter
0.0 ;Min Z
6.0 ;scale
1 ;wrap
0 ;Height source = Average RGB
1 ;Alpha channel = Height
0 ;no conversion
0 ;no DU/DV map
0 ;xinvert
0 ;yinvert
0 ;swapRGB
0.0 ;contrast
drawable) ;no idea what this is for
(file-dds-save RUN-NONINTERACTIVE
image
drawable
save_filename
save_filename
2 ;DXT3
1 ;generate mipmaps
0 ;save selected layer
0 ;default pixel format
-1 ;disable transparent-index
0 ;default color selection algorithm
0 ;no dither
0)) ;default mipmap filter
(set! filelist (cdr filelist))))) |