/**********************************************************
 *                                                        *
 *                   Magnet                               *
 *                                                        *
 * Author : Ubi China - Marc Trabucato                    *
 *                                                        *
 **********************************************************/
 
#if !defined( _MGTMAIN_H_ )
#define _MGTMAIN_H_
 
/*************************************************************************************************/
#include "cpa_expt.h"
 
#include "MGT\MGTStruc.h"
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
/*************************************************************************************************/
 
extern CPA_EXPORT void MGT_fn_vTreatMagnets                 ( void );
 
/*************************************************************************************************/
 
void					MGT_fn_vInitTreatement						( void );
void                    MGT_fn_vEndTreatement                       ( void );
ACP_tdxBool             MGT_fn_bMorphMagnetModif                    ( MGT_tdxHandleToMagnetModification h_MagnetModif );
void                    MGT_fn_vComputeInfluence                    ( HIE_tdxHandleToSuperObject h_SO , MS_tdxHandleToMSMagnet h_Magnet , ACP_tdxIndex x_Magnet );
ACP_tdxIndex			MGT_fn_bComputeInfluenceOnSuperObject		( MS_tdxHandleToMSMagnet h_Magnet , ACP_tdxIndex x_Magnet , MTH_tdxReal xFarFar, HIE_tdxHandleToSuperObject  h_SuperObject );
ACP_tdxBool				MGT_fn_bComputeInfluenceOnObject			( ACP_tdxIndex x_Magnet, MTH_tdxReal xFarFar, GEO_tdstGeometricObject *p_stObject ,
																	  ACP_tdxIndex *p_x_ModifiedObject ,
																	  MTH3D_tdstVector *p_stMagnetPosition , HIE_tdxHandleToSuperObject h_SuperObject );
void                    MGT_fn_vUpdateInfluence                     ( MS_tdxHandleToMSMagnet h_Magnet, ACP_tdxBool bRecompute );
void					MGT_fn_vSetMagnetModificationUse			( MS_tdxHandleToMSMagnet h_Magnet, ACP_tdxBool bRecompute );
void					MGT_fn_vComputeNewPosition					( MGT_tdxHandleToMagnetModification h_MagnetModif , ACP_tdxIndex xIndexPoint, char *p_cFieldBitAlreadyInfluenced, unsigned long ulCurrentDuration ,
																	  MTH3D_tdstVector *p_stInitialPosition , MTH3D_tdstVector *p_stCurrentPosition , MTH3D_tdstVector *p_stMagnetPosition ,
																	  MTH_tdxReal xNear , MTH_tdxReal xStrength , MTH_tdxReal xInvFarMinusNear , MTH_tdxReal xInvFrames);
void					MGT_fn_vComputePreviousPosition				( MGT_tdxHandleToMagnetModification h_MagnetModif , ACP_tdxIndex xIndexPoint, char *p_cFieldBitAlreadyInfluenced,
																	  unsigned long ulCurrentDuration , unsigned long ulDecreaseDuration ,
																	  MTH3D_tdstVector *p_stInitialPosition , MTH3D_tdstVector *p_stCurrentPosition);
 
void					MGT_fn_bUpdateBoundingVolume					( void );
void					MGT_fn_vClearMagnetModificationFlagInHierarchy	( HIE_tdxHandleToSuperObject h_SuperObject );
void					MGT_fn_vRecurUpdateBoundingVolumeInHierarchy	( HIE_tdxHandleToSuperObject h_SuperObject );
 
/*************************************************************************************************/
 
#ifdef __cplusplus
};
#endif /* __cplusplus */
 
/*************************************************************************************************/
 
#endif /* _MGTMAIN_H_ */
 
