Merge branch 'master' into divVerent/skyboxes
authorRudolf Polzer <divverent@alientrap.org>
Thu, 22 Jul 2010 13:32:25 +0000 (15:32 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 22 Jul 2010 13:32:25 +0000 (15:32 +0200)
models/fans/bigfan01.md3 [new file with mode: 0644]
models/fans/bigfan01.md3.framegroups [new file with mode: 0644]
models/fans/bigfan_light.md3 [new file with mode: 0644]
models/fans/bigfan_shadow.md3 [new file with mode: 0644]
models/fans/fanlight.tga [new file with mode: 0644]
models/fans/fanshadow.tga [new file with mode: 0644]
scripts/bigfan01.shader [new file with mode: 0644]
scripts/shader-audit.sh

diff --git a/models/fans/bigfan01.md3 b/models/fans/bigfan01.md3
new file mode 100644 (file)
index 0000000..9570ac5
Binary files /dev/null and b/models/fans/bigfan01.md3 differ
diff --git a/models/fans/bigfan01.md3.framegroups b/models/fans/bigfan01.md3.framegroups
new file mode 100644 (file)
index 0000000..8fd3d18
--- /dev/null
@@ -0,0 +1 @@
+0 30 5 1 // fan rotation speed is 3rd number, bigger = faster
\ No newline at end of file
diff --git a/models/fans/bigfan_light.md3 b/models/fans/bigfan_light.md3
new file mode 100644 (file)
index 0000000..1f24517
Binary files /dev/null and b/models/fans/bigfan_light.md3 differ
diff --git a/models/fans/bigfan_shadow.md3 b/models/fans/bigfan_shadow.md3
new file mode 100644 (file)
index 0000000..833291c
Binary files /dev/null and b/models/fans/bigfan_shadow.md3 differ
diff --git a/models/fans/fanlight.tga b/models/fans/fanlight.tga
new file mode 100644 (file)
index 0000000..54aa3da
Binary files /dev/null and b/models/fans/fanlight.tga differ
diff --git a/models/fans/fanshadow.tga b/models/fans/fanshadow.tga
new file mode 100644 (file)
index 0000000..db3136f
Binary files /dev/null and b/models/fans/fanshadow.tga differ
diff --git a/scripts/bigfan01.shader b/scripts/bigfan01.shader
new file mode 100644 (file)
index 0000000..c38a880
--- /dev/null
@@ -0,0 +1,17 @@
+models/mapobjects/fans/fanlight.tga\r
+{\r
+ {\r
+       map models/fans/fanlight.tga\r
+       blendfunc add\r
+       tcmod rotate 40\r
+ }\r
+}\r
+\r
+models/mapobjects/fans/fanshadow.tga\r
+{\r
+ {\r
+       map models/fans/fanshadow.tga\r
+       blendfunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA\r
+       tcmod rotate 40\r
+ }\r
+}\r
index 0d19a20229c26cfcd87a4115fa7772d13cd64082..dd371ac0099d80ad8027339e2403ef5f6fa9a6ca 100644 (file)
@@ -8,6 +8,9 @@ normalize()
        echo "$1" | sed 's/\.\(tga\|jpg\|png\)$//'
 }
 
+allowed_prefixes=
+forbidden_prefixes=
+
 textures_used=
 # $1 = shader
 # $2 = texture
@@ -29,6 +32,29 @@ use_texture()
        fi
        textures_used="$textures_used$LF$2"
 
+       if [ -n "$allowed_prefixes" ]; then
+               ok=false
+               for p in $allowed_prefixes; do
+                       case "$1:" in
+                               "$p"*)
+                                       ok=true
+                                       ;;
+                       esac
+               done
+       else
+               ok=true
+       fi
+       for p in $forbidden_prefixes; do
+               case "$1:" in
+                       "$p"*)
+                               ok=false
+                               ;;
+               esac
+       done
+       if ! $ok; then
+               echo "(EE) shader $1 is not allowed in this shader file (allowed: $allowed_prefixes, forbidden: $forbidden_prefixes)"
+       fi
+
        # TODO verify shader -> texture name
        case "$1" in
                textures/*x/*-*)
@@ -58,11 +84,12 @@ use_texture()
                textures/map_*/*)
                        pre=${1%%/map_*}
                        suf=${1#*/map_}
+                       map=${suf%%[_/]*}
                        case "$2" in
-                               "$pre"/map_*)
+                               "$pre"/map_$map[/_]*)
                                        ;;
                                *)
-                                       echo "(EE) texture $2 of shader $1 is out of place, recommended file name is $pre/map_$suf"
+                                       echo "(EE) texture $2 of shader $1 is out of place, recommended file name is $pre/map_$map/*"
                                        ;;
                        esac
                        ;;
@@ -83,7 +110,30 @@ use_texture()
                                        # 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/*/*"
+                                       echo "(EE) texture $2 of shader $1 is out of place, recommended file name is $1"
+                                       ;;
+                       esac
+                       ;;
+               textures/skies/*)
+                       sky=${1#textures/skies/}
+                       case "$2" in
+                               "$1")
+                                       # typical place for preview image
+                                       ;;
+                               env/"${1#textures/skies/}")
+                                       # typical place for skybox
+                                       ;;
+                               *)
+                                       echo "(EE) texture $2 of shader $1 is out of place, recommended file name is $1"
+                                       ;;
+                       esac
+                       ;;
+               models/*)
+                       case "$2" in
+                               models/*)
+                                       ;;
+                               *)
+                                       echo "(EE) texture $2 of shader $1 is out of place, recommended file name is $1 or models/*"
                                        ;;
                        esac
                        ;;
@@ -143,9 +193,23 @@ parse_shader()
 
 parse_shaderfile()
 {
+       case "$1" in
+               map_*)
+                       allowed_prefixes="textures/map_`echo "$1" | cut -d _ -f 2`_ textures/map_`echo "$1" | cut -d - -f 2`/"
+                       forbidden_prefixes=
+                       ;;
+               skies_*)
+                       allowed_prefixes="textures/skies/`echo "$1" | cut -d _ -f 2`: textures/skies/`echo "$1" | cut -d _ -f 2`_"
+                       forbidden_prefixes=
+                       ;;
+               *)
+                       allowed_prefixes=
+                       forbidden_prefixes="textures/skies/ textures/map_"
+                       ;;
+       esac
        while read L; do
                case "$L" in
-                       textures/*)
+                       */*)
                                parsing_shader="`normalize "$L"`"
                                if [ x"$L" != x"$parsing_shader" ]; then
                                        echo "(WW) normalized shader name $L to $parsing_shader"
@@ -168,7 +232,7 @@ strip_comments()
 t=`mktemp`
 for X in *.shader; do
        strip_comments < "$X" > "$t"
-       parse_shaderfile < "$t"
+       parse_shaderfile "${X%.shader}" < "$t"
 done
 rm -f "$t"