Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,589 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Box utils
--------------------------------------------------------------------------------
-- Creation date : 22 aug 1996 Author : FPI
--------------------------------------------------------------------------------
*/
#include "acp_base.h"
#include "MTH.h"
#include "GEO.h"
#include "GLI.h"
#include "MEC.h"
#include "GMT.h"
#include "COL/Box.h"
/*
--------------------------------------------------------------------------------
-- Description : Macros
--------------------------------------------------------------------------------
*/
#define COL_M_vUpdateMin( xMin , xValue ) if( MTH_M_bLess( (xValue) , (xMin) ) ) (xMin) = (xValue);
#define COL_M_vUpdateMax( xMax , xValue ) if( MTH_M_bGreater( (xValue) , (xMax) ) ) (xMax) = (xValue);
#define COL_M_vUpdateWithMin( xMin , xValue1 , xValue2 )\
{\
if( MTH_M_bLess( (xValue1) , (xValue2) ) )\
{\
COL_M_vUpdateMin( (xMin) , (xValue1) );\
}\
else\
{\
COL_M_vUpdateMin( (xMin) , (xValue2) );\
}\
}
#define COL_M_vUpdateWithMax( xMax , xValue1 , xValue2 )\
{\
if( MTH_M_bGreater( (xValue1) , (xValue2) ) )\
{\
COL_M_vUpdateMax( (xMax) , (xValue1) );\
}\
else\
{\
COL_M_vUpdateMax( (xMax) , (xValue2) );\
}\
}
/*
--------------------------------------------------------------------------------
-- Description : Global variables
--------------------------------------------------------------------------------
*/
/* normales aux faces d une boite */
MTH3D_tdstVector COL_g_a6_stBoxSidesNormal[COL_C_xNbSidesPerBox] =
{
{ MTH_C_MinusONE, MTH_C_ZERO, MTH_C_ZERO },
{ MTH_C_ONE, MTH_C_ZERO, MTH_C_ZERO },
{ MTH_C_ZERO, MTH_C_MinusONE, MTH_C_ZERO },
{ MTH_C_ZERO, MTH_C_ONE, MTH_C_ZERO },
{ MTH_C_ZERO, MTH_C_ZERO, MTH_C_MinusONE },
{ MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE }
};
/* tableau d aretes d une boite */
GEO_tdstDoubledIndex COL_g_a12_stBoxEdges[COL_C_xNbEdgesPerBox] =
{
{ { COL_C_xXMinYMinZMin, COL_C_xXMaxYMinZMin } }, /* 00 = 0 - 4 */
{ { COL_C_xXMinYMinZMax, COL_C_xXMaxYMinZMax } }, /* 01 = 1 - 5 */
{ { COL_C_xXMinYMaxZMin, COL_C_xXMaxYMaxZMin } }, /* 02 = 2 - 6 */
{ { COL_C_xXMinYMaxZMax, COL_C_xXMaxYMaxZMax } }, /* 03 = 3 - 7 */
{ { COL_C_xXMinYMinZMin, COL_C_xXMinYMaxZMin } }, /* 04 = 0 - 2 */
{ { COL_C_xXMinYMinZMax, COL_C_xXMinYMaxZMax } }, /* 05 = 1 - 3 */
{ { COL_C_xXMaxYMinZMin, COL_C_xXMaxYMaxZMin } }, /* 06 = 4 - 6 */
{ { COL_C_xXMaxYMinZMax, COL_C_xXMaxYMaxZMax } }, /* 07 = 5 - 7 */
{ { COL_C_xXMinYMinZMin, COL_C_xXMinYMinZMax } }, /* 08 = 0 - 1 */
{ { COL_C_xXMinYMaxZMin, COL_C_xXMinYMaxZMax } }, /* 09 = 2 - 3 */
{ { COL_C_xXMaxYMinZMin, COL_C_xXMaxYMinZMax } }, /* 10 = 4 - 5 */
{ { COL_C_xXMaxYMaxZMin, COL_C_xXMaxYMaxZMax } } /* 11 = 6 - 7 */
};
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned long COL_g_a6_ulBoxSideMask[COL_C_xNbSidesPerBox] =
{
COL_C_ulXMinMask,
COL_C_ulXMaxMask,
COL_C_ulYMinMask,
COL_C_ulYMaxMask,
COL_C_ulZMinMask,
COL_C_ulZMaxMask
};
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned long COL_g_a6_ulBoxSideInvMask[COL_C_xNbSidesPerBox] =
{
COL_C_ulXMinInvMask,
COL_C_ulXMaxInvMask,
COL_C_ulYMinInvMask,
COL_C_ulYMaxInvMask,
COL_C_ulZMinInvMask,
COL_C_ulZMaxInvMask
};
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description : Convert a min-max box to a 8 vertices box
--------------------------------------------------------------------------------
-- Creation date : 22 aug 1996 Author : FPI
--------------------------------------------------------------------------------
*/
/* a revoir les get vector */
void COL_fn_vMinMaxBox2VerticesBox ( COL_tda8st8VerticesBox a8_stBoxDest,
MTH3D_tdstVector *p_stMinPoint,
MTH3D_tdstVector *p_stMaxPoint )
{
MTH3D_M_vSetVectorElements ( &(a8_stBoxDest[COL_C_xXMinYMinZMin]), p_stMinPoint->xX, p_stMinPoint->xY, p_stMinPoint->xZ );
MTH3D_M_vSetVectorElements ( &(a8_stBoxDest[COL_C_xXMinYMinZMax]), p_stMinPoint->xX, p_stMinPoint->xY, p_stMaxPoint->xZ );
MTH3D_M_vSetVectorElements ( &(a8_stBoxDest[COL_C_xXMinYMaxZMin]), p_stMinPoint->xX, p_stMaxPoint->xY, p_stMinPoint->xZ );
MTH3D_M_vSetVectorElements ( &(a8_stBoxDest[COL_C_xXMinYMaxZMax]), p_stMinPoint->xX, p_stMaxPoint->xY, p_stMaxPoint->xZ );
MTH3D_M_vSetVectorElements ( &(a8_stBoxDest[COL_C_xXMaxYMinZMin]), p_stMaxPoint->xX, p_stMinPoint->xY, p_stMinPoint->xZ );
MTH3D_M_vSetVectorElements ( &(a8_stBoxDest[COL_C_xXMaxYMinZMax]), p_stMaxPoint->xX, p_stMinPoint->xY, p_stMaxPoint->xZ );
MTH3D_M_vSetVectorElements ( &(a8_stBoxDest[COL_C_xXMaxYMaxZMin]), p_stMaxPoint->xX, p_stMaxPoint->xY, p_stMinPoint->xZ );
MTH3D_M_vSetVectorElements ( &(a8_stBoxDest[COL_C_xXMaxYMaxZMax]), p_stMaxPoint->xX, p_stMaxPoint->xY, p_stMaxPoint->xZ );
}
/*
--------------------------------------------------------------------------------
-- Description : Compute the bounding box of a list of vertices
--------------------------------------------------------------------------------
-- Creation date : 22 aug 1996 Author : FPI
--------------------------------------------------------------------------------
*/
/* calcul de la boite englobante d un nuage de points */
void COL_fn_vComputeBoundingBoxOfVertices ( MTH3D_tdstVector *p_stMinPoint,
MTH3D_tdstVector *p_stMaxPoint,
ACP_tdxIndex xNbVertices,
MTH3D_tdstVector *d_stListOfVertices )
{
long lVertexIndex;
MTH3D_tdstVector *p_stVert;
MTH3D_M_vCopyVector ( p_stMinPoint, d_stListOfVertices );
MTH3D_M_vCopyVector ( p_stMaxPoint, d_stListOfVertices );
for ( lVertexIndex = 0 ; lVertexIndex < xNbVertices ; lVertexIndex ++ )
{
p_stVert = &(d_stListOfVertices[lVertexIndex]);
if ( MTH_M_bLess ( MTH3D_M_xGetXofVector ( p_stVert ),
MTH3D_M_xGetXofVector ( p_stMinPoint ) ) )
MTH3D_M_vSetXofVector ( p_stMinPoint, MTH3D_M_xGetXofVector ( p_stVert ) );
if ( MTH_M_bGreater ( MTH3D_M_xGetXofVector ( p_stVert ),
MTH3D_M_xGetXofVector ( p_stMaxPoint ) ) )
MTH3D_M_vSetXofVector ( p_stMaxPoint, MTH3D_M_xGetXofVector ( p_stVert ) );
if ( MTH_M_bLess ( MTH3D_M_xGetYofVector ( p_stVert ),
MTH3D_M_xGetYofVector ( p_stMinPoint ) ) )
MTH3D_M_vSetYofVector ( p_stMinPoint, MTH3D_M_xGetYofVector ( p_stVert ) );
if ( MTH_M_bGreater ( MTH3D_M_xGetYofVector ( &(d_stListOfVertices[lVertexIndex]) ),
MTH3D_M_xGetYofVector ( p_stMaxPoint ) ) )
MTH3D_M_vSetYofVector ( p_stMaxPoint, MTH3D_M_xGetYofVector ( p_stVert ) );
if ( MTH_M_bLess ( MTH3D_M_xGetZofVector ( p_stVert ),
MTH3D_M_xGetZofVector ( p_stMinPoint ) ) )
MTH3D_M_vSetZofVector ( p_stMinPoint, MTH3D_M_xGetZofVector ( p_stVert ) );
if ( MTH_M_bGreater ( MTH3D_M_xGetZofVector ( p_stVert ),
MTH3D_M_xGetZofVector ( p_stMaxPoint ) ) )
MTH3D_M_vSetZofVector ( p_stMaxPoint, MTH3D_M_xGetZofVector ( p_stVert ) );
}
}
/*
--------------------------------------------------------------------------------
-- Description : Compute the bounding box of two vertices boxes
--------------------------------------------------------------------------------
-- Creation date : 17 apr 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* calcul de la boite englobante de deux boites de points */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void COL_fn_vComputeBoundingBoxOfVerticesBoxes ( MTH3D_tdstVector *p_stMinPoint,
MTH3D_tdstVector *p_stMaxPoint,
COL_tda8st8VerticesBox a8_stBox1,
COL_tda8st8VerticesBox a8_stBox2 )
{
long lVertexIndex;
MTH3D_tdstVector *p_stVert;
MTH3D_M_vCopyVector ( p_stMinPoint, a8_stBox1 );
MTH3D_M_vCopyVector ( p_stMaxPoint, a8_stBox1 );
for ( lVertexIndex = 0 ; lVertexIndex < COL_C_xNbVerticesPerBox ; lVertexIndex ++ )
{
p_stVert = &(a8_stBox1[lVertexIndex]);
if ( MTH_M_bLess ( MTH3D_M_xGetXofVector ( p_stVert ),
MTH3D_M_xGetXofVector ( p_stMinPoint ) ) )
MTH3D_M_vSetXofVector ( p_stMinPoint, MTH3D_M_xGetXofVector ( p_stVert ) );
if ( MTH_M_bGreater ( MTH3D_M_xGetXofVector ( p_stVert ),
MTH3D_M_xGetXofVector ( p_stMaxPoint ) ) )
MTH3D_M_vSetXofVector ( p_stMaxPoint, MTH3D_M_xGetXofVector ( p_stVert ) );
if ( MTH_M_bLess ( MTH3D_M_xGetYofVector ( p_stVert ),
MTH3D_M_xGetYofVector ( p_stMinPoint ) ) )
MTH3D_M_vSetYofVector ( p_stMinPoint, MTH3D_M_xGetYofVector ( p_stVert ) );
if ( MTH_M_bGreater ( MTH3D_M_xGetYofVector ( p_stVert ),
MTH3D_M_xGetYofVector ( p_stMaxPoint ) ) )
MTH3D_M_vSetYofVector ( p_stMaxPoint, MTH3D_M_xGetYofVector ( p_stVert ) );
if ( MTH_M_bLess ( MTH3D_M_xGetZofVector ( p_stVert ),
MTH3D_M_xGetZofVector ( p_stMinPoint ) ) )
MTH3D_M_vSetZofVector ( p_stMinPoint, MTH3D_M_xGetZofVector ( p_stVert ) );
if ( MTH_M_bGreater ( MTH3D_M_xGetZofVector ( p_stVert ),
MTH3D_M_xGetZofVector ( p_stMaxPoint ) ) )
MTH3D_M_vSetZofVector ( p_stMaxPoint, MTH3D_M_xGetZofVector ( p_stVert ) );
p_stVert = &(a8_stBox2[lVertexIndex]);
if ( MTH_M_bLess ( MTH3D_M_xGetXofVector ( p_stVert ),
MTH3D_M_xGetXofVector ( p_stMinPoint ) ) )
MTH3D_M_vSetXofVector ( p_stMinPoint, MTH3D_M_xGetXofVector ( p_stVert ) );
if ( MTH_M_bGreater ( MTH3D_M_xGetXofVector ( p_stVert ),
MTH3D_M_xGetXofVector ( p_stMaxPoint ) ) )
MTH3D_M_vSetXofVector ( p_stMaxPoint, MTH3D_M_xGetXofVector ( p_stVert ) );
if ( MTH_M_bLess ( MTH3D_M_xGetYofVector ( p_stVert ),
MTH3D_M_xGetYofVector ( p_stMinPoint ) ) )
MTH3D_M_vSetYofVector ( p_stMinPoint, MTH3D_M_xGetYofVector ( p_stVert ) );
if ( MTH_M_bGreater ( MTH3D_M_xGetYofVector ( p_stVert ),
MTH3D_M_xGetYofVector ( p_stMaxPoint ) ) )
MTH3D_M_vSetYofVector ( p_stMaxPoint, MTH3D_M_xGetYofVector ( p_stVert ) );
if ( MTH_M_bLess ( MTH3D_M_xGetZofVector ( p_stVert ),
MTH3D_M_xGetZofVector ( p_stMinPoint ) ) )
MTH3D_M_vSetZofVector ( p_stMinPoint, MTH3D_M_xGetZofVector ( p_stVert ) );
if ( MTH_M_bGreater ( MTH3D_M_xGetZofVector ( p_stVert ),
MTH3D_M_xGetZofVector ( p_stMaxPoint ) ) )
MTH3D_M_vSetZofVector ( p_stMaxPoint, MTH3D_M_xGetZofVector ( p_stVert ) );
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description : Compute the bounding box of two boxes
--------------------------------------------------------------------------------
-- Creation date : 22 aug 1996 Author : FPI
--------------------------------------------------------------------------------
*/
/* calcul de la boite englobante de deux boites */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void COL_fn_vComputeBoundingBoxOfBoxes ( MTH3D_tdstVector *p_stMinBounding,
MTH3D_tdstVector *p_stMaxBounding,
MTH3D_tdstVector *p_stMinPoint1,
MTH3D_tdstVector *p_stMaxPoint1,
MTH3D_tdstVector *p_stMinPoint2,
MTH3D_tdstVector *p_stMaxPoint2 )
{
MTH3D_M_vMinVector ( p_stMinBounding, p_stMinPoint1, p_stMinPoint2 );
MTH3D_M_vMaxVector ( p_stMaxBounding, p_stMaxPoint1, p_stMaxPoint2 );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description : Compute the bounding sphere of a box
--------------------------------------------------------------------------------
-- Creation date : 25 feb 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* calcul de la sphere englobante d une boite */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void COL_fn_vComputeBoundingSphereOfBox ( MTH3D_tdstVector *p_stSphereCenter,
MTH_tdxReal *p_xSphereRadius,
MTH3D_tdstVector *p_stMinPoint,
MTH3D_tdstVector *p_stMaxPoint )
{
MTH3D_M_vMiddleVector ( p_stSphereCenter, p_stMinPoint, p_stMaxPoint );
*p_xSphereRadius = MTH_M_xMul ( MTH_C_Inv2, MTH3D_M_xVectorGap ( p_stMinPoint, p_stMaxPoint ) );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description : Compute the bounding box of a sphere
--------------------------------------------------------------------------------
-- Creation date : 25 feb 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* calcul de la boite englobante d une sphere */
void COL_fn_vComputeBoundingBoxOfSphere ( MTH3D_tdstVector *p_stMinBounding,
MTH3D_tdstVector *p_stMaxBounding,
MTH3D_tdstVector *p_stSphereCenter,
MTH_tdxReal xSphereRadius )
{
MTH3D_M_vSubScalarVector ( p_stMinBounding, xSphereRadius, p_stSphereCenter );
MTH3D_M_vAddScalarVector ( p_stMaxBounding, xSphereRadius, p_stSphereCenter );
}
/*
--------------------------------------------------------------------------------
-- Description : Compute the bounding box of two spheres
--------------------------------------------------------------------------------
-- Creation date : 27 dec 1996 Author : FPI
--------------------------------------------------------------------------------
*/
/* calcul de la boite englobante de deux spheres */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void COL_fn_vComputeBoundingBoxOfSpheres ( MTH3D_tdstVector *p_stMinBounding,
MTH3D_tdstVector *p_stMaxBounding,
MTH3D_tdstVector *p_stSphereCenter1,
MTH_tdxReal xSphereRadius1,
MTH3D_tdstVector *p_stSphereCenter2,
MTH_tdxReal xSphereRadius2 )
{
p_stMinBounding->xX = MTH_M_xMin ( MTH_M_xSub ( p_stSphereCenter1->xX, xSphereRadius1 ), MTH_M_xSub ( p_stSphereCenter2->xX, xSphereRadius2 ) );
p_stMinBounding->xY = MTH_M_xMin ( MTH_M_xSub ( p_stSphereCenter1->xY, xSphereRadius1 ), MTH_M_xSub ( p_stSphereCenter2->xY, xSphereRadius2 ) );
p_stMinBounding->xZ = MTH_M_xMin ( MTH_M_xSub ( p_stSphereCenter1->xZ, xSphereRadius1 ), MTH_M_xSub ( p_stSphereCenter2->xZ, xSphereRadius2 ) );
p_stMaxBounding->xX = MTH_M_xMax ( MTH_M_xAdd ( p_stSphereCenter1->xX, xSphereRadius1 ), MTH_M_xAdd ( p_stSphereCenter2->xX, xSphereRadius2 ) );
p_stMaxBounding->xY = MTH_M_xMax ( MTH_M_xAdd ( p_stSphereCenter1->xY, xSphereRadius1 ), MTH_M_xAdd ( p_stSphereCenter2->xY, xSphereRadius2 ) );
p_stMaxBounding->xZ = MTH_M_xMax ( MTH_M_xAdd ( p_stSphereCenter1->xZ, xSphereRadius1 ), MTH_M_xAdd ( p_stSphereCenter2->xZ, xSphereRadius2 ) );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
--------------------------------------------------------------------------------
-- Description : Compute the bounding box of a sphere and a box
--------------------------------------------------------------------------------
-- Creation date : 12 feb 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* calcul de la boite englobante d une sphere et d une boite */
void COL_fn_vComputeBoundingBoxOfSphereAndBox ( MTH3D_tdstVector *p_stMinBounding,
MTH3D_tdstVector *p_stMaxBounding,
MTH3D_tdstVector *p_stSphereCenter,
MTH_tdxReal xSphereRadius,
MTH3D_tdstVector *p_stMinPoint,
MTH3D_tdstVector *p_stMaxPoint )
{
p_stMinBounding->xX = MTH_M_xMin ( MTH_M_xSub ( p_stSphereCenter->xX, xSphereRadius ), p_stMinPoint->xX );
p_stMinBounding->xY = MTH_M_xMin ( MTH_M_xSub ( p_stSphereCenter->xY, xSphereRadius ), p_stMinPoint->xY );
p_stMinBounding->xZ = MTH_M_xMin ( MTH_M_xSub ( p_stSphereCenter->xZ, xSphereRadius ), p_stMinPoint->xZ );
p_stMaxBounding->xX = MTH_M_xMax ( MTH_M_xAdd ( p_stSphereCenter->xX, xSphereRadius ), p_stMaxPoint->xX );
p_stMaxBounding->xY = MTH_M_xMax ( MTH_M_xAdd ( p_stSphereCenter->xY, xSphereRadius ), p_stMaxPoint->xY );
p_stMaxBounding->xZ = MTH_M_xMax ( MTH_M_xAdd ( p_stSphereCenter->xZ, xSphereRadius ), p_stMaxPoint->xZ );
}
/*
--------------------------------------------------------------------------------
-- Description : Compute the bounding box of a geometric object
--------------------------------------------------------------------------------
-- Creation date : 12 feb 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* calcul de la boite englobante d un objet geometrique */
void COL_fn_vComputeBoundingBoxOfGeometricObject ( MTH3D_tdstVector *p_stMinPoint,
MTH3D_tdstVector *p_stMaxPoint,
GEO_tdstGeometricObject *p_stGeomObj )
{
ACP_tdxIndex xElementIndex;
ACP_tdxIndex xDataElementIndex;
GEO_tdstElementSpheres *p_stElementSpheres;
GEO_tdstIndexedSphere *p_stIndexedSphere;
MTH3D_tdstVector *p_stCenter;
COL_fn_vComputeBoundingBoxOfVertices ( p_stMinPoint, p_stMaxPoint, p_stGeomObj->xNbPoints, p_stGeomObj->d_stListOfPoints );
/* on n oublie pas d augmenter avec les spheres */
for ( xElementIndex = 0 ; xElementIndex < p_stGeomObj->xNbElements ; xElementIndex++ )
{
if ( p_stGeomObj->d_xListOfElementsTypes[xElementIndex] == GEO_C_xElementSpheres )
{
p_stElementSpheres = (GEO_tdstElementSpheres *)(p_stGeomObj->d_stListOfElements[xElementIndex]);
/* pour les spheres */
for ( xDataElementIndex = 0 ; xDataElementIndex < p_stElementSpheres->xNbSpheres ; xDataElementIndex++ )
{
/* sphere */
p_stIndexedSphere = p_stElementSpheres->d_stListOfSpheres + xDataElementIndex;
/* centre de la sphere */
p_stCenter = p_stGeomObj->d_stListOfPoints + p_stIndexedSphere->xCenterPoint;
/* recalcule la boite englobante */
COL_fn_vComputeBoundingBoxOfSphereAndBox ( p_stMinPoint, p_stMaxPoint,
p_stCenter, p_stIndexedSphere->xRadius, p_stMinPoint, p_stMaxPoint );
}
}
}
}
/* calcul de la boite englobante de deux spheres de m<>me rayon */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void COL_fn_vComputeBoundingBoxOfSpheresWithSameRadius ( MTH3D_tdstVector *p_stMinBounding,
MTH3D_tdstVector *p_stMaxBounding,
MTH3D_tdstVector *p_stSphereCenter1,
MTH3D_tdstVector *p_stSphereCenter2,
MTH_tdxReal xSphereRadius )
{
/* X axis*/
if( MTH_M_bLess( p_stSphereCenter1->xX , p_stSphereCenter2->xX ) )
{
p_stMinBounding->xX = MTH_M_xSub ( p_stSphereCenter1->xX, xSphereRadius );
p_stMaxBounding->xX = MTH_M_xAdd ( p_stSphereCenter2->xX, xSphereRadius );
}
else
{
p_stMinBounding->xX = MTH_M_xSub ( p_stSphereCenter2->xX, xSphereRadius );
p_stMaxBounding->xX = MTH_M_xAdd ( p_stSphereCenter1->xX, xSphereRadius );
}
/* Y axis*/
if( MTH_M_bLess( p_stSphereCenter1->xY , p_stSphereCenter2->xY ) )
{
p_stMinBounding->xY = MTH_M_xSub ( p_stSphereCenter1->xY, xSphereRadius );
p_stMaxBounding->xY = MTH_M_xAdd ( p_stSphereCenter2->xY, xSphereRadius );
}
else
{
p_stMinBounding->xY = MTH_M_xSub ( p_stSphereCenter2->xY, xSphereRadius );
p_stMaxBounding->xY = MTH_M_xAdd ( p_stSphereCenter1->xY, xSphereRadius );
}
/* Z axis*/
if( MTH_M_bLess( p_stSphereCenter1->xZ , p_stSphereCenter2->xZ ) )
{
p_stMinBounding->xZ = MTH_M_xSub ( p_stSphereCenter1->xZ, xSphereRadius );
p_stMaxBounding->xZ = MTH_M_xAdd ( p_stSphereCenter2->xZ, xSphereRadius );
}
else
{
p_stMinBounding->xZ = MTH_M_xSub ( p_stSphereCenter2->xZ, xSphereRadius );
p_stMaxBounding->xZ = MTH_M_xAdd ( p_stSphereCenter1->xZ, xSphereRadius );
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* mise <20> jour de la boite englobante de deux spheres de m<>me rayon */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void COL_fn_vUpdateBoundingBoxOfSpheresWithSameRadius ( MTH3D_tdstVector *p_stMinBounding,
MTH3D_tdstVector *p_stMaxBounding,
MTH3D_tdstVector *p_stSphereCenter1,
MTH3D_tdstVector *p_stSphereCenter2,
MTH_tdxReal xSphereRadius )
{
MTH_tdxReal xValue;
/* X axis*/
if( MTH_M_bLess( p_stSphereCenter1->xX , p_stSphereCenter2->xX ) )
{
xValue = MTH_M_xSub ( p_stSphereCenter1->xX, xSphereRadius );
COL_M_vUpdateMin( p_stMinBounding->xX , xValue );
xValue = MTH_M_xAdd ( p_stSphereCenter2->xX, xSphereRadius );
COL_M_vUpdateMax( p_stMaxBounding->xX , xValue );
}
else
{
xValue = MTH_M_xSub ( p_stSphereCenter2->xX, xSphereRadius );
COL_M_vUpdateMin( p_stMinBounding->xX , xValue );
xValue = MTH_M_xAdd ( p_stSphereCenter1->xX, xSphereRadius );
COL_M_vUpdateMax( p_stMaxBounding->xX , xValue );
}
/* Y axis*/
if( MTH_M_bLess( p_stSphereCenter1->xY , p_stSphereCenter2->xY ) )
{
xValue = MTH_M_xSub ( p_stSphereCenter1->xY, xSphereRadius );
COL_M_vUpdateMin( p_stMinBounding->xY , xValue );
xValue = MTH_M_xAdd ( p_stSphereCenter2->xY, xSphereRadius );
COL_M_vUpdateMax( p_stMaxBounding->xY , xValue );
}
else
{
xValue = MTH_M_xSub ( p_stSphereCenter2->xY, xSphereRadius );
COL_M_vUpdateMin( p_stMinBounding->xY , xValue );
xValue = MTH_M_xAdd ( p_stSphereCenter1->xY, xSphereRadius );
COL_M_vUpdateMax( p_stMaxBounding->xY , xValue );
}
/* Z axis*/
if( MTH_M_bLess( p_stSphereCenter1->xZ , p_stSphereCenter2->xZ ) )
{
xValue = MTH_M_xSub ( p_stSphereCenter1->xZ, xSphereRadius );
COL_M_vUpdateMin( p_stMinBounding->xZ , xValue );
xValue = MTH_M_xAdd ( p_stSphereCenter2->xZ, xSphereRadius );
COL_M_vUpdateMax( p_stMaxBounding->xZ , xValue );
}
else
{
xValue = MTH_M_xSub ( p_stSphereCenter2->xZ, xSphereRadius );
COL_M_vUpdateMin( p_stMinBounding->xZ , xValue );
xValue = MTH_M_xAdd ( p_stSphereCenter1->xZ, xSphereRadius );
COL_M_vUpdateMax( p_stMaxBounding->xZ , xValue );
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* mise <20> jour de la boite englobante de deux spheres */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void COL_fn_vUpdateBoundingBoxOfSpheres ( MTH3D_tdstVector *p_stMinBounding,
MTH3D_tdstVector *p_stMaxBounding,
MTH3D_tdstVector *p_stSphereCenter1,
MTH_tdxReal xSphereRadius1,
MTH3D_tdstVector *p_stSphereCenter2,
MTH_tdxReal xSphereRadius2 )
{
MTH_tdxReal xMin1 , xMax1 , xMin2 , xMax2 ;
/* X axis*/
xMin1 = MTH_M_xSub ( p_stSphereCenter1->xX, xSphereRadius1 );
xMax1 = MTH_M_xAdd ( p_stSphereCenter1->xX, xSphereRadius1 );
xMin2 = MTH_M_xSub ( p_stSphereCenter2->xX, xSphereRadius2 );
xMax2 = MTH_M_xAdd ( p_stSphereCenter2->xX, xSphereRadius2 );
COL_M_vUpdateWithMin( p_stMinBounding->xX , xMin1 , xMin2 );
COL_M_vUpdateWithMax( p_stMaxBounding->xX , xMax1 , xMax2 );
/* Y axis*/
xMin1 = MTH_M_xSub ( p_stSphereCenter1->xY, xSphereRadius1 );
xMax1 = MTH_M_xAdd ( p_stSphereCenter1->xY, xSphereRadius1 );
xMin2 = MTH_M_xSub ( p_stSphereCenter2->xY, xSphereRadius2 );
xMax2 = MTH_M_xAdd ( p_stSphereCenter2->xY, xSphereRadius2 );
COL_M_vUpdateWithMin( p_stMinBounding->xY , xMin1 , xMin2 );
COL_M_vUpdateWithMax( p_stMaxBounding->xY , xMax1 , xMax2 );
/* Z axis*/
xMin1 = MTH_M_xSub ( p_stSphereCenter1->xZ, xSphereRadius1 );
xMax1 = MTH_M_xAdd ( p_stSphereCenter1->xZ, xSphereRadius1 );
xMin2 = MTH_M_xSub ( p_stSphereCenter2->xZ, xSphereRadius2 );
xMax2 = MTH_M_xAdd ( p_stSphereCenter2->xZ, xSphereRadius2 );
COL_M_vUpdateWithMin( p_stMinBounding->xZ , xMin1 , xMin2 );
COL_M_vUpdateWithMax( p_stMaxBounding->xZ , xMax1 , xMax2 );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* determine si deux boites englobantes sont en collision */
ACP_tdxBool COL_fn_bDetectCollisionBetweenTwoParallelBoxes(MTH3D_tdstVector * _p_stFirstBoxMaxPoint,
MTH3D_tdstVector * _p_stFirstBoxMinPoint,
MTH3D_tdstVector * _p_stSecondBoxMaxPoint,
MTH3D_tdstVector * _p_stSecondBoxMinPoint)
{
if ( MTH_M_bGreater (_p_stSecondBoxMaxPoint->xX, _p_stFirstBoxMinPoint->xX) &&
MTH_M_bLess (_p_stSecondBoxMinPoint->xX, _p_stFirstBoxMaxPoint->xX) &&
MTH_M_bGreater (_p_stSecondBoxMaxPoint->xY, _p_stFirstBoxMinPoint->xY) &&
MTH_M_bLess (_p_stSecondBoxMinPoint->xY, _p_stFirstBoxMaxPoint->xY) &&
MTH_M_bGreater (_p_stSecondBoxMaxPoint->xZ, _p_stFirstBoxMinPoint->xZ) &&
MTH_M_bLess (_p_stSecondBoxMinPoint->xZ, _p_stFirstBoxMaxPoint->xZ))
return TRUE;
else
return FALSE;
}

View File

@@ -0,0 +1,239 @@
# Microsoft Developer Studio Project File - Name="COL" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=COL - Win32 Debug with Editors
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Col.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Col.mak" CFG="COL - Win32 Debug with Editors"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "COL - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "COL - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "COL - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE "COL - Win32 Debug with Editors" (based on\
"Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/COL", GFCAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "COL - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "USE_PROFILER" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\COLP5_vr.lib"
!ELSEIF "$(CFG)" == "COL - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "X:\CPA\Lib"
# PROP Intermediate_Dir "Tmp\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "X:\CPA\Public" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\COLP5_vd.lib"
!ELSEIF "$(CFG)" == "COL - Win32 Retail"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "COL___Wi"
# PROP BASE Intermediate_Dir "COL___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:/cpa/lib"
# PROP Intermediate_Dir "tmp/retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MD /W3 /GX /Zi /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "CPA_WANTS_EXPORT" /D "VISUAL" /D "COL_IS_MONOTHREADED" /D "USE_ZDM_BOX" /D "USE_ALTIMAPS" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "RETAIL" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"X:\CPA\Lib\COLP5_vr.lib"
# ADD LIB32 /nologo /out:"X:\CPA\Lib\COLP5_vf.lib"
!ELSEIF "$(CFG)" == "COL - Win32 Debug with Editors"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "COL___Wi"
# PROP BASE Intermediate_Dir "COL___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "tmp/debuged"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /W3 /GX /Z7 /Od /I "X:\CPA\Public" /D "_DEBUG" /D "VISUAL" /D "WIN32" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /D "USE_ZDM_BOX" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "X:\CPA\Public" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /D "ACTIVE_EDITOR" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"X:\CPA\Lib\COLP5_vd.lib"
# ADD LIB32 /nologo /out:"X:\CPA\Lib\COLP5evd.lib"
!ENDIF
# Begin Target
# Name "COL - Win32 Release"
# Name "COL - Win32 Debug"
# Name "COL - Win32 Retail"
# Name "COL - Win32 Debug with Editors"
# Begin Group "Sources"
# PROP Default_Filter "*.c"
# Begin Source File
SOURCE=.\Box.c
# End Source File
# Begin Source File
SOURCE=.\CollGO.c
# End Source File
# Begin Source File
SOURCE=.\CollGOCo.c
# End Source File
# Begin Source File
SOURCE=.\CollGOUt.c
# End Source File
# Begin Source File
SOURCE=.\CsBoxElt.c
# End Source File
# Begin Source File
SOURCE=.\CsEltEdg.c
# End Source File
# Begin Source File
SOURCE=.\CsEltPts.c
# End Source File
# Begin Source File
SOURCE=.\CsSphElt.c
# End Source File
# Begin Source File
SOURCE=.\Inters.c
# End Source File
# Begin Source File
SOURCE=.\IntersGO.c
# End Source File
# Begin Source File
SOURCE=.\OctreeGO.c
# End Source File
# End Group
# Begin Group "Includes"
# PROP Default_Filter "*.h"
# Begin Source File
SOURCE=..\..\public\COL\Box.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\CollGO.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\CollGOCo.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\CollGOUt.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\CsBoxElt.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\CsEltEdg.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\CsEltPts.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\CsSphElt.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\Futil.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\Inters.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\IntersGO.h
# End Source File
# Begin Source File
SOURCE=..\..\public\COL\OctreeGO.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\Col.mak
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,654 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="COL"
ProjectGUID="{B43ECA49-9228-41EA-A46B-EFED5303A666}"
SccProjectName="&quot;$/cpa/tempgrp/COL&quot;, GFCAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Retail|Win32"
OutputDirectory="x:/cpa/lib"
IntermediateDirectory=".\tmp/retail"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="NDEBUG;RETAIL;VISUAL;WIN32"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\tmp/retail/COL.pch"
AssemblerListingLocation=".\tmp/retail/"
ObjectFile=".\tmp/retail/"
ProgramDataBaseFileName=".\tmp/retail/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\COLP5_vf.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="X:\CPA\Libd"
IntermediateDirectory=".\Tmp\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="_DEBUG;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;VISUAL;WIN32"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Tmp\Debug/COL.pch"
AssemblerListingLocation=".\Tmp\Debug/"
ObjectFile=".\Tmp\Debug/"
ProgramDataBaseFileName=".\Tmp\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\LibD\COLP5_vd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug with Editors|Win32"
OutputDirectory="x:\cpa\libd"
IntermediateDirectory=".\tmp/debuged"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="_DEBUG;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;ACTIVE_EDITOR;VISUAL;WIN32"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\tmp/debuged/COL.pch"
AssemblerListingLocation=".\tmp/debuged/"
ObjectFile=".\tmp/debuged/"
ProgramDataBaseFileName=".\tmp/debuged/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Libd\COLP5evd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\Tmp\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="NDEBUG;USE_PROFILER;VISUAL;WIN32"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Tmp\Release/COL.pch"
AssemblerListingLocation=".\Tmp\Release/"
ObjectFile=".\Tmp\Release/"
ProgramDataBaseFileName=".\Tmp\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\COLP5_vr.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Sources"
Filter="*.c">
<File
RelativePath="Box.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="CollGO.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="CollGOCo.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="CollGOUt.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="CsBoxElt.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="CsEltEdg.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="CsEltPts.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="CsSphElt.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Inters.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="IntersGO.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="OctreeGO.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Includes"
Filter="*.h">
<File
RelativePath="..\..\public\COL\Box.h">
</File>
<File
RelativePath="..\..\public\COL.h">
</File>
<File
RelativePath="..\..\public\COL\CollGO.h">
</File>
<File
RelativePath="..\..\public\COL\CollGOCo.h">
</File>
<File
RelativePath="..\..\public\COL\CollGOUt.h">
</File>
<File
RelativePath="..\..\public\COL\CsBoxElt.h">
</File>
<File
RelativePath="..\..\public\COL\CsEltEdg.h">
</File>
<File
RelativePath="..\..\public\COL\CsEltPts.h">
</File>
<File
RelativePath="..\..\public\COL\CsSphElt.h">
</File>
<File
RelativePath="..\..\public\COL\Futil.h">
</File>
<File
RelativePath="..\..\public\COL\Inters.h">
</File>
<File
RelativePath="..\..\public\COL\IntersGO.h">
</File>
<File
RelativePath="..\..\public\COL\OctreeGO.h">
</File>
</Filter>
<File
RelativePath="Col.mak">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

View File

@@ -0,0 +1,461 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Geometric object collision part
--------------------------------------------------------------------------------
-- Creation date : 15 may 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#include "acp_base.h"
#include "MTH.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "PCS.h"
#define PO_FRIEND
#include "PO.h"
#define HieFriend
#include "SPO.h"
#include "MEC.h"
#include "COL/CollGO.h"
/*
--------------------------------------------------------------------------------
-- Description : Static with static geometric objects collision detection test
--------------------------------------------------------------------------------
-- Creation date : March 3, 1998 Author : Alexis Vaisse
--------------------------------------------------------------------------------
*/
/* Collision detection test between two static geometric objects */
/* used*/
ACP_tdxBool COL_fn_bDetectCollisionStaticGeomObjWithStaticGeomObj ( GEO_tdxHandleToBoundingSphere _hDynamicGeometricObject, /* Always a sphere*/
POS_tdstCompletePosition *_p_stDynamicGeometricObjectMatrix,
void *_hStaticGeometricObject, /* Either a Box or a sphere ...*/
POS_tdstCompletePosition *_p_stStaticGeometricObjectMatrix,
ACP_tdxBool _bStaticGeomObjHasNoTransformationMatrix,
ACP_tdxBool _bDynamicGeomObjHasZoomInsteadOfScale,
ACP_tdxBool _bHasABoxBoundingVolume)
{
MTH3D_tdstVector stDinGPoint; /* Coordinates of the center of the dynamic bounding volume in the global axis*/
MTH3D_tdstVector stSinGPoint; /* Coordinates of the center of the static bounding volume in the global axis*/
MTH3D_tdstVector * p_stSMaxBoxPoint;
MTH3D_tdstVector * p_stSMinBoxPoint;
MTH3D_tdstVector stMaxDinGPoint;
MTH3D_tdstVector stMinDinGPoint;
MTH3D_tdstVector stMaxSinGPoint;
MTH3D_tdstVector stMinSinGPoint;
MTH_tdxReal xRadiusSum;
MTH_tdxReal xRadiusDinG;
/* on se place dans global */
/* transformation de CDT0 dans global */
POS_fn_vMulMatrixVertex(&stDinGPoint, _p_stDynamicGeometricObjectMatrix, GEO_fn_pGetCenterPointOfBoundingSphere(_hDynamicGeometricObject));
if(!_bHasABoxBoundingVolume)
/*The Bounding Volume of the Static Geo.Object is a SPHERE ...*/
{
/* transformation de CS dans global */
if (_bStaticGeomObjHasNoTransformationMatrix) /* No transformation matrix -> only a translation*/
{
MTH3D_M_vAddVector (& stSinGPoint, GEO_fn_pGetCenterPointOfBoundingSphere((GEO_tdxHandleToBoundingSphere)_hStaticGeometricObject), & _p_stStaticGeometricObjectMatrix -> stTranslationVector);
}
else
{
POS_fn_vMulMatrixVertex ( &stSinGPoint, _p_stStaticGeometricObjectMatrix, GEO_fn_pGetCenterPointOfBoundingSphere((GEO_tdxHandleToBoundingSphere)_hStaticGeometricObject));
}
xRadiusSum = MTH_M_xAdd (
/* Radius of the dynamic sphere*/
MTH_M_xMul ((GEO_fn_xGetRadiusOfBoundingSphere(_hDynamicGeometricObject)), POS_fn_xGetMaxScale ( _p_stDynamicGeometricObjectMatrix )),
/* Plus radius of the static sphere*/
_bStaticGeomObjHasNoTransformationMatrix ?
GEO_fn_xGetRadiusOfBoundingSphere((GEO_tdxHandleToBoundingSphere)_hStaticGeometricObject)
: MTH_M_xMul ( GEO_fn_xGetRadiusOfBoundingSphere((GEO_tdxHandleToBoundingSphere)_hStaticGeometricObject), POS_fn_xGetMaxScale ( _p_stStaticGeometricObjectMatrix )) );
/* The distance between the two centers must be less that the sum of the two radius*/
return MTH_M_bLessEqual (MTH3D_M_xVectorGapSqr (& stDinGPoint , & stSinGPoint) , MTH_M_xSqr (xRadiusSum));
}
else
/*The Bounding Volume of the Static Geom. Object is a BOX*/
{
/* The static parallel box in the local axis*/
p_stSMaxBoxPoint = GEO_fn_pGetMaxPointOfParallelBox((GEO_tdxHandleToParallelBox)_hStaticGeometricObject);
p_stSMinBoxPoint = GEO_fn_pGetMinPointOfParallelBox((GEO_tdxHandleToParallelBox)_hStaticGeometricObject);
/* The static parallel box in the global axis*/
MTH3D_M_vAddVector(& stMaxSinGPoint , & _p_stStaticGeometricObjectMatrix->stTranslationVector , p_stSMaxBoxPoint);
MTH3D_M_vAddVector(& stMinSinGPoint , & _p_stStaticGeometricObjectMatrix->stTranslationVector , p_stSMinBoxPoint);
/* We compute the parallel box that includes the sphere bounding volume*/
xRadiusDinG = MTH_M_xMul ((GEO_fn_xGetRadiusOfBoundingSphere(_hDynamicGeometricObject)), POS_fn_xGetMaxScale ( _p_stDynamicGeometricObjectMatrix ));
/* The dynamic parallel box in the global axis*/
COL_fn_vComputeBoundingBoxOfSphere (& stMinDinGPoint , & stMaxDinGPoint , & stDinGPoint , xRadiusDinG);
return COL_fn_bDetectCollisionBetweenTwoParallelBoxes (&stMaxSinGPoint, &stMinSinGPoint, &stMaxDinGPoint, &stMinDinGPoint);
}
}
/*
--------------------------------------------------------------------------------
-- Description : Static with static geometric objects collision test init
--------------------------------------------------------------------------------
-- Creation date : 15 may 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* init de collision entre deux objets geometriques */
/* used*/
void COL_fn_vInitCollideStaticGeomObjWithStaticGeomObj ( COL_tdstGVForCollision *p_stGV )
{
/* jt 070699 */
/* MTH3D_tdstVector stNegVector; */
/* end jt 070699 */
/* init des matrices*/
POS_fn_vSetIdentityMatrix ( &p_stGV->stInvMatrix );
POS_fn_vSetIdentityMatrix ( &p_stGV->stD2ST0TransformMatrix );
POS_fn_vSetIdentityMatrix ( &p_stGV->stD2ST1TransformMatrix );
POS_fn_vSetIdentityMatrix ( &p_stGV->stS2DT0TransformMatrix );
POS_fn_vSetIdentityMatrix ( &p_stGV->stS2DT1TransformMatrix );
/* calcul des deux matrices de transformation */
/* inversion de la matrice statique */
/* jt 070699 */
/* Faut quand m<>me pas trop exag<61>rer! On en fait quoi de la rotation ? */
/* if (p_stGV->bStaticGeomObjHasNoTransformationMatrix) */
/* { */ /* No transformation matrix -> the invert matrix is the identity matrix with the opposite translation vector*/
/* MTH3D_M_vNegVector (& stNegVector , & p_stGV->p_stStaticGeomObjMatrix->stTranslationVector); */
/* POS_fn_vSetTranslationVector (& p_stGV->stInvMatrix , & stNegVector); */
/* } */
/* else */
/* { */
POS_fn_vInvertMatrix( &p_stGV->stInvMatrix, p_stGV->p_stStaticGeomObjMatrix );
/* } */
/* end jt 070699 */
/* calcul de la matrice de passage entre dynamique et statique a T0 */
POS_fn_vMulMatrixMatrix( &p_stGV->stD2ST0TransformMatrix, &p_stGV->stInvMatrix, p_stGV->p_stT0DynamicGeomObjMatrix );
/* We need the T1 point*/
/* Maybe one could compute them only when the first collision is detected (???)*/
/* calcul de la matrice de passage entre dynamique et statique a T1 */
POS_fn_vMulMatrixMatrix( &p_stGV->stD2ST1TransformMatrix, &p_stGV->stInvMatrix, p_stGV->p_stT1DynamicGeomObjMatrix );
/* optimisation sur la surface */
p_stGV->bSurfacicDynamicElement = COL_fn_bGetSurfaceInGeometricObject ( p_stGV->p_stDynamicGeomObj );
/* suppression des cas inutiles */
if ( !p_stGV->bSurfacicDynamicElement )
{
p_stGV->ulSelectedCollisionCases = p_stGV->ulSelectedCollisionCases & ( ~COL_C_ulDynamicEltWithStaticPts );
p_stGV->ulSelectedCollisionCases = p_stGV->ulSelectedCollisionCases & ( ~COL_C_ulDynamicEdgWithStaticEdg );
p_stGV->ulSelectedCollisionCases = p_stGV->ulSelectedCollisionCases & ( ~COL_C_ulDynamicEdgWithStaticElt );
p_stGV->ulSelectedCollisionCases = p_stGV->ulSelectedCollisionCases & ( ~COL_C_ulDynamicEltWithStaticEdg );
p_stGV->ulSelectedCollisionCases = p_stGV->ulSelectedCollisionCases & ( ~COL_C_ulDynamicEltWithStaticElt );
}
/* optimisation transformation des points statiques */
p_stGV->bDynamicSphereAndPointOnly = COL_fn_bGetSphereAndPointOnlyInGeometricObject ( p_stGV->p_stDynamicGeomObj );
p_stGV->p_stOctree = p_stGV->p_stStaticGeomObj->p_stOctree;
if ( p_stGV->p_stOctree != NULL )
{
p_stGV->xNbStaticPoints = 0;
p_stGV->xNbStaticEdges = 0;
}
if (p_stGV->bStaticGeomObjHasNoTransformationMatrix)
{
p_stGV->xStaticScale = 1;
}
else
{
p_stGV->xStaticScale = POS_fn_xGetMaxScale ( p_stGV->p_stStaticGeomObjMatrix );
}
}
/*
--------------------------------------------------------------------------------
-- Description : Static with static geometric objects collision test
--------------------------------------------------------------------------------
-- Creation date : 06 oct 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* test de collision entre deux objets geometriques */
/* used*/
void COL_fn_vComputeCollisionStaticGeomObjWithStaticGeomObj ( COL_tdstGVForCollision *p_stGV )
{
/* init */
COL_fn_vInitCollideStaticGeomObjWithStaticGeomObj ( p_stGV );
/* elements de dynamique contre elements de statique */
if ( p_stGV->ulSelectedCollisionCases & COL_C_ulDynamicEltWithStaticElt )
{
for ( p_stGV->xDynamicElementIndex = 0 ; p_stGV->xDynamicElementIndex < p_stGV->p_stDynamicGeomObj->xNbElements ; p_stGV->xDynamicElementIndex++ )
{
switch ( p_stGV->p_stDynamicGeomObj->d_xListOfElementsTypes[p_stGV->xDynamicElementIndex] )
{
case GEO_C_xElementSpheres :
if ( p_stGV->ulSelectedCollisionCases & COL_C_ulDynamicSphWithStaticElt )
{
p_stGV->p_stDynamicElementSpheres = (GEO_tdstElementSpheres *)(p_stGV->p_stDynamicGeomObj->d_stListOfElements[p_stGV->xDynamicElementIndex]);
/* th element always exists, but can have no sphere*/
if ( p_stGV->p_stDynamicElementSpheres->xNbSpheres )
COL_fn_vCollideStaticElementSpheresWithStaticElements ( p_stGV );
}
break;
#ifdef USE_ZDM_BOX
case GEO_C_xElementAlignedBoxes :
if ( p_stGV->ulSelectedCollisionCases & COL_C_ulDynamicBoxWithStaticElt )
{
p_stGV->p_stDynamicElementAlignedBoxes = (GEO_tdstElementAlignedBoxes *)(p_stGV->p_stDynamicGeomObj->d_stListOfElements[p_stGV->xDynamicElementIndex]);
/* th element always exists, but can have no box*/
if ( p_stGV->p_stDynamicElementAlignedBoxes->xNbAlignedBoxes )
COL_fn_vCollideStaticElementAlignedBoxesWithStaticElements ( p_stGV );
}
break;
#endif
}
}
}
}
/*
--------------------------------------------------------------------------------
-- Description : Static with static geometric objects collision test
--------------------------------------------------------------------------------
-- Creation date : 06 oct 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* test de collision entre deux objets geometriques */
/* used*/
void COL_fn_vCollideStaticGeomObj1WithStaticGeomObj2 ( ACP_tdxHandleOfObject _hGeometricObject1,
POS_tdstCompletePosition *_p_stGeometricObjectStartMatrix1,
POS_tdstCompletePosition *_p_stGeometricObjectEndMatrix1,
ACP_tdxHandleOfObject _hGeometricObject2,
POS_tdstCompletePosition *_p_stGeometricObjectMatrix2,
void * _p_vParameter1 ,
short _sParameter2 ,
ACP_tdxBool _bStaticGeomObjHasNoTransformationMatrix,
ACP_tdxBool _bDynamicGeomObjHasZoomInsteadOfScale)
{
/* init des parametres du test */
COL_g_stGVForCol.bStaticGeomObjHasNoTransformationMatrix = _bStaticGeomObjHasNoTransformationMatrix;
COL_g_stGVForCol.bDynamicGeomObjHasZoomInsteadOfScale = _bDynamicGeomObjHasZoomInsteadOfScale;
COL_g_stGVForCol.p_stDynamicGeomObj = _hGeometricObject1;
COL_g_stGVForCol.p_stT0DynamicGeomObjMatrix = _p_stGeometricObjectEndMatrix1; /* The matrix that will be used for calculation*/
COL_g_stGVForCol.p_stT1DynamicGeomObjMatrix = _p_stGeometricObjectStartMatrix1; /* This matrix will only be used when a collision is detected*/
COL_g_stGVForCol.p_stStaticGeomObj = _hGeometricObject2;
COL_g_stGVForCol.p_stStaticGeomObjMatrix = _p_stGeometricObjectMatrix2;
COL_g_stGVForCol.ulSelectedCollisionCases = COL_C_ulDynamicAllWithStaticAll;
COL_g_stGVForCol.p_vParameter1 = _p_vParameter1;
COL_g_stGVForCol.sParameter2 = _sParameter2;
/* cas de rejection immediate */
if (_hGeometricObject1 == NULL ||
_hGeometricObject2 == NULL ||
_hGeometricObject1->xNbPoints == 0 ||
_hGeometricObject2->xNbPoints == 0 ||
_hGeometricObject1->xNbElements == 0 ||
_hGeometricObject2->xNbElements == 0)
{
return;
}
COL_fn_vComputeCollisionStaticGeomObjWithStaticGeomObj ( &COL_g_stGVForCol );
}
/*--------------------------------------------------------------------------------*/
/* COL_fn_lFindNormalFromGeometricObject*/
/**/
/* This function finds the triangles of the geometric object containing the given point (on an edge),*/
/* fill an array with the normals of these triangles (two triangles maximum)*/
/* and return the number of triangles found*/
/*--------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
/*long COL_fn_lFindNormalFromGeometricObject (GEO_tdstGeometricObject * _p_stGeometricObject ,
MTH3D_tdstVector * _p_stPoint ,
MTH3D_tdstVector * _p_a2_stNormal)
{
#define C_xEpsilon MTH_M_xFloatToReal ((float) 0.001)
#define C_xLargeEpsilon MTH_M_xFloatToReal ((float) 0.1)
if (_p_stGeometricObject -> p_stOctree)
{
ACP_tdxIndex xResult;
MTH3D_tdstVector stMinPoint , stMaxPoint;
COL_tdpstOctreeNode a_pstSelectedNode [COL_C_xMaxSelectedNodes];
ACP_tdxIndex xNumberOfSelectedNodes;
ACP_tdxIndex xNodeIndex , xFaceIndex;
COL_tdxFaceIndex * p_xListIndex;
ACP_tdxIndex xElementIndex , xDataElementIndex;
GEO_tdstElementIndexedTriangles * p_stElementIndexedTriangles;
// GEO_tdstElementFaceMapDescriptors * p_stElementFaceMapDescriptors;
GEO_tdstTripledIndex * p_st3Idx;
ACP_tdxIndex xNbElements;
xResult = 0;
MTH3D_M_vSubScalarVector (& stMinPoint , C_xEpsilon , _p_stPoint);
MTH3D_M_vAddScalarVector (& stMaxPoint , C_xEpsilon , _p_stPoint);
COL_fn_vExploreOctreeWithBox (_p_stGeometricObject -> p_stOctree , & stMinPoint , & stMaxPoint ,
a_pstSelectedNode , & xNumberOfSelectedNodes);
// For each selected nodes
for (xNodeIndex = 0 ; xNodeIndex < xNumberOfSelectedNodes ; xNodeIndex++ )
{
// For the list of faces
//p_xListIndex = a_pstSelectedNode [xNodeIndex] -> d_xFaceIndexList;
xNbElements = *((COL_tdxFaceIndexDouble*)a_pstSelectedNode [xNodeIndex] -> d_xFaceIndexList);
p_xListIndex = (COL_tdxFaceIndex*)(((COL_tdxFaceIndexDouble*)a_pstSelectedNode [xNodeIndex] -> d_xFaceIndexList)+1);
for (xFaceIndex = 0 ; xFaceIndex < xNbElements ; xFaceIndex ++)
{
#ifndef U64
if ((*p_xListIndex) < COL_C_MaxIndex) xElementIndex = (ACP_tdxIndex) (* (p_xListIndex ++));
else xElementIndex = (ACP_tdxIndex) ((* (((COL_tdxFaceIndexDouble*)p_xListIndex)++)) & ~COL_C_OverflowIndex);
if ((*p_xListIndex) < COL_C_MaxIndex) xDataElementIndex = (ACP_tdxIndex) (* (p_xListIndex ++));
else xDataElementIndex = (ACP_tdxIndex) ((* (((COL_tdxFaceIndexDouble*)p_xListIndex)++)) & ~COL_C_OverflowIndex);
#else //U64
if ((*p_xListIndex) < COL_C_MaxIndex)
xElementIndex = (ACP_tdxIndex) (* (p_xListIndex ++));
else
{
ACP_tdxIndex xData;
xData=(ACP_tdxIndex)(* (p_xListIndex ++));
xData<<=8;
xData+=(ACP_tdxIndex)(* (p_xListIndex ++));
xData&=~COL_C_OverflowIndex;
xElementIndex = xData;
}
if ((*p_xListIndex) < COL_C_MaxIndex)
xDataElementIndex = (ACP_tdxIndex) (* (p_xListIndex ++));
else
{
ACP_tdxIndex xData;
xData=(ACP_tdxIndex)(* (p_xListIndex ++));
xData<<=8;
xData+=(ACP_tdxIndex)(* (p_xListIndex ++));
xData&=~COL_C_OverflowIndex;
xDataElementIndex = xData;
}
#endif //U64
switch (_p_stGeometricObject -> d_xListOfElementsTypes [xElementIndex])
{
case GEO_C_xElementIndexedTriangles :
p_stElementIndexedTriangles = (GEO_tdstElementIndexedTriangles *) (_p_stGeometricObject -> d_stListOfElements [xElementIndex]);
p_st3Idx = & p_stElementIndexedTriangles -> d_stListOfFacesTripled [xDataElementIndex];
if (INT_fn_bIsOnTriangle (_p_stPoint , _p_stGeometricObject -> d_stListOfPoints + p_st3Idx -> a3_xIndex [0] ,
_p_stGeometricObject -> d_stListOfPoints + p_st3Idx -> a3_xIndex [1] ,
_p_stGeometricObject -> d_stListOfPoints + p_st3Idx -> a3_xIndex [2]))
{
MTH3D_M_vCopyVector( _p_a2_stNormal + xResult , p_stElementIndexedTriangles -> d_stListOfFacesNormals + xDataElementIndex);
if (++ xResult == 2) return xResult; // We have found two triangles -> it's finished
}
break;
}
}
}
return xResult;
}
else
{
GEO_tdstElementIndexedTriangles *p_stETIT;
// GEO_tdstElementFaceMapDescriptors *p_stEFMD;
GEO_tdstTripledIndex *p_st3Idx;
// GEO_tdstFaceMapTriangle *p_stFMT;
ACP_tdxIndex xIndexElement , xIndexInElement;
ACP_tdxIndex xResult;
xResult = 0;
for ( xIndexElement = 0 ; xIndexElement < _p_stGeometricObject -> xNbElements ; xIndexElement++ )
{
switch ( _p_stGeometricObject -> d_xListOfElementsTypes[ xIndexElement ] )
{
case GEO_C_xElementIndexedTriangles:
p_stETIT = (GEO_tdstElementIndexedTriangles*) ( _p_stGeometricObject -> d_stListOfElements[ xIndexElement ] );
p_st3Idx = p_stETIT -> d_stListOfFacesTripled;
for ( xIndexInElement = 0 ; xIndexInElement < p_stETIT -> xNbFaces ; xIndexInElement++, p_st3Idx++ )
{
if( INT_fn_bIsOnTriangle( _p_stPoint, _p_stGeometricObject -> d_stListOfPoints + p_st3Idx -> a3_xIndex[0],
_p_stGeometricObject -> d_stListOfPoints + p_st3Idx -> a3_xIndex[1],
_p_stGeometricObject -> d_stListOfPoints + p_st3Idx -> a3_xIndex[2] ) )
{
MTH3D_M_vCopyVector( _p_a2_stNormal + xResult , p_stETIT -> d_stListOfFacesNormals + xIndexInElement );
if (++ xResult == 2) return xResult; // We have found two triangles -> it's finished
}
}
break;
#ifdef USE_ALTIMAPS
case GEO_C_xElementAltimap :
{
GEO_tdstElementAltimap *p_stElementAltimap;
ACP_tdxIndex xAx, xAy, xBx, xBy, xLoopX, xLoopY, xLoopV, xIndex;
MTH3D_tdstVector stV1, stV2, stV3, stNorm, stP1, stP2;
ACP_tdxBool xBoolA, xBoolB;
MTH3D_M_vSubScalarVector( &stP1, C_xLargeEpsilon, _p_stPoint );
MTH3D_M_vAddScalarVector( &stP2, C_xLargeEpsilon, _p_stPoint );
p_stElementAltimap = (GEO_tdstElementAltimap *)(_p_stGeometricObject->d_stListOfElements[ xIndexElement ]);
xBoolA = COL_ucSelectAltimapSquare( p_stElementAltimap, &stP1, &xAx, &xAy );
xBoolB = COL_ucSelectAltimapSquare( p_stElementAltimap, &stP2, &xBx, &xBy );
COL_M_vClipSquareSelection( p_stElementAltimap, xAx, xAy, xBoolA );
COL_M_vClipSquareSelection( p_stElementAltimap, xBx, xBy, xBoolB );
COL_M_vScanSelectedSquares( xLoopX, xLoopY, xLoopV, p_stElementAltimap->xWidth, xAx, xAy, xBx, xBy )
{
unsigned char ucType;
ucType = p_stElementAltimap->d_stSquare[ xLoopV ].ucType;
while( ucType )
{
ucType = COL_ucBuildAltimapSquareTriangle( p_stElementAltimap, xLoopX, xLoopY, ucType,
&stV1, &stV2, &stV3, &stNorm, &xIndex );
if( INT_fn_bIsOnTriangle( _p_stPoint, &stV1, &stV2, &stV3 ) )
{
MTH3D_M_vCopyVector( _p_a2_stNormal + xResult , &stNorm );
if (++ xResult == 2)
return xResult; // We have found two triangles -> it's finished
}
}
}
}
break;
#endif //USE_ALTIMAPS
return xResult;
}
}
}
}
*/
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,332 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Geometric object collision part
--------------------------------------------------------------------------------
-- Creation date : 22 aug 1996 Author : FPI
--------------------------------------------------------------------------------
*/
#include "acp_base.h"
#include "MTH.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL/CollGOCo.h"
/*XB 98/09/11*/
#include "PRF.h"
/*End XB*/
/* ANNECY AV {*/
#define C_wDoubleEdge 2
/* END ANNECY AV }*/
/*
--------------------------------------------------------------------------------
-- Description : Global variables
--------------------------------------------------------------------------------
*/
/* cas de collision */
/* Global Collisiosn Array */
COL_tdstCollisionCase COL_g_stCollisionCase [COL_C_xMaxNumberOfCollisions];
/* Pointer to Beginning of Array to be computed
/* Usually COL_g_stCollisionCaseReal = COL_g_stCollisionCase
/* but it can be usefull to compute collisions in two steps
/* then COL_g_stCollisionCaseReal = COL_g_stCollisionCase + Number of collisions computed in first step */
COL_tdstCollisionCase *COL_g_stCollisionCaseReal = COL_g_stCollisionCase;
COL_tdstGVForCollision COL_g_stGVForCol;
long COL_g_lNbElementsInTable = COL_C_xMaxNumberOfCollisions; /* Number of elements added in Collision Array */
/* size free for collide array
/* usually COL_g_lMaxNumberOfCollisions = COL_C_xMaxNumberOfCollisions
/* but it can be usefull to compute collisions in two steps
/* then COL_g_lMaxNumberOfCollisions = COL_C_xMaxNumberOfCollisions - Number of collisions computed in first step */
extern long COL_g_lMaxNumberOfCollisions;
/*
--------------------------------------------------------------------------------
-- Description : Initialize the collision table
--------------------------------------------------------------------------------
-- Creation date : 23 oct 1996 Author : FPI
--------------------------------------------------------------------------------
*/
//#define COL_fn_vInitCollisionTable() COL_g_lNbElementsInTable = 0
/* init de la table de collision */
/* passer en macro */
//void COL_fn_vInitCollisionTable ( void )
//{
/* Anthony */
/*COL_tdstCollisionCase * p;
COL_tdstCollisionCase * end;*/
/* opti par Yann Le Guyader 07/99 */
//if (COL_g_lNbElementsInTable)
//{
/*end = &COL_g_stCollisionCaseReal[COL_g_lNbElementsInTable];*/
// COL_g_lNbElementsInTable = 0;
//}
/*else return;*/
/*for (p = COL_g_stCollisionCaseReal; p < end ; p ++)
{
/* temps de collision */
//p -> xCollisionTime = MTH_C_2;
//}*/
//}
/*
--------------------------------------------------------------------------------
-- Description : Add a collision case in the collision table
--------------------------------------------------------------------------------
-- Creation date : 06 oct 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* ajout dans la table de collision */
void COL_fn_vAddInStaticCollisionTable (MTH_tdxReal _xT,
MTH3D_tdstVector *_p_stTranslation,
MTH3D_tdstVector *_p_stHit,
MTH3D_tdstVector *_p_stNormal,
GMT_tdxHandleToGameMaterial _hDynMat,
GMT_tdxHandleToGameMaterial _hStatMat,
ACP_tdxIndex _xDynamicGeomEntity,
ACP_tdxIndex _xStaticGeomEntity,
void *_p_vParameter1,
short _sParameter2,
MTH3D_tdstVector *_p_stMovement,
MTH_tdxReal _xSphereRadius,
MTH3D_tdstVector * _p_stEndPosition)
{
#ifdef USE_PROFILER
/*XB 98/09/11*/
static long s_l_MaxNbCollisions=0;
/*End XB*/
#endif /* USE_PROFILER */
long i;
COL_tdstCollisionCase * p_stCollisionCase;
/* jt 120599 */
GMT_tdxHandleToCollideMaterial hCollideMaterial;
/* end jt 120599 */
#define M_bIsVectorsEqualWithEpsilon( VectA, VectB, Eps ) \
( MTH_M_bEqualWithEpsilon( MTH3D_M_xGetXofVector( VectA ), MTH3D_M_xGetXofVector( VectB ), Eps ) && \
MTH_M_bEqualWithEpsilon( MTH3D_M_xGetYofVector( VectA ), MTH3D_M_xGetYofVector( VectB ), Eps ) && \
MTH_M_bEqualWithEpsilon( MTH3D_M_xGetZofVector( VectA ), MTH3D_M_xGetZofVector( VectB ), Eps ) )
/* jt 120599 : no registration if hand type zone hurt something else than a hang material type */
hCollideMaterial = GMT_fn_hGetCollideMaterial (_hDynMat);
/* zone has a collide material with hand type */
if ( (hCollideMaterial!=GMT_C_InvalidCollideMaterial) && (GMT_fn_hGetCollideMaterialIdentifier(hCollideMaterial)&(1<<3)) )
{
/* this is a ground */
hCollideMaterial = GMT_fn_hGetCollideMaterial (_hStatMat);
if ( (hCollideMaterial==GMT_C_InvalidCollideMaterial) || ((GMT_fn_hGetCollideMaterialIdentifier(hCollideMaterial)&4)!=4) )
/* the ground hasn't hand type material */
return;
}
/* end jt 120599 */
if (_xStaticGeomEntity == COL_C_xHighEdgeEntity ||
_xStaticGeomEntity == COL_C_xLowEdgeEntity) /* The function can be called twice for the same edge : we have to detect this*/
{
/* anthony */
/*p_stCollisionCase = COL_g_stCollisionCase;*/
p_stCollisionCase = COL_g_stCollisionCaseReal;
for (i = 0 ; i < COL_g_lNbElementsInTable ; i ++)
{
{
/* If the collision with the edge is already registered, we do nothing*/
if (p_stCollisionCase -> xStaticGeomEntity == _xStaticGeomEntity &&
p_stCollisionCase -> p_vParameter1 == _p_vParameter1 && /* Is it the same super object ?*/
MTH_M_bEqualWithEpsilon (p_stCollisionCase -> xCollisionTime , _xT , 0.001) &&
M_bIsVectorsEqualWithEpsilon (& p_stCollisionCase -> stCollisionPoint , _p_stHit , 0.005) &&
M_bIsVectorsEqualWithEpsilon (& p_stCollisionCase -> stCollisionNormal , _p_stNormal , 0.005))
{
/* Say that the edge is present twice*/
p_stCollisionCase -> sParameter2 |= C_wDoubleEdge;
return;
}
}
p_stCollisionCase ++;
}
}
/* anthony */
/*p_stCollisionCase = COL_g_stCollisionCase;*/
p_stCollisionCase = COL_g_stCollisionCaseReal;
for (i = 0 ; i < COL_g_lNbElementsInTable ; i ++)
{
if(MTH_M_bEqualWithEpsilon(_xT, p_stCollisionCase->xCollisionTime, 0.0001f))
{
if(_p_stNormal->xX < p_stCollisionCase->stCollisionNormal.xX)
{
int iNumberOfElementToCopy = 0;
COL_tdstCollisionCase * p = p_stCollisionCase;
/*COL_tdstCollisionCase * end = COL_g_stCollisionCase + COL_g_lNbElementsInTable ;*/ /* anthony */
COL_tdstCollisionCase * end = COL_g_stCollisionCaseReal + COL_g_lNbElementsInTable ;
while (p ++ < end) iNumberOfElementToCopy ++;
/* Not to go over array Boudary in memmove*/
if (p == (COL_g_stCollisionCase + (COL_C_xMaxNumberOfCollisions+1))) iNumberOfElementToCopy --;
if (iNumberOfElementToCopy )
memmove (p_stCollisionCase + 1 , p_stCollisionCase , iNumberOfElementToCopy * sizeof (COL_g_stCollisionCase [0]));
break;
}
}
else
{
if (_xT < p_stCollisionCase -> xCollisionTime)
{
int iNumberOfElementToCopy = 0;
COL_tdstCollisionCase * p = p_stCollisionCase;
/*COL_tdstCollisionCase * end = COL_g_stCollisionCase + COL_g_lNbElementsInTable ;*/ /* anthony */
COL_tdstCollisionCase * end = COL_g_stCollisionCaseReal + COL_g_lNbElementsInTable ;
/* Not to go over array Boudary in memmove*/
while (p ++ < end) iNumberOfElementToCopy ++;
if (p == (COL_g_stCollisionCase + (COL_C_xMaxNumberOfCollisions + 1))) iNumberOfElementToCopy --;
if (iNumberOfElementToCopy)
memmove (p_stCollisionCase + 1 , p_stCollisionCase , iNumberOfElementToCopy * sizeof (COL_g_stCollisionCase [0]));
break;
}
}
p_stCollisionCase ++;
}
//if (i == COL_C_xMaxNumberOfCollisions) return; /* The table is full*/
if (i == COL_g_lMaxNumberOfCollisions) return; /* anthony */
/*XB 98/09/11*/
#ifdef USE_PROFILER
if(s_l_MaxNbCollisions<i)
{
s_l_MaxNbCollisions=i;
}
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpMaxNbCollisions,s_l_MaxNbCollisions );
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpAllowedNbCollisions,COL_C_xMaxNumberOfCollisions );
#endif /* USE_PROFILER */
/*End XB*/
p_stCollisionCase -> xCollisionTime = _xT;
MTH3D_M_vCopyVector (& p_stCollisionCase -> stTranslation , _p_stTranslation);
MTH3D_M_vCopyVector (& p_stCollisionCase -> stCollisionPoint , _p_stHit);
MTH3D_M_vCopyVector (& p_stCollisionCase -> stCollisionNormal , _p_stNormal);
MTH3D_M_vCopyVector (& p_stCollisionCase -> stMovement , _p_stMovement);
MTH3D_M_vCopyVector (& p_stCollisionCase -> stEndPosition , _p_stEndPosition);
p_stCollisionCase -> hDynamicMaterial = _hDynMat;
p_stCollisionCase -> hStaticMaterial = _hStatMat;
p_stCollisionCase -> xDynamicGeomEntity = _xDynamicGeomEntity;
p_stCollisionCase -> xStaticGeomEntity = _xStaticGeomEntity;
p_stCollisionCase -> xSphereRadius = _xSphereRadius;
p_stCollisionCase -> p_vParameter1 = _p_vParameter1;
p_stCollisionCase -> sParameter2 = _sParameter2;
/* p_stCollisionCase -> bCollisionState = TRUE;*/ /* not usefull anymore */
if (COL_g_lNbElementsInTable == COL_g_lMaxNumberOfCollisions)
return;
else
COL_g_lNbElementsInTable++;
}
/*
--------------------------------------------------------------------------------
-- Description : Get of collision result
--------------------------------------------------------------------------------
-- Creation date : 22 apr 1997 Author : FPI
--------------------------------------------------------------------------------
qq*/
/* get du resultat des collisions */
/*
#ifndef _FIRE_DEADCODE_U64_
ACP_tdxBool COL_fn_bGetResultCollision ( COL_tdstCollisionCase * p_stCollisionCaseDst )
{
// resultat
if ( COL_g_stCollisionCase [0] . bCollisionState )
{
MTH3D_M_vNormalizeVector (& COL_g_stCollisionCase [0] . stCollisionNormal , & COL_g_stCollisionCase [0] . stCollisionNormal);
memcpy (p_stCollisionCaseDst , & COL_g_stCollisionCase [0] , sizeof (COL_tdstCollisionCase));
}
return COL_g_stCollisionCase [0] . bCollisionState;
}
#endif
*/
/*
--------------------------------------------------------------------------------
-- Description : Get several collision results
--------------------------------------------------------------------------------
-- Creation date : March 3, 1998 Author : Alexis Vaisse
--------------------------------------------------------------------------------
*/
ACP_tdxBool COL_fn_bGetMultipleResultCollision (COL_tdstCollisionCase * * _p_p_stCollisionCaseDst)
{
ACP_tdxBool temp;
/* return a pointer to the array of collision case*/
//* _p_p_stCollisionCaseDst = COL_g_stCollisionCase;
* _p_p_stCollisionCaseDst = COL_g_stCollisionCaseReal;
//return COL_g_stCollisionCase [0] . bCollisionState; /* If there is a collision, the position 0 is not empty*/
return temp = (COL_g_lNbElementsInTable!=0);
/*
long i , lNumberOfElementToCopy;
COL_tdstCollisionCase * p;
p = p_stCollisionCaseDst;
for (i = 0 ; i < COL_C_xMaxNumberOfCollisions ; i ++)
{
(p ++) -> bCollisionState = FALSE;
}
// Normalize the normals
p = COL_g_stCollisionCase;
for (i = 0 ; i < COL_C_xMaxNumberOfCollisions ; i ++)
{
if (p -> bCollisionState)
{
MTH3D_M_vNormalizeVector (& p -> stCollisionNormal , & p -> stCollisionNormal);
}
else break; // No collision : it is not necessary to use the next elements of the array
p ++;
}
lNumberOfElementToCopy = (i < COL_C_xMaxNumberOfCollisions) ? (i + 1) : COL_C_xMaxNumberOfCollisions;
// Copy only the minimum
memcpy (p_stCollisionCaseDst , & COL_g_stCollisionCase , sizeof (COL_tdstCollisionCase) * lNumberOfElementToCopy);
return COL_g_stCollisionCase [0] . bCollisionState; // If there is a collision, the position 0 is not empty
*/
}

View File

@@ -0,0 +1,106 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Geometric object collision part
--------------------------------------------------------------------------------
-- Creation date : 22 aug 1996 Author : FPI
--------------------------------------------------------------------------------
*/
#include "acp_base.h"
#include "MTH.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL/CollGOUt.h"
/*
--------------------------------------------------------------------------------
-- Description : Get if there is an surfacic element in geometric object
--------------------------------------------------------------------------------
-- Creation date : 12 feb 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* test si il existe un element surfacique */
ACP_tdxBool COL_fn_bGetSurfaceInGeometricObject ( ACP_tdxHandleOfObject _hGeometricObject )
{
ACP_tdxIndex xElementIndex;
/* pour les elements */
for ( xElementIndex = 0 ; xElementIndex < _hGeometricObject->xNbElements ; xElementIndex++ )
{
switch ( _hGeometricObject->d_xListOfElementsTypes[xElementIndex] )
{
#ifdef USE_ALTIMAPS
case GEO_C_xElementAltimap :
#endif /*USE_ALTIMAPS*/
case GEO_C_xElementIndexedTriangles :
/* case GEO_C_xElementFaceMapDescriptors :*/
case GEO_C_xElementSpheres :
case GEO_C_xElementAlignedBoxes :
return TRUE;
}
}
return FALSE;
}
/*
--------------------------------------------------------------------------------
-- Description : Get if the geometric object is composed of sphere and point only
--------------------------------------------------------------------------------
-- Creation date : 26 feb 1997 Author : FPI
--------------------------------------------------------------------------------
*/
/* test si il n y a que des spheres et des points */
/* pour corriger la desoptimisation des editeurs */
ACP_tdxBool COL_fn_bGetSphereAndPointOnlyInGeometricObject ( ACP_tdxHandleOfObject _hGeometricObject )
{
ACP_tdxIndex xElementIndex;
GEO_tdstElementIndexedTriangles *p_stElementIndexedTriangles;
/* GEO_tdstElementFaceMapDescriptors *p_stElementFaceMapDescriptors;*/
GEO_tdstElementAlignedBoxes *p_stElementAlignedBoxes;
/* pour les elements */
for ( xElementIndex = 0 ; xElementIndex < _hGeometricObject->xNbElements ; xElementIndex++ )
{
switch ( _hGeometricObject->d_xListOfElementsTypes[xElementIndex] )
{
case GEO_C_xElementIndexedTriangles :
p_stElementIndexedTriangles = (GEO_tdstElementIndexedTriangles *)(_hGeometricObject->d_stListOfElements[xElementIndex]);
if ( p_stElementIndexedTriangles->xNbFaces > 0 )
{
return FALSE;
}
break;
/*
case GEO_C_xElementFaceMapDescriptors :
p_stElementFaceMapDescriptors = (GEO_tdstElementFaceMapDescriptors *)(_hGeometricObject->d_stListOfElements[xElementIndex]);
if ( p_stElementFaceMapDescriptors->xNbFaces > 0 )
{
return FALSE;
}
break;
*/
case GEO_C_xElementAlignedBoxes :
p_stElementAlignedBoxes = (GEO_tdstElementAlignedBoxes *)(_hGeometricObject->d_stListOfElements[xElementIndex]);
if ( p_stElementAlignedBoxes->xNbAlignedBoxes > 0 )
{
return FALSE;
}
break;
default :
break;
}
}
return TRUE;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,214 @@
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789
--------------------------------------------------------------------------------
-- Description : Geometric object collision part : Elt - Edg
--------------------------------------------------------------------------------
-- Creation date : 15 may 1997 Author : FPI
--------------------------------------------------------------------------------
*/
#include "acp_base.h"
#include "MTH.h"
#include "MEC.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL/CsEltEdg.h"
#include "COL/CsSphElt.h"
/*--------------------------------------------------------------------------------*/
/*-- Description : COL_fn_vCollideDynamicSphereWithStaticEdge()*/
/*--------------------------------------------------------------------------------*/
/*-- Creation date : 08 jan 1996 Author : FPI*/
/*--------------------------------------------------------------------------------*/
/* used*/
void COL_fn_vCollideStaticSphereWithStaticEdge (COL_tdstGVForCollision *p_stGV,
/* ANNECY AV {*/
MTH3D_tdstVector * p_stNormal)
/* END ANNECY AV }*/
{
/* WARNING : p_stVertex2 is now the point which DOES NOT BELONG to the edge and not the second point of the edge*/
#define C_xTwoEpsilon (MTH_M_xDoubleToReal (0.002))
#define C_xOneMinusTwoEpsilon (MTH_M_xDoubleToReal (0.998))
COL_fn_vUseEnlargeSphere (p_stGV);
if (INT_fn_bDetectIntersectSegmentWithSphere ( p_stGV->p_stVertex1, &p_stGV->stEdgeVector,
&p_stGV->stDinST0Point, p_stGV->xDynamicRadius))
{
/* Here, we have collision with the 'end' position. We test now a collision with the 'start' position*/
MTH3D_tdstVector stMovementVector;
/* stDinST01Vector is the translation to go from the 'end' position to the 'start' position of the sphere center*/
/* and we need the translation to go from the 'start' position to the 'end' position*/
MTH3D_M_vNegVector (& stMovementVector, & p_stGV->stDinST01Vector);
/* jt 220399 : restore real radius of ZDM */
COL_fn_vUseInitialSphere (p_stGV);
if (INT_fn_bDetectIntersectSegmentWithSphere (p_stGV->p_stVertex1, & p_stGV->stEdgeVector,
& p_stGV->stDinST1Point, p_stGV->xDynamicRadius))
{
/* Here, we have collision with the 'end' and the 'start' position*/
MTH3D_tdstVector stVertex1ToCenter;
MTH_tdxReal xDotProduct;
MTH3D_tdstVector stTempHit;
MTH3D_tdstVector stTempNormal;
MTH3D_tdstVector stTempDistance;
MTH3D_tdstVector stEndPosition;
ACP_tdxIndex xEdgeEntity;
/* The hit is the projection of the center of the sphere onto the edge*/
MTH3D_M_vSubVector (& stVertex1ToCenter , & p_stGV->stDinST0Point , p_stGV->p_stVertex1);
xDotProduct = MTH3D_M_xDotProductVector (& stVertex1ToCenter , & p_stGV->stEdgeVector);
xDotProduct = MTH_M_xDiv (xDotProduct , MTH3D_M_xSqrVector (& p_stGV->stEdgeVector));
/* DotProduct must be between 2 x epsilon and 1 - 2 x epsilon*/
if (MTH_M_bLess (xDotProduct , C_xTwoEpsilon )) xDotProduct = C_xTwoEpsilon;
else
if (MTH_M_bGreater (xDotProduct , C_xOneMinusTwoEpsilon)) xDotProduct = C_xOneMinusTwoEpsilon;
MTH3D_M_vMulAddVector (& stTempHit , xDotProduct , & p_stGV->stEdgeVector , p_stGV->p_stVertex1);
/* The normal is the normalized vector from the hit to the center*/
MTH3D_M_vSubVector (& stTempDistance , & p_stGV->stDinST0Point , & stTempHit);
POS_fn_vMulMatrixVector (& stTempDistance , p_stGV->p_stStaticGeomObjMatrix , & stTempDistance);
/* ANNECY AV {*/
/* MTH3D_M_vNormalizeVector (& stTempNormal , & stTempDistance);*/
/* Modification : the normal is the normal of the triangle : this function MUST be called for a specific triangle*/
/* If the static object has a zoom, we must not use it to compute the normal, so we use RotateVector and not MulMatrixVector*/
/* POS_fn_vRotateVector (& stTempNormal , p_stGV->p_stStaticGeomObjMatrix , p_stNormal);*/
MTH3D_M_vMulMatrixVectorWithoutBuffer (& stTempNormal, & p_stGV->p_stStaticGeomObjMatrix->stRotationMatrix, p_stNormal);
/* END ANNECY AV }*/
/* The translation vector is Radius x normal - stTempDistance*/
/* ANNECY AV {*/
/* MTH3D_M_vNegVector (& stTempDistance , & stTempDistance);*/
/* MTH3D_M_vMulAddVector (& stTempDistance , p_stGV->xDynamicRadius , & stTempNormal , & stTempDistance);*/
/* jt 130499 : il faut enlever le scale au rayon de la zone !!! */
xDotProduct = MTH_M_xSub ( MTH_M_xMul(p_stGV->xDynamicRadius,p_stGV->xStaticScale) , MTH3D_M_xDotProductVector (& stTempDistance , & stTempNormal));
/* end jt 130499 */
MTH3D_M_vMulScalarVector (& stTempDistance , xDotProduct , & stTempNormal);
/* END ANNECY AV }*/
if (MTH_M_bGreaterEqual (MTH3D_M_xGetZofVector (p_stGV->p_stVertex2), MTH3D_M_xGetZofVector (& stTempHit)))
xEdgeEntity = COL_C_xHighEdgeEntity;
else xEdgeEntity = COL_C_xLowEdgeEntity;
POS_fn_vMulMatrixVertex (& stTempHit , p_stGV->p_stStaticGeomObjMatrix , & stTempHit);
POS_fn_vMulMatrixVector (& stMovementVector , p_stGV->p_stStaticGeomObjMatrix , & stMovementVector);
POS_fn_vMulMatrixVertex (& stEndPosition , p_stGV->p_stStaticGeomObjMatrix , & p_stGV->stDinST0Point);
/* We register the collision with Time = -1 to say that there was already a collision at the 'start' position*/
COL_fn_vAddInStaticCollisionTable (MTH_C_MinusONE , & stTempDistance , & stTempHit , & stTempNormal ,
p_stGV->hDynamicMaterial , p_stGV->hStaticMaterial ,
COL_C_xSphereEntity , xEdgeEntity ,
p_stGV->p_vParameter1 , p_stGV->sParameter2 ,
& stMovementVector,p_stGV->p_stDynamicIndexedSphere->xRadius, & stEndPosition);
}
else
{
/* Here, we have collision during the movement : we call the dynamic collision*/
MTH_tdxReal xT;
MTH3D_tdstVector stTempVector;
MTH3D_tdstVector stHit;
MTH3D_tdstVector stNormal;
MTH3D_tdstVector stTempHit;
MTH3D_tdstVector stTempDistance;
MTH3D_tdstVector stTempNormal;
MTH3D_tdstVector stEndPosition;
ACP_tdxIndex xEdgeEntity;
if (INT_fn_bIntersectSegmentWithCylinder (& p_stGV->stDinST1Point , & stMovementVector ,
p_stGV->p_stVertex1 , & p_stGV->stEdgeVector , p_stGV->xDynamicRadius ,
&xT, &stHit, &stNormal )) /* normal is the hit on the edge !*/
{
if (MTH_M_bGreaterEqual (MTH3D_M_xGetZofVector (p_stGV->p_stVertex2), MTH3D_M_xGetZofVector (& stNormal)))
xEdgeEntity = COL_C_xHighEdgeEntity;
else xEdgeEntity = COL_C_xLowEdgeEntity;
/* The hit*/
POS_fn_vMulMatrixVertex (& stTempHit , p_stGV->p_stStaticGeomObjMatrix , & stNormal );
/* The normal*/
MTH3D_M_vSubVector ( &stTempVector, &stHit, &stNormal );
MTH3D_M_vDivScalarVector ( &stTempVector, &stTempVector, p_stGV->xDynamicRadius);
/* ANNECY AV {*/
/* POS_fn_vMulMatrixVector ( &stTempNormal, p_stGV->p_stStaticGeomObjMatrix, &stTempVector );*/
/* Modification : the normal is the normal of the triangle : this function MUST be called for a specific triangle*/
/* POS_fn_vMulMatrixVector (& stTempNormal , p_stGV->p_stStaticGeomObjMatrix , p_stNormal);*/
MTH3D_M_vMulMatrixVectorWithoutBuffer (& stTempNormal, & p_stGV->p_stStaticGeomObjMatrix->stRotationMatrix, p_stNormal);
/* END ANNECY AV }*/
/* The translation is not used*/
MTH3D_M_vNullVector (& stTempDistance);
POS_fn_vMulMatrixVector (& stMovementVector , p_stGV->p_stStaticGeomObjMatrix , & stMovementVector);
POS_fn_vMulMatrixVertex (& stEndPosition , p_stGV->p_stStaticGeomObjMatrix , & p_stGV->stDinST0Point);
COL_fn_vAddInStaticCollisionTable (xT, & stTempDistance, & stTempHit, & stTempNormal,
p_stGV->hDynamicMaterial, p_stGV->hStaticMaterial,
COL_C_xSphereEntity, xEdgeEntity,
p_stGV->p_vParameter1, p_stGV->sParameter2,
& stMovementVector, p_stGV->p_stDynamicIndexedSphere->xRadius, & stEndPosition);
}
/* ??? If there is no collision during the movement, the collision is in fact with the point and with be treated somewhere else
*/
/* jt 240399 */
else
{
/* test collision with point */
if (INT_fn_bDetectIntersectSegmentWithSphere ( p_stGV->p_stVertex1, &p_stGV->stEdgeVector, &p_stGV->stDinST0Point, p_stGV->xDynamicRadius))
{
MTH3D_tdstVector stVertex1ToCenter;
MTH_tdxReal xDotProduct;
// The hit is the projection of the center of the sphere onto the edge
MTH3D_M_vSubVector (& stVertex1ToCenter , & p_stGV->stDinST0Point , p_stGV->p_stVertex1);
xDotProduct = MTH3D_M_xDotProductVector (& stVertex1ToCenter , & p_stGV->stEdgeVector);
xDotProduct = MTH_M_xDiv (xDotProduct , MTH3D_M_xSqrVector (& p_stGV->stEdgeVector));
MTH3D_M_vMulAddVector (& stTempHit , xDotProduct , & p_stGV->stEdgeVector , p_stGV->p_stVertex1);
// The normal is the normalized vector from the hit to the center
MTH3D_M_vSubVector (& stTempDistance , & p_stGV->stDinST0Point , & stTempHit);
POS_fn_vMulMatrixVector (& stTempDistance , p_stGV->p_stStaticGeomObjMatrix , & stTempDistance);
MTH3D_M_vNormalizeVector (& stTempNormal , & stTempDistance);
// The translation vector is Radius x normal - stTempDistance
MTH3D_M_vNegVector (& stTempDistance , & stTempDistance);
MTH3D_M_vMulAddVector (& stTempDistance , p_stGV->xDynamicRadius , & stTempNormal , & stTempDistance);
POS_fn_vMulMatrixVertex (& stTempHit , p_stGV->p_stStaticGeomObjMatrix , & stTempHit);
/* use real normal */
MTH3D_M_vMulMatrixVectorWithoutBuffer (& stTempNormal, & p_stGV->p_stStaticGeomObjMatrix->stRotationMatrix, p_stNormal);
POS_fn_vMulMatrixVector (& stMovementVector , p_stGV->p_stStaticGeomObjMatrix , & stMovementVector);
POS_fn_vMulMatrixVertex (& stEndPosition , p_stGV->p_stStaticGeomObjMatrix , & p_stGV->stDinST0Point);
// we register with Time=1.5 to say :
// - we don't know the real xRate
// - translation is ok
// - point type collision
COL_fn_vAddInStaticCollisionTable (MTH_M_xDoubleToReal(1.5) , & stTempDistance , & stTempHit , & stTempNormal ,
p_stGV->hDynamicMaterial , p_stGV->hStaticMaterial ,
COL_C_xSphereEntity , COL_C_xLowEdgeEntity ,
p_stGV->p_vParameter1 , p_stGV->sParameter2 , & stMovementVector,
p_stGV->p_stDynamicIndexedSphere->xRadius, & stEndPosition);
}
}
/* end jt 240399 */
}
}
}

View File

@@ -0,0 +1,6 @@
/* ANNECY AV {*/
/* All the functions of this file have been suppressed*/
/* END ANNECY AV }*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[COL.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project