| 1 |
C Copyright(C) 1999-2020 National Technology & Engineering Solutions |
| 2 |
C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
C NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
C |
| 5 |
C See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
SUBROUTINE textur(sat, ncolors, map, invert, rmult, gmult, bmult) |
| 8 |
|
| 9 |
include 'colormap.blk' |
| 10 |
INTEGER invert, map, ncolors, x, ihue |
| 11 |
REAL hue, sat, red, green, blue, h |
| 12 |
|
| 13 |
if (ncolors .eq. 0) ncolors = 7 |
| 14 |
|
| 15 |
sat = min(sat, 0.99) |
| 16 |
C ... Saturation is used to pass in the minimum hue for some maps. |
| 17 |
if (sat .ge. 0.90 .or. sat .le. 0.0) then |
| 18 |
huemin = 0.3 |
| 19 |
else |
| 20 |
huemin = sat |
| 21 |
end if |
| 22 |
|
| 23 |
ratio = (1.0 / huemin) ** (1.0 / (ncolors-1)) |
| 24 |
do x = 0, ncolors-1 |
| 25 |
hue = dble(x) / dble(ncolors) |
| 26 |
ihue = int(ncolors*hue) |
| 27 |
C ... Linear hue map |
| 28 |
hue = dble(ihue) / dble(ncolors-1) |
| 29 |
hue = min(hue, 1.0) |
| 30 |
C ... Logarithmic hue map |
| 31 |
huel = huemin * ratio**x |
| 32 |
huel = min(huel, 1.0) |
| 33 |
|
| 34 |
if(invert .eq. 1) then |
| 35 |
hue = 1.-hue |
| 36 |
huel= 1.-huel |
| 37 |
end if |
| 38 |
|
| 39 |
if (map .eq. RAINBW) THEN |
| 40 |
huetmp = 1.0 - hue |
| 41 |
call rainbow(huetmp, sat, 1., red, green, blue) |
| 42 |
else if (map .eq. VIRDIS) THEN |
| 43 |
call viridis(x, ncolors, red, green, blue) |
| 44 |
else if (map .eq. TERRAIN) THEN |
| 45 |
h = 3*hue |
| 46 |
if(h .LT. 0.25) THEN |
| 47 |
red = 0.0 |
| 48 |
green = 0.0 |
| 49 |
blue = 0.25+2*h |
| 50 |
else if(h .LT. 2) THEN |
| 51 |
red = 0.0 |
| 52 |
green = 0.25+(2-h) |
| 53 |
blue = 0.0 |
| 54 |
else if(h .LT. 2.7) THEN |
| 55 |
red = 0.75 |
| 56 |
green = 0.15 |
| 57 |
blue = 0.0 |
| 58 |
else |
| 59 |
red = 0.9 |
| 60 |
green = 0.9 |
| 61 |
blue = 0.9 |
| 62 |
end if |
| 63 |
else if (map .eq. IRON) then |
| 64 |
red = 3*(hue + 0.03) |
| 65 |
green = 3*(hue - 1.0/3.0) |
| 66 |
blue = 3*(hue - 2.0/3.0) |
| 67 |
else if (map .eq. ASTRO) then |
| 68 |
red = hue |
| 69 |
green = hue |
| 70 |
blue = (hue+.2)/1.2 |
| 71 |
else if (map .eq. ZEBRA) then |
| 72 |
red = MOD(ihue+invert, 2) |
| 73 |
green = red |
| 74 |
blue = red |
| 75 |
else if (map .eq. GRAY) THEN |
| 76 |
red = huel |
| 77 |
green = huel |
| 78 |
blue = huel |
| 79 |
else if (map .eq. METAL) then |
| 80 |
red = huel * RMULT |
| 81 |
green = huel * GMULT |
| 82 |
blue = huel * BMULT |
| 83 |
else if (map .eq. COOL) then |
| 84 |
red = hue |
| 85 |
green = 1.0 - hue |
| 86 |
blue = 1.0 |
| 87 |
end if |
| 88 |
red = max(0.0, min(red, 1.0)) |
| 89 |
green = max(0.0, min(green, 1.0)) |
| 90 |
blue = max(0.0, min(blue, 1.0)) |
| 91 |
CALL PLTCOL (8+x, red, green, blue) |
| 92 |
end do |
| 93 |
return |
| 94 |
end |