From a1f5030300acc0386d4325184e8c4e785ff01018 Mon Sep 17 00:00:00 2001 From: tTh Date: Fri, 16 Dec 2022 21:16:02 +0100 Subject: [PATCH] hop vendredi, mise en prod --- GravityField/.gitignore | 1 + GravityField/animation.f90 | 17 ++++++++++------- GravityField/essai.f90 | 8 ++++---- GravityField/vision.pov | 4 ++-- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/GravityField/.gitignore b/GravityField/.gitignore index f3f8336..1981612 100644 --- a/GravityField/.gitignore +++ b/GravityField/.gitignore @@ -10,6 +10,7 @@ WS/*/*.gif WS/data/* *.pgm +*.pnm *.png *.gif *.log diff --git a/GravityField/animation.f90 b/GravityField/animation.f90 index 05e858b..5ff50e6 100644 --- a/GravityField/animation.f90 +++ b/GravityField/animation.f90 @@ -8,6 +8,7 @@ program animation use realfield use spitpgm ! extern module + use pixrgb ! extern module implicit none @@ -53,7 +54,7 @@ subroutine la_grande_boucle(start, nbre, moons) write (filename, "(a, i5.5, a)") 'WS/data/', pass, '.txt' call save_bodies_to_txt_file (planets, filename) - write (filename, "(a, i5.5, a)") 'WS/colmap/', pass, '.pgm' + write (filename, "(a, i5.5, a)") 'WS/colmap/', pass, '.pnm' call make_color_map(planets, filename, S_WIDTH, S_HEIGHT) enddo @@ -71,7 +72,7 @@ subroutine make_color_map(moons, fname, width, height) character(len=*), intent(in) :: fname integer, intent(in) :: width, height - integer, dimension(:,:), allocatable :: map + type(t_pixrgb), dimension(:,:), allocatable :: cmap integer :: ix, iy, near, ipl integer :: errcode real :: curdist, smalldist @@ -80,10 +81,10 @@ subroutine make_color_map(moons, fname, width, height) write(0, *) "colmap ", ubound(moons, 1), "moons to ", trim(fname) ! write(0, *) "mapsize ", width, height - allocate (map(width, height), stat=errcode) + allocate (cmap(width, height), stat=errcode) ! write(0, *) "errcode allocate ", errcode - map = -1 ! invalidate colmap + ! map = -1 ! invalidate colmap ! DO SOME GOOD STUFF HERE do ix=1, width @@ -106,14 +107,16 @@ subroutine make_color_map(moons, fname, width, height) endif end do ! loop on all the moons, ipl index - map(ix, iy) = mod(near*13, 255) + cmap(ix, iy)%r = mod(near*13, 255) + cmap(ix, iy)%g = mod(near*14, 255) + cmap(ix, iy)%b = mod(near*15, 255) enddo enddo - call spit_as_pgm_8(map, fname) + call rgbpix_spit_as_pnm(cmap, fname) - deallocate(map) + deallocate(cmap) end subroutine !----------------------------------------------------------------------- diff --git a/GravityField/essai.f90 b/GravityField/essai.f90 index 8a06d0e..64b6b3f 100644 --- a/GravityField/essai.f90 +++ b/GravityField/essai.f90 @@ -12,7 +12,7 @@ program essai call init_random() - call essai_near_planet(256, 1024) + call essai_near_planet(1024, 1024) STOP 'BECAUSE YOLO' @@ -64,9 +64,9 @@ subroutine essai_near_planet(nbplanets, szfield) endif end do ! loop on ipl - cmap(ix, iy)%r = mod(near*2, 255) - cmap(ix, iy)%g = mod(near*3, 255) - cmap(ix, iy)%b = mod(near*4, 255) + cmap(ix, iy)%r = mod(near*4, 255) + cmap(ix, iy)%g = mod(near*7, 255) + cmap(ix, iy)%b = mod(near*11, 255) enddo diff --git a/GravityField/vision.pov b/GravityField/vision.pov index ff0de48..bf3d4f4 100644 --- a/GravityField/vision.pov +++ b/GravityField/vision.pov @@ -23,7 +23,7 @@ global_settings { #declare HFNAME = concat(HFDIR, str(HFCK , -5, 0), ".pgm"); #declare CMDIR = "WS/colmap/"; -#declare CMNAME = concat(CMDIR, str(HFCK , -5, 0), ".pgm"); +#declare CMNAME = concat(CMDIR, str(HFCK , -5, 0), ".pnm"); #debug concat("- - - - - - - ", HFNAME, " ", CMNAME, "\n") @@ -36,7 +36,7 @@ height_field { } texture { pigment { - image_map { pgm CMNAME } + image_map { ppm CMNAME } // image_map { png "WS/mire1024.png" } rotate x*90 translate <-0.5, 0, -0.5>