/*************************************************************************************************************************************/
/* */
/* G E S T I O N D U D E P T H - C U E I N G : */
/* */
/* */
/* Author of '$xrq/nucleon.Ld$I' : */
/* */
/* Jean-Francois Colonna (LACTAMME, 1992??????????). */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* G E S T I O N D U D E P T H - C U E I N G : */
/* */
/*************************************************************************************************************************************/
#TestADef AJUSTER_AUTOMATIQUEMENT_PROFONDEUR_MINIMALE_ET_PROFONDEUR_MAXIMALE \
FAUX
DEFV(Local,DEFV(Logical,INIT(ajuster_automatiquement_profondeur_minimale_et_profondeur_maximale
,AJUSTER_AUTOMATIQUEMENT_PROFONDEUR_MINIMALE_ET_PROFONDEUR_MAXIMALE
)
)
);
/* Afin de permettre le calcul automatique des bornes de "depth-cueing" dans la fonction */
/* 'TRI_D_UNE_LISTE_DE_POINTS' qui est appelee avant 'DEPTH_CUEING_DES_POINTS(...)'. */
#TestADef PROFONDEUR_MINIMALE \
COORDONNEE_BARYCENTRIQUE_MINIMALE
DEFV(Local,DEFV(Float,INIT(profondeur_minimale,PROFONDEUR_MINIMALE)));
DEFV(Local,DEFV(Float,INIT(profondeur_minimale_reelle,PROFONDEUR_MINIMALE)));
#TestADef PROFONDEUR_MAXIMALE \
GRO4(FRA4(COORDONNEE_BARYCENTRIQUE_MAXIMALE))
DEFV(Local,DEFV(Float,INIT(profondeur_maximale,PROFONDEUR_MAXIMALE)));
DEFV(Local,DEFV(Float,INIT(profondeur_maximale_reelle,PROFONDEUR_MAXIMALE)));
#TestADef PROFONDEUR_MINIMALE_DE_TRONCATION \
GRO1(FRA4(COORDONNEE_BARYCENTRIQUE_MAXIMALE))
DEFV(Local,DEFV(Float,INIT(profondeur_minimale_de_troncation,PROFONDEUR_MINIMALE_DE_TRONCATION)));
#TestADef PROFONDEUR_MAXIMALE_DE_TRONCATION \
COORDONNEE_BARYCENTRIQUE_MAXIMALE
DEFV(Local,DEFV(Float,INIT(profondeur_maximale_de_troncation,PROFONDEUR_MAXIMALE_DE_TRONCATION)));
#define mATTENUATION_DE_DEPTH_CUEING(composante_de_charge_de_couleur,profondeur) \
ADD2(SCAL(SOUS(composante_de_charge_de_couleur,COULEUR_min) \
,SOUS(COORDONNEE_BARYCENTRIQUE_MAXIMALE,COORDONNEE_BARYCENTRIQUE_MINIMALE) \
,SOUS(TRON(COND(IL_NE_FAUT_PAS(ajuster_automatiquement_profondeur_minimale_et_profondeur_maximale) \
,HOMO(TRON(ADD2(profondeur,NEGA(TRANSLATION_DE_Z_PHYSIQUE)) \
,COORDONNEE_BARYCENTRIQUE_MINIMALE \
,COORDONNEE_BARYCENTRIQUE_MAXIMALE \
) \
,COORDONNEE_BARYCENTRIQUE_MINIMALE \
,COORDONNEE_BARYCENTRIQUE_MAXIMALE \
,profondeur_minimale \
,profondeur_maximale \
) \
,HOMO(profondeur \
,profondeur_minimale_reelle \
,profondeur_maximale_reelle \
,profondeur_minimale \
,profondeur_maximale \
) \
) \
,profondeur_minimale_de_troncation \
,profondeur_maximale_de_troncation \
) \
,COORDONNEE_BARYCENTRIQUE_MINIMALE \
) \
) \
,COULEUR_min \
) \
/* Fonction d'attenuation de la charge de couleur en fonction de la profondeur ; on peut */ \
/* dire qu'il existe deux cas suivant que le proton est vu de dessus ou de cote : */ \
/* */ \
/* 1-vue de dessus : dans ce cas, il faut rehausser le niveau du proton car c'est lui */ \
/* ------------- qui est le plus peuple... */ \
/* */ \
/* */ \
/* Z corrigee ^ */ \
/* | */ \
/* profondeur_maximale ................ |.................. */ \
/* (+3/2) | . /. */ \
/* | . / . */ \
/* | . / . */ \
/* | . / . */ \
/* | . / . */ \
/* profondeur_maximale_de_troncation .. | . ******* */ \
/* (+1) | . * . */ \
/* | .* . */ \
/* | * . */ \
/* | *. . */ \
/* | * . . */ \
/* | * . . */ \
/* | * . . */ \
/* | * . . */ \
/* profondeur_minimale_de_troncation .. **** . . */ \
/* (+1/4) | / . . */ \
/* |/ . . */ \
/* profondeur_minimale ................ O------------------------> */ \
/* (0) | ^ 1 Z normalise dans [0,1] */ \
/* | | */ \
/* | | */ \
/* | */ \
/* plan du proton */ \
/* */ \
/* */ \
/* 2-vue de cote : c'est par exemple le cas d'une animation avec mouvement autour du */ \
/* ----------- proton, des particules risquent alors de passer tres pres de */ \
/* l'observateur, et malgre cela, leur eclairage doit rester correct... */ \
/* */ \
/* */ \
/* Z corrigee ^ */ \
/* | */ \
/* profondeur_maximale .................................... |.............* */ \
/* (+4/4) . | *. */ \
/* profondeur_maximale_de_troncation .................... | * . */ \
/* (+1) | * . */ \
/* | * . */ \
/* | * . */ \
/* | * . */ \
/* | * . */ \
/* | * . */ \
/* | * . */ \
/* | * . */ \
/* profondeur_minimale_de_troncation ...................... **** . */ \
/* (+1/4) | / . */ \
/* |/ . */ \
/* profondeur_minimale .................................... O------------------------> */ \
/* (0) | 1 Z normalise */ \
/* | dans [0,1] */ \
/* | */ \
/* */ \
/* */ \
/* En resume, et en notant : */ \
/* */ \
/* pm = profondeur_minimale */ \
/* pM = profondeur_maximale */ \
/* */ \
/* pmT = profondeur_minimale_de_troncation */ \
/* pMT = profondeur_maximale_de_troncation */ \
/* */ \
/* la formule "simplifiee" de transformation d'un niveau 'N' est : */ \
/* */ \
/* N*TRON[z*(pM-pm)+pm,pmT,pMT] */ \
/* */ \
/* Note sur l'absence de "depth-cueing" : celle-ci est obtenu simplement en faisant : */ \
/* */ \
/* profondeur_minimale = COORDONNEE_BARYCENTRIQUE_MAXIMALE */ \
/* profondeur_maximale = COORDONNEE_BARYCENTRIQUE_MAXIMALE */ \
/* */ \
/* profondeur_minimale_de_troncation = COORDONNEE_BARYCENTRIQUE_MAXIMALE */ \
/* profondeur_maximale_de_troncation = COORDONNEE_BARYCENTRIQUE_MAXIMALE */ \
/* */ \
/* soit : */ \
/* */ \
/* minimum=Zminimum=1.0 */ \
/* maximum=Zmaximum=1.0 */ \
/* */ \
/* minimumT=ZminimumT=1.0 */ \
/* maximumT=ZmaximumT=1.0 */ \
/* */ \
/* */ \
/* Note sur le "depth-cueing" maximal : celle-ci est obtenu simplement en faisant : */ \
/* */ \
/* profondeur_minimale = COORDONNEE_BARYCENTRIQUE_MINIMALE */ \
/* profondeur_maximale = COORDONNEE_BARYCENTRIQUE_MAXIMALE */ \
/* */ \
/* profondeur_minimale_de_troncation = COORDONNEE_BARYCENTRIQUE_MINIMALE */ \
/* profondeur_maximale_de_troncation = COORDONNEE_BARYCENTRIQUE_MAXIMALE */ \
/* */ \
/* soit : */ \
/* */ \
/* minimum=Zminimum=0.0 */ \
/* maximum=Zmaximum=1.0 */ \
/* */ \
/* minimumT=ZminimumT=0.0 */ \
/* maximumT=ZmaximumT=1.0 */ \
/* */ \
/* ATTENTION, on notera bien que les valeurs {profondeur_minimale,profondeur_maximale} */ \
/* et {profondeur_minimale_de_troncation,profondeur_maximale_de_troncation} ne sont donc */ \
/* absolument pas synonymes. On pourra donc pour jouer sur le "depth-cueing" utiliser */ \
/* systematiquement les arguments suivants : */ \
/* */ \
/* Zmaximum=1.0 */ \
/* ZmaximumT=1.0 */ \
/* */ \
/* et a "moduler" : */ \
/* */ \
/* Zminimum=VALEUR */ \
/* ZminimumT=VALEUR */ \
/* */ \
/* ou 'VALEUR' est une valeur dans [0,1] pour laquelle '1.0' est l'absence de "depth-cueing" */ \
/* et '0.0' donne le "depth-cueing" maximal... */
BFonctionF
DEFV(Local,DEFV(FonctionF,attenuation_de_depth_cueing(composante_de_charge_de_couleur,profondeur)))
/* ATTENTION, cette fonction a ete introduite afin de reduire la complexite des programmes */
/* '$c' generes, en particulier sur les SYSTEMEs 'SYSTEME_NWS3000_NEWSOS_2CC' et */
/* 'SYSTEME_VAX9000_ULTRIX_GCC'. Malgre, cela on recupere le message : */
/* */
/* out of swap space, pid ..., proc... */
/* */
/* puis : */
/* */
/* Segmentation fault */
/* */
/* sur 'SYSTEME_NWS3000_NEWSOS_2CC', qui disparait avec un petit format d'image ('Suq' par */
/* exemple...). */
DEFV(Argument,DEFV(Float,composante_de_charge_de_couleur));
/* Definition de la composante a attenuer en fonction de la profondeur. */
DEFV(Argument,DEFV(Float,profondeur));
/* Definition de la profondeur a laquelle se situe la composante... */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(mATTENUATION_DE_DEPTH_CUEING(composante_de_charge_de_couleur,profondeur));
Eblock
EFonctionF
#define ATTENUATION_DE_DEPTH_CUEING(composante_de_charge_de_couleur,profondeur) \
attenuation_de_depth_cueing(FLOT(composante_de_charge_de_couleur),FLOT(profondeur)) \
/* Fonction d'attenuation de la charge de couleur en fonction de la profondeur. */