]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/shadescript/shade.sh
Merge branch 'nyov/wiki' into 'master'
[xonotic/xonotic.git] / misc / tools / shadescript / shade.sh
index 7533002638769c8566e9bd6bc95375d6d827d12c..f5da83e99f7227e71e18a6bf8babfbfc5517af2f 100644 (file)
@@ -4,7 +4,8 @@ case "$#" in
        2)
                ;;
        *)
-               echo "Usage: $1 directory shader.template"
+               echo "Usage: from xonotic-maps.pk3dir directory, copy and edit shader.template, then"
+               echo "  $0 texturepackname myshader.template"
                exit 1
                ;;
 esac
@@ -40,26 +41,26 @@ find "textures/$1" -type f -path "textures/*/*/*.*" -not -name '*_norm.*' -not -
                *water*)
                        noLightmap=true
                        isLiquid=true
-                       shaderHead="$shaderHead surfaceparm trans\n     surfaceparm water\n     qer_trans 20\n"
+                       shaderHead="$shaderHead surfaceparm trans$LF    surfaceparm water$LF    qer_trans 20$LF"
                        ;;
                *slime*)
                        noLightmap=true
                        isLiquid=true
-                       shaderHead="$shaderHead surfaceparm trans\n     surfaceparm slime\n     qer_trans 20\n"
+                       shaderHead="$shaderHead surfaceparm trans$LF    surfaceparm slime$LF    qer_trans 20$LF"
                        ;;
                *lava*)
                        noLightmap=true
                        isLiquid=true
-                       shaderHead="$shaderHead surfaceparm trans\n     surfaceparm lava\n      qer_trans 20\n"
+                       shaderHead="$shaderHead surfaceparm trans$LF    surfaceparm lava$LF     qer_trans 20$LF"
                        ;;
                *glass*)
                        noLightmap=true
-                       shaderHead="$shaderHead surfaceparm trans\n"
-                       diffuseExtra="$diffuseExtra             blendfunc add\n"
+                       shaderHead="$shaderHead surfaceparm trans$LF"
+                       diffuseExtra="$diffuseExtra             blendfunc add$LF"
                        ;;
                *metal*)
                        bounceScale=`echo "$bounceScale + 0.25" | bc -l`
-                       shaderHead="$shaderHead         surfaceparm metalsteps\n"
+                       shaderHead="$shaderHead surfaceparm metalsteps$LF"
                        ;;
        esac
 
@@ -67,8 +68,8 @@ find "textures/$1" -type f -path "textures/*/*/*.*" -not -name '*_norm.*' -not -
        case "$F" in
                *grate*)
                        bounceScale=`echo "$bounceScale + 0.25" | bc -l`
-                       shaderHead="$shaderHead surfaceparm trans\n"
-                       diffuseExtra="$diffuseExtra             blendfunc blend\n"
+                       shaderHead="$shaderHead surfaceparm trans$LF"
+                       diffuseExtra="$diffuseExtra             blendfunc blend$LF"
                        ;;
        esac
 
@@ -81,13 +82,13 @@ find "textures/$1" -type f -path "textures/*/*/*.*" -not -name '*_norm.*' -not -
        case "$F" in
                *dirt*|*terrain*|*old*)
                        bounceScale=`echo "$bounceScale - 0.25" | bc -l`
-                       shaderHead="$shaderHead surfaceparm dust\n"
+                       shaderHead="$shaderHead surfaceparm dust$LF"
                        ;;
        esac
 
        shaderDiffuse="$F"
        if [ -f "$F""_gloss.tga" ] || [ -f "$F""_gloss.jpg" ] || [ -f "$F""_gloss.png" ]; then
-               bounceScale=`echo "$bounceScale - 0.25" | bc -l`
+               bounceScale=`echo "$bounceScale + 0.25" | bc -l`
        fi
 
        if [ -f "$F""_qei.tga" ] || [ -f "$F""_qei.jpg" ] || [ -f "$F""_qei.png" ]; then
@@ -97,13 +98,13 @@ find "textures/$1" -type f -path "textures/*/*/*.*" -not -name '*_norm.*' -not -
        fi
 
        if ! $noLightmap; then
-               shaderTail="    {\n             map \$lightmap\n                rgbGen identity\n               tcGen lightmap\n                blendfunc filter\n      }"
+               shaderTail="    {$LF            map \$lightmap$LF               rgbGen identity$LF              tcGen lightmap$LF               blendfunc filter$LF     }"
        fi
        case "$bounceScale" in
                1|1.0|1.00)
                        ;;
                *)
-                       shaderHead="$shaderHead q3map_bouncescale $bounceScale\n"
+                       shaderHead="$shaderHead q3map_bouncescale $bounceScale$LF"
                        ;;
        esac