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
|
bloubs.inc
|
||||||
nbimg.inc
|
|
||||||
|
|
||||||
*.gif
|
*.gif
|
||||||
*.blbs
|
*.blbs
|
||||||
*.mp4
|
*.mp4
|
||||||
|
@ -4,7 +4,7 @@ all: genbloubs movebloubs exportbloubs
|
|||||||
|
|
||||||
|
|
||||||
GFOPT = -Wall -Wextra -g -time
|
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
|
povstuff.o: povstuff.f90 Makefile
|
||||||
gfortran $(GFOPT) -c $<
|
gfortran $(GFOPT) -c $<
|
||||||
|
|
||||||
mathstuff.o: mathstuff.f90 Makefile
|
|
||||||
gfortran $(GFOPT) -c $<
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
genbloubs: genbloubs.f90 Makefile $(OBJS)
|
genbloubs: genbloubs.f90 Makefile $(OBJS)
|
||||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
gfortran $(GFOPT) $(OBJS) $< -o $@
|
||||||
|
|
||||||
movebloubs: movebloubs.f90 Makefile $(OBJS)
|
movebloubs: movebloubs.f90 Makefile $(OBJS)
|
||||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
gfortran $(GFOPT) $(OBJS) $< -o $@
|
||||||
|
|
||||||
exportbloubs: exportbloubs.f90 Makefile $(OBJS)
|
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
|
type t_bloubs
|
||||||
character(8) :: nick
|
character(8) :: nick
|
||||||
logical :: alive
|
|
||||||
integer :: num
|
integer :: num
|
||||||
real :: px, py, pz
|
real :: px, py, pz
|
||||||
real :: vx, vy, vz
|
real :: vx, vy, vz
|
||||||
|
@ -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 = 1.3 * (rand() - 0.50)
|
blb%px = rand() - 0.50
|
||||||
blb%py = rand() * 0.50
|
blb%py = rand() * 0.25
|
||||||
blb%pz = 2.0 * (rand() - 0.50)
|
blb%pz = rand() - 0.50
|
||||||
|
|
||||||
blb%vx = (rand() - 0.5) / 3.000
|
blb%vx = (rand() - 0.5) / 4.000
|
||||||
blb%vy = (rand() - 0.5) / 3.000
|
blb%vy = (rand() - 0.5) / 4.000
|
||||||
blb%vz = (rand() - 0.5) / 3.000
|
blb%vz = (rand() - 0.5) / 4.000
|
||||||
|
|
||||||
blb%alive = .TRUE.
|
blb%alive = .TRUE.
|
||||||
|
|
||||||
@ -47,10 +47,10 @@ module bloubspace
|
|||||||
else
|
else
|
||||||
life = "dead"
|
life = "dead"
|
||||||
endif
|
endif
|
||||||
write (0, '(4X, A)') '+------------ ' // message
|
write (0, '(A)') '------------- ' // message
|
||||||
write (0, '(4X,A3,A8,2X,I6,4X,A5)') '| ', blb%nick, blb%num, life
|
write (0, '(4X,A8,2X,I6,4X,A5)') blb%nick, blb%num, blb%alive
|
||||||
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))') '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, '(4X,A1,3X,3(F8.3, 4X))') 'V', blb%vx, blb%vy, blb%vz
|
||||||
write (0, '()')
|
write (0, '()')
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
@ -85,22 +85,18 @@ 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
|
||||||
|
|
||||||
@ -109,7 +105,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. 4) then
|
if (blb%seq .gt. 200) 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 warning \
|
-loglevel info \
|
||||||
-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 alpha ]---' \
|
-metadata title='---[ BloubWorld ]---' \
|
||||||
-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, I8, A)') compte, " bloubs exported"
|
write(0, '(1X, I5, A)') compte, " bloubs exported"
|
||||||
|
|
||||||
close(idu)
|
close(idu)
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@ program genbloubs
|
|||||||
character(200) :: filename
|
character(200) :: filename
|
||||||
character(30) :: str
|
character(30) :: str
|
||||||
type(t_bloubs) :: bloub
|
type(t_bloubs) :: bloub
|
||||||
integer :: idu
|
|
||||||
|
integer, parameter :: idu = 33
|
||||||
|
|
||||||
i = IARGC()
|
i = IARGC()
|
||||||
if (i .ne. 2) then
|
if (i .ne. 2) then
|
||||||
@ -23,15 +24,14 @@ program genbloubs
|
|||||||
|
|
||||||
! print *, "generating ", nbbloubs, "bloubs to ", filename
|
! 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')
|
action='write', status='replace')
|
||||||
|
|
||||||
do i = 1, nbbloubs
|
do i = 1, nbbloubs
|
||||||
|
|
||||||
bloub%nick = 'noname '
|
bloub%nick = 'noname '
|
||||||
bloub%alive = .TRUE.
|
bloub%alive = .TRUE.
|
||||||
call random_pv(bloub)
|
call random_pv(bloub)
|
||||||
bloub%radius = 0.025
|
bloub%radius = 0.028
|
||||||
bloub%seq = 0
|
bloub%seq = 0
|
||||||
|
|
||||||
write(idu) bloub ! no error control ?
|
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 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 = .TRUE.
|
logical :: add_new_bloub = .FALSE.
|
||||||
! real :: rnd
|
|
||||||
|
|
||||||
call init_random_seed()
|
|
||||||
|
|
||||||
i = IARGC()
|
i = IARGC()
|
||||||
if (i .ne. 2) then
|
if (i .ne. 2) then
|
||||||
@ -23,19 +18,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(newunit=inu, &
|
open(unit=inu, file=trim(infile), form='unformatted', &
|
||||||
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(newunit=outu, &
|
open(unit=outu, file=trim(outfile), form='unformatted', &
|
||||||
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
|
||||||
@ -43,35 +38,26 @@ 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.15)
|
call move_bloub (bloub, 0.11)
|
||||||
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 + dble(bloub%px)
|
bx = bx + bloub%px
|
||||||
by = by + dble(bloub%py)
|
by = by + bloub%py
|
||||||
bz = bz + dble(bloub%pz)
|
bz = bz + 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
|
||||||
|
|
||||||
@ -80,23 +66,19 @@ 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.045
|
bloub%radius = 0.042
|
||||||
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)
|
||||||
|
|
||||||
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
|
end program
|
@ -20,8 +20,6 @@ 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,8 +11,6 @@ POVOPT="+Q9 +a -v -d -W920 -H600"
|
|||||||
DDIR="frames"
|
DDIR="frames"
|
||||||
LOGERR="log.error"
|
LOGERR="log.error"
|
||||||
|
|
||||||
NBIMG=4000
|
|
||||||
|
|
||||||
make all
|
make all
|
||||||
err=$?
|
err=$?
|
||||||
if [ $err -ne 0 ] ; then
|
if [ $err -ne 0 ] ; then
|
||||||
@ -20,15 +18,13 @@ 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 9000
|
./genbloubs in.blbs 100000
|
||||||
|
|
||||||
for idx in $(seq 0 $NBIMG)
|
for idx in $(seq 0 800)
|
||||||
do
|
do
|
||||||
|
|
||||||
echo "======== run passe $idx ========="
|
echo "======== run passe $idx ========="
|
||||||
@ -44,14 +40,14 @@ do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
td=$(date +'%F %R:%S')
|
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)
|
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
|
||||||
echo "$txt" | tee -a log.txt
|
echo "$txt"
|
||||||
|
|
||||||
convert ${TMPPNG} \
|
convert ${TMPPNG} \
|
||||||
-font fixed \
|
-font fixed \
|
||||||
-pointsize 20 \
|
-pointsize 20 \
|
||||||
-fill Orange \
|
-fill orange \
|
||||||
-gravity south-east \
|
-gravity south-east \
|
||||||
-annotate +15+10 "$txt" \
|
-annotate +15+10 "$txt" \
|
||||||
$PNG
|
$PNG
|
||||||
@ -66,8 +62,8 @@ done
|
|||||||
|
|
||||||
rm $LOGERR
|
rm $LOGERR
|
||||||
|
|
||||||
# XXX convert -delay 10 -resize 50% -colors 192 \
|
convert -delay 10 -resize 50% -colors 192 \
|
||||||
# XXX $DDIR/????[0]*.png foo.gif
|
$DDIR/????[0]*.png foo.gif
|
||||||
|
|
||||||
./encode.sh
|
./encode.sh
|
||||||
|
|
||||||
|
@ -5,32 +5,26 @@
|
|||||||
#version 3.7;
|
#version 3.7;
|
||||||
|
|
||||||
global_settings {
|
global_settings {
|
||||||
ambient_light rgb <0.12, 0.01, 0.01>
|
ambient_light rgb <0.09, 0.02, 0.02>
|
||||||
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 Gray60 }
|
pigment { color Gray50 }
|
||||||
finish { phong 0.58 specular 0.45 }
|
finish { phong 0.58 metallic 0.45 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plane {
|
plane {
|
||||||
<0, 1, 0>, 0
|
<0, 1, 0>, 0
|
||||||
texture {
|
texture {
|
||||||
pigment { color Black }
|
pigment { color Gray10 }
|
||||||
finish { phong 0.18 metallic 0.45 }
|
finish { phong 0.18 metallic 0.45 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,7 +39,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.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 { <4, 12, -11> color Gray80 }
|
||||||
light_source { <7, 19, 9> color Gray60 }
|
// light_source { <4, 19, 9> color White }
|
||||||
|
|
||||||
#declare HCAM = 5 + (7 * NormClock);
|
|
||||||
|
|
||||||
camera {
|
camera {
|
||||||
location <6, HCAM, -16>
|
location <7, 5, -16>
|
||||||
look_at <0, 0, 0>
|
look_at <0, 0, 0>
|
||||||
right x*image_width/image_height
|
right x*image_width/image_height
|
||||||
angle 48
|
angle 54
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user