Add rayman2 source files
This commit is contained in:
194
Rayman_X/cpa/public/COL/Box.h
Normal file
194
Rayman_X/cpa/public/COL/Box.h
Normal file
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : Box.h (Box utils)
|
||||
*/
|
||||
|
||||
#ifndef COL_BOX_H
|
||||
#define COL_BOX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
CONSTANT DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define COL_C_xXMinYMinZMin 0
|
||||
#define COL_C_xXMinYMinZMax 1
|
||||
#define COL_C_xXMinYMaxZMin 2
|
||||
#define COL_C_xXMinYMaxZMax 3
|
||||
#define COL_C_xXMaxYMinZMin 4
|
||||
#define COL_C_xXMaxYMinZMax 5
|
||||
#define COL_C_xXMaxYMaxZMin 6
|
||||
#define COL_C_xXMaxYMaxZMax 7
|
||||
|
||||
#define COL_C_xNbVerticesPerBox 8
|
||||
|
||||
#define COL_C_xXMin 0
|
||||
#define COL_C_xXMax 1
|
||||
#define COL_C_xYMin 2
|
||||
#define COL_C_xYMax 3
|
||||
#define COL_C_xZMin 4
|
||||
#define COL_C_xZMax 5
|
||||
|
||||
#define COL_C_ulNullMask 0x00
|
||||
#define COL_C_ulXMinMask 0x01
|
||||
#define COL_C_ulXMaxMask 0x02
|
||||
#define COL_C_ulYMinMask 0x04
|
||||
#define COL_C_ulYMaxMask 0x08
|
||||
#define COL_C_ulZMinMask 0x10
|
||||
#define COL_C_ulZMaxMask 0x20
|
||||
#define COL_C_ulAllPMask 0x3F
|
||||
|
||||
#define COL_C_ulFullMask 0x3F
|
||||
#define COL_C_ulXMinInvMask 0x3E
|
||||
#define COL_C_ulXMaxInvMask 0x3D
|
||||
#define COL_C_ulYMinInvMask 0x3B
|
||||
#define COL_C_ulYMaxInvMask 0x37
|
||||
#define COL_C_ulZMinInvMask 0x2F
|
||||
#define COL_C_ulZMaxInvMask 0x1F
|
||||
|
||||
#define COL_C_xNbSidesPerBox 6
|
||||
|
||||
#define COL_C_xYMinZMin 0
|
||||
#define COL_C_xYMinZMax 1
|
||||
#define COL_C_xYMaxZMin 2
|
||||
#define COL_C_xYMaxZMax 3
|
||||
#define COL_C_xXMinZMin 4
|
||||
#define COL_C_xXMinZMax 5
|
||||
#define COL_C_xXMaxZMin 6
|
||||
#define COL_C_xXMaxZMax 7
|
||||
#define COL_C_xXMinYMin 8
|
||||
#define COL_C_xXMinYMax 9
|
||||
#define COL_C_xXMaxYMin 10
|
||||
#define COL_C_xXMaxYMax 11
|
||||
|
||||
#define COL_C_xNbEdgesPerBox 12
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
TYPES DEFINITION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef MTH3D_tdstVector COL_tda8st8VerticesBox[COL_C_xNbVerticesPerBox];
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
GLOBAL VARIABLE DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern MTH3D_tdstVector COL_g_a6_stBoxSidesNormal[COL_C_xNbSidesPerBox];
|
||||
extern GEO_tdstDoubledIndex COL_g_a12_stBoxEdges[COL_C_xNbEdgesPerBox];
|
||||
extern unsigned long COL_g_a6_ulBoxSideMask[COL_C_xNbSidesPerBox];
|
||||
extern unsigned long COL_g_a6_ulBoxSideInvMask[COL_C_xNbSidesPerBox];
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vMinMaxBox2VerticesBox ( COL_tda8st8VerticesBox a8_stBoxDest,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfVertices ( MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
ACP_tdxIndex xNbVertices,
|
||||
MTH3D_tdstVector *d_stListOfVertices );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfVerticesBoxes ( MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
COL_tda8st8VerticesBox a8_stBox1,
|
||||
COL_tda8st8VerticesBox a8_stBox2 );
|
||||
|
||||
extern CPA_EXPORT 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 );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputeBoundingSphereOfBox ( MTH3D_tdstVector *p_stSphereCenter,
|
||||
MTH_tdxReal *p_xSphereRadius,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfSphere ( MTH3D_tdstVector *p_stMinBounding,
|
||||
MTH3D_tdstVector *p_stMaxBounding,
|
||||
MTH3D_tdstVector *p_stSphereCenter,
|
||||
MTH_tdxReal xSphereRadius );
|
||||
|
||||
extern CPA_EXPORT 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 );
|
||||
|
||||
extern CPA_EXPORT 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 );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfGeometricObject ( MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
GEO_tdstGeometricObject *p_stGeomObj );
|
||||
|
||||
/* ANNECY MT 25/02/98 {*/
|
||||
extern CPA_EXPORT void COL_fn_vComputeBoundingBoxOfSpheresWithSameRadius ( MTH3D_tdstVector *p_stMinBounding,
|
||||
MTH3D_tdstVector *p_stMaxBounding,
|
||||
MTH3D_tdstVector *p_stSphereCenter1,
|
||||
MTH3D_tdstVector *p_stSphereCenter2,
|
||||
MTH_tdxReal xSphereRadius );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vUpdateBoundingBoxOfSpheresWithSameRadius ( MTH3D_tdstVector *p_stMinBounding,
|
||||
MTH3D_tdstVector *p_stMaxBounding,
|
||||
MTH3D_tdstVector *p_stSphereCenter1,
|
||||
MTH3D_tdstVector *p_stSphereCenter2,
|
||||
MTH_tdxReal xSphereRadius );
|
||||
|
||||
extern CPA_EXPORT 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 );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool COL_fn_bDetectCollisionBetweenTwoParallelBoxes(MTH3D_tdstVector * _p_stFirstBoxMaxPoint,
|
||||
MTH3D_tdstVector * _p_stFirstBoxMinPoint,
|
||||
MTH3D_tdstVector * _p_stSecondBoxMaxPoint,
|
||||
MTH3D_tdstVector * _p_stSecondBoxMinPoint);
|
||||
/* END ANNECY MT }*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* COL_BOX_H */
|
6
Rayman_X/cpa/public/COL/CoBoxElt.h
Normal file
6
Rayman_X/cpa/public/COL/CoBoxElt.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
6
Rayman_X/cpa/public/COL/CoEdgEdg.h
Normal file
6
Rayman_X/cpa/public/COL/CoEdgEdg.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
6
Rayman_X/cpa/public/COL/CoEdgElt.h
Normal file
6
Rayman_X/cpa/public/COL/CoEdgElt.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
6
Rayman_X/cpa/public/COL/CoEltEdg.h
Normal file
6
Rayman_X/cpa/public/COL/CoEltEdg.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
6
Rayman_X/cpa/public/COL/CoEltPts.h
Normal file
6
Rayman_X/cpa/public/COL/CoEltPts.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
6
Rayman_X/cpa/public/COL/CoFMDElt.h
Normal file
6
Rayman_X/cpa/public/COL/CoFMDElt.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
6
Rayman_X/cpa/public/COL/CoITrElt.h
Normal file
6
Rayman_X/cpa/public/COL/CoITrElt.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
6
Rayman_X/cpa/public/COL/CoPtsElt.h
Normal file
6
Rayman_X/cpa/public/COL/CoPtsElt.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
6
Rayman_X/cpa/public/COL/CoSphElt.h
Normal file
6
Rayman_X/cpa/public/COL/CoSphElt.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
80
Rayman_X/cpa/public/COL/CollGO.h
Normal file
80
Rayman_X/cpa/public/COL/CollGO.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : CollGO.h (Geometric object collision)
|
||||
*/
|
||||
|
||||
#ifndef COL_COLLGO_H
|
||||
#define COL_COLLGO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
#include "Box.h"
|
||||
#include "Inters.h"
|
||||
#include "IntersGO.h"
|
||||
#include "OctreeGO.h"
|
||||
#include "CollGOCo.h"
|
||||
#include "CsEltPts.h"
|
||||
#include "CsEltEdg.h"
|
||||
#include "CsSphElt.h"
|
||||
#include "CsBoxElt.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool COL_fn_bDetectCollisionStaticGeomObjWithStaticGeomObj (GEO_tdxHandleToBoundingSphere _hDynamicGeometricObject,
|
||||
POS_tdstCompletePosition *_p_stDynamicGeometricObjectMatrix,
|
||||
void * _hStaticGeometricObject,
|
||||
POS_tdstCompletePosition *_p_stStaticGeometricObjectMatrix,
|
||||
ACP_tdxBool _bStaticGeomObjHasNoTransformationMatrix,
|
||||
ACP_tdxBool _bDynamicGeomObjHasZoomInsteadOfScale,
|
||||
ACP_tdxBool _bStaticGeomObjHasABoxBoundingVolume);
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vInitCollideStaticGeomObjWithStaticGeomObj ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputeCollisionStaticGeomObjWithStaticGeomObj ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
extern CPA_EXPORT 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);
|
||||
|
||||
/* 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*/
|
||||
extern CPA_EXPORT long COL_fn_lFindNormalFromGeometricObject (GEO_tdstGeometricObject * _p_stGeometricObject ,
|
||||
MTH3D_tdstVector * _p_stPoint ,
|
||||
MTH3D_tdstVector * _p_a2_stNormal);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* COL_COLLGO_H */
|
383
Rayman_X/cpa/public/COL/CollGOCo.h
Normal file
383
Rayman_X/cpa/public/COL/CollGOCo.h
Normal file
@@ -0,0 +1,383 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : CollGOCo.h (Geometric object collision)
|
||||
*/
|
||||
|
||||
#ifndef COL_COLLGOCO_H
|
||||
#define COL_COLLGOCO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
#include "Box.h"
|
||||
#include "Inters.h"
|
||||
#include "IntersGO.h"
|
||||
#include "OctreeGO.h"
|
||||
#include "CollGOUt.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
CONSTANT DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* cas de collision */
|
||||
#define COL_C_ulDynamicNonWithStaticNon 0x00000000
|
||||
|
||||
#define COL_C_ulDynamicPtsWithStaticITr 0x00000001
|
||||
#define COL_C_ulDynamicPtsWithStaticFMD 0x00000002
|
||||
#define COL_C_ulDynamicPtsWithStaticSph 0x00000004
|
||||
#define COL_C_ulDynamicPtsWithStaticBox 0x00000008
|
||||
#define COL_C_ulDynamicPtsWithStaticElt 0x0000000F
|
||||
|
||||
#define COL_C_ulDynamicITrWithStaticPts 0x00000010
|
||||
#define COL_C_ulDynamicFMDWithStaticPts 0x00000020
|
||||
#define COL_C_ulDynamicSphWithStaticPts 0x00000040
|
||||
#define COL_C_ulDynamicBoxWithStaticPts 0x00000080
|
||||
#define COL_C_ulDynamicEltWithStaticPts 0x000000F0
|
||||
|
||||
#define COL_C_ulDynamicEdgWithStaticEdg 0x00000100
|
||||
|
||||
#define COL_C_ulDynamicEdgWithStaticSph 0x00000200
|
||||
#define COL_C_ulDynamicEdgWithStaticBox 0x00000400
|
||||
#define COL_C_ulDynamicEdgWithStaticElt 0x00000600
|
||||
|
||||
#define COL_C_ulDynamicSphWithStaticEdg 0x00000800
|
||||
#define COL_C_ulDynamicBoxWithStaticEdg 0x00001000
|
||||
#define COL_C_ulDynamicEltWithStaticEdg 0x00001800
|
||||
|
||||
#define COL_C_ulDynamicITrWithStaticSph 0x00002000
|
||||
#define COL_C_ulDynamicITrWithStaticBox 0x00004000
|
||||
#define COL_C_ulDynamicITrWithStaticElt 0x00006000
|
||||
|
||||
#define COL_C_ulDynamicFMDWithStaticSph 0x00008000
|
||||
#define COL_C_ulDynamicFMDWithStaticBox 0x00010000
|
||||
#define COL_C_ulDynamicFMDWithStaticElt 0x00018000
|
||||
|
||||
#define COL_C_ulDynamicSphWithStaticITr 0x00020000
|
||||
#define COL_C_ulDynamicSphWithStaticFMD 0x00040000
|
||||
#define COL_C_ulDynamicSphWithStaticSph 0x00080000
|
||||
#define COL_C_ulDynamicSphWithStaticBox 0x00100000
|
||||
#define COL_C_ulDynamicSphWithStaticElt 0x001E0000
|
||||
|
||||
#define COL_C_ulDynamicBoxWithStaticITr 0x00200000
|
||||
#define COL_C_ulDynamicBoxWithStaticFMD 0x00400000
|
||||
#define COL_C_ulDynamicBoxWithStaticSph 0x00800000
|
||||
#define COL_C_ulDynamicBoxWithStaticBox 0x01000000
|
||||
#define COL_C_ulDynamicBoxWithStaticElt 0x01E00000
|
||||
|
||||
#define COL_C_ulDynamicEltWithStaticElt 0x01FFE000
|
||||
|
||||
#define COL_C_ulDynamicAllWithStaticAll 0x01FFFFFF
|
||||
|
||||
/* ANNECY AV {*/
|
||||
/*#define COL_C_xPointEntity 0*/
|
||||
#define COL_C_xTriangleEntity 1
|
||||
/*#define COL_C_xEdgeEntity 2*/
|
||||
#define COL_C_xSphereEntity 3
|
||||
#define COL_C_xAlignedBoxEntity 4
|
||||
#define COL_C_xHighEdgeEntity 7 /* Edge that is above the collision point */
|
||||
#define COL_C_xLowEdgeEntity 8 /* Edge that is below the collision point */
|
||||
/* END ANNECY AV }*/
|
||||
|
||||
/*ANNECY jt {*/
|
||||
#define COL_C_xNoEntity 99
|
||||
/*ENDANNECY jt }*/
|
||||
|
||||
#define COL_C_xMaxStaticPoints 500
|
||||
#define COL_C_xMaxStaticEdges 500
|
||||
#define COL_C_xMaxStaticBoundingBoxes 50
|
||||
|
||||
/*#define COL_C_xMaxNumberOfCollisions 25 // 50 jt*/
|
||||
#define COL_C_xMaxNumberOfCollisions 75
|
||||
|
||||
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
TYPES DEFINITION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* WARNING
|
||||
To Optimize MECA-Collisions Array computing,
|
||||
this struct MUST BE exactly the same as
|
||||
DNM_stMecObstacle in DNMObsta.h
|
||||
Any change to this struct MUST be reported to DNM_stMecObstacle */
|
||||
|
||||
typedef struct COL_tdstCollisionCase_
|
||||
{
|
||||
/* 1 temps de collision */
|
||||
MTH_tdxReal xCollisionTime;
|
||||
|
||||
/* 2 normale de collision */
|
||||
MTH3D_tdstVector stCollisionNormal;
|
||||
|
||||
/* 3 point de collision */
|
||||
MTH3D_tdstVector stCollisionPoint;
|
||||
|
||||
|
||||
/* 4 materiau dynamique */
|
||||
GMT_tdxHandleToGameMaterial hDynamicMaterial;
|
||||
|
||||
/* 5 materiau statique */
|
||||
GMT_tdxHandleToGameMaterial hStaticMaterial;
|
||||
|
||||
/* 6 parametre 1 pour la meca HIE_tdxHandleToSuperObject mp_stSupObj */
|
||||
void *p_vParameter1;
|
||||
|
||||
/* 7 parametre 2 pour la meca DNM_tdeObstacleType m_eType */
|
||||
long sParameter2;
|
||||
|
||||
/* 8 geometrie dynamique */
|
||||
ACP_tdxIndex xDynamicGeomEntity;
|
||||
|
||||
/* 9 geometrie statique */
|
||||
ACP_tdxIndex xStaticGeomEntity;
|
||||
|
||||
|
||||
/* 10 The translation to do to the actor*/
|
||||
MTH3D_tdstVector stTranslation;
|
||||
|
||||
/* 11 the movement of the zone */
|
||||
MTH3D_tdstVector stMovement;
|
||||
|
||||
/* 12 the final position of the center of the sphere */
|
||||
MTH3D_tdstVector stEndPosition;
|
||||
|
||||
/* 13 The radius of the sphere (or the dimension of the box) */
|
||||
MTH_tdxReal xSphereRadius;
|
||||
|
||||
/* 14 Pour correspondre a la structure de meca*/
|
||||
/*DNM_tdstMecMatCharacteristics m_stProperties; *//* Material properties */
|
||||
MTH_tdxReal m_xSlide1;
|
||||
MTH_tdxReal m_xRebound1;
|
||||
|
||||
/* 15 Pour correspondre a la structure de meca*/
|
||||
/* DNM_tdstMecMatCharacteristics m_stMyProperties;*/ /* Material properties of mine */
|
||||
MTH_tdxReal m_xSlide2;
|
||||
MTH_tdxReal m_xRebound2;
|
||||
|
||||
|
||||
|
||||
}
|
||||
COL_tdstCollisionCase;
|
||||
|
||||
typedef struct COL_tdstGVForCollision_
|
||||
{
|
||||
/* parametres */
|
||||
ACP_tdxBool bStaticGeomObjHasNoTransformationMatrix;
|
||||
ACP_tdxBool bDynamicGeomObjHasZoomInsteadOfScale;
|
||||
GEO_tdstGeometricObject *p_stDynamicGeomObj;
|
||||
POS_tdstCompletePosition *p_stT0DynamicGeomObjMatrix;
|
||||
POS_tdstCompletePosition *p_stT1DynamicGeomObjMatrix;
|
||||
GEO_tdstGeometricObject *p_stStaticGeomObj;
|
||||
POS_tdstCompletePosition *p_stStaticGeomObjMatrix;
|
||||
unsigned long ulSelectedCollisionCases;
|
||||
void *p_vParameter1;
|
||||
short sParameter2;
|
||||
|
||||
/* variables internes */
|
||||
|
||||
/* matrices */
|
||||
POS_tdstCompletePosition stInvMatrix;
|
||||
|
||||
POS_tdstCompletePosition stD2ST0TransformMatrix;
|
||||
POS_tdstCompletePosition stD2ST1TransformMatrix;
|
||||
|
||||
POS_tdstCompletePosition stS2DT0TransformMatrix;
|
||||
POS_tdstCompletePosition stS2DT1TransformMatrix;
|
||||
|
||||
MTH_tdxReal xStaticScale;
|
||||
|
||||
/* index generaux */
|
||||
ACP_tdxIndex xDynamicPointIndex;
|
||||
ACP_tdxIndex xStaticPointIndex;
|
||||
|
||||
ACP_tdxIndex xDynamicEdgeIndex;
|
||||
ACP_tdxIndex xStaticEdgeIndex;
|
||||
|
||||
ACP_tdxIndex xDynamicElementIndex;
|
||||
ACP_tdxIndex xStaticElementIndex;
|
||||
|
||||
/* pointeurs des elements */
|
||||
MTH3D_tdstVector *p_stDynamicPoint;
|
||||
MTH3D_tdstVector *p_stStaticPoint;
|
||||
|
||||
GEO_tdstDoubledIndex *p_stDynamicEdge;
|
||||
GEO_tdstDoubledIndex *p_stStaticEdge;
|
||||
|
||||
GEO_tdstElementIndexedTriangles *p_stDynamicElementIndexedTriangles;
|
||||
GEO_tdstElementIndexedTriangles *p_stStaticElementIndexedTriangles;
|
||||
|
||||
//XB99/04/27
|
||||
#ifndef U64
|
||||
GEO_tdstElementFaceMapDescriptors *p_stDynamicElementFaceMapDescriptors;
|
||||
GEO_tdstElementFaceMapDescriptors *p_stStaticElementFaceMapDescriptors;
|
||||
#endif U64
|
||||
//End XB99/04/27
|
||||
|
||||
GEO_tdstElementSpheres *p_stDynamicElementSpheres;
|
||||
GEO_tdstElementSpheres *p_stStaticElementSpheres;
|
||||
|
||||
GEO_tdstElementAlignedBoxes *p_stDynamicElementAlignedBoxes;
|
||||
GEO_tdstElementAlignedBoxes *p_stStaticElementAlignedBoxes;
|
||||
|
||||
#ifdef USE_ALTIMAPS
|
||||
GEO_tdstElementAltimap *p_stStaticElementAltimap;
|
||||
#endif /*USE_ALTIMAPS*/
|
||||
|
||||
/* index des elements */
|
||||
ACP_tdxIndex xDynamicIndexedTriangleIndex;
|
||||
ACP_tdxIndex xStaticIndexedTriangleIndex;
|
||||
|
||||
ACP_tdxIndex xDynamicFaceMapTriangleIndex;
|
||||
ACP_tdxIndex xStaticFaceMapTriangleIndex;
|
||||
|
||||
ACP_tdxIndex xDynamicIndexedSphereIndex;
|
||||
ACP_tdxIndex xStaticIndexedSphereIndex;
|
||||
|
||||
ACP_tdxIndex xDynamicIndexedAlignedBoxIndex;
|
||||
ACP_tdxIndex xStaticIndexedAlignedBoxIndex;
|
||||
|
||||
/* ANNECY MT 25/02/98 {*/
|
||||
long lBitsFieldOfIndexedSpheresInCollision;
|
||||
/* END ANNECY MT }*/
|
||||
|
||||
/* pointeurs des parties d element */
|
||||
GEO_tdstIndexedSphere *p_stDynamicIndexedSphere;
|
||||
GEO_tdstIndexedSphere *p_stStaticIndexedSphere;
|
||||
|
||||
GEO_tdstIndexedAlignedBox *p_stDynamicIndexedAlignedBox;
|
||||
GEO_tdstIndexedAlignedBox *p_stStaticIndexedAlignedBox;
|
||||
|
||||
/* donnees de base */
|
||||
MTH3D_tdstVector stDinST0Point;
|
||||
MTH3D_tdstVector stDinST1Point;
|
||||
MTH3D_tdstVector stDinST01Vector;
|
||||
|
||||
/* jt 220399 */
|
||||
MTH3D_tdstVector stSwapDinST0Point;
|
||||
|
||||
MTH3D_tdstVector stSinDT0Point;
|
||||
MTH3D_tdstVector stSinDT1Point;
|
||||
MTH3D_tdstVector stSinDT01Vector;
|
||||
|
||||
ACP_tdxIndex xVertex1Index;
|
||||
ACP_tdxIndex xVertex2Index;
|
||||
MTH3D_tdstVector *p_stVertex1;
|
||||
MTH3D_tdstVector *p_stVertex2;
|
||||
MTH3D_tdstVector stEdgeVector;
|
||||
|
||||
MTH3D_tdstVector *p_stDynamicCenter;
|
||||
MTH3D_tdstVector *p_stStaticCenter;
|
||||
MTH_tdxReal xDynamicRadius;
|
||||
|
||||
/* jt 260399 */
|
||||
MTH_tdxReal xSwapRadius;
|
||||
ACP_tdxBool bUseEnlargeSphere;
|
||||
|
||||
MTH3D_tdstVector *p_stDynamicMinPoint;
|
||||
MTH3D_tdstVector *p_stDynamicMaxPoint;
|
||||
MTH3D_tdstVector *p_stStaticMinPoint;
|
||||
MTH3D_tdstVector *p_stStaticMaxPoint;
|
||||
|
||||
MTH3D_tdstVector stDinST0MaxPoint;
|
||||
MTH3D_tdstVector stDinST1MaxPoint;
|
||||
MTH3D_tdstVector stDinST0MinPoint;
|
||||
MTH3D_tdstVector stDinST1MinPoint;
|
||||
|
||||
COL_tda8st8VerticesBox a8_stDynamic8VBox;
|
||||
COL_tda8st8VerticesBox a8_stStatic8VBox;
|
||||
|
||||
COL_tda8st8VerticesBox a8_stDinST08VBox;
|
||||
COL_tda8st8VerticesBox a8_stDinST18VBox;
|
||||
COL_tda8st8VerticesBox a8_stDinST01Vect;
|
||||
|
||||
COL_tda8st8VerticesBox a8_stSinDT08VBox;
|
||||
COL_tda8st8VerticesBox a8_stSinDT18VBox;
|
||||
COL_tda8st8VerticesBox a8_stSinDT01Vect;
|
||||
|
||||
GMT_tdxHandleToGameMaterial hDynamicMaterial;
|
||||
GMT_tdxHandleToGameMaterial hStaticMaterial;
|
||||
|
||||
COL_tdpstOctree p_stOctree;
|
||||
ACP_tdxIndex xNumberOfSelectedNodes;
|
||||
COL_tdpstOctreeNode aDEF_pstSelectedNode[COL_C_xMaxSelectedNodes];
|
||||
MTH_tdxReal aDEF_xSelectedT[COL_C_xMaxSelectedNodes];
|
||||
|
||||
ACP_tdxBool bSurfacicDynamicElement;
|
||||
ACP_tdxBool bDynamicSphereAndPointOnly;
|
||||
|
||||
ACP_tdxIndex xNbStaticPoints;
|
||||
ACP_tdxIndex aDEF_xListOfStaticPoints[COL_C_xMaxStaticPoints];
|
||||
|
||||
ACP_tdxIndex xNbStaticEdges;
|
||||
ACP_tdxIndex aDEF_xListOfStaticPt1Edges[COL_C_xMaxStaticEdges];
|
||||
ACP_tdxIndex aDEF_xListOfStaticPt2Edges[COL_C_xMaxStaticEdges];
|
||||
GMT_tdxHandleToGameMaterial aDEF_hListOfStaticMaterialEdges[COL_C_xMaxStaticEdges];
|
||||
}
|
||||
COL_tdstGVForCollision;
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
GLOBAL VARIABLE DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* cas de collision */
|
||||
extern COL_tdstCollisionCase COL_g_stCollisionCase [COL_C_xMaxNumberOfCollisions];
|
||||
|
||||
extern COL_tdstGVForCollision COL_g_stGVForCol;
|
||||
extern long COL_g_lNbElementsInTable;
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*extern CPA_EXPORT void COL_fn_vInitCollisionTable ( void );*/ /* anthony */
|
||||
#define COL_fn_vInitCollisionTable() { COL_g_lNbElementsInTable = 0; }
|
||||
|
||||
|
||||
extern CPA_EXPORT 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);
|
||||
/*extern CPA_EXPORT ACP_tdxBool COL_fn_bGetResultCollision (COL_tdstCollisionCase * p_stCollisionCaseDst);*/
|
||||
extern CPA_EXPORT ACP_tdxBool COL_fn_bGetMultipleResultCollision (COL_tdstCollisionCase * * _p_p_stCollisionCaseDst);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* COL_COLLGOCO_H */
|
145
Rayman_X/cpa/public/COL/CollGOUt.h
Normal file
145
Rayman_X/cpa/public/COL/CollGOUt.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : CollGOUt.h (Geometric object collision)
|
||||
*/
|
||||
|
||||
#ifndef COL_COLLGOUT_H
|
||||
#define COL_COLLGOUT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
#include "Box.h"
|
||||
#include "Inters.h"
|
||||
#include "IntersGO.h"
|
||||
#include "OctreeGO.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define COL_M_vIntSegTriBoundReject( p_stVertexA, p_stVectAB, p_stVertex1, p_stVertex2, p_stVertex3, xCoord, xMin, xMax )\
|
||||
{\
|
||||
xMin = p_stVertexA->xCoord;\
|
||||
if (*((long *)&(p_stVectAB->xCoord)) < 0L)\
|
||||
{\
|
||||
xMin += p_stVectAB->xCoord;\
|
||||
}\
|
||||
\
|
||||
FUT_M_vMaxValue3 ( xMax, p_stVertex1->xCoord, p_stVertex2->xCoord, p_stVertex3->xCoord );\
|
||||
\
|
||||
if ( MTH_M_bLess ( xMax, xMin ) )\
|
||||
{\
|
||||
return ;\
|
||||
}\
|
||||
\
|
||||
xMax = p_stVertexA->xCoord;\
|
||||
if (*((long *)&(p_stVectAB->xCoord)) > 0L)\
|
||||
{\
|
||||
xMax += p_stVectAB->xCoord;\
|
||||
}\
|
||||
\
|
||||
FUT_M_vMinValue3 ( xMin, p_stVertex1->xCoord, p_stVertex2->xCoord, p_stVertex3->xCoord );\
|
||||
\
|
||||
if ( MTH_M_bLess ( xMax, xMin ) )\
|
||||
{\
|
||||
return ;\
|
||||
}\
|
||||
}
|
||||
|
||||
#define COL_M_vIntSegSphBoundReject( p_stVertex1, p_stVect12, p_stSphereCenter, xRadius, xCoord, xMin, xMax )\
|
||||
{\
|
||||
xMin = p_stVertex1->xCoord;\
|
||||
if (*((long *)&(p_stVect12->xCoord)) < 0L)\
|
||||
{\
|
||||
xMin += p_stVect12->xCoord;\
|
||||
}\
|
||||
\
|
||||
xMax = MTH_M_xAdd ( p_stSphereCenter->xCoord, xRadius );\
|
||||
\
|
||||
if ( MTH_M_bLess ( xMax, xMin ) )\
|
||||
{\
|
||||
return ;\
|
||||
}\
|
||||
\
|
||||
xMax = p_stVertex1->xCoord;\
|
||||
if (*((long *)&(p_stVect12->xCoord)) > 0L)\
|
||||
{\
|
||||
xMax += p_stVect12->xCoord;\
|
||||
}\
|
||||
\
|
||||
xMin = MTH_M_xSub ( p_stSphereCenter->xCoord, xRadius );\
|
||||
\
|
||||
if ( MTH_M_bLess ( xMax, xMin ) )\
|
||||
{\
|
||||
return ;\
|
||||
}\
|
||||
}
|
||||
|
||||
#define COL_M_vIntSegCylBoundRejection( p_stVertex1, p_stVect12, p_stVertexA, p_stVectAB, xCoord, xRadius, xMin, xMax )\
|
||||
{\
|
||||
xMin = p_stVertex1->xCoord;\
|
||||
if (*((long *)&(p_stVect12->xCoord)) < 0L)\
|
||||
{\
|
||||
xMin += p_stVect12->xCoord;\
|
||||
}\
|
||||
\
|
||||
xMax = p_stVertexA->xCoord;\
|
||||
if (*((long *)&(p_stVectAB->xCoord)) > 0L)\
|
||||
{\
|
||||
xMax += p_stVectAB->xCoord;\
|
||||
}\
|
||||
\
|
||||
if ( MTH_M_bLess ( MTH_M_xAdd ( xMax, xRadius ), xMin ) )\
|
||||
{\
|
||||
return ;\
|
||||
}\
|
||||
\
|
||||
xMax = p_stVertex1->xCoord;\
|
||||
if (*((long *)&(p_stVect12->xCoord)) > 0L)\
|
||||
{\
|
||||
xMax += p_stVect12->xCoord;\
|
||||
}\
|
||||
\
|
||||
xMin = p_stVertexA->xCoord;\
|
||||
if (*((long *)&(p_stVectAB->xCoord)) < 0L)\
|
||||
{\
|
||||
xMin += p_stVectAB->xCoord;\
|
||||
}\
|
||||
\
|
||||
if ( MTH_M_bLess ( xMax, MTH_M_xSub ( xMin, xRadius ) ) )\
|
||||
{\
|
||||
return ;\
|
||||
}\
|
||||
}
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool COL_fn_bGetSurfaceInGeometricObject ( ACP_tdxHandleOfObject _hGeometricObject );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool COL_fn_bGetSphereAndPointOnlyInGeometricObject ( ACP_tdxHandleOfObject _hGeometricObject );
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* COL_COLLGOUT_H */
|
85
Rayman_X/cpa/public/COL/CsBoxElt.h
Normal file
85
Rayman_X/cpa/public/COL/CsBoxElt.h
Normal file
@@ -0,0 +1,85 @@
|
||||
|
||||
/*******************************************************************************/
|
||||
/* To use the functions of this file, define USE_ZDM_BOX*/
|
||||
/*******************************************************************************/
|
||||
#ifdef USE_ZDM_BOX
|
||||
|
||||
|
||||
#ifndef COL_CSBOXELT_H
|
||||
#define COL_CSBOXELT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
#include "Box.h"
|
||||
#include "Inters.h"
|
||||
#include "IntersGO.h"
|
||||
#include "OctreeGO.h"
|
||||
#include "CollGOCo.h"
|
||||
#include "CsEltPts.h"
|
||||
#include "CsEltEdg.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
CONSTANT DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
TYPES DEFINITION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
GLOBAL VARIABLE DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticAlignedBoxWithStaticIndexedTriangle ( COL_tdstGVForCollision *p_stGV, ACP_tdxBool bFaceMapInsteadOfIndexedTriangle);
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticElementAlignedBoxesWithStaticElementIndexedTriangles ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
/*extern CPA_EXPORT void COL_fn_vCollideStaticElementAlignedBoxesWithStaticElementFaceMapDescriptors ( COL_tdstGVForCollision *p_stGV );*/
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticAlignedBoxWithStaticSphere ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticElementAlignedBoxesWithStaticElementSpheres ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticAlignedBoxWithStaticAlignedBox ( COL_tdstGVForCollision *p_stGV );
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticElementAlignedBoxesWithStaticElementAlignedBoxes ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticElementAlignedBoxesWithStaticOctree ( COL_tdstGVForCollision *p_stGV );
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticElementAlignedBoxesWithStaticElements ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* COL_CSSPHELT_H */
|
||||
|
||||
#endif /* USE_ZDM_BOX*/
|
52
Rayman_X/cpa/public/COL/CsEltEdg.h
Normal file
52
Rayman_X/cpa/public/COL/CsEltEdg.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : CsEltEdg.h (Geometric object collision)
|
||||
*/
|
||||
|
||||
#ifndef COL_CSELTEDG_H
|
||||
#define COL_CSELTEDG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
#include "Box.h"
|
||||
#include "Inters.h"
|
||||
#include "IntersGO.h"
|
||||
#include "OctreeGO.h"
|
||||
#include "CollGOCo.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticSphereWithStaticEdge (COL_tdstGVForCollision *p_stGV,
|
||||
/* ANNECY AV {*/
|
||||
MTH3D_tdstVector * p_stNormal);
|
||||
/* END ANNECY AV }*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* COL_COEDGELT_H */
|
6
Rayman_X/cpa/public/COL/CsEltPts.h
Normal file
6
Rayman_X/cpa/public/COL/CsEltPts.h
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
/* ANNECY AV {*/
|
||||
|
||||
/* All the functions of this file have been suppressed*/
|
||||
|
||||
/* END ANNECY AV }*/
|
87
Rayman_X/cpa/public/COL/CsSphElt.h
Normal file
87
Rayman_X/cpa/public/COL/CsSphElt.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : CsSphElt.h (Geometric object collision)
|
||||
*/
|
||||
|
||||
#ifndef COL_CSSPHELT_H
|
||||
#define COL_CSSPHELT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
#include "Box.h"
|
||||
#include "Inters.h"
|
||||
#include "IntersGO.h"
|
||||
#include "OctreeGO.h"
|
||||
#include "CollGOCo.h"
|
||||
#include "CsEltPts.h"
|
||||
#include "CsEltEdg.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
CONSTANT DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
TYPES DEFINITION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
GLOBAL VARIABLE DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ANNECY AV STATIC {*/
|
||||
extern CPA_EXPORT ACP_tdxBool COL_fn_bCollideStaticSphereWithStaticIndexedTriangle (COL_tdstGVForCollision *p_stGV ,
|
||||
ACP_tdxBool bFaceMapInsteadOfIndexedTriangle);
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticElementSpheresWithStaticElementIndexedTriangles ( COL_tdstGVForCollision *p_stGV );
|
||||
/* Not used anymore : extern CPA_EXPORT void COL_fn_vCollideStaticSphereWithStaticFaceMapTriangle ( COL_tdstGVForCollision *p_stGV );*/
|
||||
/* END ANNECY AV STATIC }*/
|
||||
|
||||
/*extern CPA_EXPORT void COL_fn_vCollideStaticElementSpheresWithStaticElementFaceMapDescriptors ( COL_tdstGVForCollision *p_stGV );*/
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticSphereWithStaticSphere ( COL_tdstGVForCollision *p_stGV );
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticElementSpheresWithStaticElementSpheres ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticElementSpheresWithStaticOctree ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCollideStaticElementSpheresWithStaticElements ( COL_tdstGVForCollision *p_stGV );
|
||||
|
||||
|
||||
void COL_fn_vUseInitialSphere (COL_tdstGVForCollision * p_stGV);
|
||||
void COL_fn_vUseEnlargeSphere (COL_tdstGVForCollision * p_stGV);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* COL_CSSPHELT_H */
|
202
Rayman_X/cpa/public/COL/Futil.h
Normal file
202
Rayman_X/cpa/public/COL/Futil.h
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : Futil.h (Util macro definition)
|
||||
*/
|
||||
|
||||
#ifndef COL_FUTIL_H
|
||||
#define COL_FUTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION:
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
-- Description : Return true if two values (NOZ) have the same sign
|
||||
--------------------------------------------------------------------------------
|
||||
-- Creation date : 12 feb 1997 Author : FPI
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define FUT_M_bSameSign( A, B ) ( MTH_M_bGreaterEqualZero ( A ) == MTH_M_bGreaterEqualZero ( B ) )
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
-- Description : Return the max value of three values
|
||||
--------------------------------------------------------------------------------
|
||||
-- Creation date : 22 aug 1996 Author : FPI
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define FUT_M_xMaxValue3( A, B, C ) (\
|
||||
( ( (A) > (B) ) && ( (A) > (C) ) ) ?\
|
||||
(A) :\
|
||||
( ( (B) > (C) ) ? (B) : (C) )\
|
||||
)
|
||||
|
||||
#define FUT_M_vMaxValue3( V, A, B, C )\
|
||||
{\
|
||||
if ( (A) > (B) )\
|
||||
{\
|
||||
if ( (A) > (C) )\
|
||||
{\
|
||||
(V) = (A);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
(V) = (C);\
|
||||
}\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
if ( (B) > (C) )\
|
||||
{\
|
||||
(V) = (B);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
(V) = (C);\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
-- Description : Return the min value of three values
|
||||
--------------------------------------------------------------------------------
|
||||
-- Creation date : 22 aug 1996 Author : FPI
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define FUT_M_xMinValue3( A, B, C ) (\
|
||||
( ( (A) < (B) ) && ( (A) < (C) ) ) ?\
|
||||
(A) :\
|
||||
( ( (B) < (C) ) ? (B) : (C) )\
|
||||
)
|
||||
|
||||
#define FUT_M_vMinValue3( V, A, B, C )\
|
||||
{\
|
||||
if ( (A) < (B) )\
|
||||
{\
|
||||
if ( (A) < (C) )\
|
||||
{\
|
||||
(V) = (A);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
(V) = (C);\
|
||||
}\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
if ( (B) < (C) )\
|
||||
{\
|
||||
(V) = (B);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
(V) = (C);\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
-- Description : Return the delta of a trinome
|
||||
--------------------------------------------------------------------------------
|
||||
-- Creation date : 06 feb 1997 Author : FPI
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define FUT_M_xTrinomeDelta( A, B, C ) ( MTH_M_xSub ( MTH_M_xSqr ( B ),\
|
||||
MTH_M_xMul ( MTH_C_4,\
|
||||
MTH_M_xMul ( A, C )\
|
||||
)\
|
||||
)\
|
||||
)
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
-- Description : Return the interval inclusion for 2 two values
|
||||
--------------------------------------------------------------------------------
|
||||
-- Creation date : 22 aug 1996 Author : FPI
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define FUT_M_bInRangeE2( A, B, C, D, E, F ) ( ( (A) <= (B) ) &&\
|
||||
( (B) <= (C) ) &&\
|
||||
( (D) <= (E) ) &&\
|
||||
( (E) <= (F) )\
|
||||
)
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
-- Description : Add a scalar to a vector
|
||||
--------------------------------------------------------------------------------
|
||||
-- Creation date : 22 jan 1997 Author : FPI
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* MTH3D_M_vAddVector(VectDest, VectA, S) : VectDest = VectA + S */
|
||||
#define FUT_M_vAddScaleVector( VectDest, VectA, S )\
|
||||
{\
|
||||
(VectDest)->xX = MTH_M_xAdd ( (VectA)->xX, (S) );\
|
||||
(VectDest)->xY = MTH_M_xAdd ( (VectA)->xY, (S) );\
|
||||
(VectDest)->xZ = MTH_M_xAdd ( (VectA)->xZ, (S) );\
|
||||
}
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
-- Description : Sub a scalar to a vector
|
||||
--------------------------------------------------------------------------------
|
||||
-- Creation date : 22 jan 1997 Author : FPI
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* MTH3D_M_vSubVector(VectDest, VectA, S) : VectDest = VectA - S */
|
||||
#define FUT_M_vSubScaleVector( VectDest, VectA, S )\
|
||||
{\
|
||||
(VectDest)->xX = MTH_M_xSub ( (VectA)->xX, (S) );\
|
||||
(VectDest)->xY = MTH_M_xSub ( (VectA)->xY, (S) );\
|
||||
(VectDest)->xZ = MTH_M_xSub ( (VectA)->xZ, (S) );\
|
||||
}
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
-- Description : Swap two vector 3D pointers
|
||||
--------------------------------------------------------------------------------
|
||||
-- Creation date : 22 aug 1996 Author : FPI
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define FUT_M_vSwapVector3DPointer( A, B )\
|
||||
{\
|
||||
MTH3D_tdstVector *p_stT;\
|
||||
\
|
||||
p_stT = *A;\
|
||||
*A = *B;\
|
||||
*B = p_stT;\
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* COL_FUTIL_H */
|
368
Rayman_X/cpa/public/COL/Inters.h
Normal file
368
Rayman_X/cpa/public/COL/Inters.h
Normal file
@@ -0,0 +1,368 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : Inters.h (Low level intersection)
|
||||
*/
|
||||
|
||||
#ifndef COL_INTERS_H
|
||||
#define COL_INTERS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
#include "Box.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
CONSTANT DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define INT_C_xNoSolution 0
|
||||
#define INT_C_xOneSolution 1
|
||||
#define INT_C_xTwoSolutions 2
|
||||
|
||||
#define INT_C_xEpsInc ( MTH_M_xDoubleToReal ( 0.00001 ) )
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
TYPES DEFINITION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if 0
|
||||
typedef struct INT_tdstIntSegTri_
|
||||
{
|
||||
MTH3D_tdstVector *p_stVertexA;
|
||||
MTH3D_tdstVector *p_stVectAB;
|
||||
MTH3D_tdstVector *p_stVertex1;
|
||||
MTH3D_tdstVector *p_stVertex2;
|
||||
MTH3D_tdstVector *p_stVertex3;
|
||||
MTH3D_tdstVector *p_stNormal;
|
||||
MTH_tdxReal xDPlan;
|
||||
MTH_tdxReal xDotProduct;
|
||||
MTH_tdxReal xT;
|
||||
MTH3D_tdstVector stHit;
|
||||
}
|
||||
INT_tdstIntSegTri, *INT_tdpstIntSegTri;
|
||||
|
||||
typedef struct INT_tdstIntSegSph_
|
||||
{
|
||||
MTH3D_tdstVector *p_stVertexA;
|
||||
MTH3D_tdstVector *p_stVectAB;
|
||||
MTH3D_tdstVector *p_stVertex1;
|
||||
MTH3D_tdstVector *p_stVertex2;
|
||||
MTH3D_tdstVector *p_stVertex3;
|
||||
MTH3D_tdstVector *p_stNormal;
|
||||
MTH_tdxReal xDPlan;
|
||||
MTH_tdxReal xDotProduct;
|
||||
MTH_tdxReal xT;
|
||||
MTH3D_tdstVector stHit;
|
||||
}
|
||||
INT_tdstIntSegSph, *INT_tdpstIntSegSph;
|
||||
|
||||
typedef struct INT_tdstIntSegCyl_
|
||||
{
|
||||
MTH3D_tdstVector *p_stVertex1;
|
||||
MTH3D_tdstVector *p_stVect12;
|
||||
MTH3D_tdstVector *p_stVertexA;
|
||||
MTH3D_tdstVector *p_stVectAB;
|
||||
MTH_tdxReal xCylinderRadius;
|
||||
MTH_tdxReal xTSegment;
|
||||
MTH3D_tdstVector stHitSegment;
|
||||
MTH3D_tdstVector stHitLine;
|
||||
}
|
||||
INT_tdstIntSegCyl, *INT_tdpstIntSegCyl;
|
||||
#endif
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
GLOBAL VARIABLE DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* statistiques */
|
||||
#if 0
|
||||
extern long INT_g_lIntTriangle;
|
||||
extern long INT_g_lIntTriangleBound;
|
||||
extern long INT_g_lIntTriangleBack;
|
||||
extern long INT_g_lIntTriangleT;
|
||||
#endif
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define MTH_M_xMulAdd( A, T, B ) ( ((A)*(T)) + (B) )
|
||||
|
||||
extern CPA_EXPORT ACP_tdxIndex INT_fn_xTrinomeResolution ( MTH_tdxReal xA,
|
||||
MTH_tdxReal xB,
|
||||
MTH_tdxReal xC,
|
||||
MTH_tdxReal *p_xT1,
|
||||
MTH_tdxReal *p_xT2 );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectBoxWithBox ( MTH3D_tdstVector *p_stMinPoint1,
|
||||
MTH3D_tdstVector *p_stMaxPoint1,
|
||||
MTH3D_tdstVector *p_stMinPoint2,
|
||||
MTH3D_tdstVector *p_stMaxPoint2 );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSphereWithBox ( MTH3D_tdstVector *p_stCenter,
|
||||
MTH_tdxReal xRadius,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSphereWithSphere ( MTH3D_tdstVector *p_stCenter1,
|
||||
MTH_tdxReal xRadius1,
|
||||
MTH3D_tdstVector *p_stCenter2,
|
||||
MTH_tdxReal xRadius2 );
|
||||
|
||||
extern CPA_EXPORT unsigned long INT_fn_ulGetPositionPointWithBox ( MTH3D_tdstVector *p_stPoint,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bGetInclusionPointInBox ( MTH3D_tdstVector *p_stPoint,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint );
|
||||
|
||||
extern CPA_EXPORT unsigned long INT_fn_ulGetPositionPointWithEdgeBox ( MTH3D_tdstVector *p_stPoint,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
MTH3D_tdstVector *p_stDelta,
|
||||
MTH3D_tdstVector *p_stNegDelta );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectEdgeWithBox ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
unsigned long ulExploredPlan );
|
||||
|
||||
/*ANNECY TQ 06/03/98{*/
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectEdgeWithBoxWithHit ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
unsigned long ulExploredPlan,
|
||||
MTH3D_tdstVector *p_stHit);
|
||||
/*ENDANNECY TQ}*/
|
||||
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSegmentWithBox ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
MTH_tdxReal *p_xT,
|
||||
MTH3D_tdstVector *p_stHit,
|
||||
MTH3D_tdstVector *p_stNormal );
|
||||
|
||||
#ifdef ACTIVE_EDITOR
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSemiAxeWithBox ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
ACP_tdxBool *bBack,
|
||||
MTH_tdxReal *p_xT,
|
||||
MTH3D_tdstVector *p_stHit,
|
||||
MTH3D_tdstVector *p_stNormal );
|
||||
#endif
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSemiAxeWithBoxForOctree ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
ACP_tdxBool *bBack,
|
||||
MTH_tdxReal *p_xT );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectNearSemiAxeWithBoxForOctree ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH_tdxReal xNearDistance,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
MTH_tdxReal *p_xT );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bDetectIntersectSemiAxeWithBox ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint );
|
||||
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bDetectIntersectSegmentWithBox ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
MTH_tdxReal *_p_xT);
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bGetPointInTriangle ( MTH3D_tdstVector *p_stPoint,
|
||||
MTH3D_tdstVector *p_stVertex0,
|
||||
MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stNormal );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSegmentWithTriangle ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVertex3,
|
||||
MTH3D_tdstVector *p_stNormal,
|
||||
MTH_tdxReal xDPlan,
|
||||
MTH_tdxReal *p_xT,
|
||||
MTH3D_tdstVector *p_stHit );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSegmentWithTriangle2 ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVertex3,
|
||||
MTH3D_tdstVector *p_stNormal,
|
||||
MTH_tdxReal xDPlan,
|
||||
MTH_tdxReal xDotProduct,
|
||||
MTH_tdxReal *p_xT,
|
||||
MTH3D_tdstVector *p_stHit );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bDetectIntersectSegmentWithTriangle ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVertex3,
|
||||
MTH3D_tdstVector *p_stNormal,
|
||||
MTH_tdxReal xDPlan );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSemiAxeWithTriangle ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVertex3,
|
||||
MTH3D_tdstVector *p_stNormal,
|
||||
MTH_tdxReal xDPlan,
|
||||
ACP_tdxBool *bBack,
|
||||
MTH_tdxReal *p_xT,
|
||||
MTH3D_tdstVector *p_stHit );
|
||||
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectTriangleWithBox ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVertex3,
|
||||
MTH3D_tdstVector *p_stNormal,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint );
|
||||
|
||||
/*ANNECY TQ 04/03/98{*/
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectTriangleWithBoxWithHit ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVertex3,
|
||||
MTH3D_tdstVector *p_stNormal,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
MTH3D_tdstVector *p_stHit);
|
||||
/*ENDANNECY TQ}*/
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bGetInclusionPointInSphere ( MTH3D_tdstVector *p_stPoint,
|
||||
MTH3D_tdstVector *p_stSphereCenter,
|
||||
MTH_tdxReal xSphereRadius );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSegmentWithSphere ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stSphereCenter,
|
||||
MTH_tdxReal xSphereRadius,
|
||||
MTH_tdxReal *p_xT,
|
||||
MTH3D_tdstVector *p_stHit,
|
||||
MTH3D_tdstVector *p_stNormal );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bDetectIntersectSegmentWithSphere ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stSphereCenter,
|
||||
MTH_tdxReal xSphereRadius );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSemiAxeWithSphere ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stSphereCenter,
|
||||
MTH_tdxReal xSphereRadius,
|
||||
ACP_tdxBool *bBack,
|
||||
MTH_tdxReal *p_xT,
|
||||
MTH3D_tdstVector *p_stHit,
|
||||
MTH3D_tdstVector *p_stNormal );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bDetectIntersectSemiAxeWithSphere ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stSphereCenter,
|
||||
MTH_tdxReal xSphereRadius );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSegmentWithCylinder ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
MTH_tdxReal xCylinderRadius,
|
||||
MTH_tdxReal *p_xTSegment,
|
||||
MTH3D_tdstVector *p_stHitSegment,
|
||||
MTH3D_tdstVector *p_stHitLine );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSemiAxeWithCone ( MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stTopPoint,
|
||||
MTH3D_tdstVector *p_stBasePoint,
|
||||
MTH_tdxReal xBaseRadius,
|
||||
ACP_tdxBool *bBack,
|
||||
MTH_tdxReal *p_xT,
|
||||
MTH3D_tdstVector *p_stHit );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bGetInclusionPointInCone ( MTH3D_tdstVector *p_stPoint,
|
||||
MTH3D_tdstVector *p_stTopPoint,
|
||||
MTH3D_tdstVector *p_stBasePoint,
|
||||
MTH_tdxReal xBaseRadius );
|
||||
|
||||
extern CPA_EXPORT MTH_tdxReal INT_fn_xDistancePointToLine ( MTH3D_tdstVector *p_stPoint,
|
||||
MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
MTH_tdxReal *p_xT,
|
||||
MTH3D_tdstVector *p_stHit );
|
||||
|
||||
extern CPA_EXPORT MTH_tdxReal INT_fn_xSqrDistancePointToSegment ( MTH3D_tdstVector *p_stPoint,
|
||||
MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB );
|
||||
|
||||
extern CPA_EXPORT MTH_tdxReal INT_fn_xDistanceSegmentToLine ( MTH3D_tdstVector *p_stVertex1, /* segment */
|
||||
MTH3D_tdstVector *p_stVect12,
|
||||
MTH3D_tdstVector *p_stVertexA, /* line */
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
MTH_tdxReal *p_xTLine,
|
||||
MTH3D_tdstVector *p_stHitSegment,
|
||||
MTH3D_tdstVector *p_stHitLine );
|
||||
|
||||
/* ANNECY AV STATIC {*/
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIsOnTriangle ( MTH3D_tdstVector *_p_stPointI,
|
||||
MTH3D_tdstVector *_p_stPointA,
|
||||
MTH3D_tdstVector *_p_stPointB,
|
||||
MTH3D_tdstVector *_p_stPointC );
|
||||
/* END ANNECY AV STATIC }*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* COL_INTERS_H */
|
279
Rayman_X/cpa/public/COL/IntersGO.h
Normal file
279
Rayman_X/cpa/public/COL/IntersGO.h
Normal file
@@ -0,0 +1,279 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : IntersGO.h (Geometric object intersection)
|
||||
*/
|
||||
|
||||
#ifndef COL_INTERSGO_H
|
||||
#define COL_INTERSGO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
#include "Box.h"
|
||||
#include "Inters.h"
|
||||
#include "OctreeGO.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
CONSTANT DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define INT_C_lMaxProjectingEdges 100
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
TYPES DEFINITION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef struct COL_tdstShadowElement_
|
||||
{
|
||||
ACP_tdxIndex xElementIndex;
|
||||
ACP_tdxIndex xDataElementIndex;
|
||||
}
|
||||
COL_tdstShadowElement;
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
GLOBAL VARIABLE DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
MACROS DEFINITIONS
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef USE_ALTIMAPS
|
||||
/***********************************************************************************************/
|
||||
/* Name : COL_M_vSortSquareSelection*/
|
||||
/* Description : Macro that sorts the given coords*/
|
||||
/* Author : Marc FASCIA*/
|
||||
/***********************************************************************************************/
|
||||
#define COL_M_vSortSquareSelection( xMin, xMax ) \
|
||||
if( (xMin) > (xMax) ) \
|
||||
{ \
|
||||
ACP_tdxIndex xSwap; \
|
||||
xSwap = xMax; \
|
||||
xMax = xMin; \
|
||||
xMin = xSwap; \
|
||||
}
|
||||
|
||||
/***********************************************************************************************/
|
||||
/* Name : COL_M_vScanSelectedSquares*/
|
||||
/* Description : Macro that scans all the squares selected */
|
||||
/* Author : Marc FASCIA*/
|
||||
/***********************************************************************************************/
|
||||
#define COL_M_vScanSelectedSquares( xI, xJ, xV, xDx, xSMinX, xSMinY, xSMaxX, xSMaxY ) \
|
||||
COL_M_vSortSquareSelection( xSMinX, xSMaxX ); \
|
||||
COL_M_vSortSquareSelection( xSMinY, xSMaxY ); \
|
||||
for( (xV)=(xDx)*(xSMinY), (xJ)=(xSMinY) ; (xJ)<((xSMaxY) + 1) ; (xJ)++, (xV)=(xDx)*(xJ) ) \
|
||||
for( (xV)+=(xSMinX), (xI)=(xSMinX) ; (xI)<((xSMaxX) + 1) ; (xI)++, (xV)++ )
|
||||
|
||||
/***********************************************************************************************/
|
||||
/* Name : COL_M_vClipSquareSelection*/
|
||||
/* Description : Clips the selection is bigger than the altimap*/
|
||||
/* Author : Marc FASCIA*/
|
||||
/***********************************************************************************************/
|
||||
#define COL_M_vClipSquareSelection( p_Altimap, xX, xY, ClipMode ) \
|
||||
if( ClipMode ) \
|
||||
{ \
|
||||
if( ClipMode & 1 ) \
|
||||
xX = 0; \
|
||||
else \
|
||||
if( ClipMode & 2 ) \
|
||||
xX = p_Altimap->xWidth - 1; \
|
||||
\
|
||||
if( ClipMode & 4 ) \
|
||||
xY = 0; \
|
||||
else \
|
||||
if( ClipMode & 8 ) \
|
||||
xY = p_Altimap->xDepth - 1; \
|
||||
}
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/***********************************************************************************************/
|
||||
/* Name : COL_bSelectAltimapSquare*/
|
||||
/* Description : Sets the square coords of the square placed below or above the point*/
|
||||
/* Return val. : True if the point is above or below the altimap. False otherwise*/
|
||||
/* 0 : On the map*/
|
||||
/* 1 : Left*/
|
||||
/* 2 : Right*/
|
||||
/* 4 : Below*/
|
||||
/* 8 : Above*/
|
||||
/* Author : Marc FASCIA*/
|
||||
/***********************************************************************************************/
|
||||
unsigned char COL_ucSelectAltimapSquare( GEO_tdstElementAltimap * p_Altimap,
|
||||
MTH3D_tdstVector * p_TestPoint,
|
||||
ACP_tdxIndex * p_xCoordX,
|
||||
ACP_tdxIndex * p_xCoordY );
|
||||
|
||||
/***********************************************************************************************/
|
||||
/* Name : COL_ucBuildAltimapSquareTriangle*/
|
||||
/* Description : */
|
||||
/* Return val. : The type of the next triangle in this square*/
|
||||
/* Author : Marc FASCIA*/
|
||||
/***********************************************************************************************/
|
||||
unsigned char COL_ucBuildAltimapSquareTriangle( GEO_tdstElementAltimap * p_Altimap, /* The altimap*/
|
||||
ACP_tdxIndex xSx, /* Square coord X*/
|
||||
ACP_tdxIndex xSy, /* Square coord Y*/
|
||||
unsigned char ucTriangle, /* Which triangle of this square*/
|
||||
MTH3D_tdstVector * p_stV1, /* Triplet of points*/
|
||||
MTH3D_tdstVector * p_stV2, /* ''*/
|
||||
MTH3D_tdstVector * p_stV3, /* ''*/
|
||||
MTH3D_tdstVector * p_stNormal, /* Normal vector*/
|
||||
ACP_tdxIndex * p_xFaceIndex ); /* Index of built face*/
|
||||
#endif /*USE_ALTIMAPS*/
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
extern CPA_EXPORT void INT_fn_vViewAndAddFaceElementInList ( ACP_tdxIndex xNbMaxElements,
|
||||
ACP_tdxIndex *p_xNbElements,
|
||||
struct GLI_tdstDataOfElement_ *d_stDataOfElement,
|
||||
MTH3D_tdstVector *p_stVertexA,
|
||||
ACP_tdxBool bBack,
|
||||
MTH3D_tdstVector *p_stHit,
|
||||
ACP_tdxIndex xElements,
|
||||
ACP_tdxIndex xDataElementIndex );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSegmentWithFaceOfGeometricObject ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVertexB,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xNbMaxElements,
|
||||
ACP_tdxIndex *p_xNbElements,
|
||||
struct GLI_tdstDataOfElement_ *d_stDataOfElement );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSegmentWithFirstFaceOfGeometricObject ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVertexB,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
GEO_tdstGeometricObject *p_stGeomObj,
|
||||
MTH3D_tdstVector *p_stHitPoint,
|
||||
ACP_tdxIndex *p_xElement,
|
||||
ACP_tdxIndex *p_xDataElement );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bDetectIntersectSegmentWithFaceOfGeometricObject ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
GEO_tdstGeometricObject *p_stGeomObj );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSemiAxeWithFaceOfGeometricObject ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVertexB,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xNbMaxElements,
|
||||
ACP_tdxIndex *p_xNbElements,
|
||||
struct GLI_tdstDataOfElement_ *d_stDataOfElement );
|
||||
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bSemiAxeNearPointOfTriangle ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
MTH_tdxReal xNearDistance,
|
||||
MTH3D_tdstVector *p_stVertex1,
|
||||
MTH3D_tdstVector *p_stVertex2,
|
||||
MTH3D_tdstVector *p_stVertex3,
|
||||
MTH_tdxReal *p_xT );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSemiAxeWithShadowFaceOfGeometricObject ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVertexB,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
GEO_tdstGeometricObject *p_stGeomObj,
|
||||
MTH3D_tdstVector *p_stHit,
|
||||
ACP_tdxIndex *p_xElement,
|
||||
ACP_tdxIndex *p_xDataElements
|
||||
);
|
||||
|
||||
ACP_tdxBool INT_fn_bIntersectSegmentWithShadowFaceOfGeometricObject ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVertexB,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
GEO_tdstGeometricObject *p_stGeomObj,
|
||||
MTH3D_tdstVector *p_stHit,
|
||||
ACP_tdxIndex *p_xElement,
|
||||
ACP_tdxIndex *p_xDataElements
|
||||
);
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSphereWithShadowFaceOfGeometricObject ( MTH3D_tdstVector *p_stCenter,
|
||||
MTH_tdxReal xRadius,
|
||||
GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xNbMaxElements,
|
||||
ACP_tdxIndex *p_xNbElements,
|
||||
COL_tdstShadowElement *d_stShadowElement,
|
||||
ACP_tdxBool *p_bBadMaterial);
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bDetectIntersectSemiAxeWithFaceOfGeometricObject ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVertexB,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
GEO_tdstGeometricObject *p_stGeomObj );
|
||||
|
||||
extern CPA_EXPORT void INT_fn_vSearchAndReplacePointInElement ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xNbElements,
|
||||
struct GLI_tdstDataOfElement_ *d_stDataOfElement );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSemiAxeWithPointOfGeometricObject ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xNbMaxElements,
|
||||
ACP_tdxIndex *p_xNbElements,
|
||||
struct GLI_tdstDataOfElement_ *d_stDataOfElement );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bEdgePartOfTriangle ( ACP_tdxIndex xEdge1,
|
||||
ACP_tdxIndex xEdge2,
|
||||
ACP_tdxIndex xPoint1,
|
||||
ACP_tdxIndex xPoint2,
|
||||
ACP_tdxIndex xPoint3 );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bEdgePartOfEdge ( ACP_tdxIndex xEdge1,
|
||||
ACP_tdxIndex xEdge2,
|
||||
ACP_tdxIndex xPoint1,
|
||||
ACP_tdxIndex xPoint2 );
|
||||
|
||||
extern CPA_EXPORT void INT_fn_vSearchAndReplaceEdgeInElement ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xNbElements,
|
||||
struct GLI_tdstDataOfElement_ *d_stDataOfElement );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bIntersectSemiAxeWithEdgeOfGeometricObject ( MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xNbMaxElements,
|
||||
ACP_tdxIndex *p_xNbElements,
|
||||
struct GLI_tdstDataOfElement_ *d_stDataOfElement );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bGetInclusionPointInGeometricObject ( MTH3D_tdstVector *p_stPoint,
|
||||
GEO_tdstGeometricObject *p_stGeomObj );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool INT_fn_bDetectIntersectGeomObjWithGeomObj ( GEO_tdstGeometricObject *p_stGeomObj1,
|
||||
POS_tdstCompletePosition *_p_stMatrix1,
|
||||
GEO_tdstGeometricObject *p_stGeomObj2,
|
||||
POS_tdstCompletePosition *_p_stMatrix2,
|
||||
GMT_tdxHandleToGameMaterial *_p_hMat1,
|
||||
GMT_tdxHandleToGameMaterial *_p_hMat2 );
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* COL_INTERSGO_H */
|
301
Rayman_X/cpa/public/COL/OctreeGO.h
Normal file
301
Rayman_X/cpa/public/COL/OctreeGO.h
Normal file
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
MODULE : COL (Intersection & Collision Library)
|
||||
AUTHOR : Frederic PHILIPPE
|
||||
UBI R&D
|
||||
FILE : OctreeGO.h (Geometric object octree)
|
||||
*/
|
||||
|
||||
#ifndef COL_OCTREEGO_H
|
||||
#define COL_OCTREEGO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "cpa_expt.h"
|
||||
|
||||
/* For Global declaration in C files : */
|
||||
#ifdef COL_GLOBALS
|
||||
#define COL_EXTERN extern
|
||||
#else /* !COL_GLOBALS */
|
||||
#define COL_EXTERN
|
||||
#endif /* !COL_GLOBALS */
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
INCLUDES FILES
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Futil.h"
|
||||
#include "Box.h"
|
||||
#include "Inters.h"
|
||||
#include "IntersGO.h"
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
CONSTANT DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define COL_C_xMaxSelectedNodes 100
|
||||
|
||||
#define COL_C_xNoProblem 0
|
||||
#define COL_C_xNoOctree 1
|
||||
#define COL_C_xDepthProblem 2
|
||||
#define COL_C_xFacesPerNodeLimit 3
|
||||
#define COL_C_xNbOfElements 4
|
||||
#define COL_C_xNbOfFaces 5
|
||||
|
||||
/* ANNECY MT - 14/09/98 {*/
|
||||
#define COL_C_MaxIndex 0x0080
|
||||
#define COL_C_OverflowIndex 0x8000
|
||||
/* END ANNECY MT }*/
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
TYPES DEFINITION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* index de face */
|
||||
/* ANNECY MT - 14/09/98 {*/
|
||||
typedef unsigned char COL_tdxFaceIndex;
|
||||
typedef unsigned short COL_tdxFaceIndexDouble;
|
||||
/* END ANNECY MT }*/
|
||||
|
||||
/* definition d un noeud de l octree */
|
||||
typedef struct COL_tdstOctreeNode_
|
||||
{
|
||||
/* boite du noeud = partition */
|
||||
#if !defined(PRESS_DEMO) /* swap members to make the engine unusable with the binarized data of another engine */
|
||||
MTH3D_tdstVector stMinPart;
|
||||
MTH3D_tdstVector stMaxPart;
|
||||
#else
|
||||
MTH3D_tdstVector stMaxPart;
|
||||
MTH3D_tdstVector stMinPart;
|
||||
#endif /* PRESS_DEMO */
|
||||
|
||||
/* liste de fils */
|
||||
struct COL_tdstOctreeNode_ **p_pstChildList;
|
||||
/* liste de faces + nombre de faces de cette liste */
|
||||
COL_tdxFaceIndex *d_xFaceIndexList;
|
||||
}
|
||||
COL_tdstOctreeNode, *COL_tdpstOctreeNode;
|
||||
|
||||
/* definition d un octree */
|
||||
typedef struct COL_tdstOctree_
|
||||
{
|
||||
/* racine de l octree */
|
||||
COL_tdpstOctreeNode p_stOctreeRoot;
|
||||
/* nombre de faces dans l octree */
|
||||
ACP_tdxIndex xNbFaces;
|
||||
/* table de bases des elements dans le tableau de tags de faces */
|
||||
/* ANNECY MT - 26/11/98 {*/
|
||||
COL_tdxFaceIndexDouble *d_xElementBasesTable;
|
||||
/* END ANNECY MT }*/
|
||||
/* boite englobante de l objet */
|
||||
MTH3D_tdstVector stMinBoundingBox;
|
||||
MTH3D_tdstVector stMaxBoundingBox;
|
||||
}
|
||||
COL_tdstOctree, *COL_tdpstOctree;
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
GLOBAL VARIABLE DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* statistiques */
|
||||
/* compteur de noeuds */
|
||||
extern ACP_tdxIndex COL_g_xNodeCounter;
|
||||
/* compteur de feuilles */
|
||||
extern ACP_tdxIndex COL_g_xFinalNodeCounter;
|
||||
/* memoire allouee */
|
||||
extern long COL_g_lMemory;
|
||||
/* nb faces mises en liste */
|
||||
extern long COL_g_lFacesInList;
|
||||
/* profondeur du noeud */
|
||||
extern ACP_tdxIndex COL_g_xSelectedDepth;
|
||||
|
||||
/* ANNECY MT - 19/08/98 {*/
|
||||
extern long COL_g_lFacesTagCounter;
|
||||
|
||||
extern long *COL_g_d_lTaggedFacesTable;
|
||||
/* END ANNECY MT }*/
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTIONS DECLARATION
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ANNECY MT - 19/08/98 {*/
|
||||
extern CPA_EXPORT void COL_fn_vOctreeGlobalInit();
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vOctreeGlobalsCompute();
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vOctreeGlobalDesInit();
|
||||
/* END ANNECY MT }*/
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputeElementBasesTable ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
COL_tdpstOctree p_stOctree );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vInitTaggedPointsTable ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
COL_tdpstOctree p_stOctree );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vInitTaggedFacesTable ( COL_tdpstOctree p_stOctree );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vCreateTagsTables ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
COL_tdpstOctree p_stOctree );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxIndex COL_fn_xNumberOfFacesInBox ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
COL_tdpstOctree p_stOctree,
|
||||
MTH3D_tdstVector *p_stPartitionMinPoint,
|
||||
MTH3D_tdstVector *p_stPartitionMaxPoint,
|
||||
ACP_tdxIndex *p_xSuppIndex );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputeMidBox ( MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
MTH3D_tdstVector *p_stSeparationPoint );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputeSeparationPoint ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
MTH3D_tdstVector *p_stSeparationPoint );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vComputePartitionBox ( MTH3D_tdstVector *p_stMinPart,
|
||||
MTH3D_tdstVector *p_stMaxPart,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
MTH3D_tdstVector *p_stSeparationPoint,
|
||||
ACP_tdxIndex xBoxPosition );
|
||||
|
||||
extern CPA_EXPORT COL_tdpstOctreeNode COL_fn_pstConstructRecursiveOctree ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxBool COL_fn_bCreateOctree ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xNbOfFacesLimit,
|
||||
ACP_tdxIndex xTotalNbOfFacesLimit,
|
||||
ACP_tdxIndex xOctMaxDepth );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vDestructRecursiveOctree ( COL_tdstOctreeNode *p_stNodeToBeDestructed );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vDeleteOctree ( GEO_tdstGeometricObject *p_stGeomObj );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vExploreRecursiveOctreeWithBox ( COL_tdpstOctreeNode p_stNodeToBeExplored,
|
||||
MTH3D_tdstVector *p_stMinSituation,
|
||||
MTH3D_tdstVector *p_stMaxSituation,
|
||||
COL_tdpstOctreeNode *d_pstSelectedNode,
|
||||
ACP_tdxIndex *p_xNumberOfSelectedNodes );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vExploreOctreeWithBox ( COL_tdpstOctree p_stOctree,
|
||||
MTH3D_tdstVector *p_stMinPoint,
|
||||
MTH3D_tdstVector *p_stMaxPoint,
|
||||
COL_tdpstOctreeNode *d_pstSelectedNode,
|
||||
ACP_tdxIndex *p_xNumberOfSelectedNodes );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vViewAndAddSelectedNode ( COL_tdpstOctreeNode p_stNodeToBeExplored,
|
||||
MTH_tdxReal xT,
|
||||
COL_tdpstOctreeNode *d_pstSelectedNode,
|
||||
MTH_tdxReal *d_xSelectedT,
|
||||
ACP_tdxIndex *p_xNumberOfSelectedNodes );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vExploreRecursiveOctreeWithSegment ( COL_tdpstOctreeNode p_stNodeToBeExplored,
|
||||
MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
COL_tdpstOctreeNode *d_pstSelectedNode,
|
||||
MTH_tdxReal *d_xSelectedT,
|
||||
ACP_tdxIndex *p_xNumberOfSelectedNodes );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vExploreOctreeWithSegment ( COL_tdpstOctree p_stOctree,
|
||||
MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
COL_tdpstOctreeNode *d_pstSelectedNode,
|
||||
MTH_tdxReal *d_xSelectedT,
|
||||
ACP_tdxIndex *p_xNumberOfSelectedNodes );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vExploreRecursiveOctreeWithSemiAxe ( COL_tdpstOctreeNode p_stNodeToBeExplored,
|
||||
MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVertexB,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
COL_tdpstOctreeNode *d_pstSelectedNode,
|
||||
MTH_tdxReal *d_xSelectedT,
|
||||
ACP_tdxIndex *p_xNumberOfSelectedNodes );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vExploreOctreeWithSemiAxe ( COL_tdpstOctree p_stOctree,
|
||||
MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVertexB,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
COL_tdpstOctreeNode *d_pstSelectedNode,
|
||||
MTH_tdxReal *d_xSelectedT,
|
||||
ACP_tdxIndex *p_xNumberOfSelectedNodes );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vExploreRecursiveOctreeWithSemiAxeForShadow ( COL_tdpstOctreeNode p_stNodeToBeExplored,
|
||||
MTH3D_tdstVector *p_stVertexA,
|
||||
MTH3D_tdstVector *p_stVertexB,
|
||||
MTH3D_tdstVector *p_stVectAB,
|
||||
MTH_tdxReal xNearDistance,
|
||||
COL_tdpstOctreeNode *d_pstSelectedNode,
|
||||
MTH_tdxReal *d_xSelectedT,
|
||||
ACP_tdxIndex *p_xNumberOfSelectedNodes );
|
||||
|
||||
|
||||
extern CPA_EXPORT ACP_tdxIndex COL_fn_xVerifyRecursiveOctree ( COL_tdpstOctreeNode p_stNodeToBeExplored,
|
||||
ACP_tdxIndex xNbOfElements,
|
||||
ACP_tdxIndex xNbOfFaces,
|
||||
ACP_tdxIndex xNbOfFacesPerNodeLimit,
|
||||
ACP_tdxIndex xOctMaxDepth );
|
||||
|
||||
extern CPA_EXPORT ACP_tdxIndex COL_fn_xVerifyOctree ( COL_tdpstOctree p_stOctree,
|
||||
ACP_tdxIndex xNbOfElements,
|
||||
ACP_tdxIndex xNbOfFaces,
|
||||
ACP_tdxIndex xNbOfFacesPerNodeLimit,
|
||||
ACP_tdxIndex xOctMaxDepth );
|
||||
|
||||
/* ANNECY MT - 14/09/98 {*/
|
||||
/*
|
||||
extern CPA_EXPORT void COL_fn_vModifyRecursiveIndexedTriangleInOctree ( COL_tdpstOctreeNode p_stNodeToBeExplored,
|
||||
ACP_tdxIndex xOldElementIndex,
|
||||
ACP_tdxIndex xOldTriangleIndex,
|
||||
ACP_tdxIndex xNewElementIndex,
|
||||
ACP_tdxIndex xNewFaceMapIndex );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vModifyIndexedTriangleInOctree ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xOldElementIndex,
|
||||
ACP_tdxIndex xOldTriangleIndex,
|
||||
ACP_tdxIndex xNewElementIndex,
|
||||
ACP_tdxIndex xNewFaceMapIndex );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vModifyRecursiveFaceMapTriangleInOctree ( COL_tdpstOctreeNode p_stNodeToBeExplored,
|
||||
ACP_tdxIndex xOldElementIndex,
|
||||
ACP_tdxIndex xOldFaceMapIndex,
|
||||
ACP_tdxIndex xNewElementIndex,
|
||||
ACP_tdxIndex xNewTriangleIndex );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vModifyFaceMapTriangleInOctree ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xOldElementIndex,
|
||||
ACP_tdxIndex xOldFaceMapIndex,
|
||||
ACP_tdxIndex xNewElementIndex,
|
||||
ACP_tdxIndex xNewTriangleIndex );
|
||||
*/
|
||||
/* END ANNECY MT }*/
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vModifyRecursiveFaceInOctree ( COL_tdpstOctreeNode p_stNodeToBeExplored,
|
||||
ACP_tdxIndex xOldElementIndex,
|
||||
ACP_tdxIndex xOldFaceIndex,
|
||||
ACP_tdxIndex xNewElementIndex,
|
||||
ACP_tdxIndex xNewFaceIndex );
|
||||
|
||||
extern CPA_EXPORT void COL_fn_vModifyFaceInOctree ( GEO_tdstGeometricObject *p_stGeomObj,
|
||||
ACP_tdxIndex xOldElementIndex,
|
||||
ACP_tdxIndex xOldFaceIndex,
|
||||
ACP_tdxIndex xNewElementIndex,
|
||||
ACP_tdxIndex xNewFaceIndex );
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* COL_OCTREEGO_H */
|
Reference in New Issue
Block a user