284 lines
9.8 KiB
C
284 lines
9.8 KiB
C
|
|
/* (c) Ubi Studios 1997 */
|
|
/* See Vincent Greco for any comment or question */
|
|
|
|
/*
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
DESCRIPTION :
|
|
~~~~~~~~~~~
|
|
THIS IS AN EXAMPLE OF ACP HEADER FILES
|
|
|
|
For a given file <HeaderName>.h, all occurences of the string HEADERNAME
|
|
must be replaced with the string <HeaderName>.
|
|
For a given module, all occurences of the string MODULETAG must be replaced
|
|
with the CPA tag of the module (GLI, MTH ...) .
|
|
You must do :
|
|
#define MODULETAG_GLOBALS
|
|
in one (and only one) .c file of your Module.
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
*/
|
|
|
|
/* To avoid unnecessary includes : */
|
|
#ifndef __GEO_GEOBDVOL_H
|
|
#define __GEO_GEOBDVOL_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
/* For DLLs who are using this module : */
|
|
#undef CPA_EXPORT
|
|
#if defined(CPA_WANTS_IMPORT)
|
|
#define CPA_EXPORT __declspec(dllimport)
|
|
#elif defined(CPA_WANTS_EXPORT)
|
|
#define CPA_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define CPA_EXPORT
|
|
#endif
|
|
|
|
|
|
/* For Global declaration in C files : */
|
|
#ifdef GEO_GLOBALS
|
|
#define __GEO_EXTERN extern
|
|
#else /* !MODULETAG_GLOBALS */
|
|
#define __GEO_EXTERN
|
|
#endif /* !MODULETAG_GLOBALS */
|
|
|
|
#include "geoobj.h"
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT ACP_tdxHandleOfObject GEO_fn_hCreateGeometricSphere
|
|
(
|
|
void
|
|
);
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vGetInfoFromGeometricSphere
|
|
(
|
|
MTH3D_tdstVector *_p_stSphereCenter,
|
|
MTH_tdxReal *_p_xSphereRadius,
|
|
ACP_tdxHandleOfObject _hBoundingVolume
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
extern CPA_EXPORT void GEO_fn_vSetGeometricSphere
|
|
(
|
|
MTH3D_tdstVector *_p_stSphereCenter,
|
|
MTH_tdxReal _xSphereRadius,
|
|
ACP_tdxHandleOfObject _hBoundingSphere
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
extern CPA_EXPORT void GEO_fn_vUpdateBoundingSphere
|
|
(
|
|
ACP_tdxHandleOfObject _hGeometricSphere,
|
|
GEO_tdxHandleToBoundingSphere _hBoundingSphere
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
extern CPA_EXPORT void GEO_fn_vUpdateGeometricSphere
|
|
(
|
|
ACP_tdxHandleOfObject _hGeometricSphere,
|
|
GEO_tdxHandleToBoundingSphere _hBoundingSphere
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
extern CPA_EXPORT ACP_tdxHandleOfObject GEO_fn_hCreateSphereGeometricObject
|
|
(
|
|
void
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
extern CPA_EXPORT void GEO_fn_vCreateParallelBox
|
|
(
|
|
GEO_tdxHandleToParallelBox * _p_hNewBox
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
extern CPA_EXPORT void GEO_vDeleteParallelBox
|
|
(
|
|
GEO_tdxHandleToParallelBox _hParallelBox
|
|
);
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vCreateAndInitBoxBoundingVolume
|
|
(
|
|
GEO_tdxHandleToParallelBox * _p_hNewBox,
|
|
MTH3D_tdstVector* _p_stMaxBoxPoint,
|
|
MTH3D_tdstVector* _p_stMinBoxPoint
|
|
);
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vGetSphereFromParallelBox
|
|
(
|
|
MTH3D_tdstVector * _p_stCenter,
|
|
MTH_tdxReal * _p_xRadius,
|
|
MTH3D_tdstVector * _p_stMaxBoxPoint,
|
|
MTH3D_tdstVector * _p_stMinBoxPoint
|
|
);
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vComputeParallelBoxOfSphere
|
|
(
|
|
MTH3D_tdstVector * _p_stMaxBoxPoint,
|
|
MTH3D_tdstVector * _p_stMinBoxPoint,
|
|
MTH3D_tdstVector * _p_stCenter,
|
|
MTH_tdxReal _p_xSphereRadius
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
extern CPA_EXPORT void GEO_fn_vComputeParallelBoxOfTwoBoxes
|
|
(
|
|
MTH3D_tdstVector * _p_stMaxReturnedBoxPoint,
|
|
MTH3D_tdstVector * _p_stMinReturnedBoxPoint,
|
|
MTH3D_tdstVector * _p_stMaxFirstBoxPoint,
|
|
MTH3D_tdstVector * _p_stMinFirstBoxPoint,
|
|
MTH3D_tdstVector * _p_stMaxSecondBoxPoint,
|
|
MTH3D_tdstVector * _p_stMinSecondBoxPoint
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
extern CPA_EXPORT void GEO_fn_vAddObjectToBox
|
|
(
|
|
ACP_tdxHandleOfObject _hGeometricObject,
|
|
POS_tdstCompletePosition* _p_stGlobalMatrix,
|
|
MTH3D_tdstVector* _p_stMax,
|
|
MTH3D_tdstVector* _p_stMin
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
#ifdef USE_ALTIMAPS
|
|
extern CPA_EXPORT void GEO_fn_vAddAltimapToSphere
|
|
(
|
|
ACP_tdxHandleOfObject _hGeometricObject,
|
|
MTH3D_tdstVector *_p_stSphereCenter,
|
|
MTH_tdxReal *_p_xSphereRadius
|
|
);
|
|
#endif /*USE_ALTIMAPS*/
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vAddObjectToSphere
|
|
(
|
|
ACP_tdxHandleOfObject _hGeometricObject,
|
|
MTH3D_tdstVector *_p_stSphereCenter,
|
|
MTH_tdxReal *_p_xSphereRadius
|
|
);
|
|
/*--------------------------------------------------------------------------------------*/
|
|
extern CPA_EXPORT void GEO_fn_vComputeBoundingSphereOfTwoSpheres
|
|
(
|
|
MTH3D_tdstVector *_p_stReturnedSphereCenter,
|
|
MTH_tdxReal *_p_xReturnedSphereRadius,
|
|
MTH3D_tdstVector *_p_stFirstSphereCenter,
|
|
MTH_tdxReal _xFirstSphereRadius,
|
|
MTH3D_tdstVector *_p_stSecondSphereCenter,
|
|
MTH_tdxReal _xSecondSphereRadius
|
|
);
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vCreateBoundingSphere
|
|
(
|
|
GEO_tdxHandleToBoundingSphere *_p_hNewSphere
|
|
);
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vSetBoundingSphere
|
|
(
|
|
GEO_tdxHandleToBoundingSphere _hBoundingSphere,
|
|
MTH3D_tdstVector* _p_stCenterPoint,
|
|
MTH_tdxReal _xRadius
|
|
);
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vCreateAndInitBoundingSphere
|
|
(
|
|
GEO_tdxHandleToBoundingSphere *_p_hNewSphere,
|
|
MTH3D_tdstVector *_p_stCenter,
|
|
MTH_tdxReal _xRadius
|
|
);
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vInitBoundingVolumeMaterial
|
|
(
|
|
void
|
|
);
|
|
/*-------------------------------------------------------------------------------------- */
|
|
extern CPA_EXPORT void GEO_fn_vAddObjectToBox2
|
|
(
|
|
ACP_tdxHandleOfObject _hGeometricObject,
|
|
POS_tdstCompletePosition *_p_stGlobalMatrix,
|
|
MTH3D_tdstVector *_p_stMax,
|
|
MTH3D_tdstVector *_p_stMin
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/* inline functions*/
|
|
|
|
/*--------------------------------------------------------------------------------------*/
|
|
/**/
|
|
/* Set Max (Min) point of the parallel box structure*/
|
|
/**/
|
|
/*--------------------------------------------------------------------------------------*/
|
|
|
|
INLINE
|
|
void GEO_fn_vSetMaxPointOfParallelBox( GEO_tdxHandleToParallelBox _hParallelBox, MTH3D_tdstVector* _p_stPoint)
|
|
{
|
|
#ifndef CODEWARRIOR
|
|
assert(_hParallelBox);
|
|
#endif
|
|
MTH3D_M_vCopyVector( &(_hParallelBox->stMaxPoint), _p_stPoint);
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------------------*/
|
|
INLINE
|
|
void GEO_fn_vSetMinPointOfParallelBox(GEO_tdxHandleToParallelBox _hParallelBox,MTH3D_tdstVector* _p_stPoint)
|
|
{
|
|
#ifndef CODEWARRIOR
|
|
assert(_hParallelBox);
|
|
#endif
|
|
MTH3D_M_vCopyVector( & (_hParallelBox -> stMinPoint ), _p_stPoint );
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------------------*/
|
|
/**/
|
|
/* Get Max (Min) point of the parallel box structure*/
|
|
/**/
|
|
/*--------------------------------------------------------------------------------------*/
|
|
INLINE
|
|
MTH3D_tdstVector * GEO_fn_pGetMaxPointOfParallelBox( GEO_tdxHandleToParallelBox _hParallelBox)
|
|
{
|
|
#ifndef CODEWARRIOR
|
|
assert(_hParallelBox);
|
|
#endif
|
|
return &(_hParallelBox->stMaxPoint);
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------------------*/
|
|
INLINE
|
|
MTH3D_tdstVector * GEO_fn_pGetMinPointOfParallelBox( GEO_tdxHandleToParallelBox _hParallelBox)
|
|
{
|
|
#ifndef CODEWARRIOR
|
|
assert(_hParallelBox);
|
|
#endif
|
|
return &(_hParallelBox->stMinPoint);
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------------------*/
|
|
/**/
|
|
/* Get the center of a bounding sphere*/
|
|
/**/
|
|
/*--------------------------------------------------------------------------------------*/
|
|
INLINE
|
|
MTH3D_tdstVector *GEO_fn_pGetCenterPointOfBoundingSphere( GEO_tdxHandleToBoundingSphere _hBoundingSphere)
|
|
{
|
|
#ifndef CODEWARRIOR
|
|
assert(_hBoundingSphere);
|
|
#endif
|
|
return &(_hBoundingSphere->stCenterPoint);
|
|
}
|
|
/*--------------------------------------------------------------------------------------*/
|
|
/**/
|
|
/* Get the radius of a bounding sphere*/
|
|
/**/
|
|
/*--------------------------------------------------------------------------------------*/
|
|
INLINE
|
|
MTH_tdxReal GEO_fn_xGetRadiusOfBoundingSphere(GEO_tdxHandleToBoundingSphere _hBoundingSphere)
|
|
{
|
|
#ifndef CODEWARRIOR
|
|
assert(_hBoundingSphere);
|
|
#endif
|
|
return(_hBoundingSphere->xRadius);
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
};
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* __GEO_GEOBDVOL_H */
|
|
|