/* ##C_FILE#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE :          PhysColl.c
 
DESCRIPTION :   Physical collide set module
 
VERSION :       1.00/Olivier Jourdan/Creation
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
 
#define PCS_MAIN
 
#include "ACP_Base.h"
 
#include "GEO.h"
 
#include "PCS\PCS_Cst.h"
#include "PCS\PCS_Str.h"
#include "PCS\PCS_Mcr.h"
#include "PCS\PCS_Hdl.h"
#include "PCS\PCS_Prt.h"
#include "PCS\PCS_Fct.h"
 
/* ##F===================================================================================
NAME :          PCS_fn_hCreatePhysicalCollideSet
DESCRIPTION :   Create and init a Physical Collide Set structure
OUTPUT :        handle to physical collide set
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
PCS_tdxHandleToPhysicalCollSet PCS_fn_hCreatePhysicalCollideSet()
{
   tdstPhysicalCollSet * p_stPCS;
 
   MMG_fn_vAddMemoryInfo (MMG_C_lTypePCS , MMG_C_lSubTypePCSStructure , NULL);
   GEO_M_CPAMalloc(p_stPCS,tdstPhysicalCollSet *,sizeof(tdstPhysicalCollSet),E_uwGEONotEnoughtMemory);
   p_stPCS->hZde = NULL;
   p_stPCS->hZdm = NULL;
   p_stPCS->hZdr = NULL;
   p_stPCS->hZdd = NULL;
   return( (PCS_tdxHandleToPhysicalCollSet)p_stPCS );
}
 
 
/* ##F===================================================================================
NAME :          PCS_fn_hGetZddGeoObjOfPhysicalCollSet
DESCRIPTION :   Get the Zdd in Physical Collide Set
INPUT :         handle to phyical collide set
OUTPUT :        handle of object Zdd
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
ACP_tdxHandleOfObject PCS_fn_hGetZddGeoObjOfPhysicalCollSet(PCS_tdxHandleToPhysicalCollSet _hPhyCollSet)
{
  return( PCS_M_hGetZddGeoObjOfPhysicalCollSet(_hPhyCollSet) );
}
 
/* ##F===================================================================================
NAME :          PCS_fn_hGetZdeGeoObjOfPhysicalCollSet
DESCRIPTION :   Get the Zde in Physical Collide Set
INPUT :         handle to phyical collide set
OUTPUT :        handle of object Zde
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
ACP_tdxHandleOfObject PCS_fn_hGetZdeGeoObjOfPhysicalCollSet(PCS_tdxHandleToPhysicalCollSet _hPhyCollSet)
{
  return( PCS_M_hGetZdeGeoObjOfPhysicalCollSet(_hPhyCollSet) );
}
 
/* ##F===================================================================================
NAME :          PCS_fn_hGetZdrGeoObjOfPhysicalCollSet
DESCRIPTION :   Get the Zdr in Physical Collide Set
INPUT :         handle to phyical collide set
OUTPUT :        handle of object Zdr
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
ACP_tdxHandleOfObject PCS_fn_hGetZdrGeoObjOfPhysicalCollSet(PCS_tdxHandleToPhysicalCollSet _hPhyCollSet)
{
  return( PCS_M_hGetZdrGeoObjOfPhysicalCollSet(_hPhyCollSet) );
}
 
/* ##F===================================================================================
NAME :          PCS_fn_hGetZdmGeoObjOfPhysicalCollSet
DESCRIPTION :   Get the Zdm in Physical Collide Set
INPUT :         handle to phyical collide set
OUTPUT :        handle of object Zdm
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
#ifndef _FIRE_DEADCODE_U64_
ACP_tdxHandleOfObject PCS_fn_hGetZdmGeoObjOfPhysicalCollSet(PCS_tdxHandleToPhysicalCollSet _hPhyCollSet)
{
  return( PCS_M_hGetZdmGeoObjOfPhysicalCollSet(_hPhyCollSet) );
}
#endif /* _FIRE_DEADCODE_U64_ */
 
/* ##F===================================================================================
NAME :          PCS_fn_hGetGeoObjOfPhysicalCollSet
DESCRIPTION :   Get the Zdx of type in Physical Collide Set
INPUT :         zone type
                handle to physical collide set
OUTPUT :        handle of object Zdx
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
ACP_tdxHandleOfObject PCS_fn_hGetGeoObjOfPhysicalCollSet(unsigned char ucZoneType,PCS_tdxHandleToPhysicalCollSet _hPhyCollSet)
{
   switch( ucZoneType )
   {
   case C_ucTypeZdd:
     return( PCS_M_hGetZddGeoObjOfPhysicalCollSet(_hPhyCollSet) );
     break;
   case C_ucTypeZdm:
     return( PCS_M_hGetZdmGeoObjOfPhysicalCollSet(_hPhyCollSet) );
     break;
   case C_ucTypeZdr:
     return( PCS_M_hGetZdrGeoObjOfPhysicalCollSet(_hPhyCollSet) );
     break;
   case C_ucTypeZde:
     return( PCS_M_hGetZdeGeoObjOfPhysicalCollSet(_hPhyCollSet) );
     break;
   default:
       return NULL;
       break;
   }
}
 
 
/* ##F===================================================================================
NAME :          PCS_fn_vSetZddGeoObjOfPhysicalCollSet
DESCRIPTION :   Set the Zdd in Physical Collide Set
INPUT :         handle to physical collide set
                handle of object Zdd
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
void PCS_fn_vSetZddGeoObjOfPhysicalCollSet(PCS_tdxHandleToPhysicalCollSet _hPhyCollSet,ACP_tdxHandleOfObject _hGeoObj)
{
  PCS_M_vSetZddGeoObjOfPhysicalCollSet(_hPhyCollSet,_hGeoObj);
}
 
/* ##F===================================================================================
NAME :          PCS_fn_vSetZdeGeoObjOfPhysicalCollSet
DESCRIPTION :   Set the Zde in Physical Collide Set
INPUT :         handle to phyical collide set
                handle of object Zde
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
void PCS_fn_vSetZdeGeoObjOfPhysicalCollSet(PCS_tdxHandleToPhysicalCollSet _hPhyCollSet,ACP_tdxHandleOfObject _hGeoObj)
{
  PCS_M_vSetZdeGeoObjOfPhysicalCollSet(_hPhyCollSet,_hGeoObj);
}
 
/* ##F===================================================================================
NAME :          PCS_fn_vSetZdmGeoObjOfPhysicalCollSet
DESCRIPTION :   Set the Zdm in Physical Collide Set
INPUT :         handle to phyical collide set
                handle of object Zdm
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
void PCS_fn_vSetZdmGeoObjOfPhysicalCollSet(PCS_tdxHandleToPhysicalCollSet _hPhyCollSet,ACP_tdxHandleOfObject _hGeoObj)
{
  PCS_M_vSetZdmGeoObjOfPhysicalCollSet(_hPhyCollSet,_hGeoObj);
}
 
/* ##F===================================================================================
NAME :          PCS_fn_vSetZdrGeoObjOfPhysicalCollSet
DESCRIPTION :   Set the Zdr in Physical Collide Set
INPUT :         handle to phyical collide set
                handle of object Zdr
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
void PCS_fn_vSetZdrGeoObjOfPhysicalCollSet(PCS_tdxHandleToPhysicalCollSet _hPhyCollSet,ACP_tdxHandleOfObject _hGeoObj)
{
  PCS_M_vSetZdrGeoObjOfPhysicalCollSet(_hPhyCollSet,_hGeoObj);
}
 
/* ##F===================================================================================
NAME :          PCS_fn_vSetGeoObjOfPhysicalCollSet
DESCRIPTION :   Set the Zdx in Physical Collide Set
INPUT :         zone type
                handle to phyical collide set
                handle of object Zdx
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
#ifndef _FIRE_DEADCODE_U64_
void PCS_fn_vSetGeoObjOfPhysicalCollSet(unsigned char ucZoneType,PCS_tdxHandleToPhysicalCollSet _hPhyCollSet,ACP_tdxHandleOfObject _hGeoObj)
{
   switch( ucZoneType )
   {
   case C_ucTypeZdd:
     PCS_M_vSetZddGeoObjOfPhysicalCollSet(_hPhyCollSet,_hGeoObj);
     break;
   case C_ucTypeZdm:
     PCS_M_vSetZdmGeoObjOfPhysicalCollSet(_hPhyCollSet,_hGeoObj);
     break;
   case C_ucTypeZdr:
     PCS_M_vSetZdrGeoObjOfPhysicalCollSet(_hPhyCollSet,_hGeoObj);
     break;
   case C_ucTypeZde:
     PCS_M_vSetZdeGeoObjOfPhysicalCollSet(_hPhyCollSet,_hGeoObj);
     break;
   default:
     break;
   }
}
#endif /* _FIRE_DEADCODE_U64_ */
 
 
/* ##F===================================================================================
NAME :          PCS_fn_vAddPhysicalCollSetToBoundingVolume
DESCRIPTION :   Compute the bouding volume of the physical collide set
INPUT :         handle to bounding volume
                handle to physical collide set
=========================================================================================
CREATION :      Olivier Jourdan
=======================================================================================*/
#ifndef _FIRE_DEADCODE_U64_
/*
void PCS_fn_vAddPhysicalCollSetToBoundingVolume(
            ACP_tdxHandleOfObject _hBoundingVolume,
            PCS_tdxHandleToPhysicalCollSet _hPhyCollSet)
{
   if( PCS_M_hGetZddGeoObjOfPhysicalCollSet(_hPhyCollSet) )
      GEO_fn_vAddObjectToBoundingVolume( PCS_M_hGetZddGeoObjOfPhysicalCollSet(_hPhyCollSet),_hBoundingVolume );
   if( PCS_M_hGetZdeGeoObjOfPhysicalCollSet(_hPhyCollSet) )
      GEO_fn_vAddObjectToBoundingVolume( PCS_M_hGetZddGeoObjOfPhysicalCollSet(_hPhyCollSet),_hBoundingVolume );
   if( PCS_M_hGetZdrGeoObjOfPhysicalCollSet(_hPhyCollSet) )
      GEO_fn_vAddObjectToBoundingVolume( PCS_M_hGetZddGeoObjOfPhysicalCollSet(_hPhyCollSet),_hBoundingVolume );
   if( PCS_M_hGetZdmGeoObjOfPhysicalCollSet(_hPhyCollSet) )
      GEO_fn_vAddObjectToBoundingVolume( PCS_M_hGetZddGeoObjOfPhysicalCollSet(_hPhyCollSet),_hBoundingVolume );
}
*/
#endif /* _FIRE_DEADCODE_U64_ */
 
/*-----------------------------------------------------------------------
 ************************************************************************
 * Do not add anything after this block of comment
 ************************************************************************
 *----------------------------------------------------------------------*/
#undef PCS_MAIN
