!/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   E F F E T   D E   L O I N T A I N                                                                                 #
#         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.62$Z  <surface> <Texture> <paletteT> <depth-cueing> <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.62$Z' :                                                                                            #
#                                                                                                                                     #
#                     Jean-Francois Colonna (LACTAMME, AAAAMMJJhhmmss).                                                               #
#                                                                                                                                     #
#######################################################################################################################################

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

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  imageZ
                                        # Nom temporaire pour le 'Z-Buffer'.                                                          #

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

FileTmpE       imageS

FileTmpE       imageZ

$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.