From e780a79273618c89193be7574b7961b3f8d8ec43 Mon Sep 17 00:00:00 2001 From: tTh Date: Fri, 16 Dec 2022 20:37:52 +0100 Subject: [PATCH] trying to use the new rgb pixels module --- GravityField/Makefile | 4 ++-- GravityField/animation.f90 | 2 ++ GravityField/essai.f90 | 27 +++++++++++++++------------ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/GravityField/Makefile b/GravityField/Makefile index 7fcab29..f971c1a 100644 --- a/GravityField/Makefile +++ b/GravityField/Makefile @@ -2,8 +2,8 @@ # Fortraneries by tTh - Gravity Field # -GFOPT = -Wall -Wextra -g -pg -time -I../Modules -MODOBJ = ../Modules/spitpgm.o +GFOPT = -Wall -Wextra -g -time -I../Modules +MODOBJ = ../Modules/spitpgm.o ../Modules/pixrgb.o all: essai animation diff --git a/GravityField/animation.f90 b/GravityField/animation.f90 index a2d84b1..05e858b 100644 --- a/GravityField/animation.f90 +++ b/GravityField/animation.f90 @@ -64,6 +64,8 @@ end subroutine !----------------------------------------------------------------------- !- +! this is going to go very complex +!- subroutine make_color_map(moons, fname, width, height) type(massbody), intent(in) :: moons(:) character(len=*), intent(in) :: fname diff --git a/GravityField/essai.f90 b/GravityField/essai.f90 index 27b2d4b..8a06d0e 100644 --- a/GravityField/essai.f90 +++ b/GravityField/essai.f90 @@ -4,8 +4,9 @@ !- !----------------------------------------------------------------------- program essai - use realfield - use spitpgm ! XXX + use realfield + use spitpgm ! XXX + use pixrgb implicit none @@ -23,17 +24,17 @@ contains subroutine essai_near_planet(nbplanets, szfield) integer, intent(in) :: nbplanets, szfield - integer, dimension(:,:), allocatable :: map - integer :: ix, iy - real :: fx, fy, dx, dy - integer :: near, ipl, errcode - real :: curdist, smalldist - type(massbody) :: planets(nbplanets) + type(t_pixrgb), dimension(:,:), allocatable :: cmap + integer :: ix, iy + real :: fx, fy, dx, dy + integer :: near, ipl, errcode + real :: curdist, smalldist + type(massbody) :: planets(nbplanets) print *, "near planets test", nbplanets, szfield - allocate(map(szfield, szfield), stat=errcode) - map = -1 + allocate(cmap(szfield, szfield), stat=errcode) + ! map = -1 ! create some random bodies do ipl=1, nbplanets @@ -63,7 +64,9 @@ subroutine essai_near_planet(nbplanets, szfield) endif end do ! loop on ipl - map(ix, iy) = mod(near, 255) + cmap(ix, iy)%r = mod(near*2, 255) + cmap(ix, iy)%g = mod(near*3, 255) + cmap(ix, iy)%b = mod(near*4, 255) enddo @@ -71,7 +74,7 @@ subroutine essai_near_planet(nbplanets, szfield) enddo - call spit_as_pgm_8(map, "nearest.pgm") + call rgbpix_spit_as_pnm(cmap, "rgb.pnm") end subroutine !-----------------------------------------------------------------------