bloubworld: more tweaking, more pimping

This commit is contained in:
tTh
2024-01-29 05:25:08 +01:00
parent 329f054fff
commit 5030fda56f
10 changed files with 119 additions and 77 deletions

View File

@@ -68,31 +68,37 @@ module bloubspace
end subroutine load_boundingbox
! ----------------------------------------------------------------
subroutine make_a_random_bloub(blb)
!-
! coefxyz :
! dispersion de la position autour de l'origine
!-
subroutine make_a_random_bloub(blb, coefxyz)
type(t_bloubs), intent (out) :: blb
real, intent(in) :: coefxyz
blb%px = 3.57 * (rand() - 0.50)
blb%py = 2.66 * (rand() - 0.50)
blb%pz = 3.57 * (rand() - 0.50)
! write(0, *) "coef xyz = ", coefxyz
blb%px = coefxyz * (rand() - 0.50)
blb%py = coefxyz * (rand() - 0.50)
blb%pz = coefxyz * (rand() - 0.50)
blb%vx = (rand()) / 2.500
blb%vx = (rand()) / 5.000
if (blb%px .LT. 0.0) blb%vx = -blb%vx
blb%vy = (rand()) / 4.000
if (blb%py .LT. 0.0) blb%vy = -blb%vx
blb%vy = 0.2 + (rand()) / 8.000
if (blb%py .LT. 0.0) blb%vy = -blb%vy
blb%vz = (rand()) / 2.500
blb%vz = (rand()) / 5.000
if (blb%pz .LT. 0.0) blb%vz = -blb%vz
blb%state = 0
blb%alive = .TRUE.
blb%age = 0
blb%agemax = 300
blb%agemax = 100
end subroutine
! ----------------------------------------------------------------
! Load a blbs file into an array of bloubs
subroutine spit_bloubs_to_file (fname, blbarray, towrite)
character(*), intent(in) :: fname
type(t_bloubs), dimension(:) :: blbarray
@@ -125,7 +131,7 @@ module bloubspace
enddo
close(output)
write(0, '(1X, "spitted ", I6, " bloubs")') spitted
write(0, '(1X, "spitted ", I0, " bloubs.")') spitted
end subroutine spit_bloubs_to_file
! ----------------------------------------------------------------
@@ -201,7 +207,9 @@ module bloubspace
end subroutine
! ----------------------------------------------------------------
!-
! Deplacement d'un bloub
!-
subroutine move_bloub (blb, coef)
type(t_bloubs), intent (inout) :: blb
real, intent (in) :: coef
@@ -215,7 +223,9 @@ module bloubspace
! ----------------------------------------------------------------
!
! detection des collisions avec les parois de la boite
! laquelle boite gagnerais beaucoup a etre parametrable.
! laquelle boite gagnerais beaucoup a etre parametrable,
! ainsi qu'un éventuel coefficient de réduction de la
! vitesse. XXX
!
subroutine bound_a_bloub (blb)
type(t_bloubs), intent (inout) :: blb
@@ -226,7 +236,7 @@ module bloubspace
! X axis
if ((blb%px + blb%radius) .GT. SH) then
blb%vx = -1.0 * blb%vx
blb%px = SH- blb%radius
blb%px = SH - blb%radius
blb%age = blb%age + 1
endif
if ((blb%px - blb%radius) .LT. -SH) then
@@ -282,13 +292,13 @@ module bloubspace
subroutine green_soylent (blb)
type(t_bloubs), intent (inout) :: blb
if (blb%age .gt. 24) then
if (blb%age .gt. 240) then
blb%alive = .FALSE.
endif
! this is juste a molly-guard, don't worry
!
if (blb%radius .GT. 2.0) then
if (blb%radius .GT. 4.0) then
blb%alive = .FALSE.
endif
end subroutine