r3983 - trunk/misc
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jul 30 12:39:25 EDT 2008
Author: div0
Date: 2008-07-30 12:39:25 -0400 (Wed, 30 Jul 2008)
New Revision: 3983
Added:
trunk/misc/brightspot.sh
Modified:
trunk/misc/brightspot.c
Log:
add shell script running brightspot... and it indeed IS broken
Modified: trunk/misc/brightspot.c
===================================================================
--- trunk/misc/brightspot.c 2008-07-30 16:05:50 UTC (rev 3982)
+++ trunk/misc/brightspot.c 2008-07-30 16:39:25 UTC (rev 3983)
@@ -1,25 +1,13 @@
#include <stdio.h>
#include <math.h>
-// USAGE:
-// for X in *.tga; do convert "$X" -geometry 512x512 -depth 8 GRAY:-; done > /tmp/foo
-// brightspot /tmp/foo
+// USAGE: see brightspot.sh (and in the future brightspot.bat)
// It should output the right parameters for the sun direction in q3map2's format.
// But probably is broken.
#define false 0
#define true 1
-int sides_alphabet[6] =
-{
- 2, // bk
- 5, // dn
- 3, // ft
- 1, // lf
- 0, // rt
- 4 // up
-};
-
int flip[6*3] =
{
false, false, true, // "rt"
Added: trunk/misc/brightspot.sh
===================================================================
--- trunk/misc/brightspot.sh (rev 0)
+++ trunk/misc/brightspot.sh 2008-07-30 16:39:25 UTC (rev 3983)
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+if [ -z "$1" ]; then
+ echo>&2 "Usage: $0 foo_rt.jpg"
+ exit 1
+fi
+
+brightspot=
+if which brightspot-bin >/dev/null; then
+ brightspot=brightspot-bin
+else
+ case "$0" in
+ */*)
+ mydir=${0%/*}
+ ;;
+ *)
+ mydir=.
+ ;;
+ esac
+ brightspot="$mydir/brightspot-bin"
+ [ "$brightspot" -nt "$mydir/brightspot.c" ] || gcc -lm -O3 -Wall -Wextra "$mydir/brightspot.c" -o "$brightspot" || exit 1
+fi
+
+i=$1
+ext=${i##*.}
+name=${i%.*}
+name=${name%_[rlbfud][tfktpn]}
+
+{
+ convert "$name"_rt."$ext" -depth 8 -geometry 512x512 GRAY:-
+ convert "$name"_lf."$ext" -depth 8 -geometry 512x512 GRAY:-
+ convert "$name"_bk."$ext" -depth 8 -geometry 512x512 GRAY:-
+ convert "$name"_ft."$ext" -depth 8 -geometry 512x512 GRAY:-
+ convert "$name"_up."$ext" -depth 8 -geometry 512x512 GRAY:-
+ convert "$name"_dn."$ext" -depth 8 -geometry 512x512 GRAY:-
+} | "$brightspot" /dev/stdin
More information about the nexuiz-commits
mailing list