#!/bin/csh

#######################################################################################################################################
#                                                                                                                                     #
#         M I S E   E N   M O N T A G N E   T E X T U R E E   E T   V U E   D E   C O T E                                             #
#         A V E C   U N   P R E M I E R   P L A N   ( D I T   " B R U M E " )                                                         #
#         D ' U N E   I M A G E   E N   V R A I E S   C O U L E U R S   P A R F A I T E S  :                                          #
#                                                                                                                                     #
#                                                                                                                                     #
#         Utilisation :                                                                                                               #
#                                                                                                                                     #
#                   $xci/montagne.63$Z  <surface> <Texture> <paletteT> <depth-cueing> <Ibrume> <Fbrume> <imageR> [Ty=<translationY>]  #
#                                                                                                                                     #
#                                                                         E  [0,1]             E  [0,1]                               #
#                                                                                                                                     #
#                                                                            |                    |                                   #
#                                                                           \|/                   |                                   #
#                                                                            .                    |                                   #
#                                                                                                 |                                   #
#                                                                   (0. = effet maximum)          |                                   #
#                                                                      (1.0 = absent)             |                                   #
#                                                                                                \|/                                  #
#                                                                                                 .                                   #
#                                                                                                                                     #
#                                                                                        (0. = pas de brume)                          #
#                                                                                 (1.0 = brume a couper au couteau)                   #
#                                                                                                                                     #
#                                                                                                                                     #
#         Author of '$xci/montagne.63$Z' :                                                                                            #
#                                                                                                                                     #
#                     Jean-Francois Colonna (LACTAMME, AAAAMMJJhhmmss).                                                               #
#                                                                                                                                     #
#######################################################################################################################################

set  surface=$1
set  Texture=$2
set  paletteT=$3
set  depth_cueing=$4
set  Ibrume=$5
set  Fbrume=$6
set  imageR=$7
set  Ty=$8

set  translation="Ty=0.50"" $Ty"
                                        # Pour translater verticalement l'image.                                                      #

set  depth="depth=FAUX"
                                        # Pour ne pas avoir de depth-cueing.                                                          #
set  depth="depth=VRAI min=$depth_cueing"
                                        # Pour avoir du depth-cueing (0.0 representant le maximum d'effet, et 1.0 son absence).       #

set  avion="avion=FAUX alias=VRAI"
                                        # Pour faire une vue de cote.                                                                 #

set  texture=`get_feuille$Z $Texture`
                                        # Recuperation du nom de la texture dans son directory.                                       #
$xci/vraies_C$X     A=$Texture p=$paletteT RR=$xT/$texture$ROUGE RV=$xT/$texture$VERTE RB=$xT/$texture$BLEUE $formatI
                                        # Recuperation des trois composantes 'RVB' de la texture.                                     #

FileTmpB  imageS $M
                                        # Nom temporaire pour la montagne sans effet de lointain.                                     #
FileTmpB  imageB
                                        # Nom temporaire pour la brume mise a l'echelle.                                              #

$xci/montagne.01$X  A=$surface T=$xT/$texture$ROUGE                                                                                     \
                    R=$imageS$ROUGE $depth $avion $translation $formatI
$xci/montagne.01$X  A=$surface T=$xT/$texture$VERTE                                                                                     \
                    R=$imageS$VERTE $depth $avion $translation $formatI
$xci/montagne.01$X  A=$surface T=$xT/$texture$BLEUE                                                                                     \
                    R=$imageS$BLEUE $depth $avion $translation $formatI
                                        # Mise en montagne de l'image argument ($surface).                                            #
$xci/scale$X        A=$Ibrume a=$Fbrume b=0.000 R=$imageB$ROUGE $formatI
$xci/scale$X        A=$Ibrume a=$Fbrume b=0.000 R=$imageB$VERTE $formatI
$xci/scale$X        A=$Ibrume a=$Fbrume b=0.000 R=$imageB$BLEUE $formatI
                                        # Mise a l'echelle de la brume.                                                               #
$xci/vitre.53$Z     $imageS $imageB $imageR
                                        # Et reconstitution finale en fausses couleurs parfaites du lointain.                         #

FileTmpE       imageS

FileTmpE       imageB

$DELETE_VALIDE $xT/$texture$ROUGE
$DELETE_VALIDE $xT/$texture$VERTE
$DELETE_VALIDE $xT/$texture$BLEUE
                                        # Enfin, on nettoie...                                                                        #



Copyright © Jean-François Colonna, 2019-2021.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / Ecole Polytechnique, 2019-2021.