mirror of
https://gitlab.com/xonotic/xonotic
synced 2025-01-22 14:03:49 +00:00
38 lines
531 B
Bash
Executable File
38 lines
531 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# input: a .shader file
|
|
# parameters: in and out .bsp file
|
|
|
|
BSPTOOL="${0%/*}"/bsptool.pl
|
|
LF="
|
|
"
|
|
|
|
in=$1
|
|
out=$2
|
|
|
|
shaders=`"$BSPTOOL" "$in" -S`
|
|
|
|
newshaders=`cat | grep '^[^ {}]'`
|
|
|
|
set --
|
|
|
|
list=
|
|
for shader in $shaders; do
|
|
if [ -z "$list" ]; then
|
|
echo >&2 "Filling list..."
|
|
list=`echo "$newshaders" | sort -R`$LF
|
|
fi
|
|
case "$shader" in
|
|
noshader|NULL|textures/common/*)
|
|
;;
|
|
*)
|
|
item=${list%%$LF*}
|
|
list=${list#*$LF}
|
|
set -- "$@" "-S$shader=$item"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
set -- "$BSPTOOL" "$in" "$@" -o"$out"
|
|
"$@"
|