/*************************************************************************************************************************************/ /* */ /* M A P P I N G S U R U N E S P H E R E " F I L D E F E R " D E L ' I M A G E A R G U M E N T : */ /* */ /* */ /* Definition : */ /* */ /* Cette commande genere une image */ /* dont le nom est le premier argument */ /* d'appel ; elle est le resultat de */ /* du mapping de la premiere sur une */ /* sphere. */ /* */ /* */ /* Author of '$xci/sphere.02$K' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, 1995??????????). */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* 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 maths_fonct_SURFACES_1_EXT /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P A R A M E T R E S : */ /* */ /*************************************************************************************************************************************/ #define RAYON \ PARE(0.4) \ /* Rayon par defaut de la sphere. */ #define Umin \ PARE(0.00) #define Umax \ PARE(1.00) #define NOMBRE_DE_PAS_DE_U \ SEIZE #define Vmin \ PARE(0.00) #define Vmax \ PARE(1.00) #define NOMBRE_DE_PAS_DE_V \ SEIZE /* Definition des coordonnees curvilignes de la surface. */ #define REMPLI_LES_FACETTES \ VRAI \ /* Indique si l'on doit juste tracer les aretes ('FAUX') ou bien remplir les facettes */ \ /* par interpolation ('VRAI'). */ #define UTILISER_L_AIRE_DES_TRIANGLES_LORS_DE_L_INTERPOLATION_DES_FACETTES \ FAUX \ /* Indique s'il faut utiliser en tant que ponderateurs directement les coordonnees */ \ /* barycentriques ('FAUX') ou bien l'aire des triangles ('VRAI') lors de l'interpolation */ \ /* a l'interieure des facettes... */ #define X_TRANSLATION \ RAYON \ /* Translation horizontale, */ #define Y_TRANSLATION \ RAYON \ /* Translation verticale. */ #define Z_TRANSLATION \ NEGA(RAYON) \ /* Translation en 'Z'. */ #define X_LUMIERE \ PARE(10.0) \ /* Abscisse de la source lumineuse, */ #define Y_LUMIERE \ PARE(10.0) \ /* Ordonnee de la source lumineuse, */ #define Z_LUMIERE \ PARE(40.0) \ /* Cote de la source lumineuse. */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A C R O S U T I L E S : */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A P P I N G S U R U N E S P H E R E " F I L D E F E R " D E L ' I M A G E A R G U M E N T : */ /* */ /*************************************************************************************************************************************/ BCommande(nombre_d_arguments,arguments) /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE)); DEFV(CHAR,INIC(POINTERc(nom_imageA),NOM_PIPE)); DEFV(Float,INIT(u,Umin)); DEFV(Float,INIT(U,Umax)); DEFV(Int,INIT(nombre_de_pas_U,NOMBRE_DE_PAS_DE_U)); DEFV(Float,INIT(v,Vmin)); DEFV(Float,INIT(V,Vmax)); DEFV(Int,INIT(nombre_de_pas_V,NOMBRE_DE_PAS_DE_V)); /* Definition des coordonnees curvilignes de la surface. */ DEFV(Logical,INIT(remplir_les_facettes,REMPLI_LES_FACETTES)); /* Indique si l'on doit juste tracer les aretes ('FAUX') ou bien remplir les facettes */ /* par interpolation ('VRAI'). */ DEFV(Logical,INIT(utiliser_l_aire_des_triangles_lors_de_l_interpolation_des_facettes ,UTILISER_L_AIRE_DES_TRIANGLES_LORS_DE_L_INTERPOLATION_DES_FACETTES ) ); /* Indique s'il faut utiliser en tant que ponderateurs directement les coordonnees */ /* barycentriques ('FAUX') ou bien l'aire des triangles ('VRAI') lors de l'interpolation */ /* a l'interieure des facettes... */ DEFV(deltaF_3D,translation); /* Translation de la surface. */ DEFV(pointF_3D,source_lumineuse); /* Position de la source lumineuse. */ /*..............................................................................................................................*/ SET_ECHANTILLONNAGE(PasX,PasY); INITIALISATION_ACCROISSEMENT_3D(translation,X_TRANSLATION,Y_TRANSLATION,Z_TRANSLATION); /* Initialisation par defaut de la translation de la surface. */ INITIALISATION_POINT_3D(source_lumineuse,X_LUMIERE,Y_LUMIERE,Z_LUMIERE); /* Initialisation par defaut de la source lumineuse. */ EGAL(Fsphere_x__Fsphere_y__Fsphere_z_____rayon,RAYON); /* Initialisation par defaut du rayon de la sphere. */ GET_ARGUMENTSg(nombre_d_arguments ,BLOC(GET_ARGUMENT_C("imageA=""A=",nom_imageA); GET_ARGUMENT_C("imageR=""R=",nom_imageR); GET_ARGUMENT_F("rayon=",Fsphere_x__Fsphere_y__Fsphere_z_____rayon); GET_ARGUMENT_F("u=",u); GET_ARGUMENT_F("U=",U); GET_ARGUMENT_I("nu=",nombre_de_pas_U); GET_ARGUMENT_F("v=",v); GET_ARGUMENT_F("V=",V); GET_ARGUMENT_I("nv=",nombre_de_pas_V); GET_ARGUMENT_L("remplir=",remplir_les_facettes); GET_ARGUMENT_L("aire=",utiliser_l_aire_des_triangles_lors_de_l_interpolation_des_facettes); GET_ARGUMENT_F("Tx=",ASD1(translation,dx)); GET_ARGUMENT_F("Ty=",ASD1(translation,dy)); GET_ARGUMENT_F("Tz=",ASD1(translation,dz)); GET_ARGUMENT_F("sx=",ASD1(source_lumineuse,x)); GET_ARGUMENT_F("sy=",ASD1(source_lumineuse,y)); GET_ARGUMENT_F("sz=",ASD1(source_lumineuse,z)); ) ); CALi(FgERASE()); /* Initialisation de l'image Resultat. */ Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(ImageA,nom_imageA)))) Bblock CALS(Iinit_Z_Buffer()); /* Initialisation du 'Z-Buffer'. */ CALS(Ifil_de_fer_surface(aFONCTION(Fsphere_x),aFONCTION(Fsphere_y),aFONCTION(Fsphere_z) ,ADRESSE(translation) ,u,U ,nombre_de_pas_U ,v,V ,nombre_de_pas_V ,remplir_les_facettes ,ImageA ,ADRESSE(source_lumineuse) ,utiliser_l_aire_des_triangles_lors_de_l_interpolation_des_facettes ) ); CALi(Iupdate_image(nom_imageR,ImageG)); Eblock ATes Bblock Test__CODE_ERREUR__ERREUR07; Eblock ETes RETU_Commande; Eblock ECommande