ready for another run ?

This commit is contained in:
tth 2022-02-18 19:30:10 +01:00
parent 64206904ca
commit 47a383f3b6
9 changed files with 66 additions and 34 deletions

View File

@ -1,6 +1,7 @@
all: genbloubs movebloubs exportbloubs mergebloubs all: genbloubs movebloubs exportbloubs mergebloubs \
essai
# ------------------------------------------------------------ # ------------------------------------------------------------

3
BloubWorld/WS/README.md Normal file
View File

@ -0,0 +1,3 @@
# Work Space
Where the progs put their work file.

View File

@ -11,7 +11,7 @@ module bloubspace
type t_bloubs type t_bloubs
character(8) :: nick character(8) :: nick
logical :: alive logical :: alive
integer :: num integer :: num ! ???
real :: px, py, pz real :: px, py, pz
real :: vx, vy, vz real :: vx, vy, vz
real :: radius real :: radius
@ -23,18 +23,25 @@ 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 = 1.35 * (rand() - 0.50)
blb%py = 0.50 + rand() * 0.50 blb%py = 0.50 + (rand() * 0.50)
blb%pz = 2.0 * (rand() - 0.50) blb%pz = 1.90 * (rand() - 0.50)
blb%vx = (rand() - 0.5) / 2.500 blb%vx = (rand() - 0.5) / 2.500
blb%vy = (rand() - 0.5) / 4.000 blb%vy = (rand() - 0.1) / 4.000
blb%vz = (rand() - 0.5) / 2.500 blb%vz = (rand() - 0.5) / 2.500
blb%alive = .TRUE. blb%alive = .TRUE.
end subroutine end subroutine
! ---------------------------------------------------------------- ! ----------------------------------------------------------------
! Load a blbs file into an array of bloubs
! ----------------------------------------------------------------
! Dump an array of bloubs to a blbs file.
! ----------------------------------------------------------------
! Display a bloub content to stderr
subroutine display_bloub (blb, message) subroutine display_bloub (blb, message)
type(t_bloubs), intent (in) :: blb type(t_bloubs), intent (in) :: blb
@ -127,7 +134,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%age .gt. 5) then if (blb%age .gt. 8) then
blb%alive = .FALSE. blb%alive = .FALSE.
endif endif
end subroutine end subroutine

View File

@ -10,7 +10,7 @@ program essai
call init_random_seed() call init_random_seed()
somme = 0.0 somme = 0.0
do foo=1, 200000 do foo=1, 5
quux = rand() quux = rand()
somme = somme + quux somme = somme + quux
print *, foo, quux, somme/foo print *, foo, quux, somme/foo

View File

@ -17,8 +17,8 @@ module mathstuff
write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3 write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3
call srand(t3) call srand(t3)
! after initializing the random generator, ! after initializing the random generator engine,
! you MUST use it for initializin the initialier ! you MUST use it for initializing the initializer
dummy = rand() dummy = rand()
end subroutine end subroutine

View File

@ -3,7 +3,7 @@ program mergebloubs
use bloubspace use bloubspace
implicit none implicit none
integer, parameter :: NB_MAX_BLOUBS = 20000 integer, parameter :: NB_MAX_BLOUBS = 25000
character(200) :: infile, outfile character(200) :: infile, outfile
type(t_bloubs) :: bloub, newbloub type(t_bloubs) :: bloub, newbloub

View File

@ -12,7 +12,7 @@ program movebloubs
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 = .TRUE.
! real :: rnd real :: rnd
call init_random_seed() call init_random_seed()
@ -56,6 +56,9 @@ program movebloubs
! moving and boundingboxing ! moving and boundingboxing
call move_bloub (bloub, 0.14) call move_bloub (bloub, 0.14)
call bound_a_blob (bloub) call bound_a_blob (bloub)
if (bloub%radius .GT. 0.052) then
bloub%radius = bloub%radius * 0.985
endif
call green_soylent (bloub) call green_soylent (bloub)
if (.NOT. bloub%alive) then if (.NOT. bloub%alive) then
! write(0, '(A)') " KILL!" ! write(0, '(A)') " KILL!"
@ -73,21 +76,25 @@ program movebloubs
endif endif
compteur = compteur + 1 compteur = compteur + 1
enddo enddo ! end of main loop
write(0, '(I5,1X,A)') compteur, "bloubs processed"
! ok, we have read all the bloubs in the input file ! ok, we have read all the bloubs in the input file
! insert some fancy conditional here ! insert some fancy conditional here
if (compteur .LT. 1600) then if (compteur .LT. 1600) then
if (rand() .LT. 0.05) then rnd = rand()
call add_more_bloubs(outu, 8, 0.052) write (0, '(A,1X,F5.3)') "try to add bloubs, rnd is", rnd
if (rnd .LT. 0.02) then
call add_more_bloubs(outu, 12, 0.210)
endif endif
endif endif
close(inu) ; close(outu) close(inu) ; close(outu)
if (killed .GT. 0) then if (killed .GT. 0) then
write (0, '(I5, A)') killed, " bloubs killed" write (0, '(I5,A)') killed, " bloubs killed"
endif endif
bx = bx / dble(compteur) bx = bx / dble(compteur)

View File

@ -5,9 +5,9 @@
# #
INCFILE="bloubs.inc" INCFILE="WS/bloubs.inc"
TMPPNG="/dev/shm/bloubs7.png" TMPPNG="/dev/shm/bloubs7.png"
POVOPT="+Q9 +a -v -d -W960 -H640 -WT2" POVOPT="+Q9 +a -v -d -W1024 -H768 -WT2"
DDIR="frames" DDIR="frames"
LOGERR="log.error" LOGERR="log.error"
@ -15,7 +15,7 @@ LOGERR="log.error"
BLBS_IN="/dev/shm/in.blbs" BLBS_IN="/dev/shm/in.blbs"
BLBS_OUT="/dev/shm/out.blbs" BLBS_OUT="/dev/shm/out.blbs"
NBIMG=1200 NBIMG=1800
make all make all
err=$? err=$?
@ -24,13 +24,13 @@ if [ $err -ne 0 ] ; then
exit 1 exit 1
fi fi
printf "\n#declare NbImg = %d;\n" $NBIMG > nbimg.inc printf "\n#declare NbImg = %d;\n" $NBIMG > WS/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 parametrizable # --> this function need to be parametrizable
# #
./genbloubs ${BLBS_IN} 100 ./genbloubs ${BLBS_IN} 15
for idx in $(seq 0 $NBIMG) for idx in $(seq 0 $NBIMG)
do do
@ -49,16 +49,22 @@ do
td=$(date +'%F %R:%S') td=$(date +'%F %R:%S')
hi=$(printf "#%05d" $idx) hi=$(printf "#%05d" $idx)
count=$(head -1 "WS/log.nb_bloubs")
PNG=$(printf "%s/%05d.png" ${DDIR} $idx) PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
convert ${TMPPNG} \ convert ${TMPPNG} \
-font Courier-Bold \ -font Courier-Bold \
-pointsize 22 \ -pointsize 16 \
-fill Orange \ -fill Orange \
-gravity south-east \ -gravity south-east \
-annotate +15+10 "$td" \ -annotate +15+10 "$td" \
-gravity south-west \ -gravity south-west \
-annotate +15+10 "$hi" \ -annotate +15+10 "$hi" \
-fill Yellow \
-pointsize 32 \
-gravity north-east \
-annotate +15+10 "$count" \
$PNG $PNG
echo $PNG '[done]' echo $PNG '[done]'
@ -67,7 +73,7 @@ do
mv ${BLBS_OUT} ${BLBS_IN} mv ${BLBS_OUT} ${BLBS_IN}
echo echo
sleep 9 sleep 15
done done

View File

@ -11,13 +11,18 @@ global_settings {
#include "colors.inc" #include "colors.inc"
#include "nbimg.inc" #include "WS/nbimg.inc"
#declare NormClock = clock / NbImg; #declare NormClock = clock / NbImg;
// ---------------------------------------------------------- // ----------------------------------------------------------
#include "bloubs.inc" #include "WS/bloubs.inc"
#fopen LC "WS/log.nb_bloubs" write
#write (LC, Nb_Bloubs, "\n")
#fclose LC
object { object {
Bloubs Bloubs
@ -27,8 +32,8 @@ object {
plane { plane {
<0, 1, 0>, 0 <0, 1, 0>, 0
texture { texture {
pigment { color Gray05 } pigment { color srgb <0.133, 0.144, 0.111> }
finish { phong 0.18 metallic 0.45 } finish { phong 0.18 metallic 0.55 }
} }
} }
@ -49,7 +54,7 @@ merge {
#declare Un_Cadre = object #declare Un_Cadre = object
{ {
merge { merge {
#local Ruc = BR * 0.78; #local Ruc = BR * 0.666;
cylinder { <-BH, 0, -BH>, <-BH, 0, BH>, Ruc } cylinder { <-BH, 0, -BH>, <-BH, 0, BH>, Ruc }
cylinder { < BH, 0, -BH>, < BH, 0, BH>, BR } cylinder { < BH, 0, -BH>, < BH, 0, BH>, BR }
cylinder { < BH, 0, -BH>, <-BH, 0, -BH>, BR } cylinder { < BH, 0, -BH>, <-BH, 0, -BH>, BR }
@ -100,16 +105,19 @@ union {
light_source { <9, 22, -17> color Gray80 } light_source { <9, 22, -17> color Gray80 }
light_source { <11, 19, 9> color Gray60 } light_source { <11, 19, 9> color Gray60 }
#declare XCAM = 8 -( NormClock*3 ); #declare XCAM = 8 - ( 8 * NormClock);
#declare YCAM = 5 + (11 * NormClock); #declare YCAM = 5 + ( 6 * NormClock);
#declare ZCAM = -17;
#fopen LC "log.camera" append /*
#fopen LC "WS/log.camera" append
#write (LC, clock, " ", NormClock, " ", YCAM, "\n") #write (LC, clock, " ", NormClock, " ", YCAM, "\n")
#fclose LC #fclose LC
*/
camera { camera {
location <XCAM, YCAM, -16> location <XCAM, YCAM, ZCAM>
look_at <0, 1, 0> look_at <0, 1.5, 0>
right x*image_width/image_height right x*image_width/image_height
angle 48 angle 42
} }