-
Notifications
You must be signed in to change notification settings - Fork 3
/
create.sh
48 lines (36 loc) · 1.15 KB
/
create.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
#!/bin/sh
. ./postgres_connection.sh
# Creating this file overrides which scenes get rendered
scenelist_override=scenelist_override.txt
scenelist=scenelist.txt
outputdir=example_outputs
mkdir -p ${outputdir}
psql \
--host=${PGHOST} \
--port=${PGPORT} \
--username=${PGUSER} \
--dbname=${PGDB} \
--file=setup.sql \
--file=raytracer.sql \
--command="\\timing" \
--command="\\copy (select scenename from scene) to './${outputdir}/${scenelist}' csv"
test -e ${scenelist_override} && cp ${scenelist_override} ${outputdir}/${scenelist}
while read scenename
do
echo ""
echo "Rendering scene ${scenename}"
psql \
--host=${PGHOST} \
--port=${PGPORT} \
--username=${PGUSER} \
--dbname=${PGDB} \
--command="UPDATE camera SET sceneid=(SELECT sceneid FROM scene WHERE scenename='${scenename}')" \
--command="\\timing" \
--command="\\copy (select * from ppm) to './${outputdir}/${scenename}.ppm' csv"
if [ "$(uname)" == "Darwin" ]; then
open ./${outputdir}/${scenename}.ppm
else
xdg-open ./${outputdir}/${scenename}.ppm
fi
convert ./${outputdir}/${scenename}.ppm ./${outputdir}/${scenename}.png
done < ./${outputdir}/${scenelist}