-
Notifications
You must be signed in to change notification settings - Fork 3
/
anim.sh
42 lines (34 loc) · 887 Bytes
/
anim.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
#!/bin/sh
. ./postgres_connection.sh
scenename="busyday"
outfolder=anim
dt=0.05
gravity=-9.8
psql \
--host=${PGHOST} \
--port=${PGPORT} \
--username=${PGUSER} \
--dbname=${PGDB} \
--file=setup.sql \
--file=raytracer.sql \
--command="UPDATE camera SET sceneid=(SELECT sceneid FROM scene WHERE scenename='${scenename}')"
mkdir -p ${outfolder}
for frame in `seq -w 0 1000`
do
echo "Frame ${frame}"
psql \
--host=${PGHOST} \
--port=${PGPORT} \
--username=${PGUSER} \
--dbname=${PGDB} \
--command="INSERT INTO updateworld(dt, grav_x, grav_y, grav_z) VALUES (${dt}, 0.0, ${gravity}, 0.0)" \
--command="\\timing" \
--command="\\copy (select * from ppm) to './${outfolder}/${scenename}_${frame}.ppm' csv"
done
ffmpeg \
-r 25 \
-i ./${outfolder}/${scenename}_%d.ppm \
-vcodec libx264 \
-crf 25 \
-pix_fmt yuv420p \
./${outfolder}/${scenename}.mp4