]> de.git.xonotic.org Git - xonotic/xonotic-maps.pk3dir.git/blobdiff - scripts/shader-audit.sh
Merge branch 'master' into cbrutail/shaders_fx_xonotic2
[xonotic/xonotic-maps.pk3dir.git] / scripts / shader-audit.sh
index 2d020a08a4d7ba5ce474f6b4036363864929b560..9b5d9d94f7ee707dd14993ba7ecadb1704d756a0 100644 (file)
@@ -30,6 +30,56 @@ use_texture()
        textures_used="$textures_used$LF$2"
 
        # TODO verify shader -> texture name
+       case "$1" in
+               textures/*x/*-*)
+                       pre=${1%%x/*}x
+                       suf=${1#*x/}
+                       # rule: in suffix part, change each - to /
+                       suf="`echo "$suf" | sed 's,-,/,g'`"
+                       case "$2" in
+                               "$pre"/*/*)
+                                       ;;
+                               *)
+                                       echo "(EE) texture $2 of shader $1 is out of place, recommended file name is $pre/$suf"
+                                       ;;
+                       esac
+                       ;;
+               textures/*x/*)
+                       pre=${1%%x/*}x
+                       suf=${1#*x/}
+                       case "$2" in
+                               "$pre"/*/*)
+                                       ;;
+                               *)
+                                       echo "(EE) texture $2 of shader $1 is out of place, recommended file name is $pre/base/$suf"
+                                       ;;
+                       esac
+                       ;;
+               textures/common/*)
+                       case "$2" in
+                               "$1")
+                                       ;;
+                               textures/common/*/*)
+                                       ;;
+                               *)
+                                       echo "(EE) texture $2 of shader $1 is out of place, recommended file name is $1 or textures/common/*/*"
+                                       ;;
+                       esac
+                       ;;
+               textures/decals/*)
+                       case "$2" in
+                               "$1")
+                                       # I _suppose_ this is fine, as tZork committed this pack
+                                       ;;
+                               *)
+                                       echo "(EE) texture $2 of shader $1 is out of place, recommended file name is $1 or textures/common/*/*"
+                                       ;;
+                       esac
+                       ;;
+               *)
+                       echo "(EE) no shader name pattern for $1"
+                       ;;
+       esac
 }
 
 parsing_shader=
@@ -115,5 +165,11 @@ textures_avail=`( cd ..; find textures/ -type f -not -name '*_norm.*' -not -name
 textures_used=`echo "${textures_used#$LF}" | sort -u`
 
 echo "$textures_used$LF$textures_used$LF$textures_avail" | sort | uniq -u | while IFS= read -r L; do
-       echo "(EE) texture $L is not referenced by any shader"
+       case "$L" in
+               textures/radiant/*)
+                       ;;
+               *)
+                       echo "(EE) texture $L is not referenced by any shader"
+                       ;;
+       esac
 done