/*************************************************************************************************************************************/
/* */
/* M I S E E N M O N T A G N E D E L ' I M A G E A R G U M E N T N U M E R O 1 */
/* A V E C I N T E G R A T I O N D ' U N E S E R I E D ' I M A G E S N U M E R O 2 : */
/* */
/* */
/* Definition : */
/* */
/* Cette commande "empile" d'arriere (la derniere */
/* image) en "avant" (la premiere image) une */
/* serie d'images. Il n'y a donc pas effet de */
/* transparence, mais uniquement de "depth-cueing,. */
/* puis met en montagne la deuxieme image. */
/* */
/* */
/* Author of '$xci/montagne.03$K' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 1989??????????). */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* I N T E R F A C E ' listG ' : */
/* */
/* */
/* :Debut_listG: */
/* :Fin_listG: */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* D I R E C T I V E S S P E C I F I Q U E S D E C O M P I L A T I O N : */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* F I C H I E R S D ' I N C L U D E S : */
/* */
/*************************************************************************************************************************************/
#include INCLUDES_BASE
#include image_image_MONTAGNES_EXT
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* P A R A M E T R E S : */
/* */
/*************************************************************************************************************************************/
#include xci/sequence.01.I"
#define SEUIL_NOIR_BLANC \
GRIS_6 \
/* Seuil de discrimination entre le 'NOIR' et le 'BLANC'... */
#define EFFACEMENT \
FAUX \
/* Pour ne effacer pas initialement l'image a generer dans 'Imontagnes()'... */
#define OMBRES \
VRAI \
/* Pour generer les ombres portees. */
#define PENOMBRE \
FLOT(DOUZE) \
/* Largeur de la zone de penombre. */
#define DEPTH \
FAUX \
/* Pour ne pas faire du "depth-cueing". */
#define MIN_DEPTH_CUEING \
FZERO \
/* Pour que le "depth-cueing" soit maximal lorsqu'il est demande. */
#define AVION \
FAUX \
/* Pour voir la montagne en perspective. */
#define ALIAS \
VRAI \
/* Pour faire le traitement anti-aliasing. */
#define ECHELLE \
FU \
/* On laisse le champ invariant... */
#define X_TRANSLATION \
FZERO \
/* Translation horizontale, */
#define Y_TRANSLATION \
FDU \
/* Translation verticale, */
#define X_LUMIERE \
FLOT(HUIT) \
/* Abscisse de la source lumineuse (autrefois 6.4453), */
#define Y_LUMIERE \
FLOT(HUIT) \
/* Ordonnee de la source lumineuse (autrefois 2.7343). */
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* M A C R O S U T I L E S : */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* E X E C U T I O N D E L A M I S E E N M O N T A G N E : */
/* */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
DEFV(CHAR,INIC(POINTERc(nom_imageA2),NOM_PIPE));
/* Nom de la sequence a integrer. */
DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE));
DEFV(CHAR,INIC(POINTERc(nom_imageA1),NOM_PIPE));
DEFV(CHAR,INIC(POINTERc(nom_imageT),NOM_PIPE));
DEFV(genere_Float,INIT(premiere_image,FLOT(PREMIERE_IMAGE)));
/* Numero de la premiere image, */
DEFV(genere_Float,INIT(derniere_image,FLOT(DERNIERE_IMAGE)));
/* Numero de la derniere image. */
DEFV(genere_Float,INIT(pas_des_images,FLOT(PAS_DES_IMAGES)));
/* Pas de passage d'un numero d'image a une autre. */
DEFV(Int,INIT(nombre_de_chiffres,NOMBRE_DE_CHIFFRES));
/* Nombre de chiffres codant le numero des images de la serie... */
DEFV(genere_Float,INIT(numero_d_image,FLOT__UNDEF));
/* Numero de l'image courante. */
DEFV(CHAR,INIT(POINTERc(nom_image),NOM_UNDEF));
/* Nom courant des images. */
DEFV(genere_p,INIT(seuil_de_masquage,SEUIL_NOIR_BLANC));
/* Seuil de masquage. */
DEFV(Int,INIT(tranche_Z,UNDEF));
/* Definition de la troisieme coordonnee 'Z' qui est aussi dans le cas */
/* present le temps... */
DEFV(Int,INIT(z_de_depth_cueing,UNDEF));
/* Coordonnee de "depth-cueing"... */
DEFV(Float,INIT(echelle,ECHELLE));
/* Facteur d'echelle a appliquer a l'image Argument. */
DEFV(deltaF_2D,translation);
/* Translation de la montagne dans l'image. */
DEFV(pointF_2D,source_lumineuse);
/* Position de la source lumineuse. */
DEFV(Logical,INIT(effacement,EFFACEMENT));
/* Pour l'effacement initial de l'image Resultat. */
DEFV(Logical,INIT(ombres,OMBRES));
/* Pour mettre ou pas les ombres portees, */
DEFV(Float,INIT(penombre,PENOMBRE));
/* Largeur de la zone de penombre. */
DEFV(Logical,INIT(depth,DEPTH));
/* Pour faire ou pas du "depth-cueing", */
DEFV(Float,INIT(min_depth_cueing,MIN_DEPTH_CUEING));
/* Pour ponderer dans [0,1] le "depth-cueing" : plus on est proche de */
/* zero, plus il est fort... */
DEFV(Logical,INIT(avion,AVION));
/* Pour voir d'avion ou pas la montagne. */
DEFV(Logical,INIT(alias,ALIAS));
/* Pour faire ou pas le traitement anti-aliasing. */
/*..............................................................................................................................*/
INITIALISATION_ACCROISSEMENT_2D(translation,X_TRANSLATION,Y_TRANSLATION);
/* Initialisation par defaut de la translation de la montagne. */
INITIALISATION_POINT_2D(source_lumineuse,X_LUMIERE,Y_LUMIERE);
/* Initialisation par defaut de la source lumineuse. */
GET_ARGUMENTSv(nombre_d_arguments
,BLOC(GET_ARGUMENT_C("imageA1=""A1=",nom_imageA1);
GET_ARGUMENT_C("texture=""T=",nom_imageT);
GET_ARGUMENT_C("imageA2=""A2=",nom_imageA2);
GET_ARGUMENT_C("imageR=""R=",nom_imageR);
GET_ARGUMENT_F("premiere=",premiere_image);
GET_ARGUMENT_F("derniere=",derniere_image);
GET_ARGUMENT_F("pas=",pas_des_images);
GET_ARGUMENT_I("chiffres=",nombre_de_chiffres);
GET_ARGUMENT_P("seuil=",seuil_de_masquage);
GET_ARGUMENT_F("Tx=",ASD1(translation,dx));
GET_ARGUMENT_F("Ty=",ASD1(translation,dy));
GET_ARGUMENT_F("sx=""sX=""Sx=""SX=",ASD1(source_lumineuse,x));
GET_ARGUMENT_F("sy=""sY=""Sy=""SY=",ASD1(source_lumineuse,y));
GET_ARGUMENT_L("init=",effacement);
GET_ARGUMENT_F("echelle=""e=",echelle);
GET_ARGUMENT_L("ombres=",ombres);
GET_ARGUMENT_F("penombre=",penombre);
GET_ARGUMENT_L("depth_cueing=""depth=",depth);
GET_ARGUMENT_F("minimum=""min_depth_cueing=""min=",min_depth_cueing);
/* Le 20110223145422 furent introduits "depth_cueing=" et "min_depth_cueing="... */
GET_ARGUMENT_F("perspective=",Imontagnes_precises_____facteur_de_correction_perspective);
GET_ARGUMENT_L("verification_perspective=""vp="
,Imontagnes_precises_____verification_de_la_correction_perspective
);
/* Introduit le 20170413104041... */
GET_ARGUMENT_L("alias=",alias);
GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20061220=""compatibilite_20061220="
,Imontagnes_precises_____compatibilite_20061220
);
/* Introduit le 20061220110439... */
GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20090130=""compatibilite_20090130="
,Imontagnes_precises_____compatibilite_20090130
);
/* Introduit le 20090130182247... */
GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20090202=""compatibilite_20090202="
,Imontagnes_precises_____compatibilite_20090202
);
/* Introduit le 20090202104139... */
GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20090203=""compatibilite_20090203="
,Imontagnes_precises_____compatibilite_20090203
);
/* Introduit le 20090203155217... */
GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20210928=""compatibilite_20210928="
,Imontagnes_precises_____compatibilite_20210928
);
/* Introduit le 20210928141554... */
GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20211001=""compatibilite_20211001="
,Imontagnes_precises_____compatibilite_20211001
);
/* Introduit le 20211001180957... */
GET_ARGUMENT_F("fc1=""facteur_cretes_1="
,Imontagnes_precises_____facteur_1_interpolation_toutes_lignes_de_crete
);
GET_ARGUMENT_F("fc2=""facteur_cretes_2="
,Imontagnes_precises_____facteur_2_interpolation_toutes_lignes_de_crete
);
/* Introduit le 20061220120556 et etendu le 20061220135238 a deux facteurs... */
GET_ARGUMENT_F("idv=",Imontagnes_precises_____importance_du_decalage_vertical);
GET_ARGUMENT_P("noir=""NOIR=",noir_plancher_substitution);
GET_ARGUMENT_I("pas_falaise=",pas_entre_CLIPPING_INTENSITE_et_MIN_INTENSITE);
)
);
CALi(Inoir(ImageR));
/* Initialisation de l'image Resultat. */
Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(ImageA1,nom_imageA1))))
/* Chargement de l'image a transformer. */
Bblock
Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(ImageA2,nom_imageT))))
/* Chargement de la texture. */
Bblock
CALS(Iinit_Z_Buffer());
/* Initialisation du 'Z-Buffer'. */
SET_FILTRAGE(ACTIF);
SUBSTITUTION(L_SUBSTITUTION_02);
CALS(Imontagnes(ImageR
,echelle,ImageA1
,ImageA2
,effacement
,ADRESSE(translation)
,ombres,penombre,ADRESSE(source_lumineuse)
,depth,min_depth_cueing
,avion
,alias
)
);
SET_FILTRAGE(INACTIF);
EGAL(z_de_depth_cueing,NOIR_PLANCHER);
/* Afin de faire du "depth-cueing", la troisieme coordonnee 'z' suit */
/* les couleurs... */
DoDe(numero_d_image,premiere_image,derniere_image,pas_des_images)
Bblock
EGAL(nom_image
,chain_Aconcaten2_sauf_nom_pipe(nom_imageA2,chain_numero_modulo(INTE(numero_d_image),nombre_de_chiffres))
);
/* Le 20221212115146, 'chain_numero_modulo(...)' a remplace 'chain_numero(...)'... */
Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(Masque,nom_image))))
Bblock
/* 'Masque' donne la couche a l'instant courant, */
EGAL(tranche_Z
,COZA(SCAL(SOUS(derniere_image,numero_d_image)
,LENG(premiere_image,derniere_image)
,dimZ
)
)
);
/* Conversion du numero d'image en une troisieme coordonnee... */
MASQUE_IMAGES(seuil_de_masquage);
BoIn(niveau,NOIR,BLANC,PAS_COULEURS)
Bblock
MODIFICATION_LISTE_DE_SUBSTITUTION(niveau
,fonction_01_de_substitution(GENP(z_de_depth_cueing))
);
/* La liste de substitution (associee au masque) est telle que tout ce qui */
/* est inferieur au seuil disparait, et que les autres sont materialises */
/* par le 'z' de depth-cueing... */
Eblock
EBoI
SUBSTITUTION(L_SUBSTITUTION_VARIABLE);
SET_FILTRAGE(ACTIF);
CALS(ImoveM_3D_plan(ImageR,Masque,_____cNORMALISE_OZ(tranche_Z)));
/* Et on superpose les nuages... */
SET_FILTRAGE(INACTIF);
DEMASQUE_IMAGES;
EGAL(z_de_depth_cueing
,MODU(ADD2(z_de_depth_cueing
,DIVI(COULEURS
,DIVI(LENG(premiere_image,derniere_image)
,pas_des_images
)
)
)
,NOIR_PLANCHER
,BLANC
)
);
Eblock
ATes
Bblock
Test__CODE_ERREUR__ERREUR07;
Eblock
ETes
CALZ_FreCC(nom_image);
Eblock
EDoD
CALi(Iupdate_image(nom_imageR,ImageR));
Eblock
ATes
Bblock
Test__CODE_ERREUR__ERREUR07;
Eblock
ETes
Eblock
ATes
Bblock
Test__CODE_ERREUR__ERREUR07;
Eblock
ETes
RETU_Commande;
Eblock
ECommande