- while read L A1 Aother; do
- case "`echo "$L" | tr A-Z a-z`" in
- qer_editorimage)
- use_texture "$parsing_shader" "`normalize "$A1"`" editorimage
- ;;
- skyparms)
- use_texture "$parsing_shader" "${A1}_lf" sky
- use_texture "$parsing_shader" "${A1}_rt" sky
- use_texture "$parsing_shader" "${A1}_up" sky
- use_texture "$parsing_shader" "${A1}_dn" sky
- use_texture "$parsing_shader" "${A1}_ft" sky
- use_texture "$parsing_shader" "${A1}_bk" sky
- ;;
- '{')
- parse_shaderstage
+ offsetmapping_match8=
+ textureblending=false
+ maintexture=
+ nowarn=false
+}
+
+parse_shader_line()
+{
+ L=$1
+ A1=$2
+ Aother=$3
+ case "`echo "$L" | tr A-Z a-z`" in
+ xon_nowarn)
+ nowarn=true
+ ;;
+ dpoffsetmapping)
+ set -- $Aother
+ if [ x"$A1" = x"none" ]; then
+ offsetmapping_match8=none
+ elif [ x"$A1" = x"off" ]; then
+ offsetmapping_match8=none
+ elif [ x"$A1" = x"disabled" ]; then
+ offsetmapping_match8=none
+ elif [ x"$2" = x"match8" ]; then
+ offsetmapping_match8=`echo "($3 + 0.5) / 1" | bc`
+ elif [ x"$2" = x"match16" ]; then
+ offsetmapping_match8=`echo "($3 / 257 + 0.5) / 1" | bc`
+ elif [ x"$2" = x"match" ]; then
+ offsetmapping_match8=`echo "($3 * 255 + 0.5) / 1" | bc`
+ elif [ x"$2" = x"bias" ]; then
+ offsetmapping_match8=`echo "((1 - $3) * 255 + 0.5) / 1" | bc`
+ else
+ offsetmapping_match8=default
+ fi
+ ;;
+ qer_editorimage)
+ use_texture "$parsing_shader" "`shader_normalize "$A1"`" editorimage
+ ;;
+ skyparms)
+ use_texture "$parsing_shader" "${A1}_lf" sky
+ use_texture "$parsing_shader" "${A1}_rt" sky
+ use_texture "$parsing_shader" "${A1}_up" sky
+ use_texture "$parsing_shader" "${A1}_dn" sky
+ use_texture "$parsing_shader" "${A1}_ft" sky
+ use_texture "$parsing_shader" "${A1}_bk" sky
+ ;;
+ *)
+ ;;
+ esac
+}
+
+parse_shader_post()
+{
+ if [ -n "$AUDIT_ALPHACHANNELS" ] && [ -n "$maintexture" ] && ! $textureblending; then
+ getstats "../$maintexture.tga" || getstats "../$maintexture.png" || getstats "../$maintexture.jpg"
+ case "$mainblendfunc" in
+ *src_alpha*|*blend*)
+ # texture must have alpha
+ if [ x"$mainalphagen" = x"none" -a $min -eq 255 ]; then
+ err "$parsing_shader uses alpha-less texture $maintexture with blendfunc $mainblendfunc and alphagen $mainalphagen"
+ fi