first step in revamping
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
# Fortraneries by tTh - Gravity Field
|
# Fortraneries by tTh - Gravity Field
|
||||||
#
|
#
|
||||||
|
|
||||||
GFOPT = -Wall -Wextra -g -time -I../Modules
|
GFOPT = -Wall -Wextra -g -I../Modules
|
||||||
MODOBJ = ../Modules/spitpgm.o ../Modules/pixrgb.o
|
MODOBJ = ../Modules/spitpgm.o ../Modules/pixrgb.o
|
||||||
|
|
||||||
all: essai animation realdump2png
|
all: essai animation realdump2png
|
||||||
|
|||||||
@@ -4,19 +4,25 @@ _Some crude experiments to make fancy picture of a useless gravity field._
|
|||||||
|
|
||||||
Expect bug party.
|
Expect bug party.
|
||||||
|
|
||||||
## Le module `realfield`
|
## Le module realfield
|
||||||
|
|
||||||
Les mécaniques sous-jacentes. Sans la moindre rigueur mathématique.
|
Les mécaniques sous-jacentes. Sans la moindre rigueur mathématique.
|
||||||
|
Mais avec un bout de [code](./essai.f90) pour essayer des trucs et
|
||||||
|
des machins.
|
||||||
|
|
||||||
## Le commandeur en chef
|
## Le commandeur en chef
|
||||||
|
|
||||||
C'est le logiciel sobrement nommé `animation` qui n'est absolument
|
C'est le logiciel sobrement nommé [`animation`](./animation.f90)
|
||||||
|
lequel n'est absolument
|
||||||
pas fini. Par exemple, il n'est absolument pas paramétrable sans
|
pas fini. Par exemple, il n'est absolument pas paramétrable sans
|
||||||
passer per une recompilation.
|
passer par une recompilation.
|
||||||
|
|
||||||
## Le raytracing
|
## Le raytracing
|
||||||
|
|
||||||
Vous vous en doutez, c'est du POVray.
|
Vous vous en doutez, c'est du POVray.
|
||||||
|
Le fichier [vision.pov](./vision.pov), et en particulier l'object
|
||||||
|
`GravityField` assemblent le `height_field` et l'`image_map`
|
||||||
|
soigneusement calculés à l'étape précédente.
|
||||||
|
|
||||||
## Sortie graphique
|
## Sortie graphique
|
||||||
|
|
||||||
|
|||||||
@@ -13,20 +13,20 @@ program animation
|
|||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
! some configuration constants
|
! some configuration constants
|
||||||
integer, parameter :: S_WIDTH = 2048
|
integer, parameter :: IMG_WIDTH = 640
|
||||||
integer, parameter :: S_HEIGHT = 2048
|
integer, parameter :: IMG_HEIGHT = 640
|
||||||
integer, parameter :: NB_BODY = 666
|
integer, parameter :: NB_BODY = 133
|
||||||
|
|
||||||
!!! WARNING : global variable !!!
|
!!! WARNING : global variable !!!
|
||||||
type(massbody) :: planets(NB_BODY)
|
type(massbody) :: planets(NB_BODY)
|
||||||
|
|
||||||
call init_random()
|
call init_random()
|
||||||
call create_some_planets(planets, 1664e3, S_WIDTH , S_HEIGHT)
|
call create_some_planets(planets, 1664.3, IMG_WIDTH , IMG_HEIGHT)
|
||||||
call print_barycentre_bodies(planets, 'begin')
|
call print_barycentre_bodies(planets, 'begin')
|
||||||
|
|
||||||
call la_grande_boucle(0, 4000, planets)
|
call la_grande_boucle(0, 667, planets)
|
||||||
|
|
||||||
STOP ': YOLO TIME *NOW*'
|
! STOP ': YOLO TIME *NOW*'
|
||||||
|
|
||||||
!-----------------------------------------------------------------------
|
!-----------------------------------------------------------------------
|
||||||
contains
|
contains
|
||||||
@@ -46,16 +46,16 @@ subroutine la_grande_boucle(start, nbre, moons)
|
|||||||
call deplace_les_planetes(moons, .TRUE.)
|
call deplace_les_planetes(moons, .TRUE.)
|
||||||
|
|
||||||
! computing the field (used as a HF in Povray
|
! computing the field (used as a HF in Povray
|
||||||
write (filename, "(a, i5.5, a)") 'WS/nanim/', pass, '.pgm'
|
write (filename, "(a, i5.5, a)") 'WS/nanim/', pass, '.pnm'
|
||||||
write(0, '(3I5, " * ", a20)') start, nbre, pass, filename
|
write(0, '(3I5, " * ", a20)') start, nbre, pass, filename
|
||||||
call build_and_write_a_field(S_WIDTH, S_HEIGHT, moons, filename)
|
call build_and_write_a_field(IMG_WIDTH, IMG_HEIGHT, moons, filename)
|
||||||
|
|
||||||
! save the current bodies positions (can be used in gnuplot)
|
! save the current bodies positions (can be used in gnuplot)
|
||||||
! write (filename, "(a, i5.5, a)") 'WS/data/', pass, '.txt'
|
! write (filename, "(a, i5.5, a)") 'WS/data/', pass, '.txt'
|
||||||
! call save_bodies_to_txt_file (planets, filename)
|
! call save_bodies_to_txt_file (planets, filename)
|
||||||
|
|
||||||
write (filename, "(a, i5.5, a)") 'WS/colmap/', pass, '.pnm'
|
write (filename, "(a, i5.5, a)") 'WS/colmap/', pass, '.pnm'
|
||||||
call make_color_map(planets, filename, S_WIDTH, S_HEIGHT)
|
call make_color_map(planets, filename, IMG_WIDTH, IMG_HEIGHT)
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
@@ -134,8 +134,8 @@ subroutine deplace_les_planetes(moons, clipit)
|
|||||||
real :: depx, depy, coef
|
real :: depx, depy, coef
|
||||||
|
|
||||||
integer, parameter :: EE = 100
|
integer, parameter :: EE = 100
|
||||||
integer :: SW = S_WIDTH - EE
|
integer :: SW = IMG_WIDTH - EE
|
||||||
integer :: SH = S_HEIGHT - EE
|
integer :: SH = IMG_HEIGHT - EE
|
||||||
|
|
||||||
do foo=1, ubound(moons, 1)
|
do foo=1, ubound(moons, 1)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ echo "file type :" $filetype
|
|||||||
|
|
||||||
case $filetype in
|
case $filetype in
|
||||||
PNG) extension=".png" ;;
|
PNG) extension=".png" ;;
|
||||||
Netpbm) extension=".pgm" ;;
|
Netpbm) extension=".pnm" ;;
|
||||||
*) extension=".pnm" ;;
|
*) extension=".pnm" ;;
|
||||||
esac
|
esac
|
||||||
echo "extension :" $extension
|
echo "extension :" $extension
|
||||||
@@ -32,7 +32,7 @@ TITLE=$(printf -- '---{ experimental gravity field %d }---' $$)
|
|||||||
ffmpeg -nostdin \
|
ffmpeg -nostdin \
|
||||||
-loglevel warning \
|
-loglevel warning \
|
||||||
-y -r 30 -f image2 -i ${SDIR}/%05d${extension} \
|
-y -r 30 -f image2 -i ${SDIR}/%05d${extension} \
|
||||||
-metadata artist='---{ tTh }---' \
|
-metadata artist='tTh des Bourtoulots' \
|
||||||
-metadata title="${TITLE}" \
|
-metadata title="${TITLE}" \
|
||||||
-c:v libx264 -pix_fmt yuv420p \
|
-c:v libx264 -pix_fmt yuv420p \
|
||||||
$FNAME
|
$FNAME
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ program essai
|
|||||||
use realfield
|
use realfield
|
||||||
use spitpgm ! XXX
|
use spitpgm ! XXX
|
||||||
use pixrgb
|
use pixrgb
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
call init_random()
|
call init_random() ! defined in realfied module
|
||||||
|
|
||||||
call essai_near_planet(2048, 2048)
|
call essai_near_planet(2048, 2048)
|
||||||
|
|
||||||
@@ -49,7 +48,6 @@ subroutine essai_near_planet(nbplanets, szfield)
|
|||||||
fx = real(ix)
|
fx = real(ix)
|
||||||
do iy=1, szfield
|
do iy=1, szfield
|
||||||
fy = real(iy)
|
fy = real(iy)
|
||||||
|
|
||||||
near = -1
|
near = -1
|
||||||
smalldist = 1e37
|
smalldist = 1e37
|
||||||
! loop over all the planet's bodies
|
! loop over all the planet's bodies
|
||||||
@@ -63,15 +61,11 @@ subroutine essai_near_planet(nbplanets, szfield)
|
|||||||
smalldist = curdist
|
smalldist = curdist
|
||||||
endif
|
endif
|
||||||
end do ! loop on ipl
|
end do ! loop on ipl
|
||||||
|
|
||||||
cmap(ix, iy)%r = mod(near*4, 255)
|
cmap(ix, iy)%r = mod(near*4, 255)
|
||||||
cmap(ix, iy)%g = mod(near*7, 255)
|
cmap(ix, iy)%g = mod(near*7, 255)
|
||||||
cmap(ix, iy)%b = mod(near*11, 255)
|
cmap(ix, iy)%b = mod(near*11, 255)
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
write(0, *) "row", ix, " on", szfield
|
write(0, *) "row", ix, " on", szfield
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
call rgbpix_spit_as_pnm_8(cmap, "rgb.pnm")
|
call rgbpix_spit_as_pnm_8(cmap, "rgb.pnm")
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# I don't remember what this scrip is fscking doing
|
||||||
|
#
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SRC=WS/data/00013.txt
|
SRC=WS/data/00013.txt
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
POVOPT=" -q9 +a -W1280 -H1024 +WT2 -d -v "
|
POVOPT=" -q9 +a -W1152 -H900 +WT2 -d -v "
|
||||||
SOURCE="vision.pov"
|
SOURCE="vision.pov"
|
||||||
TMPF="/dev/shm/gravfield.png"
|
TMPF="/dev/shm/gravfield.png"
|
||||||
|
|
||||||
date > pov.stderr
|
date > WS/pov.stderr
|
||||||
|
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
|
|
||||||
@@ -14,9 +14,16 @@ une_passe ()
|
|||||||
{
|
{
|
||||||
clock=$1
|
clock=$1
|
||||||
|
|
||||||
cp pov.stderr old.stderr
|
cp WS/pov.stderr WS/old.stderr
|
||||||
|
|
||||||
povray -i${SOURCE} -K${clock} $POVOPT -O${TMPF} 2> pov.stderr
|
set +e
|
||||||
|
povray -i${SOURCE} -K${clock} $POVOPT -O${TMPF} 2> WS/pov.stderr
|
||||||
|
err=$?
|
||||||
|
if [ $err != 0 ] ; then
|
||||||
|
tail -20 WS/pov.stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
|
||||||
timestamp=$(date -u +'%F %H:%M' | tr '01' 'Ol')
|
timestamp=$(date -u +'%F %H:%M' | tr '01' 'Ol')
|
||||||
texte=$(printf "pass %04d" $clock | tr '01' 'Ol')
|
texte=$(printf "pass %04d" $clock | tr '01' 'Ol')
|
||||||
@@ -24,12 +31,12 @@ outfile=$(printf "WS/troid/%05d.png" $clock)
|
|||||||
echo $timestamp $texte $outfile
|
echo $timestamp $texte $outfile
|
||||||
|
|
||||||
convert ${TMPF} \
|
convert ${TMPF} \
|
||||||
-pointsize 24 \
|
-pointsize 18 \
|
||||||
-font Courier-Bold \
|
-font Courier-Bold \
|
||||||
-fill Yellow \
|
-fill Yellow \
|
||||||
-annotate +20+32 "$timestamp" \
|
-annotate +20+32 "$timestamp" \
|
||||||
-annotate +20+58 "$texte" \
|
-annotate +20+58 "$texte" \
|
||||||
-pointsize 16 \
|
-pointsize 12 \
|
||||||
-gravity south-west \
|
-gravity south-west \
|
||||||
-annotate +15+9 "tTh & Konrad" \
|
-annotate +15+9 "tTh & Konrad" \
|
||||||
${outfile}
|
${outfile}
|
||||||
@@ -38,10 +45,9 @@ sleep 6
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
|
|
||||||
# main loop, build all that nice picz
|
# main loop, build all that nice picz
|
||||||
|
|
||||||
for foo in $(seq 0 1999)
|
for foo in $(seq 0 665)
|
||||||
do
|
do
|
||||||
echo '............' $foo
|
echo '............' $foo
|
||||||
une_passe $foo
|
une_passe $foo
|
||||||
|
|||||||
@@ -66,27 +66,29 @@ subroutine create_some_planets(planets, coef, sx, sy)
|
|||||||
|
|
||||||
fmt = "(I4, ' | ', 2(F10.2, ' '), ' | ', 2F9.3, ' ', e12.3, I7)"
|
fmt = "(I4, ' | ', 2(F10.2, ' '), ' | ', 2F9.3, ' ', e12.3, I7)"
|
||||||
|
|
||||||
do foo=1, ubound(planets, 1)
|
|
||||||
if (foo .EQ. 1) then
|
|
||||||
!-
|
!-
|
||||||
! the first planet is the home of Johnny Root
|
! the first planet is the home of Johnny Root
|
||||||
!-
|
!-
|
||||||
planets(1)%posx = sx / 2
|
planets(1)%posx = sx / 2
|
||||||
planets(1)%posy = sy / 2
|
planets(1)%posy = sy / 2
|
||||||
planets(1)%mass = 31e8
|
planets(1)%mass = 7.12e3 + coef*foo*8.6
|
||||||
planets(1)%serial = 1337
|
planets(1)%serial = 1337
|
||||||
planets(1)%speed = 6.666
|
planets(1)%speed = 6.666
|
||||||
else
|
|
||||||
|
do foo=2, ubound(planets, 1)
|
||||||
!-
|
!-
|
||||||
! others are planets for peones
|
! others are planets for peones
|
||||||
!-
|
!-
|
||||||
planets(foo)%posx = rand() * real(sx-1)
|
planets(foo)%posx = rand() * real(sx-1)
|
||||||
planets(foo)%posy = rand() * real(sy-1)
|
planets(foo)%posy = rand() * real(sy-1)
|
||||||
planets(foo)%mass = 7.12e6 + coef*foo*3
|
planets(foo)%mass = 7.12e3 + coef*foo*3
|
||||||
planets(foo)%heading = 2 * 3.141592654 * rand()
|
planets(foo)%heading = 2 * 3.141592654 * rand()
|
||||||
if (rand() .LT. 0.15) planets(foo)%speed = 3.14159
|
if (rand() .LT. 0.15) then
|
||||||
planets(foo)%serial = foo*2 + 120
|
planets(foo)%speed = rand() * 2.0
|
||||||
|
else
|
||||||
|
planets(foo)%speed = rand() + 0.5
|
||||||
endif
|
endif
|
||||||
|
planets(foo)%serial = foo*2 + 120
|
||||||
|
|
||||||
write (*, fmt) foo, planets(foo)
|
write (*, fmt) foo, planets(foo)
|
||||||
enddo
|
enddo
|
||||||
|
|||||||
@@ -3,14 +3,17 @@
|
|||||||
set -e # stop on error
|
set -e # stop on error
|
||||||
|
|
||||||
make animation
|
make animation
|
||||||
|
echo err = $?
|
||||||
|
|
||||||
LOG="WS/log.animation"
|
LOG="WS/log.animation"
|
||||||
|
|
||||||
date >> $LOG
|
date >> $LOG
|
||||||
|
|
||||||
|
rm WS/colmap/* WS/nanim/*
|
||||||
|
|
||||||
time ./animation | tee -a $LOG
|
time ./animation | tee -a $LOG
|
||||||
|
|
||||||
./encode.sh WS/nanim/ gravity-field.mp4
|
./encode.sh WS/nanim/ gravity-nanim.mp4
|
||||||
./encode.sh WS/colmap/ gravity-colmap.mp4
|
./encode.sh WS/colmap/ gravity-colmap.mp4
|
||||||
|
|
||||||
ls -rtl *.mp4 >> $LOG
|
ls -rtl *.mp4 >> $LOG
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ global_settings {
|
|||||||
|
|
||||||
#declare HFDIR = "WS/nanim/";
|
#declare HFDIR = "WS/nanim/";
|
||||||
#declare HFCK = mod(clock, 2000);
|
#declare HFCK = mod(clock, 2000);
|
||||||
#declare HFNAME = concat(HFDIR, str(HFCK , -5, 0), ".pgm");
|
#declare HFNAME = concat(HFDIR, str(HFCK , -5, 0), ".pnm");
|
||||||
|
|
||||||
#declare CMDIR = "WS/colmap/";
|
#declare CMDIR = "WS/colmap/";
|
||||||
#declare CMNAME = concat(CMDIR, str(HFCK , -5, 0), ".pnm");
|
#declare CMNAME = concat(CMDIR, str(HFCK , -5, 0), ".pnm");
|
||||||
|
|||||||
Reference in New Issue
Block a user