-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrender.sh
executable file
·78 lines (70 loc) · 2.55 KB
/
render.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright (C) 2009 Sebastian Mach (*1983)
# * mail: phresnel/at/gmail/dot/com
# * http:#phresnel.org
# * http:#picogen.org
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TARGET_DIR=supertrace
mkdir -p $TARGET_DIR
TOTAL_WIDTH=32
TOTAL_HEIGHT=32
GCC=/usr/local/gcc-4.5-20100306/bin/g++
echo "using $GCC"
echo "version: '"$($GCC --version)"'"
TILE_WIDTH=5
TILE_HEIGHT=1
if [ "${1}" = "join" ] ; then
do_join="yes"
render="no"
elif [ "$1" = "multi" ] ; then
do_join="no"
render="yes"
y_start=$2
n_th=$3
else
do_join="yes"
render="yes"
y_start=0
n_th=1
fi;
if [ $render = "yes" ] ; then
for ((y=$y_start; y<TOTAL_HEIGHT; y+=((TILE_HEIGHT*$n_th)) )); do
for ((x=0; x<TOTAL_WIDTH; x+=TILE_WIDTH)); do
mkdir -p $TARGET_DIR/$y/
binname=$x.$y.out
$GCC \
-o $binname -std=c++0x -ftemplate-depth-10000 \
-DTOTAL_WIDTH=$TOTAL_WIDTH \
-DTOTAL_HEIGHT=$TOTAL_HEIGHT \
-DTILE_WIDTH=$TILE_WIDTH \
-DTILE_HEIGHT=$TILE_HEIGHT \
-DTOTAL_X=$x -DTOTAL_Y=$y \
src/main.cc && ./$binname > $TARGET_DIR/$y/$x.ppm
rm $binname
done;
pushd $TARGET_DIR/$y/
convert +append $(ls *.ppm | sort -n) ../$y.ppm
popd
done;
echo "" > $TARGET_DIR/$2.done ;
fi;
if [ $do_join = "yes" ] ; then
echo "joining..."
pushd $TARGET_DIR
convert -append $(ls *.ppm | sort -n) final.ppm
popd
fi;