Compare commits
No commits in common. "0934b49bc6201f170e800ffacc289aa113ab0b92" and "d84c6d969c29c05105b3666f8f311d51a808c181" have entirely different histories.
0934b49bc6
...
d84c6d969c
2
BloubWorld/.gitignore
vendored
2
BloubWorld/.gitignore
vendored
@ -1,7 +1,5 @@
|
||||
|
||||
bloubs.inc
|
||||
nbimg.inc
|
||||
|
||||
*.gif
|
||||
*.blbs
|
||||
*.mp4
|
||||
|
@ -4,7 +4,7 @@ all: genbloubs movebloubs exportbloubs
|
||||
|
||||
|
||||
GFOPT = -Wall -Wextra -g -time
|
||||
OBJS = bloubspace.o povstuff.o mathstuff.o
|
||||
OBJS = bloubspace.o povstuff.o
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
@ -19,19 +19,16 @@ bloubspace.o: bloubspace.f90 Makefile
|
||||
povstuff.o: povstuff.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
mathstuff.o: mathstuff.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
genbloubs: genbloubs.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
gfortran $(GFOPT) $(OBJS) $< -o $@
|
||||
|
||||
movebloubs: movebloubs.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
gfortran $(GFOPT) $(OBJS) $< -o $@
|
||||
|
||||
exportbloubs: exportbloubs.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
gfortran $(GFOPT) $(OBJS) $< -o $@
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
|
@ -13,7 +13,6 @@ Lesquelles évoluent en fonction du temps.
|
||||
```
|
||||
type t_bloubs
|
||||
character(8) :: nick
|
||||
logical :: alive
|
||||
integer :: num
|
||||
real :: px, py, pz
|
||||
real :: vx, vy, vz
|
||||
|
@ -23,13 +23,13 @@ module bloubspace
|
||||
subroutine random_pv (blb)
|
||||
type(t_bloubs), intent (inout) :: blb
|
||||
|
||||
blb%px = 1.3 * (rand() - 0.50)
|
||||
blb%py = rand() * 0.50
|
||||
blb%pz = 2.0 * (rand() - 0.50)
|
||||
blb%px = rand() - 0.50
|
||||
blb%py = rand() * 0.25
|
||||
blb%pz = rand() - 0.50
|
||||
|
||||
blb%vx = (rand() - 0.5) / 3.000
|
||||
blb%vy = (rand() - 0.5) / 3.000
|
||||
blb%vz = (rand() - 0.5) / 3.000
|
||||
blb%vx = (rand() - 0.5) / 4.000
|
||||
blb%vy = (rand() - 0.5) / 4.000
|
||||
blb%vz = (rand() - 0.5) / 4.000
|
||||
|
||||
blb%alive = .TRUE.
|
||||
|
||||
@ -47,10 +47,10 @@ module bloubspace
|
||||
else
|
||||
life = "dead"
|
||||
endif
|
||||
write (0, '(4X, A)') '+------------ ' // message
|
||||
write (0, '(4X,A3,A8,2X,I6,4X,A5)') '| ', blb%nick, blb%num, life
|
||||
write (0, '(4X,A3,3X,3(F8.3, 4X))') '| P', blb%px, blb%py, blb%pz
|
||||
write (0, '(4X,A3,3X,3(F8.3, 4X))') '| V', blb%vx, blb%vy, blb%vz
|
||||
write (0, '(A)') '------------- ' // message
|
||||
write (0, '(4X,A8,2X,I6,4X,A5)') blb%nick, blb%num, blb%alive
|
||||
write (0, '(4X,A1,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, '()')
|
||||
|
||||
end subroutine
|
||||
@ -85,22 +85,18 @@ module bloubspace
|
||||
if (0.0 .gt. blb%py) then
|
||||
blb%vy = -1.0 * blb%vy
|
||||
blb%py = 0.0
|
||||
blb%seq = blb%seq + 1
|
||||
endif
|
||||
if (3.0 .lt. blb%py) then
|
||||
blb%vy = -1.0 * blb%vy
|
||||
blb%seq = blb%seq + 1
|
||||
blb%py = 3.0
|
||||
endif
|
||||
|
||||
if (5.0 .lt. blb%pz) then
|
||||
blb%vz = -1.0 * blb%vz
|
||||
blb%seq = blb%seq + 1
|
||||
blb%pz = 5.0
|
||||
endif
|
||||
if (-5.0 .gt. blb%pz) then
|
||||
blb%vz = -1.0 * blb%vz
|
||||
blb%seq = blb%seq + 1
|
||||
blb%pz = -5.0
|
||||
endif
|
||||
|
||||
@ -109,7 +105,7 @@ module bloubspace
|
||||
! ----------------------------------------------------------------
|
||||
subroutine green_soylent (blb)
|
||||
type(t_bloubs), intent (inout) :: blb
|
||||
if (blb%seq .gt. 4) then
|
||||
if (blb%seq .gt. 200) then
|
||||
blb%alive = .FALSE.
|
||||
endif
|
||||
end subroutine
|
||||
|
@ -3,10 +3,10 @@
|
||||
DDIR="frames/"
|
||||
|
||||
ffmpeg -nostdin \
|
||||
-loglevel warning \
|
||||
-loglevel info \
|
||||
-y -r 25 -f image2 -i $DDIR/%05d.png \
|
||||
-metadata artist='---[ tTh ]---' \
|
||||
-metadata title='---[ BloubWorld alpha ]---' \
|
||||
-metadata title='---[ BloubWorld ]---' \
|
||||
-c:v libx264 -pix_fmt yuv420p \
|
||||
bloubworld.mp4
|
||||
|
||||
|
@ -36,7 +36,7 @@ program genbloubs
|
||||
compte = compte + 1
|
||||
enddo
|
||||
|
||||
write(0, '(1X, I8, A)') compte, " bloubs exported"
|
||||
write(0, '(1X, I5, A)') compte, " bloubs exported"
|
||||
|
||||
close(idu)
|
||||
|
||||
|
@ -7,7 +7,8 @@ program genbloubs
|
||||
character(200) :: filename
|
||||
character(30) :: str
|
||||
type(t_bloubs) :: bloub
|
||||
integer :: idu
|
||||
|
||||
integer, parameter :: idu = 33
|
||||
|
||||
i = IARGC()
|
||||
if (i .ne. 2) then
|
||||
@ -23,15 +24,14 @@ program genbloubs
|
||||
|
||||
! print *, "generating ", nbbloubs, "bloubs to ", filename
|
||||
|
||||
open(newunit=idu, file=trim(filename), form='unformatted', &
|
||||
open(unit=idu, file=trim(filename), form='unformatted', &
|
||||
action='write', status='replace')
|
||||
|
||||
do i = 1, nbbloubs
|
||||
|
||||
bloub%nick = 'noname '
|
||||
bloub%alive = .TRUE.
|
||||
call random_pv(bloub)
|
||||
bloub%radius = 0.025
|
||||
bloub%radius = 0.028
|
||||
bloub%seq = 0
|
||||
|
||||
write(idu) bloub ! no error control ?
|
||||
|
@ -1,23 +0,0 @@
|
||||
module mathstuff
|
||||
|
||||
implicit none
|
||||
|
||||
contains
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
|
||||
subroutine init_random_seed()
|
||||
|
||||
integer, dimension(3) :: tarray
|
||||
integer t3
|
||||
|
||||
call itime(tarray)
|
||||
t3 = 200*tarray(1) + 20*tarray(2) + tarray(3)
|
||||
print *, tarray, ' --> ', t3
|
||||
call srand(t3)
|
||||
|
||||
end subroutine
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
end module mathstuff
|
||||
|
@ -2,19 +2,14 @@ program movebloubs
|
||||
|
||||
use bloubspace
|
||||
use povstuff
|
||||
use mathstuff
|
||||
|
||||
implicit none
|
||||
|
||||
character(200) :: infile, outfile
|
||||
integer :: inu, outu, errcode, i
|
||||
integer :: compteur, killed
|
||||
type(t_bloubs) :: bloub
|
||||
double precision :: bx, by, bz
|
||||
logical :: add_new_bloub = .TRUE.
|
||||
! real :: rnd
|
||||
|
||||
call init_random_seed()
|
||||
logical :: add_new_bloub = .FALSE.
|
||||
|
||||
i = IARGC()
|
||||
if (i .ne. 2) then
|
||||
@ -23,19 +18,19 @@ program movebloubs
|
||||
call getarg(1, infile)
|
||||
call getarg(2, outfile)
|
||||
|
||||
inu = 42 ; outu = 51
|
||||
|
||||
write (0, '(A)') &
|
||||
"*** moving bloubs from "//trim(infile)//" to "//trim(outfile)
|
||||
|
||||
open(newunit=inu, &
|
||||
file=trim(infile), form='unformatted', &
|
||||
open(unit=inu, file=trim(infile), form='unformatted', &
|
||||
iostat=errcode, &
|
||||
action='read', status='old')
|
||||
if (0 .ne. errcode) then
|
||||
STOP " : CAN'T OPEN FILE " // trim(infile)
|
||||
endif
|
||||
|
||||
open(newunit=outu, &
|
||||
file=trim(outfile), form='unformatted', &
|
||||
open(unit=outu, file=trim(outfile), form='unformatted', &
|
||||
iostat=errcode, &
|
||||
action='write', status='replace')
|
||||
if (0 .ne. errcode) then
|
||||
@ -43,35 +38,26 @@ program movebloubs
|
||||
endif
|
||||
|
||||
bx = 0.0; by = 0.0; bz = 0.0
|
||||
compteur = 0
|
||||
killed = 0
|
||||
|
||||
do
|
||||
read (unit=inu, iostat=errcode) bloub
|
||||
if (0 .ne. errcode) then
|
||||
! may be we got an EOF ?
|
||||
exit
|
||||
endif
|
||||
|
||||
! moving and boundingboxing
|
||||
call move_bloub (bloub, 0.15)
|
||||
call move_bloub (bloub, 0.11)
|
||||
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
|
||||
bx = bx + dble(bloub%px)
|
||||
by = by + dble(bloub%py)
|
||||
bz = bz + dble(bloub%pz)
|
||||
bx = bx + bloub%px
|
||||
by = by + bloub%py
|
||||
bz = bz + bloub%pz
|
||||
|
||||
write(outu, iostat=errcode) bloub ! no error control ?
|
||||
if (0 .ne. errcode) then
|
||||
STOP " : WRITE ERROR TO " // trim(outfile)
|
||||
endif
|
||||
compteur = compteur + 1
|
||||
|
||||
enddo
|
||||
|
||||
@ -80,23 +66,19 @@ program movebloubs
|
||||
bloub%nick = 'newbie '
|
||||
bloub%alive = .TRUE.
|
||||
call random_pv(bloub)
|
||||
bloub%radius = 0.045
|
||||
bloub%radius = 0.042
|
||||
bloub%seq = 0
|
||||
|
||||
!
|
||||
! where is the bug ?
|
||||
!
|
||||
call display_bloub (bloub, "new bloub")
|
||||
write(outu) bloub ! no error control ?
|
||||
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)
|
||||
|
||||
if (killed .GT. 0) then
|
||||
write (0, '(I5, A)') killed, " bloubs killed"
|
||||
endif
|
||||
|
||||
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
|
@ -20,8 +20,6 @@ module povstuff
|
||||
|
||||
end subroutine
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
! we need some primitives for the gestion of colors.
|
||||
! may be a small database indexed by name ?
|
||||
|
@ -11,8 +11,6 @@ POVOPT="+Q9 +a -v -d -W920 -H600"
|
||||
DDIR="frames"
|
||||
LOGERR="log.error"
|
||||
|
||||
NBIMG=4000
|
||||
|
||||
make all
|
||||
err=$?
|
||||
if [ $err -ne 0 ] ; then
|
||||
@ -20,15 +18,13 @@ if [ $err -ne 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "\n#declare NbImg = %d;\n" $NBIMG > nbimg.inc
|
||||
|
||||
#
|
||||
# first, we have to make a seminal buch of bloubs
|
||||
# --> this function need to be paraletrizable
|
||||
#
|
||||
./genbloubs in.blbs 9000
|
||||
./genbloubs in.blbs 100000
|
||||
|
||||
for idx in $(seq 0 $NBIMG)
|
||||
for idx in $(seq 0 800)
|
||||
do
|
||||
|
||||
echo "======== run passe $idx ========="
|
||||
@ -44,14 +40,14 @@ do
|
||||
fi
|
||||
|
||||
td=$(date +'%F %R:%S')
|
||||
txt=$(printf "%5d %s" $idx "${td}")
|
||||
txt=$(printf "%9d %5d %s" $$ $idx "${td}")
|
||||
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
|
||||
echo "$txt" | tee -a log.txt
|
||||
echo "$txt"
|
||||
|
||||
convert ${TMPPNG} \
|
||||
-font fixed \
|
||||
-pointsize 20 \
|
||||
-fill Orange \
|
||||
-fill orange \
|
||||
-gravity south-east \
|
||||
-annotate +15+10 "$txt" \
|
||||
$PNG
|
||||
@ -66,8 +62,8 @@ done
|
||||
|
||||
rm $LOGERR
|
||||
|
||||
# XXX convert -delay 10 -resize 50% -colors 192 \
|
||||
# XXX $DDIR/????[0]*.png foo.gif
|
||||
convert -delay 10 -resize 50% -colors 192 \
|
||||
$DDIR/????[0]*.png foo.gif
|
||||
|
||||
./encode.sh
|
||||
|
||||
|
@ -5,32 +5,26 @@
|
||||
#version 3.7;
|
||||
|
||||
global_settings {
|
||||
ambient_light rgb <0.12, 0.01, 0.01>
|
||||
ambient_light rgb <0.09, 0.02, 0.02>
|
||||
assumed_gamma 1.0
|
||||
}
|
||||
|
||||
#include "colors.inc"
|
||||
|
||||
#include "nbimg.inc"
|
||||
|
||||
#declare NormClock = clock / NbImg;
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
#include "bloubs.inc"
|
||||
|
||||
object {
|
||||
Bloubs
|
||||
texture {
|
||||
pigment { color Gray60 }
|
||||
finish { phong 0.58 specular 0.45 }
|
||||
pigment { color Gray50 }
|
||||
finish { phong 0.58 metallic 0.45 }
|
||||
}
|
||||
}
|
||||
|
||||
plane {
|
||||
<0, 1, 0>, 0
|
||||
texture {
|
||||
pigment { color Black }
|
||||
pigment { color Gray10 }
|
||||
finish { phong 0.18 metallic 0.45 }
|
||||
}
|
||||
}
|
||||
@ -45,7 +39,7 @@ plane {
|
||||
{
|
||||
union {
|
||||
cylinder { <0, 0, 0>, <0, BV, 0>, BR }
|
||||
cylinder { <0, 0, 0>, <0, 0.02, 0>, BR*7 }
|
||||
cylinder { <0, 0, 0>, <0, 0.03, 0>, BR*4 }
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,13 +58,11 @@ object { Les_Bornes }
|
||||
// ----------------------------------------------------------
|
||||
|
||||
light_source { <4, 12, -11> color Gray80 }
|
||||
light_source { <7, 19, 9> color Gray60 }
|
||||
|
||||
#declare HCAM = 5 + (7 * NormClock);
|
||||
// light_source { <4, 19, 9> color White }
|
||||
|
||||
camera {
|
||||
location <6, HCAM, -16>
|
||||
location <7, 5, -16>
|
||||
look_at <0, 0, 0>
|
||||
right x*image_width/image_height
|
||||
angle 48
|
||||
angle 54
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user