subroutine green_soylent in actio
This commit is contained in:
parent
6094e29efd
commit
c35c00e3da
2
BloubWorld/.gitignore
vendored
2
BloubWorld/.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
bloubs.inc
|
bloubs.inc
|
||||||
|
nbimg.inc
|
||||||
|
|
||||||
*.gif
|
*.gif
|
||||||
*.blbs
|
*.blbs
|
||||||
*.mp4
|
*.mp4
|
||||||
|
@ -23,13 +23,13 @@ module bloubspace
|
|||||||
subroutine random_pv (blb)
|
subroutine random_pv (blb)
|
||||||
type(t_bloubs), intent (inout) :: blb
|
type(t_bloubs), intent (inout) :: blb
|
||||||
|
|
||||||
blb%px = rand() - 0.50
|
blb%px = 2.0 * (rand() - 0.50)
|
||||||
blb%py = rand() * 0.25
|
blb%py = rand() * 0.50
|
||||||
blb%pz = rand() - 0.50
|
blb%pz = 2.0 * (rand() - 0.50)
|
||||||
|
|
||||||
blb%vx = (rand() - 0.5) / 4.000
|
blb%vx = (rand() - 0.5) / 3.000
|
||||||
blb%vy = (rand() - 0.5) / 4.000
|
blb%vy = (rand() - 0.5) / 3.000
|
||||||
blb%vz = (rand() - 0.5) / 4.000
|
blb%vz = (rand() - 0.5) / 3.000
|
||||||
|
|
||||||
blb%alive = .TRUE.
|
blb%alive = .TRUE.
|
||||||
|
|
||||||
@ -47,10 +47,10 @@ module bloubspace
|
|||||||
else
|
else
|
||||||
life = "dead"
|
life = "dead"
|
||||||
endif
|
endif
|
||||||
write (0, '(A)') '------------- ' // message
|
write (0, '(4X, A)') '+------------ ' // message
|
||||||
write (0, '(4X,A8,2X,I6,4X,A5)') blb%nick, blb%num, blb%alive
|
write (0, '(4X,A3,A8,2X,I6,4X,A5)') '| ', blb%nick, blb%num, life
|
||||||
write (0, '(4X,A1,3X,3(F8.3, 4X))') 'P', blb%px, blb%py, blb%pz
|
write (0, '(4X,A3,3X,3(F8.3, 4X))') '| P', blb%px, blb%py, blb%pz
|
||||||
write (0, '(4X,A1,3X,3(F8.3, 4X))') 'V', blb%vx, blb%vy, blb%vz
|
write (0, '(4X,A3,3X,3(F8.3, 4X))') '| V', blb%vx, blb%vy, blb%vz
|
||||||
write (0, '()')
|
write (0, '()')
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
@ -85,18 +85,22 @@ module bloubspace
|
|||||||
if (0.0 .gt. blb%py) then
|
if (0.0 .gt. blb%py) then
|
||||||
blb%vy = -1.0 * blb%vy
|
blb%vy = -1.0 * blb%vy
|
||||||
blb%py = 0.0
|
blb%py = 0.0
|
||||||
|
blb%seq = blb%seq + 1
|
||||||
endif
|
endif
|
||||||
if (3.0 .lt. blb%py) then
|
if (3.0 .lt. blb%py) then
|
||||||
blb%vy = -1.0 * blb%vy
|
blb%vy = -1.0 * blb%vy
|
||||||
|
blb%seq = blb%seq + 1
|
||||||
blb%py = 3.0
|
blb%py = 3.0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if (5.0 .lt. blb%pz) then
|
if (5.0 .lt. blb%pz) then
|
||||||
blb%vz = -1.0 * blb%vz
|
blb%vz = -1.0 * blb%vz
|
||||||
|
blb%seq = blb%seq + 1
|
||||||
blb%pz = 5.0
|
blb%pz = 5.0
|
||||||
endif
|
endif
|
||||||
if (-5.0 .gt. blb%pz) then
|
if (-5.0 .gt. blb%pz) then
|
||||||
blb%vz = -1.0 * blb%vz
|
blb%vz = -1.0 * blb%vz
|
||||||
|
blb%seq = blb%seq + 1
|
||||||
blb%pz = -5.0
|
blb%pz = -5.0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -105,7 +109,7 @@ module bloubspace
|
|||||||
! ----------------------------------------------------------------
|
! ----------------------------------------------------------------
|
||||||
subroutine green_soylent (blb)
|
subroutine green_soylent (blb)
|
||||||
type(t_bloubs), intent (inout) :: blb
|
type(t_bloubs), intent (inout) :: blb
|
||||||
if (blb%seq .gt. 200) then
|
if (blb%seq .gt. 4) then
|
||||||
blb%alive = .FALSE.
|
blb%alive = .FALSE.
|
||||||
endif
|
endif
|
||||||
end subroutine
|
end subroutine
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
DDIR="frames/"
|
DDIR="frames/"
|
||||||
|
|
||||||
ffmpeg -nostdin \
|
ffmpeg -nostdin \
|
||||||
-loglevel info \
|
-loglevel warning \
|
||||||
-y -r 25 -f image2 -i $DDIR/%05d.png \
|
-y -r 25 -f image2 -i $DDIR/%05d.png \
|
||||||
-metadata artist='---[ tTh ]---' \
|
-metadata artist='---[ tTh ]---' \
|
||||||
-metadata title='---[ BloubWorld ]---' \
|
-metadata title='---[ BloubWorld alpha ]---' \
|
||||||
-c:v libx264 -pix_fmt yuv420p \
|
-c:v libx264 -pix_fmt yuv420p \
|
||||||
bloubworld.mp4
|
bloubworld.mp4
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ program genbloubs
|
|||||||
compte = compte + 1
|
compte = compte + 1
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
write(0, '(1X, I5, A)') compte, " bloubs exported"
|
write(0, '(1X, I8, A)') compte, " bloubs exported"
|
||||||
|
|
||||||
close(idu)
|
close(idu)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ program genbloubs
|
|||||||
bloub%nick = 'noname '
|
bloub%nick = 'noname '
|
||||||
bloub%alive = .TRUE.
|
bloub%alive = .TRUE.
|
||||||
call random_pv(bloub)
|
call random_pv(bloub)
|
||||||
bloub%radius = 0.030
|
bloub%radius = 0.025
|
||||||
bloub%seq = 0
|
bloub%seq = 0
|
||||||
|
|
||||||
write(idu) bloub ! no error control ?
|
write(idu) bloub ! no error control ?
|
||||||
|
@ -2,14 +2,19 @@ program movebloubs
|
|||||||
|
|
||||||
use bloubspace
|
use bloubspace
|
||||||
use povstuff
|
use povstuff
|
||||||
|
use mathstuff
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
character(200) :: infile, outfile
|
character(200) :: infile, outfile
|
||||||
integer :: inu, outu, errcode, i
|
integer :: inu, outu, errcode, i
|
||||||
|
integer :: compteur, killed
|
||||||
type(t_bloubs) :: bloub
|
type(t_bloubs) :: bloub
|
||||||
double precision :: bx, by, bz
|
double precision :: bx, by, bz
|
||||||
logical :: add_new_bloub = .FALSE.
|
logical :: add_new_bloub = .TRUE.
|
||||||
|
! real :: rnd
|
||||||
|
|
||||||
|
call init_random_seed()
|
||||||
|
|
||||||
i = IARGC()
|
i = IARGC()
|
||||||
if (i .ne. 2) then
|
if (i .ne. 2) then
|
||||||
@ -18,19 +23,19 @@ program movebloubs
|
|||||||
call getarg(1, infile)
|
call getarg(1, infile)
|
||||||
call getarg(2, outfile)
|
call getarg(2, outfile)
|
||||||
|
|
||||||
inu = 42 ; outu = 51
|
|
||||||
|
|
||||||
write (0, '(A)') &
|
write (0, '(A)') &
|
||||||
"*** moving bloubs from "//trim(infile)//" to "//trim(outfile)
|
"*** moving bloubs from "//trim(infile)//" to "//trim(outfile)
|
||||||
|
|
||||||
open(unit=inu, file=trim(infile), form='unformatted', &
|
open(newunit=inu, &
|
||||||
|
file=trim(infile), form='unformatted', &
|
||||||
iostat=errcode, &
|
iostat=errcode, &
|
||||||
action='read', status='old')
|
action='read', status='old')
|
||||||
if (0 .ne. errcode) then
|
if (0 .ne. errcode) then
|
||||||
STOP " : CAN'T OPEN FILE " // trim(infile)
|
STOP " : CAN'T OPEN FILE " // trim(infile)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
open(unit=outu, file=trim(outfile), form='unformatted', &
|
open(newunit=outu, &
|
||||||
|
file=trim(outfile), form='unformatted', &
|
||||||
iostat=errcode, &
|
iostat=errcode, &
|
||||||
action='write', status='replace')
|
action='write', status='replace')
|
||||||
if (0 .ne. errcode) then
|
if (0 .ne. errcode) then
|
||||||
@ -38,26 +43,35 @@ program movebloubs
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
bx = 0.0; by = 0.0; bz = 0.0
|
bx = 0.0; by = 0.0; bz = 0.0
|
||||||
|
compteur = 0
|
||||||
|
killed = 0
|
||||||
|
|
||||||
do
|
do
|
||||||
read (unit=inu, iostat=errcode) bloub
|
read (unit=inu, iostat=errcode) bloub
|
||||||
if (0 .ne. errcode) then
|
if (0 .ne. errcode) then
|
||||||
|
! may be we got an EOF ?
|
||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! moving and boundingboxing
|
! moving and boundingboxing
|
||||||
call move_bloub (bloub, 0.11)
|
call move_bloub (bloub, 0.15)
|
||||||
call bound_a_blob (bloub)
|
call bound_a_blob (bloub)
|
||||||
|
call green_soylent (bloub)
|
||||||
|
if (.NOT. bloub%alive) then
|
||||||
|
write(0, '(A)') " KILL!"
|
||||||
|
killed = killed + 1
|
||||||
|
cycle
|
||||||
|
endif
|
||||||
! calcul du barycentre
|
! calcul du barycentre
|
||||||
bx = bx + bloub%px
|
bx = bx + dble(bloub%px)
|
||||||
by = by + bloub%py
|
by = by + dble(bloub%py)
|
||||||
bz = bz + bloub%pz
|
bz = bz + dble(bloub%pz)
|
||||||
|
|
||||||
write(outu, iostat=errcode) bloub ! no error control ?
|
write(outu, iostat=errcode) bloub ! no error control ?
|
||||||
if (0 .ne. errcode) then
|
if (0 .ne. errcode) then
|
||||||
STOP " : WRITE ERROR TO " // trim(outfile)
|
STOP " : WRITE ERROR TO " // trim(outfile)
|
||||||
endif
|
endif
|
||||||
|
compteur = compteur + 1
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
@ -66,19 +80,20 @@ program movebloubs
|
|||||||
bloub%nick = 'newbie '
|
bloub%nick = 'newbie '
|
||||||
bloub%alive = .TRUE.
|
bloub%alive = .TRUE.
|
||||||
call random_pv(bloub)
|
call random_pv(bloub)
|
||||||
bloub%radius = 0.042
|
bloub%radius = 0.045
|
||||||
bloub%seq = 0
|
bloub%seq = 0
|
||||||
!
|
|
||||||
! where is the bug ?
|
|
||||||
!
|
|
||||||
call display_bloub (bloub, "new bloub")
|
call display_bloub (bloub, "new bloub")
|
||||||
write(outu) bloub ! no error control ?
|
write(outu) bloub ! no error control ?
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! ther was some strange bias in this data
|
|
||||||
! may be a random not symetric around 0.0 ?
|
|
||||||
write (0, '(A,3(F11.3,3X))') "barycentre : ", bx, by, bz
|
|
||||||
|
|
||||||
close(inu) ; close(outu)
|
close(inu) ; close(outu)
|
||||||
|
|
||||||
|
write (0, '(I5, A)') killed, " bloubs killed"
|
||||||
|
bx = bx / dble(compteur)
|
||||||
|
by = by / dble(compteur)
|
||||||
|
bz = bz / dble(compteur)
|
||||||
|
write (0, '(A,3(F12.6,3X))') "barycentre : ", bx, by, bz
|
||||||
|
|
||||||
|
|
||||||
end program
|
end program
|
@ -20,6 +20,8 @@ module povstuff
|
|||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
! ----------------------------------------------------------------
|
||||||
|
|
||||||
! ----------------------------------------------------------------
|
! ----------------------------------------------------------------
|
||||||
! we need some primitives for the gestion of colors.
|
! we need some primitives for the gestion of colors.
|
||||||
! may be a small database indexed by name ?
|
! may be a small database indexed by name ?
|
||||||
|
@ -11,6 +11,8 @@ POVOPT="+Q9 +a -v -d -W920 -H600"
|
|||||||
DDIR="frames"
|
DDIR="frames"
|
||||||
LOGERR="log.error"
|
LOGERR="log.error"
|
||||||
|
|
||||||
|
NBIMG=3000
|
||||||
|
|
||||||
make all
|
make all
|
||||||
err=$?
|
err=$?
|
||||||
if [ $err -ne 0 ] ; then
|
if [ $err -ne 0 ] ; then
|
||||||
@ -18,13 +20,15 @@ if [ $err -ne 0 ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "\n#declare NbImg = %d;\n" $NBIMG > nbimg.inc
|
||||||
|
|
||||||
#
|
#
|
||||||
# first, we have to make a seminal buch of bloubs
|
# first, we have to make a seminal buch of bloubs
|
||||||
# --> this function need to be paraletrizable
|
# --> this function need to be paraletrizable
|
||||||
#
|
#
|
||||||
./genbloubs in.blbs 100000
|
./genbloubs in.blbs 6000
|
||||||
|
|
||||||
for idx in $(seq 0 800)
|
for idx in $(seq 0 $NBIMG)
|
||||||
do
|
do
|
||||||
|
|
||||||
echo "======== run passe $idx ========="
|
echo "======== run passe $idx ========="
|
||||||
@ -40,14 +44,14 @@ do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
td=$(date +'%F %R:%S')
|
td=$(date +'%F %R:%S')
|
||||||
txt=$(printf "%9d %5d %s" $$ $idx "${td}")
|
txt=$(printf "%5d %s" $idx "${td}")
|
||||||
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
|
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
|
||||||
echo "$txt"
|
echo "$txt" | tee -a log.txt
|
||||||
|
|
||||||
convert ${TMPPNG} \
|
convert ${TMPPNG} \
|
||||||
-font fixed \
|
-font fixed \
|
||||||
-pointsize 20 \
|
-pointsize 20 \
|
||||||
-fill orange \
|
-fill Yellow \
|
||||||
-gravity south-east \
|
-gravity south-east \
|
||||||
-annotate +15+10 "$txt" \
|
-annotate +15+10 "$txt" \
|
||||||
$PNG
|
$PNG
|
||||||
|
@ -5,26 +5,32 @@
|
|||||||
#version 3.7;
|
#version 3.7;
|
||||||
|
|
||||||
global_settings {
|
global_settings {
|
||||||
ambient_light rgb <0.09, 0.02, 0.02>
|
ambient_light rgb <0.12, 0.01, 0.01>
|
||||||
assumed_gamma 1.0
|
assumed_gamma 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "colors.inc"
|
#include "colors.inc"
|
||||||
|
|
||||||
|
#include "nbimg.inc"
|
||||||
|
|
||||||
|
#declare NormClock = clock / NbImg;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------
|
||||||
|
|
||||||
#include "bloubs.inc"
|
#include "bloubs.inc"
|
||||||
|
|
||||||
object {
|
object {
|
||||||
Bloubs
|
Bloubs
|
||||||
texture {
|
texture {
|
||||||
pigment { color Gray50 }
|
pigment { color Gray60 }
|
||||||
finish { phong 0.58 metallic 0.45 }
|
finish { phong 0.58 specular 0.45 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plane {
|
plane {
|
||||||
<0, 1, 0>, 0
|
<0, 1, 0>, 0
|
||||||
texture {
|
texture {
|
||||||
pigment { color Gray10 }
|
pigment { color Black }
|
||||||
finish { phong 0.18 metallic 0.45 }
|
finish { phong 0.18 metallic 0.45 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,7 +45,7 @@ plane {
|
|||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
cylinder { <0, 0, 0>, <0, BV, 0>, BR }
|
cylinder { <0, 0, 0>, <0, BV, 0>, BR }
|
||||||
cylinder { <0, 0, 0>, <0, 0.03, 0>, BR*4 }
|
cylinder { <0, 0, 0>, <0, 0.02, 0>, BR*8 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,11 +64,13 @@ object { Les_Bornes }
|
|||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
|
|
||||||
light_source { <4, 12, -11> color Gray80 }
|
light_source { <4, 12, -11> color Gray80 }
|
||||||
// light_source { <4, 19, 9> color White }
|
light_source { <7, 19, 9> color Gray60 }
|
||||||
|
|
||||||
|
#declare HCAM = 5 + (5 * NormClock);
|
||||||
|
|
||||||
camera {
|
camera {
|
||||||
location <7, 5, -16>
|
location <6, HCAM, -16>
|
||||||
look_at <0, 0, 0>
|
look_at <0, 0, 0>
|
||||||
right x*image_width/image_height
|
right x*image_width/image_height
|
||||||
angle 54
|
angle 52
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user