+ done
+ ;;
+ '{')
+ err "brace nesting error in $parsing_shader"
+ ;;
+ '}')
+ break
+ ;;
+ *)
+ ;;
+ esac
+}
+
+parse_shaderstage_post()
+{
+ if [ -n "$ss_map" ]; then
+ if [ -z "$maintexture" ]; then
+ maintexture=$ss_map
+ mainblendfunc=$ss_blendfunc
+ mainalphafunc=$ss_alphafunc
+ mainalphagen=$ss_alphagen
+ elif [ x"$ss_alphagen" = x"vertex" ] && ! $textureblending; then
+ case "$mainblendfunc:$mainalphafunc:$ss_blendfunc:$ss_alphafunc" in
+ none:none:"gl_src_alpha gl_one_minus_src_alpha":none) textureblending=true ;;
+ none:none:filter:none) textureblending=true ;;
+ none:none:none:g*) textureblending=true ;;
+ "gl_one gl_zero":none:filter:none) textureblending=true ;;
+ "gl_one gl_zero":none:none:g*) textureblending=true ;;
+ *)
+ err "texture blending requires first stage to have no blendfunc/alphatest, and requires second stage to be blendfunc filter"
+ ;;
+ esac
+ else
+ err "multistage shader without alphagen vertex, or using more than 2 stages, is not supported by DarkPlaces"
+ fi
+ fi
+}
+
+parse_shader_pre()
+{
+ use_texture "$parsing_shader" "$parsing_shader" shader
+ 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