]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
Merge branch 'master' into divVerent/crypto2
authorRudolf Polzer <divverent@alientrap.org>
Fri, 15 Oct 2010 13:14:06 +0000 (15:14 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 15 Oct 2010 13:14:06 +0000 (15:14 +0200)
all
misc/tools/spherefunc2skybox.c

diff --git a/all b/all
index 54452f88ba9292b44765cf479f141373fc48e6fb..158d5df145a155ac24456dbc161808557ebe6d76 100755 (executable)
--- a/all
+++ b/all
@@ -6,6 +6,7 @@ set -e
 # I use this in EVERY shell script ;)
 LF="
 "
+ESC="\e"
 
 d00=`pwd`
 while ! [ -f ./all ]; do
@@ -35,7 +36,7 @@ esac
 
 msg()
 {
-       echo >&2 "\e[1m$*\e[m"
+       echo >&2 "$ESC[1m$*$ESC[m"
 }
 
 self=`git hash-object "$SELF"`
@@ -119,7 +120,7 @@ div0-gittools                 |
 d0_blind_id                   | http://github.com/divVerent/d0_blind_id.git       | master      |
 data/xonotic-maps.pk3dir      |                                                   | master      |
 mediasource                   |                                                   | master      | no
-fteqcc                        | http://github.com/Blub/qclib.git                  | master      |
+fteqcc                        | git://github.com/Blub/qclib.git                   | master      |
 "
 # todo: in darkplaces, change repobranch to div0-stable
 
@@ -593,7 +594,7 @@ case "$cmd" in
                                        ;;
                                -r)
                                        debug=release
-                                       export CC="$CC -mtune=native -march=native"
+                                       export CC="$CC -g -mtune=native -march=native"
                                        shift
                                        ;;
                                *)
@@ -691,7 +692,7 @@ case "$cmd" in
                        verbose make $MAKEFLAGS clean
                fi
                for T in $TARGETS; do
-                       verbose make $MAKEFLAGS "$@" "$T"
+                       verbose make $MAKEFLAGS STRIP=: "$@" "$T"
                done
                for T in $BAD_TARGETS; do
                        echo "Warning: discarded invalid client $T."
@@ -1107,7 +1108,45 @@ case "$cmd" in
                                msg "Building a RELEASE"
                                ;;
                        *)
-                               msg "Must either set RELEASETYPE=beta or RELEASETYPE=release"
+                               echo >&2 -n "$ESC[2J$ESC[H"
+                               msg ""
+                               msg ""
+                               msg ""
+                               msg ""
+                               msg ""
+                               msg ""
+                               msg "        +---------------------------------------------------------.---+"
+                               msg "        | NOTE                                                    | X |"
+                               msg "        +---------------------------------------------------------^---+"
+                               msg "        |   ____                                                      |"
+                               msg "        |  /    \  This is the official release build system.         |"
+                               msg "        | |      | If you are not a member of the Xonotic Core Team,  |"
+                               msg "        | | STOP | you are not supposed to use this script and should |"
+                               msg "        | |      | instead use ./all compile to compile the engine    |"
+                               msg "        |  \____/  and game code.                                     |"
+                               msg "        |                                                             |"
+                               msg "        |                      [ I understand ]                       |"
+                               msg "        +-------------------------------------------------------------+"
+                               sleep 10
+                               # A LOT of build infrastructure is required:
+                               # - vorbis-tools
+                               # - ImageMagick
+                               # - .ssh/config must be configured so the following
+                               #   host names are reachable and have a compile
+                               #   infrastructure set up:
+                               #   - xonotic-build-linux32 (with gcc on x86)
+                               #   - xonotic-build-linux64 (with gcc on x86_64)
+                               #   - xonotic-build-win32 (with i586-mingw32msvc-g++)
+                               #   - xonotic-build-win64 (with amd64-mingw32msvc-g++
+                               #     and x86_64-w64-mingw32-g++)
+                               #   - xonotic-build-osx (with Xcode and SDL.framework)
+                               # - AMD Compressonator installed in WINE
+                               # - ResEdit installed in WINE
+                               # - a lot of other requirements you will figure out
+                               #   while reading the error messages
+                               # - environment variable RELEASETYPE set
+                               # - optionally, environment variable RELEASEDATE set
+                               #   (YYYYMMDD)
                                exit 1
                                ;;
                esac
index 1f5481c3eb8269e2a1c3dab3f1d357aabad5dbb6..201cefb955c5446652816170cb0f56b83f355df1 100644 (file)
@@ -147,17 +147,32 @@ struct
        double darkness;
        double power;
        double density;
+       int g;
+       double gpower;
+       double gfactor;
+       double gdpower;
 }
 color_starfield_parms;
+typedef struct
+{
+       double x, y, z, e;
+       double R, G, B, A;
+} starfield_t;
+starfield_t *starfield = NULL;
+int starfield_cmp(const void *a_, const void *b_)
+{
+       const starfield_t *a = a_;
+       const starfield_t *b = b_;
+       if(a->z < b->z)
+               return -1;
+       if(a->z > b->z)
+               return +1;
+       return 0;
+}
 void color_starfield(double x, double y, double z, double *r, double *g, double *b)
 {
-       static struct
-       {
-               double x, y, z, e;
-               double R, G, B, A;
-       } *starfield = NULL;
-       int i;
-       double f;
+       int i, j, k;
+       double f, mindot, d;
 
        if(!starfield)
        {
@@ -176,12 +191,6 @@ void color_starfield(double x, double y, double z, double *r, double *g, double
                                  + starfield[i].z * starfield[i].z;
                        }
                        while(r > 1);
-                       r = sqrt(r);
-                       starfield[i].x /= r;
-                       starfield[i].y /= r;
-                       starfield[i].z /= r;
-
-                       starfield[i].e = color_starfield_parms.density * pow(rnd(), -color_starfield_parms.power);
 
                        starfield[i].R = rnd();
                        starfield[i].G = rnd();
@@ -191,15 +200,39 @@ void color_starfield(double x, double y, double z, double *r, double *g, double
                        starfield[i].G /= f;
                        starfield[i].B /= f;
                        starfield[i].A = rnd();
+                       starfield[i].e = color_starfield_parms.density * pow(rnd(), -color_starfield_parms.power);
+               }
+               fprintf(stderr, "Gravitating starfield...\n");
+               for(k = 0; k < color_starfield_parms.g; ++k)
+               {
+                       i = rand() % color_starfield_parms.n;
+                       j = rand() % color_starfield_parms.n;
+                       f = pow(rnd(), color_starfield_parms.gpower);
+                       f = f * color_starfield_parms.gfactor;
+                       d = pow(starfield[j].x - starfield[i].x, 2)
+                         + pow(starfield[j].y - starfield[i].y, 2)
+                         + pow(starfield[j].z - starfield[i].z, 2);
+                       f *= pow(1 / (1 + d), color_starfield_parms.gdpower);
+                       starfield[i].x += f * (starfield[j].x - starfield[i].x);
+                       starfield[i].y += f * (starfield[j].y - starfield[i].y);
+                       starfield[i].z += f * (starfield[j].z - starfield[i].z);
+                       double r = starfield[i].x * starfield[i].x + starfield[i].y * starfield[i].y + starfield[i].z * starfield[i].z;
+                       r = sqrt(r);
+                       starfield[i].x /= r;
+                       starfield[i].y /= r;
+                       starfield[i].z /= r;
                }
+               fprintf(stderr, "Sorting starfield...\n");
+               qsort(starfield, sizeof(*starfield), color_starfield_parms.n, starfield_cmp);
                fprintf(stderr, "Done.\n");
        }
 
        *r = *g = *b = 0;
+       mindot = pow(1/256.0, 1.0/color_starfield_parms.density);
        for(i = 0; i < color_starfield_parms.n; ++i)
        {
                double dot = x * starfield[i].x + y * starfield[i].y + z * starfield[i].z;
-               if(dot <= 0)
+               if(dot <= mindot)
                        continue;
                double f = pow(dot, starfield[i].e) * starfield[i].A;
                *r += starfield[i].R * f;
@@ -355,6 +388,10 @@ int main(int argc, char **argv)
                color_starfield_parms.darkness = argc<= 5 ? 0.4 : atof(argv[5]);
                color_starfield_parms.power = argc<= 6 ? 2.5 : atof(argv[6]);
                color_starfield_parms.density = argc<= 7 ? 60000 : atof(argv[7]);
+               color_starfield_parms.g = argc<= 8 ? 10000000 : atoi(argv[8]);
+               color_starfield_parms.gpower = argc<= 9 ? 3 : atoi(argv[9]);
+               color_starfield_parms.gfactor = argc<= 10 ? 0.9 : atof(argv[10]);
+               color_starfield_parms.gdpower = argc<= 11 ? 15 : atof(argv[11]);
        }
        else
        {