Add rayman2 source files

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

View File

@@ -0,0 +1,861 @@
/*
=======================================================================================
Name : Culling.c
Author : vincent lhullier Date :15/06/98
Description : culling functions
=======================================================================================
*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include "acp_base.h"
#include "Geo.h"
#include "Gli.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
=======================================================================================
External function prototype
=======================================================================================
*/
/*
* retrieve current matrix for function that avoid MulMatrixMatrix
*/
extern POS_tdstCompletePosition *HIE_hRetrieveCurrentMatrix();
#ifdef __cplusplus
extern "C"
{
#endif
/*
=======================================================================================
static global var
=======================================================================================
*/
MTH_tdxReal GEO_g_xZFar = 0.0f;
MTH_tdxReal GEO_g_xZFarTransparencyZone = 10.0f;
MTH_tdxReal GEO_g_xOoZFarTransparencyZone = 0.1f;
MTH_tdxReal GEO_g_xZFarTransparencyLevel;
static MTH3D_tdstVector gs_stGlobalNormPlaneLeft;
static MTH3D_tdstVector gs_stGlobalNormPlaneRight;
static MTH3D_tdstVector gs_stGlobalNormPlaneUp;
static MTH3D_tdstVector gs_stGlobalNormPlaneDown;
static MTH3D_tdstVector gs_stGlobalNormPlaneNear;
static MTH3D_tdstVector gs_stCameraPosInGlobal;
/*
=======================================================================================
Access function
=======================================================================================
*/
MTH_tdxReal GEO_xGetZFar( void ) { return GEO_g_xZFar; }
void GEO_vSetZFar( MTH_tdxReal _xZ ) { GEO_g_xZFar = _xZ; }
MTH_tdxReal GEO_xGetZFarTransparencyZone( void ) { return GEO_g_xZFarTransparencyZone; }
void GEO_vSetZFarTransparencyZone( MTH_tdxReal _xZ )
{
GEO_g_xZFarTransparencyZone = _xZ;
if (_xZ)
GEO_g_xOoZFarTransparencyZone = MTH_M_xInv( _xZ );
}
MTH_tdxReal GEO_xGetZFarTransparencyLevel( void ) { return GEO_g_xZFarTransparencyLevel; }
/*
=======================================================================================
Local functions
=======================================================================================
*/
/**********************************************************************************************/
/* local function !!*/
/* use GEO_lCullingSphere or GEO_lCullingSphereNoMMM instead !!*/
/**/
/* Name: GEO_lMainCullingSphere*/
/* Goal: Return 1 if the sphere is visible with the viewport's camera, 0 else.*/
/* Code: Philippe Vimont*/
/* modif : Fabien Bole-Feysot*/
/* entry : the viewport to test*/
/* the center of the sphere, in object's local axis system*/
/* the radius of the sphere, not including any scale or so*/
/* the matrix that must be used to compute coords in the camera axis system*/
/* the matrix that must be used to compute coords in the world axis system*/
/**********************************************************************************************/
long GEO_lMainCullingSphere
(
GLD_tdstViewportAttributes *p_stVpt ,
MTH3D_tdstVector *p_stShereCenter ,
MTH_tdxReal xRadius,
POS_tdstCompletePosition *p_stMatrix,
POS_tdstCompletePosition *p_stMatrixW,
long _lCullingResult
)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
GLI_tdstSpecificAttributesFor3D *p_stSpecifAttrib3D;
/* XB 05/05/99 */
/* MTH3D_tdstVector stMin,stMax,stMinG,stMaxG; */
/* End XB 05/05/99 */
MTH3D_tdstVector stCenter;
GLI_tdxHandleToCamera hCamera;
MTH_tdxReal xDotProduct;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
if (!POS_fn_ulIsNotScaledMatrix ( p_stMatrix ))
{
/* the matrix is scaled...*/
/* so compute a parallel box around the sphere (in global coords) and call the cullingbox function*/
/*
stMin.xX = p_stShereCenter -> xX - xRadius;
stMin.xY = p_stShereCenter -> xY - xRadius;
stMin.xZ = p_stShereCenter -> xZ - xRadius;
stMax.xX = p_stShereCenter -> xX + xRadius;
stMax.xY = p_stShereCenter -> xY + xRadius;
stMax.xZ = p_stShereCenter -> xZ + xRadius;
*/
/* here, stMin & stMax are not scaled and in local coordinates system compute them in global coordinates*/
/*
POS_fn_vMulMatrixVertex (&stMinG,p_stMatrixW,&stMin);
POS_fn_vMulMatrixVertex (&stMaxG,p_stMatrixW,&stMax);
*/
/* and cull this parallel box*/
/*
return GEO_lCullingBox (p_stVpt,&stMinG,&stMaxG, _lCullingResult);
*/
/* the previous box isn't ligned in global axis system */
xRadius = MTH_M_xMul(xRadius,POS_fn_xGetMaxScale(p_stMatrix));
}
/* the matrix is not scaled, so perform plan rejection for sphere*/
p_stSpecifAttrib3D = (GLI_tdstSpecificAttributesFor3D *) p_stVpt -> p_vSpecificToXD;
hCamera = p_stSpecifAttrib3D->p_stCam;
/* compute sphere center in camera coords*/
POS_fn_vMulMatrixVertex (&stCenter,p_stMatrix,p_stShereCenter);
_lCullingResult |= GEO_C_lCullingIntersect;
/* if the culling result against the near border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingNear) )
{
if ( stCenter.xZ + xRadius < hCamera->xNear )
{
return GEO_C_lCullingOut;
}
xDotProduct = MTH_M_xSub(stCenter.xZ, xRadius);
/* if all points are beyond the near plane, the sphere is inside relatively to this plane*/
if ( MTH_M_bGreater(xDotProduct, hCamera->xNear) )
{
_lCullingResult |= GEO_C_lCullingNear;
}
}
/* if the culling result against the far border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingFar) )
{
if ( MTH_M_bDifferentZero(GEO_g_xZFar) )
{
if ( xDotProduct > GEO_g_xZFar )
{
GEO_g_xZFarTransparencyLevel = MTH_C_ZERO;
return GEO_C_lCullingOut;
}
if ( xDotProduct > GEO_g_xZFar - GEO_g_xZFarTransparencyZone )
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE - ((stCenter.xZ - xRadius - GEO_g_xZFar + GEO_g_xZFarTransparencyZone) * GEO_g_xOoZFarTransparencyZone);
}
else
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE;
/* if all points are in front of the far plane, the sphere is inside relatively to this plane*/
_lCullingResult |= GEO_C_lCullingFar;
}
}
else
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE;
/* if all points are in front of the far plane, the sphere is inside relatively to this plane*/
_lCullingResult |= GEO_C_lCullingFar;
}
}
else
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE;
}
/* if the culling result against the left border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingLeft) )
{
xDotProduct = MTH3D_M_xDotProductVector(&stCenter, &hCamera->stNormPlaneRight); /*left and right plane normal car names are inversed!*/
if (xDotProduct > xRadius + hCamera->xDistPlaneLeft)
{
return GEO_C_lCullingOut;
}
if (xDotProduct < hCamera->xDistPlaneLeft - xRadius)
{
_lCullingResult |= GEO_C_lCullingLeft;
}
}
/* if the culling result against the right border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingRight) )
{
xDotProduct = MTH3D_M_xDotProductVector(&stCenter, &hCamera->stNormPlaneLeft); /*left and right plane normal car names are inversed!*/
if (xDotProduct > xRadius + hCamera->xDistPlaneRight)
{
return GEO_C_lCullingOut;
}
if (xDotProduct < hCamera->xDistPlaneRight - xRadius)
{
_lCullingResult |= GEO_C_lCullingRight;
}
}
/* if the culling result against the up border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingUp) )
{
xDotProduct = MTH3D_M_xDotProductVector(&stCenter, &hCamera->stNormPlaneUp);
if (xDotProduct > xRadius + hCamera->xDistPlaneUp)
{
return GEO_C_lCullingOut;
}
if (xDotProduct < hCamera->xDistPlaneUp - xRadius)
{
_lCullingResult |= GEO_C_lCullingUp;
}
}
/* if the culling result against the down border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingDown) )
{
xDotProduct = MTH3D_M_xDotProductVector(&stCenter, &hCamera->stNormPlaneDown);
if (xDotProduct > xRadius + hCamera->xDistPlaneDown)
{
return GEO_C_lCullingOut;
}
if (xDotProduct < hCamera->xDistPlaneDown - xRadius)
{
_lCullingResult |= GEO_C_lCullingDown;
}
}
return _lCullingResult;
}
/*
=======================================================================================
Exported functions
=======================================================================================
*/
/*
***************************************************************************************
Name: GLI_fn_vComputeCameraParametersForCulling
Goal: pre compute camera parameters for faster culling
compute clipping plane normal in global system axis to avoid object
transformation from global to camera system axis
Code:
***************************************************************************************
*/
void GEO_fn_vComputeCameraParametersForCulling( GLD_tdstViewportAttributes *p_stVpt, MTH_tdxReal _xZFar )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
POS_tdstCompletePosition stMatrixInverse;
register GLI_tdxHandleToCamera hCamera;
register MTH3D_tdstMatrix *hInvTransformMatrix;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
hCamera = ((GLI_tdstSpecificAttributesFor3D *) p_stVpt->p_vSpecificToXD)->p_stCam;
/* STM - camera matrix should _never_ be scaled*/
assert (hCamera->stMatrix.ulType <= POS_C_ulRotationMatrixFlag);
/*invert the camera's position and get an handle on the rotation*/
POS_fn_vInvertIsoMatrix( &stMatrixInverse, &hCamera->stMatrix);
hInvTransformMatrix = &stMatrixInverse.stTransformMatrix;
/*near plane (we use stCameraPosInGlobal as a temporary vector...)*/
MTH3D_M_vSetVectorElements( &gs_stCameraPosInGlobal, MTH_C_ZERO, MTH_C_ZERO, MTH_C_MinusONE );
MTH3D_M_vMulMatrixVectorWithoutBuffer( &gs_stGlobalNormPlaneNear, hInvTransformMatrix, &gs_stCameraPosInGlobal );
/*position*/
MTH3D_M_vCopyVector( &gs_stCameraPosInGlobal, &stMatrixInverse.stTranslationVector );
/*left plane (the relative left and right planes are inversed in the camera...)*/
MTH3D_M_vMulMatrixVectorWithoutBuffer( &gs_stGlobalNormPlaneLeft, hInvTransformMatrix, &hCamera->stNormPlaneRight );
/*right plane (the relative left and right planes are inversed in the camera...)*/
MTH3D_M_vMulMatrixVectorWithoutBuffer( &gs_stGlobalNormPlaneRight, hInvTransformMatrix, &hCamera->stNormPlaneLeft );
/*upper plane*/
MTH3D_M_vMulMatrixVectorWithoutBuffer( &gs_stGlobalNormPlaneUp, hInvTransformMatrix, &hCamera->stNormPlaneUp );
/*lower plane*/
MTH3D_M_vMulMatrixVectorWithoutBuffer( &gs_stGlobalNormPlaneDown, hInvTransformMatrix, &hCamera->stNormPlaneDown );
GEO_g_xZFar = _xZFar;
}
/**********************************************************************************************/
/* Name: GEO_lCullingGlobalSphere*/
/* Goal: Return 1 if the sphere is visible with the viewport's camera, 0 else.*/
/* Code: Philippe Vimont*/
/* modif : Fabien Bole-Feysot*/
/* entry : the viewport to test*/
/* the center of the sphere, in global axis system*/
/* the radius of the sphere, not including any scale or so*/
/**/
/* if you plan to use this function during the drawing process, then look at the*/
/* GEO_lCullingSphereNoMMM below, which is faster.*/
/**********************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
long GEO_lCullingGlobalSphere
(
GLD_tdstViewportAttributes *_p_stVpt,
MTH3D_tdstVector *_p_stSphereCenter,
MTH_tdxReal _xRadius,
long _lCullingResult
)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
GLI_tdstSpecificAttributesFor3D *p_stSpecifAttrib3D;
GLI_tdxHandleToCamera hCamera;
MTH_tdxReal xDotProduct;
MTH3D_tdstVector stCenter;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* the matrix is not scaled, so perform plan rejection for sphere*/
p_stSpecifAttrib3D = (GLI_tdstSpecificAttributesFor3D *) _p_stVpt -> p_vSpecificToXD;
hCamera = p_stSpecifAttrib3D->p_stCam;
/* compute sphere center in camera coords*/
POS_fn_vMulMatrixVertex (&stCenter,&hCamera->stMatrix,_p_stSphereCenter);
_lCullingResult |= GEO_C_lCullingIntersect;
/* if the culling result against the near border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingNear) )
{
if (stCenter.xZ + _xRadius < hCamera->xNear)
{
return GEO_C_lCullingOut;
}
xDotProduct = stCenter.xZ - _xRadius;
if (xDotProduct > hCamera->xNear)
{
/* if all points are beyond the near plane, the sphere is inside relatively to this plane*/
_lCullingResult |= GEO_C_lCullingNear;
}
}
/* if the culling result against the far border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingFar) )
{
if ( MTH_M_bDifferentZero(GEO_g_xZFar) )
{
if (stCenter.xZ - _xRadius > GEO_g_xZFar )
return GEO_C_lCullingOut;
if ( stCenter.xZ - _xRadius > GEO_g_xZFar - GEO_g_xZFarTransparencyZone )
GEO_g_xZFarTransparencyLevel = MTH_C_ONE - ((stCenter.xZ - _xRadius - GEO_g_xZFar + GEO_g_xZFarTransparencyZone) * GEO_g_xOoZFarTransparencyZone);
else
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE;
/* if all points are in front of the far plane, the sphere is inside relatively to this plane*/
_lCullingResult |= GEO_C_lCullingFar;
}
}
else
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE;
/* if all points are in front of the far plane, the sphere is inside relatively to this plane*/
_lCullingResult |= GEO_C_lCullingFar;
}
}
else
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE;
}
/* if the culling result against the left border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingLeft) )
{
xDotProduct = MTH3D_M_xDotProductVector(&stCenter, &hCamera->stNormPlaneRight); /*left and right plane normal car names are inversed!*/
if (xDotProduct > _xRadius + hCamera->xDistPlaneLeft)
{
return GEO_C_lCullingOut;
}
if (xDotProduct < hCamera->xDistPlaneLeft - _xRadius)
{
_lCullingResult |= GEO_C_lCullingLeft;
}
}
/* if the culling result against the right border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingRight) )
{
xDotProduct = MTH3D_M_xDotProductVector(&stCenter, &hCamera->stNormPlaneLeft); /*left and right plane normal car names are inversed!*/
if (xDotProduct > _xRadius + hCamera->xDistPlaneRight)
{
return GEO_C_lCullingOut;
}
if (xDotProduct < hCamera->xDistPlaneRight - _xRadius)
{
_lCullingResult |= GEO_C_lCullingRight;
}
}
/* if the culling result against the up border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingUp) )
{
xDotProduct = MTH3D_M_xDotProductVector(&stCenter, &hCamera->stNormPlaneUp);
if (xDotProduct > _xRadius + hCamera->xDistPlaneUp)
{
return GEO_C_lCullingOut;
}
if (xDotProduct < hCamera->xDistPlaneUp - _xRadius)
{
_lCullingResult |= GEO_C_lCullingUp;
}
}
/* if the culling result against the down border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingDown) )
{
xDotProduct = MTH3D_M_xDotProductVector(&stCenter, &hCamera->stNormPlaneDown);
if (xDotProduct > _xRadius + hCamera->xDistPlaneDown)
{
return GEO_C_lCullingOut;
}
if (xDotProduct < hCamera->xDistPlaneDown - _xRadius)
{
_lCullingResult |= GEO_C_lCullingDown;
}
}
return _lCullingResult;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* Name: GEO_lCullingSphere*/
/* Goal: Return 1 if the sphere is visible with the viewport's camera, 0 else.*/
/* Code: Philippe Vimont*/
/* modif : Fabien Bole-Feysot*/
/* entry : the viewport to test*/
/* the center of the sphere, in object's local axis system*/
/* the radius of the sphere, not including any scale or so*/
/* the object's matrix (that must be used to compute coords in the global axis system)*/
/**/
/* if you plan to use this function during the drawing process, then look at the*/
/* GEO_lCullingSphereNoMMM below, which is faster.*/
/**********************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
long GEO_lCullingSphere
(
GLD_tdstViewportAttributes *p_stVpt,
MTH3D_tdstVector *p_stSphereCenter,
MTH_tdxReal xRadius,
POS_tdstCompletePosition *p_stMatrix,
long _lCullingResult
)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
POS_tdstCompletePosition stTempMatrix;
GLI_tdstSpecificAttributesFor3D *p_stSpecifAttrib3D;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
p_stSpecifAttrib3D = (GLI_tdstSpecificAttributesFor3D*) p_stVpt -> p_vSpecificToXD;
/* compute the camera * local matrix*/
POS_fn_vMulMatrixMatrix (&stTempMatrix,&p_stSpecifAttrib3D->p_stCam->stMatrix,p_stMatrix);
/* call the sphere culling main function*/
return GEO_lMainCullingSphere(p_stVpt,p_stSphereCenter,xRadius,&stTempMatrix,p_stMatrix,_lCullingResult);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**********************************************************************************************/
/* Name: GEO_lCullingSphereNoMMM*/
/* Goal: Return 1 if the sphere is visible with the viewport's camera, 0 else.*/
/* Code: Philippe Vimont*/
/* modif : Fabien Bole-Feysot*/
/* entry : the viewport to test*/
/* the center of the sphere, in object's local axis system*/
/* the radius of the sphere, not including any scale or so*/
/* the object's matrix (that must be used to compute coords in the global axis system)*/
/**/
/* use this function only in the drawing process, because the matrix that */
/* will be used for computing will be retrieved with the HIE_hRetrieveCurrentMatrix() function.*/
/**/
/* if the HIE_hRetrieveCurrentMatrix() matrix is not up to date, use GEO_lCullingSphere instead*/
/**********************************************************************************************/
long GEO_lCullingSphereNoMMM
(
GLD_tdstViewportAttributes *p_stVpt ,
MTH3D_tdstVector *p_stSphereCenter ,
MTH_tdxReal xRadius,
POS_tdstCompletePosition *p_stMatrix,
long _lCullingResult
)
{
return GEO_lMainCullingSphere(p_stVpt,p_stSphereCenter,xRadius,HIE_hRetrieveCurrentMatrix(),p_stMatrix,_lCullingResult);
}
/**********************************************************************************************/
/* Name: GEO_lCullingBox*/
/* Goal: Return 1 if the parallele box is visible with the viewport's camera, 0 else.*/
/* Code: Philippe Vimont*/
/* modif : Fabien Bole-Feysot (optimisation)*/
/* modif : Vincent Lhullier (optimisation )*/
/* entry : the viewport to test*/
/* the min point of the parallel box, in the world global axis system*/
/* the max point of the parallel box, in the world global axis system*/
/**********************************************************************************************/
long GEO_lCullingBox
(
GLD_tdstViewportAttributes *p_stVpt,
MTH3D_tdstVector *p_stMin,
MTH3D_tdstVector *p_stMax,
long _lCullingResult
)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
MTH3D_tdstVector stMinWithCamera, stMaxWithCamera;
MTH_tdxReal xCompute, xValue0, xValue1, xValue2, xValue3, xValue4, xValue5;
GLI_tdxHandleToCamera hCamera;
ACP_tdxBool bComputed = FALSE;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
hCamera = ((GLI_tdstSpecificAttributesFor3D *) p_stVpt -> p_vSpecificToXD) -> p_stCam;
MTH3D_M_vSubVector( &stMinWithCamera, p_stMin, &gs_stCameraPosInGlobal );
MTH3D_M_vSubVector( &stMaxWithCamera, p_stMax, &gs_stCameraPosInGlobal );
_lCullingResult |= GEO_C_lCullingIntersect;
/* if the culling result against the near border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingNear) )
{
xValue0 = stMinWithCamera.xX * gs_stGlobalNormPlaneNear.xX;
xValue1 = stMinWithCamera.xY * gs_stGlobalNormPlaneNear.xY;
xValue2 = stMinWithCamera.xZ * gs_stGlobalNormPlaneNear.xZ;
xValue3 = stMaxWithCamera.xX * gs_stGlobalNormPlaneNear.xX;
xValue4 = stMaxWithCamera.xY * gs_stGlobalNormPlaneNear.xY;
xValue5 = stMaxWithCamera.xZ * gs_stGlobalNormPlaneNear.xZ;
xCompute = ((xValue0 < xValue3) ? xValue0 : xValue3) + ((xValue1 < xValue4) ? xValue1 : xValue4) + ((xValue2 < xValue5) ? xValue2 : xValue5);
/*if all points are behind the near plane, the box is out*/
if ( xCompute > - hCamera->xNear )
{
return GEO_C_lCullingOut;
}
/* if all points are beyond the near plane, the box is inside relatively to this plane*/
xCompute = ((xValue0 > xValue3) ? xValue0 : xValue3) + ((xValue1 > xValue4) ? xValue1 : xValue4) + ((xValue2 > xValue5) ? xValue2 : xValue5);
if ( xCompute < - hCamera->xNear )
{
_lCullingResult |= GEO_C_lCullingNear;
}
bComputed = TRUE; /*the test against the plane normal is already computed*/
}
/* if the culling result against the far border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingFar) )
{
if ( MTH_M_bDifferentZero(GEO_g_xZFar) )
{
if ( !bComputed ) /* we did not test agains the near plane, so we need to compute the test against the far plane normal*/
{
xValue0 = stMinWithCamera.xX * gs_stGlobalNormPlaneNear.xX;
xValue1 = stMinWithCamera.xY * gs_stGlobalNormPlaneNear.xY;
xValue2 = stMinWithCamera.xZ * gs_stGlobalNormPlaneNear.xZ;
xValue3 = stMaxWithCamera.xX * gs_stGlobalNormPlaneNear.xX;
xValue4 = stMaxWithCamera.xY * gs_stGlobalNormPlaneNear.xY;
xValue5 = stMaxWithCamera.xZ * gs_stGlobalNormPlaneNear.xZ;
xCompute = - (((xValue0 > xValue3) ? xValue0 : xValue3) + ((xValue1 > xValue4) ? xValue1 : xValue4) + ((xValue2 > xValue5) ? xValue2 : xValue5));
}
else
{
xCompute = - xCompute;
}
/* if all points are beyond the far clipping plane, the box is out*/
if ( xCompute > GEO_g_xZFar )
return GEO_C_lCullingOut;
GEO_g_xZFarTransparencyLevel = GEO_g_xZFar - GEO_g_xZFarTransparencyZone;
if ( xCompute > GEO_g_xZFarTransparencyLevel )
GEO_g_xZFarTransparencyLevel = MTH_C_ONE - ((xCompute - GEO_g_xZFarTransparencyLevel) * GEO_g_xOoZFarTransparencyZone);
else
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE;
/* if all points are in front of the far plane, the box is inside relatively to this plane*/
_lCullingResult |= GEO_C_lCullingFar;
}
}
else
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE;
/* since there is no far plane, the box is inside relatively to this plane*/
_lCullingResult |= GEO_C_lCullingFar;
}
}
else
{
GEO_g_xZFarTransparencyLevel = MTH_C_ONE;
}
/* if the culling result against the left border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingLeft) )
{
xValue0 = stMinWithCamera.xX * gs_stGlobalNormPlaneLeft.xX;
xValue1 = stMinWithCamera.xY * gs_stGlobalNormPlaneLeft.xY;
xValue2 = stMinWithCamera.xZ * gs_stGlobalNormPlaneLeft.xZ;
xValue3 = stMaxWithCamera.xX * gs_stGlobalNormPlaneLeft.xX;
xValue4 = stMaxWithCamera.xY * gs_stGlobalNormPlaneLeft.xY;
xValue5 = stMaxWithCamera.xZ * gs_stGlobalNormPlaneLeft.xZ;
/*if all points on the left side of the left plane, the box is out*/
xCompute = ((xValue0 < xValue3) ? xValue0 : xValue3) + ((xValue1 < xValue4) ? xValue1 : xValue4) + ((xValue2 < xValue5) ? xValue2 : xValue5);
if ( xCompute > hCamera->xDistPlaneLeft )
{
return GEO_C_lCullingOut;
}
/*if all points are on the right side of the left plane, the box is inside relatively to this plane*/
xCompute = ((xValue0 > xValue3) ? xValue0 : xValue3) + ((xValue1 > xValue4) ? xValue1 : xValue4) + ((xValue2 > xValue5) ? xValue2 : xValue5);
if (xCompute < hCamera->xDistPlaneLeft )
{
_lCullingResult |= GEO_C_lCullingLeft;
}
}
/* if the culling result against the right border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingRight) )
{
xValue0 = stMinWithCamera.xX * gs_stGlobalNormPlaneRight.xX;
xValue1 = stMinWithCamera.xY * gs_stGlobalNormPlaneRight.xY;
xValue2 = stMinWithCamera.xZ * gs_stGlobalNormPlaneRight.xZ;
xValue3 = stMaxWithCamera.xX * gs_stGlobalNormPlaneRight.xX;
xValue4 = stMaxWithCamera.xY * gs_stGlobalNormPlaneRight.xY;
xValue5 = stMaxWithCamera.xZ * gs_stGlobalNormPlaneRight.xZ;
/*if all points on the right side of the right plane, the box is out*/
xCompute = ((xValue0 < xValue3) ? xValue0 : xValue3) + ((xValue1 < xValue4) ? xValue1 : xValue4) + ((xValue2 < xValue5) ? xValue2 : xValue5);
if (xCompute > hCamera->xDistPlaneRight )
{
return GEO_C_lCullingOut;
}
/*if all points are on the left side of the right plane, the box is inside relatively to this plane*/
xCompute = ((xValue0 > xValue3) ? xValue0 : xValue3) + ((xValue1 > xValue4) ? xValue1 : xValue4) + ((xValue2 > xValue5) ? xValue2 : xValue5);
if (xCompute < hCamera->xDistPlaneRight )
{
_lCullingResult |= GEO_C_lCullingRight;
}
}
/* if the culling result against the up border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingUp) )
{
xValue0 = stMinWithCamera.xX * gs_stGlobalNormPlaneUp.xX;
xValue1 = stMinWithCamera.xY * gs_stGlobalNormPlaneUp.xY;
xValue2 = stMinWithCamera.xZ * gs_stGlobalNormPlaneUp.xZ;
xValue3 = stMaxWithCamera.xX * gs_stGlobalNormPlaneUp.xX;
xValue4 = stMaxWithCamera.xY * gs_stGlobalNormPlaneUp.xY;
xValue5 = stMaxWithCamera.xZ * gs_stGlobalNormPlaneUp.xZ;
/*if all points are above the upper plane, the box is out*/
xCompute = ((xValue0 < xValue3) ? xValue0 : xValue3) + ((xValue1 < xValue4) ? xValue1 : xValue4) + ((xValue2 < xValue5) ? xValue2 : xValue5);
if (xCompute > hCamera->xDistPlaneUp )
{
return GEO_C_lCullingOut;
}
/*if all points are below the upper plane, the box is inside relatively to this plane*/
xCompute = ((xValue0 > xValue3) ? xValue0 : xValue3) + ((xValue1 > xValue4) ? xValue1 : xValue4) + ((xValue2 > xValue5) ? xValue2 : xValue5);
if (xCompute < hCamera->xDistPlaneUp )
{
_lCullingResult |= GEO_C_lCullingUp;
}
}
/* if the culling result against the down border is not known as in, compute it*/
if ( !(_lCullingResult & GEO_C_lCullingDown) )
{
xValue0 = stMinWithCamera.xX * gs_stGlobalNormPlaneDown.xX;
xValue1 = stMinWithCamera.xY * gs_stGlobalNormPlaneDown.xY;
xValue2 = stMinWithCamera.xZ * gs_stGlobalNormPlaneDown.xZ;
xValue3 = stMaxWithCamera.xX * gs_stGlobalNormPlaneDown.xX;
xValue4 = stMaxWithCamera.xY * gs_stGlobalNormPlaneDown.xY;
xValue5 = stMaxWithCamera.xZ * gs_stGlobalNormPlaneDown.xZ;
/*if all points are under the lower plane, the box is out*/
xCompute = ((xValue0 < xValue3) ? xValue0 : xValue3) + ((xValue1 < xValue4) ? xValue1 : xValue4) + ((xValue2 < xValue5) ? xValue2 : xValue5);
if (xCompute > hCamera->xDistPlaneDown )
{
return GEO_C_lCullingOut;
}
/*if all points are above the lower plane, the box is inside relatively to this plane*/
xCompute = ((xValue0 > xValue3) ? xValue0 : xValue3) + ((xValue1 > xValue4) ? xValue1 : xValue4) + ((xValue2 > xValue5) ? xValue2 : xValue5);
if (xCompute < hCamera->xDistPlaneDown )
{
_lCullingResult |= GEO_C_lCullingDown;
}
}
return _lCullingResult;
}
/*
* OLD CULLING
// DONT REMOVE SPACE ********************************************************************************************
// Name: GLI_lCullingBox
// Goal: Return 1 if the parallele box is visible with the viewport's camera, 0 else.
// Code: Philippe Vimont
// modif : Fabien Bole-Feysot (optimisation)
// entry : the viewport to test
// the min point of the parallel box, in the world global axis system
// the max point of the parallel box, in the world global axis system
// DONT REMOVE SPACE ********************************************************************************************
long GLI_lNormalCullingBox
(
GLD_tdstViewportAttributes *p_stVpt ,
MTH3D_tdstVector *p_stMin ,
MTH3D_tdstVector *p_stMax
)
{
GLI_tdstAligned3DVector a8_stVertexTrans [8], *p_stFastPointer;
GLI_tdstSpecificAttributesFor3D *p_stSpecifAttrib3D;
MTH3D_tdstVector stDiago, stOrigin;
MTH3D_tdstVector stIp, stJp, stKp;
POS_tdstCompletePosition *p_stPos;
MTH3D_tdstMatrix *p_stMatrix;
GLI_tdstAligned2DVector a8_st2DVertex [8] ;
ACP_tdxIndex xCounter;
MTH_tdxReal xNearPlane;
p_stSpecifAttrib3D = (GLI_tdstSpecificAttributesFor3D *) p_stVpt -> p_vSpecificToXD;
p_stPos = &p_stSpecifAttrib3D->p_stCam->stMatrix;
p_stMatrix = &p_stPos->stTransformMatrix;
xNearPlane = p_stSpecifAttrib3D->p_stCam->xNear;
// build the diagonal vector
MTH3D_M_vSubVector(&stDiago,p_stMax,p_stMin);
// compute the new box origin point
POS_fn_vMulMatrixVertex (&stOrigin,p_stPos,p_stMin);
// compute the new Ip,Jp,Kp vectors
stIp.xX = MTH_M_xMul( p_stMatrix->stCol_0.xX, stDiago.xX);
stIp.xY = MTH_M_xMul( p_stMatrix->stCol_0.xY, stDiago.xX);
stIp.xZ = MTH_M_xMul( p_stMatrix->stCol_0.xZ, stDiago.xX);
stJp.xX = MTH_M_xMul( p_stMatrix->stCol_1.xX, stDiago.xY);
stJp.xY = MTH_M_xMul( p_stMatrix->stCol_1.xY, stDiago.xY);
stJp.xZ = MTH_M_xMul( p_stMatrix->stCol_1.xZ, stDiago.xY);
stKp.xX = MTH_M_xMul( p_stMatrix->stCol_2.xX, stDiago.xZ);
stKp.xY = MTH_M_xMul( p_stMatrix->stCol_2.xY, stDiago.xZ);
stKp.xZ = MTH_M_xMul( p_stMatrix->stCol_2.xZ, stDiago.xZ);
// Build The Cube from its new origin and new base vectors
MTH3D_M_vCopyVector(&a8_stVertexTrans[0],&stOrigin);
MTH3D_M_vAddVector(&a8_stVertexTrans[1],&stOrigin,&stIp); //i
MTH3D_M_vAddVector(&a8_stVertexTrans[2],&stOrigin,&stJp); //j
MTH3D_M_vAddVector(&a8_stVertexTrans[3],&stOrigin,&stKp); //k
MTH3D_M_vAddVector(&a8_stVertexTrans[4],&a8_stVertexTrans[1],&stJp); //i+j
MTH3D_M_vAddVector(&a8_stVertexTrans[5],&a8_stVertexTrans[1],&stKp); //i+k
MTH3D_M_vAddVector(&a8_stVertexTrans[6],&a8_stVertexTrans[2],&stKp); //j+k
MTH3D_M_vAddVector(&a8_stVertexTrans[7],&a8_stVertexTrans[4],&stKp); //i+j+k
// Fast Cull on Z
xCounter = 8; // count the points that are not visible
for (p_stFastPointer = a8_stVertexTrans+7; p_stFastPointer != a8_stVertexTrans-1; p_stFastPointer--)
{
if (xNearPlane >= p_stFastPointer->xZ)
{
// this point is invisible !
xCounter--;
p_stFastPointer->xZ = xNearPlane; // in case we must project this point...
}
}
if (!xCounter)
{
// every point is invisible !
return 0;
}
// part of the cube is in front of the camera, so project
GLI_xSerialProjection (p_stSpecifAttrib3D -> p_stCam ,8,a8_stVertexTrans,a8_st2DVertex);
// correct 3DFX bug
g_stCurLLInterface.p_fnSerialSnap2DVertices (a8_st2DVertex,8);
// and clip
return g_stCurLLInterface.p_fnCullListOfPoints (p_stVpt , 8 , a8_st2DVertex);
}
* END OLD CULLING
*/
/*
* TEST FOR CULLING
// DONT REMOVE SPACE ********************************************************************************************
// Name: GLI_lCullingBox
// Goal: Return 1 if the parallele box is visible with the viewport's camera, 0 else.
// Code: Philippe Vimont
// modif : Fabien Bole-Feysot (optimisation)
// entry : the viewport to test
// the min point of the parallel box, in the world global axis system
// the max point of the parallel box, in the world global axis system
// DONT REMOVE SPACE ********************************************************************************************
extern struct tdstEngineStructure_ g_stEngineStructure;
long GLI_lCullingBox
(
GLD_tdstViewportAttributes *p_stVpt ,
MTH3D_tdstVector *p_stMin ,
MTH3D_tdstVector *p_stMax
)
{
long lMyResult, lNormalResult;
static unsigned long lClippedByMeButNotByNormal = 0;
static unsigned long lClippedByNormalButNotByMe = 0;
static char cReturnType = 0;
static unsigned long ulTrameNumber = 0xFF;
static GLD_tdstViewportAttributes *p_stLastVpt = NULL;
if ( ( *(unsigned long*) ((char *) &g_stEngineStructure + 0xEA8 ) != ulTrameNumber) || (p_stVpt != p_stLastVpt) )
{
ulTrameNumber = *(unsigned long*) ((char *) &g_stEngineStructure + 0xEA8 );
p_stLastVpt = p_stVpt;
GLI_fn_vComputeCameraParametersForCulling( p_stVpt );
}
lMyResult = GLI_lMyCullingBox( p_stVpt , p_stMin , p_stMax );
lNormalResult = GLI_lNormalCullingBox( p_stVpt , p_stMin , p_stMax );
if ((lMyResult == 0) && (lNormalResult != 0))
lClippedByMeButNotByNormal++;
else if ((lMyResult != 0) && (lNormalResult == 0))
lClippedByNormalButNotByMe++;
switch (cReturnType)
{
case 0 : return lMyResult;
case 1 : return lNormalResult;
}
}
* END TEST FOR CULLING
*/
#ifdef __cplusplus
} /*extern "C"*/
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,103 @@
#include "acp_base.h"
#include "mth.h"
#include "GEO.h"
#include "Gmt.h"
#include "mec.h"
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void
GEO_xCreateFaceMapDescriptor ( ACP_tdxHandleOfFMD *hFmd )
{
GEO_M_CPAMalloc (
*hFmd ,
GEO_tdstFaceMapDescriptor *,
sizeof(GEO_tdstFaceMapDescriptor),
E_uwGEONotEnoughtMemory );
}
void
GEO_xSetFaceMapDescriptorUV ( ACP_tdxHandleOfFMD hFmd ,
ACP_tdst2DUVValues *p_stUVA,
ACP_tdst2DUVValues *p_stUVB,
ACP_tdst2DUVValues *p_stUVC)
{
hFmd-> stUVValues[0] = *p_stUVA;
hFmd-> stUVValues[1] = *p_stUVB;
hFmd-> stUVValues[2] = *p_stUVC;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_
void
GEO_xGetFaceMapDescriptorUV ( ACP_tdxHandleOfFMD hFmd ,
ACP_tdst2DUVValues *p_stUVA,
ACP_tdst2DUVValues *p_stUVB,
ACP_tdst2DUVValues *p_stUVC)
{
*p_stUVA = hFmd-> stUVValues[0] ;
*p_stUVB = hFmd-> stUVValues[1] ;
*p_stUVC = hFmd-> stUVValues[2] ;
}
void
GEO_xSetFaceMapDescriptorMaterial ( ACP_tdxHandleOfFMD hFmd ,
ACP_tdxHandleOfMaterial hMaterial)
{
GMT_fn_vSetVisualMaterial(hFmd-> hMaterial, hMaterial);
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void
GEO_xGetFaceMapDescriptorMaterial ( ACP_tdxHandleOfFMD hFmd ,
ACP_tdxHandleOfMaterial *p_hMaterial)
{
*p_hMaterial=GMT_fn_hGetVisualMaterial( hFmd-> hMaterial );
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_xSetFaceMapDescriptorGameMaterial
// Set the game material of a FMD
////////////////////////////////////////////////////////////////////////////////
// Input : hFmd : handle to the FMD
// hMaterial : handle to the game material
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 1997 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
void
GEO_xSetFaceMapDescriptorGameMaterial ( ACP_tdxHandleOfFMD hFmd ,
GMT_tdxHandleToGameMaterial hMaterial)
{
hFmd-> hMaterial = hMaterial;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_xSetFaceMapDescriptorGameMaterial
// Set the game material of a FMD
////////////////////////////////////////////////////////////////////////////////
// Input : hFmd : handle to the FMD
// hMaterial : handle to the game material
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 1997 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
void
GEO_xGetFaceMapDescriptorGameMaterial ( ACP_tdxHandleOfFMD hFmd ,
GMT_tdxHandleToGameMaterial *p_hMaterial)
{
*p_hMaterial = hFmd-> hMaterial ;
}

View File

@@ -0,0 +1,223 @@
# Microsoft Developer Studio Project File - Name="Geo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=Geo - Win32 Debug with Editors
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Geo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Geo.mak" CFG="Geo - Win32 Debug with Editors"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Geo - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "Geo - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "Geo - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE "Geo - Win32 Debug with Editors" (based on\
"Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/GEO", NWCAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "Geo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "USE_PROFILER" /D "VISUAL" /D "WIN32" /D "PACKAGE10" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\GEOP5_vr.lib"
!ELSEIF "$(CFG)" == "Geo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "X:\CPA\Lib"
# PROP Intermediate_Dir "Tmp\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "X:\CPA\Public" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "VISUAL" /D "WIN32" /D "PACKAGE10" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\GEOP5_vd.lib"
!ELSEIF "$(CFG)" == "Geo - Win32 Retail"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Geo___Wi"
# PROP BASE Intermediate_Dir "Geo___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:/cpa/lib"
# PROP Intermediate_Dir "tmp/retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MD /W3 /GX /Zi /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "CPA_WANTS_EXPORT" /D "WIN32" /D "_WINDOWS" /D "VISUAL" /D "WIN95" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "X:\CPA\Public" /D "NDEBUG" /D "RETAIL" /D "VISUAL" /D "WIN32" /D "PACKAGE10" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"X:\CPA\Lib\GEOP5_vr.lib"
# ADD LIB32 /nologo /out:"X:\CPA\Lib\GEOP5_vf.lib"
!ELSEIF "$(CFG)" == "Geo - Win32 Debug with Editors"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Geo___W0"
# PROP BASE Intermediate_Dir "Geo___W0"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "tmp\debuged"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MD /W3 /GX /Z7 /Od /I "X:\CPA\Public" /D "_DEBUG" /D "ACTIVE_EDITOR" /D "CPA_WANTS_EXPORT" /D "WIN32" /D "_WINDOWS" /D "VISUAL" /D "WIN95" /D "USE_ALTIMAPS" /D "USE_PROFILER" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "X:\CPA\Public" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "ACTIVE_EDITOR" /D "CPA_WANTS_EXPORT" /D "USE_ALTIMAPS" /D "VISUAL" /D "WIN32" /D "PACKAGE10" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"X:\CPA\Lib\GEOP5evd.lib"
# ADD LIB32 /nologo /out:"X:\CPA\Lib\GEOP5evd.lib"
!ENDIF
# Begin Target
# Name "Geo - Win32 Release"
# Name "Geo - Win32 Debug"
# Name "Geo - Win32 Retail"
# Name "Geo - Win32 Debug with Editors"
# Begin Group "Sources"
# PROP Default_Filter ".c"
# Begin Source File
SOURCE=.\P5\BinLoad.c
# End Source File
# Begin Source File
SOURCE=.\Culling.c
# End Source File
# Begin Source File
SOURCE=.\Element.c
# End Source File
# Begin Source File
SOURCE=.\Fmd.c
# End Source File
# Begin Source File
SOURCE=.\GeoBdVol.c
# End Source File
# Begin Source File
SOURCE=.\GeoMem.c
# End Source File
# Begin Source File
SOURCE=.\GeoObj.c
# End Source File
# Begin Source File
SOURCE=.\GeoObj2.c
# End Source File
# Begin Source File
SOURCE=.\sprite.c
# End Source File
# End Group
# Begin Group "Include"
# PROP Default_Filter ".h"
# Begin Source File
SOURCE=..\..\Public\GEO\color.h
# End Source File
# Begin Source File
SOURCE=..\..\public\GEO\Culling.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\GEO\Element.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\GEO\ErrGEO.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\GEO\Fmd.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\GEO\GeoBdVol.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\GEO\Geomem.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\GEO\GeoObj.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\GEO\GeoSprit.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\GEO\LoadBin.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\GEO\MMGGEO.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\Geo.mak
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,578 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Geo"
ProjectGUID="{74CA8821-9A41-4AB6-B257-65E47A6FE35B}"
SccProjectName="&quot;$/cpa/tempgrp/GEO&quot;, NWCAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug with Editors|Win32"
OutputDirectory="x:\cpa\libd"
IntermediateDirectory=".\tmp\debuged"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="_DEBUG;USE_PROFILER;MTH_CHECK;ACTIVE_EDITOR;CPA_WANTS_EXPORT;USE_ALTIMAPS;VISUAL;WIN32;PACKAGE10"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\tmp\debuged/Geo.pch"
AssemblerListingLocation=".\tmp\debuged/"
ObjectFile=".\tmp\debuged/"
ProgramDataBaseFileName=".\tmp\debuged/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Libd\GEOP5evd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Retail|Win32"
OutputDirectory="x:/cpa/lib"
IntermediateDirectory=".\tmp/retail"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="NDEBUG;RETAIL;VISUAL;WIN32;PACKAGE10"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\tmp/retail/Geo.pch"
AssemblerListingLocation=".\tmp/retail/"
ObjectFile=".\tmp/retail/"
ProgramDataBaseFileName=".\tmp/retail/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\GEOP5_vf.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\Tmp\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="NDEBUG;USE_PROFILER;VISUAL;WIN32;PACKAGE10"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Tmp\Release/Geo.pch"
AssemblerListingLocation=".\Tmp\Release/"
ObjectFile=".\Tmp\Release/"
ProgramDataBaseFileName=".\Tmp\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\GEOP5_vr.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="X:\CPA\Libd"
IntermediateDirectory=".\Tmp\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="X:\CPA\Public"
PreprocessorDefinitions="_DEBUG;USE_PROFILER;MTH_CHECK;VISUAL;WIN32;PACKAGE10"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Tmp\Debug/Geo.pch"
AssemblerListingLocation=".\Tmp\Debug/"
ObjectFile=".\Tmp\Debug/"
ProgramDataBaseFileName=".\Tmp\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Libd\GEOP5_vd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Sources"
Filter=".c">
<File
RelativePath="P5\BinLoad.c">
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Culling.c">
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Element.c">
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Fmd.c">
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="GeoBdVol.c">
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="GeoMem.c">
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="GeoObj.c">
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="GeoObj2.c">
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="sprite.c">
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Include"
Filter=".h">
<File
RelativePath="..\..\Public\GEO\color.h">
</File>
<File
RelativePath="..\..\public\GEO\Culling.h">
</File>
<File
RelativePath="..\..\Public\GEO\Element.h">
</File>
<File
RelativePath="..\..\Public\GEO\ErrGEO.h">
</File>
<File
RelativePath="..\..\Public\GEO\Fmd.h">
</File>
<File
RelativePath="..\..\Public\GEO\GeoBdVol.h">
</File>
<File
RelativePath="..\..\Public\GEO\Geomem.h">
</File>
<File
RelativePath="..\..\Public\GEO\GeoObj.h">
</File>
<File
RelativePath="..\..\Public\GEO\GeoSprit.h">
</File>
<File
RelativePath="..\..\Public\GEO\LoadBin.h">
</File>
<File
RelativePath="..\..\Public\GEO\MMGGEO.h">
</File>
</Filter>
<File
RelativePath="Geo.mak">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,796 @@
#include <assert.h> /* for "assert" : to be removed */
#include "cpa_std.h" /* for "memcpy" and NULL : to be removed */
#include "acp_base.h"
#include "MTH.h"
#include "POS.h"
#include "GEO.h"
#include "GMT.h"
#include "MEC.h"
#include "GLI.h"
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
GMT_tdxHandleToGameMaterial gs_hMaterial=NULL;
#endif /* _FIRE_DEADCODE_U64 */ /* Added by RUC */
/*--------------------------------------------------------------------------------------*/
/**/
/* We will need a default game material to draw the structures that are defined*/
/* in this file*/
/**/
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_fn_vInitBoundingVolumeMaterial
(
void
)
{
gs_hMaterial = GMT_fn_hCreateGameMaterial();
}
#endif /* _FIRE_DEADCODE_U64 */ /* Added by RUC */
/*--------------------------------------------------------------------------------------*/
/**/
/* Create a box that include a geometric object*/
/**/
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_fn_vAddObjectToBox
(
ACP_tdxHandleOfObject _hGeometricObject,
struct POS_stCompletePosition *_p_stGlobalMatrix,
MTH3D_tdstVector *_p_stMax,
MTH3D_tdstVector *_p_stMin
)
{
MTH3D_tdstVector* p_stVertex;
MTH3D_tdstVector stVertex;
long i;
assert(_hGeometricObject != NULL);
#ifdef USE_ALTIMAPS
/*--- We need to know if it is an Altimap or not ---*/
if( _hGeometricObject->d_xListOfElementsTypes[0] == GEO_C_xElementAltimap )
{
/*--- It is an Altimap ! ---*/
MTH3D_tdstVector stVRef[3], stOrig;
MTH3D_tdstVector aDEF_stVertex[ C_lMaxVertexPerObject ];
MTH3D_tdstVector * p_stAVectCurr, * p_stAVectNext, * p_stEndLoop;
MTH3D_tdstVector stAVRef[3];
ACP_tdxIndex cWidth, cDepth, xNbAltimapVertex;
MTH_tdxReal * p_xHeight;
GEO_tdstElementAltimap * p_stLocalElementAltimap;
p_stLocalElementAltimap = (GEO_tdstElementAltimap *) _hGeometricObject->d_stListOfElements[ 0 ];
/*--- Seeting some Geo Obj attributes for further computations ---*/
xNbAltimapVertex = (p_stLocalElementAltimap->xWidth + 1) * (p_stLocalElementAltimap->xDepth + 1);
_hGeometricObject->xNbPoints = xNbAltimapVertex;
/*--- We need to get the origin without its height ---*/
stOrig = p_stLocalElementAltimap->stOrigin;
stOrig.xZ = MTH_C_ZERO;
/*--- Projection of the Origin point ---*/
MTH3D_M_vMulMatrixVector ( aDEF_stVertex, &_p_stGlobalMatrix->stTransformMatrix, &stOrig );
/*--- Projection of Dx and Dy vectors and Unary Dz Vector ---*/
MTH3D_M_vSetVectorElements( (stVRef ), MTH_C_ONE, MTH_C_ZERO, MTH_C_ZERO );
MTH3D_M_vSetVectorElements( (stVRef + 1), MTH_C_ZERO, MTH_C_ONE, MTH_C_ZERO );
MTH3D_M_vSetVectorElements( (stVRef + 2), MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE );
MTH3D_M_vMulMatrixVector ( (stAVRef ), &_p_stGlobalMatrix->stTransformMatrix, (stVRef ) );
MTH3D_M_vMulMatrixVector ( (stAVRef + 1), &_p_stGlobalMatrix->stTransformMatrix, (stVRef + 1) );
MTH3D_M_vMulMatrixVector ( (stAVRef + 2), &_p_stGlobalMatrix->stTransformMatrix, (stVRef + 2) );
MTH3D_M_vMulScalarVector( (stAVRef ), p_stLocalElementAltimap->xDeltaX, (stAVRef ) );
MTH3D_M_vMulScalarVector( (stAVRef + 1), p_stLocalElementAltimap->xDeltaY, (stAVRef + 1) );
/*--- Loops initialisations ---*/
p_stAVectCurr = p_stAVectNext = aDEF_stVertex;
xNbAltimapVertex = (p_stLocalElementAltimap->xWidth + 1) * (p_stLocalElementAltimap->xDepth + 1);
p_xHeight = p_stLocalElementAltimap->d_xHeight;
/*--- Filling the array along X and Y. Heights are calculated further ---*/
for( cDepth = 0 ; cDepth < p_stLocalElementAltimap->xDepth + 1 ; cDepth ++ )
{
if( cDepth > 0 )
{
p_stAVectNext ++;
MTH3D_M_vAddVector( p_stAVectNext, (stAVRef + 1), p_stAVectCurr ); /*--- p(0,y+1) = p(0,y) + dy*/
}
p_stAVectCurr = p_stAVectNext; /*--- We save the 1st point of current line*/
for( cWidth = 1 ; cWidth < p_stLocalElementAltimap->xWidth + 1 ; cWidth ++ )
{
MTH3D_M_vAddVector( p_stAVectNext + 1, stAVRef, p_stAVectNext );
p_stAVectNext++;
}
}
/*--- Adding the Height projection ---*/
p_stAVectCurr = aDEF_stVertex;
p_stEndLoop = p_stAVectCurr + xNbAltimapVertex;
for( ; p_stAVectCurr < p_stEndLoop ; p_xHeight ++, p_stAVectCurr ++ )
{
MTH3D_M_vMulAddVector( p_stAVectCurr,
*p_xHeight,
(stAVRef + 2),
p_stAVectCurr );
}
/*--- Computation of the Bounding Parallel box ---*/
/*--- All the vertices have been projected ---*/
p_stVertex = aDEF_stVertex;
for (i=0; i<_hGeometricObject->xNbPoints; i++,p_stVertex++)
{
if (MTH_M_bLess(p_stVertex->xX, _p_stMin->xX))
_p_stMin->xX = p_stVertex->xX;
if(MTH_M_bGreater(p_stVertex->xX, _p_stMax->xX))
_p_stMax->xX = p_stVertex->xX;
if (MTH_M_bLess(p_stVertex->xY, _p_stMin->xY))
_p_stMin->xY = p_stVertex->xY;
if(MTH_M_bGreater(p_stVertex->xY, _p_stMax->xY))
_p_stMax->xY = p_stVertex->xY;
if (MTH_M_bLess(p_stVertex->xZ, _p_stMin->xZ))
_p_stMin->xZ = p_stVertex->xZ;
if(MTH_M_bGreater(p_stVertex->xZ, _p_stMax->xZ))
_p_stMax->xZ = p_stVertex->xZ;
}
}
else
#endif /*USE_ALTIMAPS*/
{
long lElementCounter;
/*--- It is NOT an Altimap ! ---*/
p_stVertex = _hGeometricObject->d_stListOfPoints;
for (i=0; i<_hGeometricObject->xNbPoints; i++,p_stVertex++)
{
/* The point must be computed in the global world, not in the local one...*/
MTH3D_M_vMulMatrixVector ( &stVertex, &_p_stGlobalMatrix->stTransformMatrix, p_stVertex );
if (MTH_M_bLess(stVertex.xX, _p_stMin->xX))
_p_stMin->xX = stVertex.xX;
if(MTH_M_bGreater(stVertex.xX, _p_stMax->xX))
_p_stMax->xX = stVertex.xX;
if (MTH_M_bLess(stVertex.xY, _p_stMin->xY))
_p_stMin->xY = stVertex.xY;
if(MTH_M_bGreater(stVertex.xY, _p_stMax->xY))
_p_stMax->xY = stVertex.xY;
if (MTH_M_bLess(stVertex.xZ, _p_stMin->xZ))
_p_stMin->xZ = stVertex.xZ;
if(MTH_M_bGreater(stVertex.xZ, _p_stMax->xZ))
_p_stMax->xZ = stVertex.xZ;
}
/* Some elements are not included by the point, it's the case for the spheres, the boxes, the sprites & the cones.*/
/* So here some new box are added.*/
for (lElementCounter = 0 ; lElementCounter < _hGeometricObject->xNbElements;lElementCounter++) {
if (_hGeometricObject->d_xListOfElementsTypes[lElementCounter] == GEO_C_xElementSprites) {
GEO_tdstElementSprite * p_stLocalElementSprite =
((GEO_tdstElementSprite *) _hGeometricObject -> d_stListOfElements[lElementCounter]);
for ( i = 0 ; i < p_stLocalElementSprite -> xNbSprites; i ++) {
MTH_tdxReal xRadius;
/* because all sprites are scaled Sprites*/
MTH2D_tdstVector * p_stSize =
p_stLocalElementSprite->d_stListOfSprites[i].hSprite->d_xSizeOfSprite;
MTH3D_tdstVector stCenter;
/* compute bulk of sprite*/
xRadius = MTH_M_xMul(MTH2D_M_xNormVector(p_stSize),MTH_C_Inv2);
xRadius = MTH_M_xMul(xRadius,POS_fn_xGetMaxScale(_p_stGlobalMatrix));
/* Compute Center in Global World coordintes*/
MTH3D_M_vMulMatrixVector(&stCenter,&_p_stGlobalMatrix->stTransformMatrix,
&_hGeometricObject->d_stListOfPoints[p_stLocalElementSprite->d_stListOfSprites[i].xCenterPoint]);
/* Compute Min Point */
_p_stMin->xX = MTH_M_xMin(_p_stMin->xX,MTH_M_xSub(stCenter.xX,xRadius));
_p_stMin->xY = MTH_M_xMin(_p_stMin->xY,MTH_M_xSub(stCenter.xY,xRadius));
_p_stMin->xZ = MTH_M_xMin(_p_stMin->xZ,MTH_M_xSub(stCenter.xZ,xRadius));
/* Compute Max Point */
_p_stMax->xX = MTH_M_xMax(_p_stMax->xX,MTH_M_xAdd(stCenter.xX,xRadius));
_p_stMax->xY = MTH_M_xMax(_p_stMax->xY,MTH_M_xAdd(stCenter.xY,xRadius));
_p_stMax->xZ = MTH_M_xMax(_p_stMax->xZ,MTH_M_xAdd(stCenter.xZ,xRadius));
}
}
}
}
}
#if defined(U64)
void GEO_fn_vAddObjectToBox2
(
ACP_tdxHandleOfObject _hGeometricObject,
struct POS_stCompletePosition *_p_stGlobalMatrix,
MTH3D_tdstVector *_p_stMax,
MTH3D_tdstVector *_p_stMin
)
{
MTH3D_tdstVector* p_stVertex;
MTH3D_tdstVector stVertex;
long i;
/* First : get the collision part*/
p_stVertex = _hGeometricObject->d_stListOfPoints;
for (i=0; i<_hGeometricObject->xNbPoints; i++,p_stVertex++)
{
/* The point must be computed in the global world, not in the local one...*/
POS_fn_vMulMatrixVertex( &stVertex, _p_stGlobalMatrix, p_stVertex );
if (MTH_M_bLess(stVertex.xX, _p_stMin->xX))
_p_stMin->xX = stVertex.xX;
if(MTH_M_bGreater(stVertex.xX, _p_stMax->xX))
_p_stMax->xX = stVertex.xX;
if (MTH_M_bLess(stVertex.xY, _p_stMin->xY))
_p_stMin->xY = stVertex.xY;
if(MTH_M_bGreater(stVertex.xY, _p_stMax->xY))
_p_stMax->xY = stVertex.xY;
if (MTH_M_bLess(stVertex.xZ, _p_stMin->xZ))
_p_stMin->xZ = stVertex.xZ;
if(MTH_M_bGreater(stVertex.xZ, _p_stMax->xZ))
_p_stMax->xZ = stVertex.xZ;
}
/* Second : deals with the graphics part ... this is temporary anti-bug, waiting for binarization of BV*/
{
/* Max*/
MTH_tdxReal xCoord = MTH_M_xFloatToReal(_hGeometricObject->fRadius);
MTH3D_M_vSetVectorElements( &stVertex, xCoord, xCoord, xCoord );
POS_fn_vMulMatrixVertex( &stVertex, _p_stGlobalMatrix, &stVertex );
if(MTH_M_bGreater(stVertex.xX, _p_stMax->xX))
_p_stMax->xX = stVertex.xX;
if(MTH_M_bGreater(stVertex.xY, _p_stMax->xY))
_p_stMax->xY = stVertex.xY;
if(MTH_M_bGreater(stVertex.xZ, _p_stMax->xZ))
_p_stMax->xZ = stVertex.xZ;
/* Min*/
xCoord = MTH_M_xNeg( xCoord );
MTH3D_M_vSetVectorElements( &stVertex, xCoord, xCoord, xCoord );
POS_fn_vMulMatrixVertex( &stVertex, _p_stGlobalMatrix, &stVertex );
if (MTH_M_bLess(stVertex.xX, _p_stMin->xX))
_p_stMin->xX = stVertex.xX;
if (MTH_M_bLess(stVertex.xY, _p_stMin->xY))
_p_stMin->xY = stVertex.xY;
if (MTH_M_bLess(stVertex.xZ, _p_stMin->xZ))
_p_stMin->xZ = stVertex.xZ;
}
}
#endif /* U64 */
/*--------------------------------------------------------------------------------------*/
/**/
/* Create a bounding sphere that includes 2 bounding spheres*/
/**/
/*--------------------------------------------------------------------------------------*/
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
)
{
MTH_tdxReal xDistanceBetweenCenters, xAlpha;
MTH3D_tdstVector stDeltaCenter;
MTH3D_M_vSubVector(&stDeltaCenter, _p_stFirstSphereCenter, _p_stSecondSphereCenter);
xDistanceBetweenCenters=MTH3D_M_xNormVector(&stDeltaCenter);/*! can be zero*/
if(xDistanceBetweenCenters+_xFirstSphereRadius<=_xSecondSphereRadius)
{
MTH3D_M_vCopyVector(_p_stReturnedSphereCenter,_p_stSecondSphereCenter);
*_p_xReturnedSphereRadius=_xSecondSphereRadius;
return;
}
else if(xDistanceBetweenCenters+_xSecondSphereRadius<_xFirstSphereRadius)
{
MTH3D_M_vCopyVector(_p_stReturnedSphereCenter,_p_stFirstSphereCenter);
*_p_xReturnedSphereRadius=_xFirstSphereRadius;
return;
}
else
{
xAlpha=(1.0f-(_xFirstSphereRadius-_xSecondSphereRadius)/xDistanceBetweenCenters)/2.0f;
MTH3D_M_vLinearInterpolVector( _p_stReturnedSphereCenter, _p_stFirstSphereCenter, _p_stSecondSphereCenter, xAlpha);
*_p_xReturnedSphereRadius=(xDistanceBetweenCenters+_xFirstSphereRadius+_xSecondSphereRadius)/2.0f;
}
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Create a bounding sphere that includes a bounding sphere and a point*/
/* It is exactly the same function as before with a null radius second sphere*/
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vComputeBoundingSphereOfOneSphereAndOnePoint
(
MTH3D_tdstVector *_p_stReturnedSphereCenter,
MTH_tdxReal *_p_xReturnedSphereRadius,
MTH3D_tdstVector *_p_stFirstSphereCenter,
MTH_tdxReal _xFirstSphereRadius,
MTH3D_tdstVector *_p_stSecondSphereCenter
)
{
MTH_tdxReal xDistanceBetweenCenters, xAlpha;
MTH3D_tdstVector stDeltaCenter;
MTH3D_M_vSubVector(&stDeltaCenter, _p_stFirstSphereCenter, _p_stSecondSphereCenter);
xDistanceBetweenCenters=MTH3D_M_xNormVector(&stDeltaCenter);/*! can be zero*/
if(xDistanceBetweenCenters<=_xFirstSphereRadius)/* ! both can be zero*/
{
MTH3D_M_vCopyVector(_p_stReturnedSphereCenter,_p_stFirstSphereCenter);
*_p_xReturnedSphereRadius=_xFirstSphereRadius;
return;
}
else
{
xAlpha=(1.0f-(_xFirstSphereRadius)/xDistanceBetweenCenters)/2.0f;
MTH3D_M_vLinearInterpolVector( _p_stReturnedSphereCenter, _p_stFirstSphereCenter, _p_stSecondSphereCenter, xAlpha);
*_p_xReturnedSphereRadius=(xDistanceBetweenCenters+_xFirstSphereRadius)/2.0f;
}
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Create a bounding sphere that includes a sprite*/
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vComputeBoundingSphereOfSprite
(
GEO_tdstIndexedSprite *p_stIndexedSprite,
MTH_tdxReal *p_stSphereRadius
)
{
MTH_tdxReal xLocalValueX,xLocalValueY;
xLocalValueX = p_stIndexedSprite->stSize . xX * ( p_stIndexedSprite -> hSprite -> d_xSizeOfSprite[0] . xX + p_stIndexedSprite -> hSprite -> d_xDisplacementOfSprite[0].xX );
xLocalValueY = p_stIndexedSprite->stSize . xY * ( p_stIndexedSprite -> hSprite -> d_xSizeOfSprite[0] . xY + p_stIndexedSprite -> hSprite -> d_xDisplacementOfSprite[0].xY );
*p_stSphereRadius = MTH_M_xSqrt( xLocalValueX * xLocalValueX + xLocalValueY * xLocalValueY ) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*--------------------------------------------------------------------------------------*/
/**/
/* Create a bounding sphere that includes an altimap*/
/* */
/*--------------------------------------------------------------------------------------*/
#ifdef USE_ALTIMAPS
void GEO_fn_vAddAltimapToSphere
(
ACP_tdxHandleOfObject _hGeometricObject,
MTH3D_tdstVector *_p_stSphereCenter,
MTH_tdxReal *_p_xSphereRadius
)
{
MTH3D_tdstVector stVertex, stVectI, stVectJ, stVectK;
long cWidth, cDepth, cVertex;
GEO_tdstElementAltimap *p_stEAltimap;
MTH_tdxReal xOrigZ;
assert(_hGeometricObject != NULL);
/*--- Getting the Altimap Element*/
p_stEAltimap = (GEO_tdstElementAltimap *) _hGeometricObject->d_stListOfElements[ 0 ];
/*--- Getting the Origin for Z=0 ---*/
xOrigZ = p_stEAltimap->stOrigin.xZ;
p_stEAltimap->stOrigin.xZ = MTH_C_ZERO;
/*--- Setting reference Vectors*/
MTH3D_M_vSetBaseIVector( &stVectI );
MTH3D_M_vMulScalarVector( &stVectI, p_stEAltimap->xDeltaX, &stVectI );
MTH3D_M_vSetBaseJVector( &stVectJ );
MTH3D_M_vMulScalarVector( &stVectJ, p_stEAltimap->xDeltaY, &stVectJ );
MTH3D_M_vSetBaseKVector( &stVectK );
for( cVertex = 0, cDepth = 0 ; cDepth < p_stEAltimap->xDepth ; cDepth ++ )
for( cWidth = 0 ; cWidth < p_stEAltimap->xWidth ; cWidth ++, cVertex++ )
{
MTH3D_M_vMulAddVector( &stVertex,
MTH_M_xLongToReal( cWidth ),
&stVectI,
&p_stEAltimap->stOrigin );
MTH3D_M_vMulAddVector( &stVertex,
MTH_M_xLongToReal( cDepth ),
&stVectJ,
&stVertex );
MTH3D_M_vMulAddVector( &stVertex,
p_stEAltimap->d_xHeight[ p_stEAltimap->xWidth * cDepth + cWidth ],
&stVectK,
&stVertex );
GEO_fn_vComputeBoundingSphereOfOneSphereAndOnePoint( _p_stSphereCenter,
_p_xSphereRadius,
_p_stSphereCenter,
*_p_xSphereRadius,
&stVertex );
}
/*--- Restoring the Original Z ---*/
p_stEAltimap->stOrigin.xZ = xOrigZ;
}
#endif /*USE_ALTIMAPS*/
/*--------------------------------------------------------------------------------------*/
/**/
/* Create a sphere that includes perfectly a geometric object.*/
/**/
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_fn_vAddObjectToSphere
(
ACP_tdxHandleOfObject _hGeometricObject,
MTH3D_tdstVector *_p_stSphereCenter,
MTH_tdxReal *_p_xSphereRadius
)
{
MTH3D_tdstVector* p_stVertex;
long i,lElementCounter ;
GEO_tdstElementSpheres *p_stLocalElementSphere;
GEO_tdstElementSprite *p_stLocalElementSprite;
MTH3D_tdstVector stSphereCenterLocal;
MTH_tdxReal xSphereRadiusLocal;
assert(_hGeometricObject != NULL);
p_stVertex=_hGeometricObject->d_stListOfPoints;
for (i=0; i<_hGeometricObject->xNbPoints; i++,p_stVertex++)
{
GEO_fn_vComputeBoundingSphereOfOneSphereAndOnePoint
(
_p_stSphereCenter,
_p_xSphereRadius,
_p_stSphereCenter,
*_p_xSphereRadius,
p_stVertex
);
}
/* Some elements are not included by the point, it's the case for the spheres, the boxes, the sprites & the cones.*/
/* So here some new spheres are added.*/
for (lElementCounter = 0 ; lElementCounter < _hGeometricObject -> xNbElements; lElementCounter ++ )
switch (_hGeometricObject -> d_xListOfElementsTypes [lElementCounter ] )
{
default:break;
case GEO_C_xElementSprites:
p_stLocalElementSprite = ((GEO_tdstElementSprite *) _hGeometricObject -> d_stListOfElements[lElementCounter]);
for ( i = 0 ; i < p_stLocalElementSprite -> xNbSprites; i ++)
{
GEO_fn_vComputeBoundingSphereOfSprite(&p_stLocalElementSprite -> d_stListOfSprites[i],&xSphereRadiusLocal);
stSphereCenterLocal = *(_hGeometricObject->d_stListOfPoints + p_stLocalElementSprite -> d_stListOfSprites[i] . xCenterPoint);
GEO_fn_vComputeBoundingSphereOfTwoSpheres
(
_p_stSphereCenter,
_p_xSphereRadius,
_p_stSphereCenter,
*_p_xSphereRadius,
&stSphereCenterLocal,
xSphereRadiusLocal
);
}
break;
case GEO_C_xElementSpheres:
p_stLocalElementSphere = ((GEO_tdstElementSpheres*) _hGeometricObject -> d_stListOfElements[lElementCounter]);
for ( i= 0 ;i< p_stLocalElementSphere -> xNbSpheres ;i++ )
{
stSphereCenterLocal = *(_hGeometricObject->d_stListOfPoints + p_stLocalElementSphere -> d_stListOfSpheres [i] .xCenterPoint);
xSphereRadiusLocal = p_stLocalElementSphere -> d_stListOfSpheres [i] .xRadius;
GEO_fn_vComputeBoundingSphereOfTwoSpheres
(
_p_stSphereCenter,
_p_xSphereRadius,
_p_stSphereCenter,
*_p_xSphereRadius,
&stSphereCenterLocal,
xSphereRadiusLocal
);
}
break;
case GEO_C_xElementAlignedBoxes:
break;
case GEO_C_xElementCones:
break;
} /* Element switch*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*--------------------------------------------------------------------------------------*/
/**/
/* Find the radius and the center of a sphere geometric object*/
/**/
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void GEO_fn_vGetInfoFromGeometricSphere
(
MTH3D_tdstVector *_p_stSphereCenter,
MTH_tdxReal *_p_xSphereRadius,
ACP_tdxHandleOfObject _hBoundingVolume
)
{
MTH3D_tdstVector* p_stCenter;
struct GEO_tdstIndexedSphere_ * p_stOneSphere;
struct GEO_tdstElementSpheres_ * p_stAllTheSpheres;
p_stAllTheSpheres = (struct GEO_tdstElementSpheres_ *)(_hBoundingVolume->d_stListOfElements[0]);
p_stOneSphere = (struct GEO_tdstIndexedSphere_ *)(p_stAllTheSpheres->d_stListOfSpheres);
p_stCenter = _hBoundingVolume->d_stListOfPoints + p_stOneSphere->xCenterPoint;
MTH3D_M_vCopyVector ( _p_stSphereCenter, p_stCenter );
*_p_xSphereRadius = p_stOneSphere->xRadius;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
/*--------------------------------------------------------------------------------------*/
/**/
/* Creation of a sphere geometric object*/
/**/
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxHandleOfObject GEO_fn_hCreateGeometricSphere
(
void
)
{
MTH3D_tdstVector stVertex;
ACP_tdxHandleOfObject hReturnedObject;
ACP_tdxHandleOfElement hElmt;
MTH3D_M_vNullVector ( &stVertex );
GEO_vCreateGeometricObject(&hReturnedObject, 1/*xNbPoints*/, 1/*xNbElements*/);
GEO_vCreateElementSpheres(hReturnedObject, &hElmt, 1/*one sphere*/);
GEO_vSetPointOfObject (hReturnedObject, &stVertex , 0/*first point*/);
GEO_vSetCenterPointOfIndexedSphere (hReturnedObject, hElmt, 0/*first sphere*/, 0/*first point*/);
GEO_vSetRadiusOfIndexedSphere (hReturnedObject, hElmt, 0/*first sphere*/, 0.0/*xRadius = 0 */);
GEO_vSetGameMaterialOfIndexedSphere (hReturnedObject, hElmt, 0/*first sphere*/, gs_hMaterial);
return hReturnedObject;
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Fill the sphere geometric object structure*/
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vSetGeometricSphere
(
MTH3D_tdstVector *_p_stSphereCenter,
MTH_tdxReal _xSphereRadius,
ACP_tdxHandleOfObject _hBoundingSphere
)
{
GEO_vSetPointOfObject (_hBoundingSphere, _p_stSphereCenter , 0/*first point*/);
GEO_vSetRadiusOfIndexedSphere (_hBoundingSphere, 0/*first elmt*/, 0/*first sphere*/, _xSphereRadius);
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Copy the radius and the center of the geometric object(sphere)*/
/* into the bounding sphere structure*/
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vUpdateBoundingSphere
(
ACP_tdxHandleOfObject _hGeometricSphere,
GEO_tdxHandleToBoundingSphere _hBoundingSphere
)
{
MTH3D_tdstVector stCenter;
MTH_tdxReal xRadius;
GEO_fn_vGetInfoFromGeometricSphere (&stCenter, &xRadius, _hGeometricSphere);
GEO_fn_vSetBoundingSphere( _hBoundingSphere, &stCenter, xRadius);
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Copy the radius and the center of the bounding sphere*/
/* into the geometric object structure*/
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vUpdateGeometricSphere
(
ACP_tdxHandleOfObject _hGeometricSphere,
GEO_tdxHandleToBoundingSphere _hBoundingSphere
)
{
GEO_fn_vSetGeometricSphere
(
GEO_fn_pGetCenterPointOfBoundingSphere(_hBoundingSphere),
GEO_fn_xGetRadiusOfBoundingSphere(_hBoundingSphere),
_hGeometricSphere
);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*--------------------------------------------------------------------------------------*/
/* */
/* Create a Parallel Box*/
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vCreateParallelBox
(
GEO_tdxHandleToParallelBox *_p_hNewBox
)
{
GEO_tdxHandleToParallelBox hBox;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeParallelBox , 0 );
GEO_M_CPAMalloc ( hBox,
GEO_tdxHandleToParallelBox,
sizeof(GEO_tdstParallelBox),
E_uwGEONotEnoughtMemory );
MTH3D_M_vNullVector( &(hBox -> stMinPoint) );
MTH3D_M_vNullVector( &(hBox -> stMaxPoint) );
*_p_hNewBox = hBox;
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Delete a Parallel Box*/
/**/
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_vDeleteParallelBox
(
GEO_tdxHandleToParallelBox _hParallelBox
)
{
GEO_M_CPAFree( _hParallelBox );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*--------------------------------------------------------------------------------------*/
/**/
/* Create a Parallel box and fill the structure*/
/**/
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_fn_vCreateAndInitBoxBoundingVolume
(
GEO_tdxHandleToParallelBox *_p_hNewBox,
MTH3D_tdstVector *_p_stMaxBoxPoint,
MTH3D_tdstVector *_p_stMinBoxPoint
)
{
GEO_fn_vCreateParallelBox( _p_hNewBox );
GEO_fn_vSetMaxPointOfParallelBox( *_p_hNewBox, _p_stMaxBoxPoint );
GEO_fn_vSetMinPointOfParallelBox( *_p_hNewBox, _p_stMinBoxPoint );
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Create the sphere that includes a parallel box*/
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vGetSphereFromParallelBox
(
MTH3D_tdstVector *_p_stCenter,
MTH_tdxReal *_p_xRadius,
MTH3D_tdstVector *_p_stMaxBoxPoint,
MTH3D_tdstVector *_p_stMinBoxPoint
)
{
MTH3D_tdstVector stDist;
MTH3D_M_vAddVector( &stDist, _p_stMinBoxPoint, _p_stMaxBoxPoint );
*_p_xRadius = MTH3D_M_xNormVector( &stDist );
MTH3D_M_vMiddleVector( _p_stCenter, _p_stMinBoxPoint, _p_stMaxBoxPoint );
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Create the parallel box that includes a sphere*/
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vComputeParallelBoxOfSphere
(
MTH3D_tdstVector *_p_stMaxBoxPoint,
MTH3D_tdstVector *_p_stMinBoxPoint,
MTH3D_tdstVector *_p_stCenter,
MTH_tdxReal _p_xSphereRadius
)
{
MTH3D_M_vAddScalarVector(_p_stMaxBoxPoint, _p_xSphereRadius, _p_stCenter);
MTH3D_M_vSubScalarVector(_p_stMinBoxPoint, _p_xSphereRadius, _p_stCenter);
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Create a Parallel box that includes 2 parallel boxes*/
/**/
/*--------------------------------------------------------------------------------------*/
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
)
{
MTH3D_tdstVector stFirstTempVect, stSecondTempVect;
MTH3D_M_vMaxVector(&stFirstTempVect, _p_stMaxFirstBoxPoint, _p_stMinFirstBoxPoint);
MTH3D_M_vMaxVector(&stSecondTempVect, _p_stMaxSecondBoxPoint, _p_stMinSecondBoxPoint)
MTH3D_M_vMaxVector(_p_stMaxReturnedBoxPoint, &stFirstTempVect, &stSecondTempVect);
MTH3D_M_vMinVector(&stFirstTempVect, _p_stMaxFirstBoxPoint, _p_stMinFirstBoxPoint);
MTH3D_M_vMinVector(&stSecondTempVect, _p_stMaxSecondBoxPoint, _p_stMinSecondBoxPoint)
MTH3D_M_vMinVector(_p_stMinReturnedBoxPoint, &stFirstTempVect, &stSecondTempVect);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*--------------------------------------------------------------------------------------*/
/* */
/* Create a bounding sphere*/
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vCreateBoundingSphere
(
GEO_tdxHandleToBoundingSphere *_p_hNewSphere
)
{
GEO_tdxHandleToBoundingSphere hSphere;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeBoundingSphere , 0 );
GEO_M_CPAMalloc ( hSphere,
GEO_tdxHandleToBoundingSphere,
sizeof(GEO_tdstBoundingSphere),
E_uwGEONotEnoughtMemory );
MTH3D_M_vNullVector(&(hSphere->stCenterPoint));
hSphere->xRadius = 0.0;
*_p_hNewSphere = hSphere;
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Fill the bounding sphere structure */
/**/
/*--------------------------------------------------------------------------------------*/
void GEO_fn_vSetBoundingSphere
(
GEO_tdxHandleToBoundingSphere _hBoundingSphere,
MTH3D_tdstVector *_p_stCenterPoint,
MTH_tdxReal _xRadius
)
{
if( _hBoundingSphere)
{
MTH3D_M_vCopyVector( & (_hBoundingSphere->stCenterPoint ), _p_stCenterPoint );
_hBoundingSphere->xRadius = _xRadius;
}
}
/*--------------------------------------------------------------------------------------*/
/**/
/* Create a bounding sphere and fill the structure*/
/**/
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_fn_vCreateAndInitBoundingSphere
(
GEO_tdxHandleToBoundingSphere *_p_hNewSphere,
MTH3D_tdstVector *_p_stCenter,
MTH_tdxReal _xRadius)
{
GEO_fn_vCreateBoundingSphere( _p_hNewSphere );
GEO_fn_vSetBoundingSphere( *_p_hNewSphere, _p_stCenter, _xRadius );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*ENDANNECY TQ}*/

View File

@@ -0,0 +1,384 @@
/*#define GEO_D_DebugMalloc*/
/*#define GEO_D_DebugStatistic*/
#include <assert.h>
#include "cpa_std.h"
#include "acp_base.h"
#define __DeclareGlobalVariableErrGEO_h__
#include "GEO\ErrGEO.h"
#undef __DeclareGlobalVariableErrGEO_h__
#define __DeclareGlobalVariableMmgGEO_h__
#include "GEO\MmgGEO.h"
#undef __DeclareGlobalVariableMmgGEO_h__
#include "GEO\GEOMem.h"
#include "Gli\Init_Gli.h"
#ifndef U64
#include "SCR.h"
#endif
#include "Gam\ZeMem.h"
/* XB 16/06/99 */
#ifdef U64
extern char _lddcodeSegmentStart[], _lddcodeSegmentEnd[];
#endif /* U64 */
/* End XB 16/06/99 */
/* XB 22/06/99 */
#ifndef U64
extern CPA_EXPORT void GLI_TEX_vSignalCurrentMemoryChannel(unsigned char ucCurrentChannel);
extern CPA_EXPORT void GLI_TEX_vKillMemoryChannel(unsigned char ucCurrentChannel);
#endif /* U64 */
/* End XB 22/06/99 */
#if !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS)
void GEO_PrintUsedStaticMemory()
{
Mmg_M_PrintUsedStaticMemoryInModule(GEO);
}
#endif /* !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS) */
/**************************************************************************/
/*XB*/
#ifdef CHECK_MEMORY
void GEO_CheckMemory(void)
{
Mmg_M_CheckMemory(GEO);
}
#endif /* CHECK_MEMORY */
/*End XB*/
/**************************************************************************/
/* XB 02/06/99 */
#ifndef FINAL_VERSION
unsigned long GEO_fn_ulGetUsedStaticMemory(void)
{
return Mmg_M_GetUsedStaticMemory(GEO);
}
#endif /* FINAL_VERSION */
/* End XB 02/06/99 */
void
GEO_xInitGEOError()
{
Erm_M_InitErrMsg(GEO);
Mmg_M_InitMmg(GEO);
/* XB 22/06/99 */
#ifndef U64
GLI_TEX_vSignalCurrentMemoryChannel(E_ucDynamic);
#endif /* U64 */
/* End XB 22/06/99 */
#if defined(_DEBUG)
GEO_g_bDynamicAllocation = GEO_C_CanUseDynamic;
#else
GEO_g_bDynamicAllocation = GEO_C_CanNotUseDynamic;
#endif /* _DEBUG */
}
void
GEO_xCreateMemoryChannel(unsigned char ucChannel,unsigned long ulSize)
{
#ifndef U64
Mmg_M_InitBlockV5_1_0(GEO, ucChannel, ulSize,300000);
#else /* !U64 */
if((ucChannel==ACP_U64_FixMemoryChannel)||(ucChannel==ACP_U64_LevelMemoryChannel))
{
#ifdef CHECK_MEMORY
Mmg_M_InitSpecificBlock(GEO, ucChannel, ulSize, 300000, 8, C_BlockWithFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#else /* CHECK_MEMORY */
Mmg_M_InitSpecificBlock(GEO, ucChannel, ulSize, 300000, 8, C_BlockWithoutFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#endif /* CHECK_MEMORY */
}
else
/* XB 16/06/99 */
if(ucChannel==ACP_U64_LDDMemoryChannel)
{
g_ucUseLDDBloc=1;
#ifdef CHECK_MEMORY
Mmg_M_InitSpecificBlock(GEO, ucChannel, _lddcodeSegmentEnd-_lddcodeSegmentStart-4, 300000, 4, C_BlockWithFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#else /* CHECK_MEMORY */
Mmg_M_InitSpecificBlock(GEO, ucChannel, _lddcodeSegmentEnd-_lddcodeSegmentStart-4, 300000, 4, C_BlockWithoutFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#endif /* CHECK_MEMORY */
g_ucUseLDDBloc=0;
}
else
/* End XB 16/06/99 */
{
#ifdef CHECK_MEMORY
Mmg_M_InitSpecificBlock(GEO, ucChannel, ulSize, 300000, 4, C_BlockWithFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#else /* CHECK_MEMORY */
Mmg_M_InitSpecificBlock(GEO, ucChannel, ulSize, 300000, 4, C_BlockWithoutFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#endif /* CHECK_MEMORY */
}
#endif /* !U64 */
}
void
GEO_xSelectMemoryChannel(unsigned char ucChannel)
{
if ((E_ucGEOMaxBlocksNb < ucChannel)
&& (ucChannel != E_ucDynamic))
{
Erm_M_ClearLastError ( C_ucErmDefaultChannel );
Erm_M_UpdateLastError( GEO, C_ucErmDefaultChannel, E_uwGEOUnAvailableChannel , C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, "Malloc allocation");
}
g_ucGEOMMemMallocMode = ucChannel;
/* XB 22/06/99 */
#ifndef U64
GLI_vSignalCurrentMemoryChannel(ucChannel);
#endif /* U64 */
/* End XB 22/06/99 */
}
void
GEO_xDeleteMemoryChannel(unsigned char ucChannel)
{
if ((E_ucGEOMaxBlocksNb < ucChannel)
&& (ucChannel != E_ucDynamic))
{
Erm_M_ClearLastError ( C_ucErmDefaultChannel );
Erm_M_UpdateLastError( GEO, C_ucErmDefaultChannel, E_uwGEOUnAvailableChannel , C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, "Malloc allocation");
}
/* XB 22/06/99 */
#ifndef U64
GLI_vKillMemoryChannel(ucChannel);
#endif /* U64 */
/* End XB 22/06/99 */
Mmg_M_DeleteBlock(GEO, ucChannel);
}
/**************************************************************************/
/* XB 22/06/99 */
#ifdef U64
void *GEO_PRI_fn_pvMalloc(unsigned long _ulSize)
{
void *pvBuffer=NULL;
if(_ulSize!=0)
{
#ifndef FINAL_VERSION
g_ucModuleIdForDebug=0;
#endif /* FINAL_VERSION */
pvBuffer=Mmg_fn_p_vAlloc4Ch(_ulSize,C_ucMmgDefaultChannel);
#ifndef FINAL_VERSION
g_ucModuleIdForDebug=0xff;
#endif /* FINAL_VERSION */
}
return pvBuffer;
}
#endif /* U64 */
/* End XB 22/06/99 */
/**************************************************************************/
/* XB 22/06/99 */
#ifdef U64
void *GEO_fn_pvMalloc(unsigned long _ulSize)
{
void *pvBuffer;
M_GEOInitMem();
pvBuffer=GEO_PRI_fn_pvMalloc(_ulSize);
memset(pvBuffer,0,_ulSize);
return pvBuffer;
}
#endif /* U64 */
/* End XB 22/06/99 */
/**************************************************************************/
/* XB 22/06/99 */
#ifdef U64
void *GEO_fn_pvMallocAlign8(unsigned long _ulSize)
{
void *pvBuffer=NULL;
Mmg_M_SetModeAlloc4Ch(GEO,g_ucGEOMMemMallocMode+2,C_ucMmgDefaultChannel);
pvBuffer=GEO_PRI_fn_pvMalloc(_ulSize);
memset(pvBuffer,0,_ulSize);
return pvBuffer;
}
#endif /* U64 */
/* End XB 22/06/99 */
/**************************************************************************/
/* XB 22/06/99 */
#ifdef U64
void *GEO_fn_pvMallocLDD(unsigned long _ulSize)
{
void *pvBuffer=NULL;
Mmg_M_SetModeAlloc4Ch(GEO,ACP_U64_LDDMemoryChannel,C_ucMmgDefaultChannel);
pvBuffer=GEO_PRI_fn_pvMalloc(_ulSize);
return pvBuffer;
}
#endif /* U64 */
/* End XB 22/06/99 */
#define GEO_C_NumberOfSource 200
#if defined(_DEBUG)&&(defined(GEO_D_DebugStatistic)||defined(GEO_D_DebugMalloc))
unsigned long GEO_g_ulNumberOfAllocation = 0;
#endif /* _DEBUG&&(GEO_D_DebugStatistic||GEO_D_DebugMalloc) */
#if defined(_DEBUG)&&defined(GEO_D_DebugStatistic)
unsigned long GEO_g_ulMaxSources = 0;
struct GEO_tdstAllocInformation_
{
char GEO_szSourceName[_MAX_PATH];
unsigned long GEO_ulSourceLine;
unsigned short GEO_usSourceBloc;
unsigned long GEO_ulSourceSize;
unsigned long GEO_ulSourceNumberOfAlloc;
unsigned long GEO_ulSourceNumberOfRealloc;
unsigned long GEO_ulSourceNumberOfFree;
} GEO_g_a_stAllocInformation[GEO_C_NumberOfSource];
#endif /*_DEBUG&&GEO_D_DebugStatistic*/
#ifndef _FIRE_DEADCODE_U64_
void
GEO_fn_vMemoryLogFile(void *p_vPointer,unsigned char ucAction,char *szFile,unsigned long ulLine,unsigned long ulSize)
{
#if defined(_DEBUG)&&(defined(GEO_D_DebugStatistic)||defined(GEO_D_DebugMalloc))
/* static unsigned long GEO_g_ulNumberOfAllocation = 0;*/
unsigned short uwBlocId;
void *p_vBeginBloc;
#endif /* _DEBUG&&(GEO_D_DebugStatistic||GEO_D_DebugMalloc) */
#if defined(_DEBUG)&&defined(GEO_D_DebugStatistic)
unsigned long i;
#endif /*_DEBUG&&GEO_D_DebugStatistic*/
#if defined(_DEBUG)&&defined(GEO_D_DebugMalloc)
FILE *p_stFile;
char szFileName[30];
#endif /* _DEBUG && GEO_D_DebugMalloc */
#if defined(_DEBUG)&&(defined(GEO_D_DebugStatistic)||defined(GEO_D_DebugMalloc))
Mmg_fn_vWhereIs((void*)p_vPointer,&uwBlocId,&p_vBeginBloc);
if (ucAction==GEO_C_ActionMalloc)
GEO_g_ulNumberOfAllocation++;
else if (ucAction==GEO_C_ActionFree)
GEO_g_ulNumberOfAllocation--;
#endif /* _DEBUG&&(GEO_D_DebugStatistic||GEO_D_DebugMalloc) */
#if defined(_DEBUG)&&defined(GEO_D_DebugStatistic)
for (i=0;i<GEO_g_ulMaxSources&&(stricmp(szFile,GEO_g_a_stAllocInformation[i].GEO_szSourceName)||GEO_g_a_stAllocInformation[i].GEO_ulSourceLine!=ulLine||GEO_g_a_stAllocInformation[i].GEO_usSourceBloc!=uwBlocId);i++);
if (i==GEO_g_ulMaxSources)
{
strcpy(GEO_g_a_stAllocInformation[i].GEO_szSourceName,szFile);
GEO_g_a_stAllocInformation[i].GEO_ulSourceLine=ulLine;
GEO_g_a_stAllocInformation[i].GEO_usSourceBloc = uwBlocId;
GEO_g_a_stAllocInformation[i].GEO_ulSourceSize=0;
GEO_g_a_stAllocInformation[i].GEO_ulSourceNumberOfAlloc=0;
GEO_g_a_stAllocInformation[i].GEO_ulSourceNumberOfRealloc=0;
GEO_g_a_stAllocInformation[i].GEO_ulSourceNumberOfFree=0;
GEO_g_ulMaxSources++;
if (GEO_g_ulMaxSources>=GEO_C_NumberOfSource)
Erm_M_UpdateLastError( GEO, C_ucErmDefaultChannel,E_uwGEOIncreaseNumberOfSource, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);
}
if (ucAction==GEO_C_ActionMalloc)
{
GEO_g_a_stAllocInformation[i].GEO_ulSourceSize+=ulSize;
GEO_g_a_stAllocInformation[i].GEO_ulSourceNumberOfAlloc++;
}
else if (ucAction==GEO_C_ActionRealloc)
{
GEO_g_a_stAllocInformation[i].GEO_ulSourceSize+=ulSize;
GEO_g_a_stAllocInformation[i].GEO_ulSourceNumberOfRealloc++;
}
else if (ucAction==GEO_C_ActionFree)
{
GEO_g_a_stAllocInformation[i].GEO_ulSourceNumberOfFree++;
}
#endif /*_DEBUG&&GEO_D_DebugStatistic*/
#if defined(_DEBUG)&&defined(GEO_D_DebugMalloc)
sprintf(szFileName,"Mem%04x.log",uwBlocId);
if ((p_stFile = fopen(szFileName,"rt"))!=NULL)
fclose(p_stFile);
else
GEO_g_ulNumberOfAllocation = 0;
p_stFile = fopen(szFileName,"at");
if (p_stFile!=NULL)
{
if (ucAction==GEO_C_ActionMalloc)
fprintf(p_stFile,"Malloc : Number=#%010d, Block=#%04x, Offset=%p (%20s,%10d)\n",GEO_g_ulNumberOfAllocation,uwBlocId,(long)p_vPointer-(long)p_vBeginBloc,szFile,ulLine);
else if (ucAction==GEO_C_ActionRealloc)
fprintf(p_stFile,"Realloc : Number=#%010d, Block=#%04x, Offset=%p (%20s,%10d)\n",GEO_g_ulNumberOfAllocation,uwBlocId,(long)p_vPointer-(long)p_vBeginBloc,szFile,ulLine);
else if (ucAction==GEO_C_ActionFree)
fprintf(p_stFile,"Free : Number=#%010d, Block=#%04x, Offset=%p (%20s,%10d)\n",GEO_g_ulNumberOfAllocation,uwBlocId,(long)p_vPointer-(long)p_vBeginBloc,szFile,ulLine);
fclose(p_stFile);
}
#endif /* _DEBUG && GEO_D_DebugMalloc */
}
int GEO_fn_vMemorySort(const void *elem1, const void *elem2)
{
#if defined(_DEBUG)&&defined(GEO_D_DebugStatistic)
return(((struct GEO_tdstAllocInformation_*)elem2)->GEO_ulSourceSize-((struct GEO_tdstAllocInformation_*)elem1)->GEO_ulSourceSize);
#else
return(0);
#endif /*_DEBUG&&GEO_D_DebugStatistic*/
}
void
GEO_fn_vPrintMemoryInformation(void)
{
#if defined(_DEBUG)&&defined(GEO_D_DebugStatistic)
FILE *p_stFile;
unsigned long i;
qsort(GEO_g_a_stAllocInformation,GEO_g_ulMaxSources, sizeof(struct GEO_tdstAllocInformation_),GEO_fn_vMemorySort);
if ((p_stFile = fopen("GeoMemInfo.log","wt"))!=NULL)
{
for (i=0;i<GEO_g_ulMaxSources;i++)
{
fprintf(p_stFile,"%s (line %d, bloc %04x) :\n",GEO_g_a_stAllocInformation[i].GEO_szSourceName,GEO_g_a_stAllocInformation[i].GEO_ulSourceLine,GEO_g_a_stAllocInformation[i].GEO_usSourceBloc);
fprintf(p_stFile," Number of allocations : %d\n",GEO_g_a_stAllocInformation[i].GEO_ulSourceNumberOfAlloc);
fprintf(p_stFile," Number of reallocations : %d\n",GEO_g_a_stAllocInformation[i].GEO_ulSourceNumberOfRealloc);
fprintf(p_stFile," Number of free : %d\n",GEO_g_a_stAllocInformation[i].GEO_ulSourceNumberOfFree);
fprintf(p_stFile," Total size of allocation : %d\n",GEO_g_a_stAllocInformation[i].GEO_ulSourceSize);
}
fprintf(p_stFile,"\nTotal number of allocation : %d\n",GEO_g_ulNumberOfAllocation);
}
fclose(p_stFile);
#endif /*_DEBUG&&GEO_D_DebugStatistic*/
}
unsigned char
GEO_fn_ucGetBlocNumberOf(void *p_vPointer)
{
unsigned char ucReturn;
unsigned short uwBlocId;
void *p_vBeginBloc;
Mmg_fn_vWhereIs((void*)p_vPointer,&uwBlocId,&p_vBeginBloc);
ucReturn = (unsigned char)(uwBlocId&0x00ff);
return(ucReturn);
}
#endif /* _FIRE_DEADCODE_U64_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,238 @@
/**********************************************************************************************/
/* Name: GeoObj2.c*/
/* Code: Philippe Vimont*/
/* Modif : 30 May 1997 - Guenaele - remove old D3D*/
/**********************************************************************************************/
#include <assert.h>
#include "cpa_std.h"
#include "acp_base.h"
#include "mth.h"
#include "GEO.h"
#include "gmt.h"
#include "mec.h"
#include "Col\OctreeGO.h"
/*-----------------------------------------------------------------------------
* Description : Macro to update min and max point with a given point
*-----------------------------------------------------------------------------
* Input : a pointer to the min point
* a pointer to the max point
* a pointer to the given point
*-----------------------------------------------------------------------------
* Creation date : 20/02/98 Author : Marc Trabucato
*---------------------------------------------------------------------------*/
void GEO_fn_vUpdateMinMaxBoxWithPoint(MTH3D_tdstVector * p_stMinPoint,MTH3D_tdstVector * p_stMaxPoint,MTH3D_tdstVector * p_stPoint )
{
MTH3D_tdstVector *p_stPointToTest = p_stPoint;
if( MTH3D_M_xGetXofVector( p_stPointToTest ) < MTH3D_M_xGetXofVector( p_stMinPoint ) )
{
MTH3D_M_vSetXofVector( p_stMinPoint, MTH3D_M_xGetXofVector( p_stPointToTest ) );
}
else if( MTH3D_M_xGetXofVector( p_stPointToTest ) > MTH3D_M_xGetXofVector( p_stMaxPoint ) )
{
MTH3D_M_vSetXofVector( p_stMaxPoint, MTH3D_M_xGetXofVector( p_stPointToTest ) );
}
if( MTH3D_M_xGetYofVector( p_stPointToTest ) < MTH3D_M_xGetYofVector( p_stMinPoint ) )
{
MTH3D_M_vSetYofVector( p_stMinPoint, MTH3D_M_xGetYofVector( p_stPointToTest ) );
}
else if( MTH3D_M_xGetYofVector( p_stPointToTest ) > MTH3D_M_xGetYofVector( p_stMaxPoint ) )
{
MTH3D_M_vSetYofVector( p_stMaxPoint, MTH3D_M_xGetYofVector( p_stPointToTest ) );
}
if( MTH3D_M_xGetZofVector( p_stPointToTest ) < MTH3D_M_xGetZofVector( p_stMinPoint ) )
{
MTH3D_M_vSetZofVector( p_stMinPoint, MTH3D_M_xGetZofVector( p_stPointToTest ) );
}
else if( MTH3D_M_xGetZofVector( p_stPointToTest ) > MTH3D_M_xGetZofVector( p_stMaxPoint ) )
{
MTH3D_M_vSetZofVector( p_stMaxPoint, MTH3D_M_xGetZofVector( p_stPointToTest ) );
}
}
/*-----------------------------------------------------------------------------
* Description : Compute given bounding volume
*-----------------------------------------------------------------------------
* Input : an object
* the index of bounding volume to compute
*-----------------------------------------------------------------------------
* Creation date : 20/02/98 Author : Marc Trabucato
*---------------------------------------------------------------------------*/
void GEO_vComputeObjectParallelBox( ACP_tdxHandleOfObject hObject, ACP_tdxIndex xParallelBox )
{
GEO_tdstElementIndexedTriangles *p_stETIT;
//XB99/04/27
#ifndef U64
GEO_tdstElementFaceMapDescriptors *p_stEFMD;
#endif U64
//End XB99/04/27
GEO_tdstElementPoints *p_stEIP;
GEO_tdstElementLines *p_stEL;
GEO_tdstElementSpheres *p_stES;
GEO_tdstElementAlignedBoxes *p_stEAB;
GEO_tdstElementCones *p_stEC;
GEO_tdstElementSprite *p_stESt;
ACP_tdxIndex xIndexElement , xIndexInElement;
MTH3D_tdstVector *p_stMinPoint , *p_stMaxPoint;
GEO_tdxHandleToParallelBox hParallelBox;
BOOL bInit;
bInit = FALSE;
hParallelBox = GEO_hGetParallelBox( hObject, xParallelBox );
if( hParallelBox == NULL ) return;
p_stMinPoint = & hParallelBox -> stMinPoint;
p_stMaxPoint = & hParallelBox -> stMaxPoint;
for ( xIndexElement = 0 ; xIndexElement < hObject -> xNbElements ; xIndexElement++ )
{
if( GEO_xGetParallelBoxIndexOfElement( hObject, xIndexElement ) == xParallelBox )
{
switch ( hObject -> d_xListOfElementsTypes[ xIndexElement ] )
{
case GEO_C_xElementIndexedTriangles:
p_stETIT = (GEO_tdstElementIndexedTriangles*) ( hObject -> d_stListOfElements[ xIndexElement ] );
if( !bInit && p_stETIT -> xNbFaces )
{
MTH3D_M_vCopyVector( p_stMinPoint, hObject -> d_stListOfPoints + p_stETIT -> d_stListOfFacesTripled [ 0 ] . a3_xIndex[0] );
MTH3D_M_vCopyVector( p_stMaxPoint, hObject -> d_stListOfPoints + p_stETIT -> d_stListOfFacesTripled [ 0 ] . a3_xIndex[0] );
bInit = TRUE;
}
for ( xIndexInElement = 0 ; xIndexInElement < p_stETIT -> xNbFaces ; xIndexInElement++ )
{
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stETIT -> d_stListOfFacesTripled [ xIndexInElement ] . a3_xIndex[0] );
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stETIT -> d_stListOfFacesTripled [ xIndexInElement ] . a3_xIndex[1] );
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stETIT -> d_stListOfFacesTripled [ xIndexInElement ] . a3_xIndex[2] );
}
break;
//XB99/04/27
#ifndef U64
case GEO_C_xElementFaceMapDescriptors:
p_stEFMD = (GEO_tdstElementFaceMapDescriptors*) ( hObject -> d_stListOfElements[ xIndexElement ] );
if( !bInit && p_stEFMD -> xNbFaces )
{
MTH3D_M_vCopyVector( p_stMinPoint, hObject -> d_stListOfPoints + p_stEFMD -> d_stListOfFacesQuadrupled [ 0 ] . stFaceTripled . a3_xIndex[0] );
MTH3D_M_vCopyVector( p_stMaxPoint, hObject -> d_stListOfPoints + p_stEFMD -> d_stListOfFacesQuadrupled [ 0 ] . stFaceTripled . a3_xIndex[0] );
bInit = TRUE;
}
for ( xIndexInElement = 0 ; xIndexInElement < p_stEFMD -> xNbFaces ; xIndexInElement++ )
{
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEFMD -> d_stListOfFacesQuadrupled [ xIndexInElement ] . stFaceTripled . a3_xIndex[0] );
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEFMD -> d_stListOfFacesQuadrupled [ xIndexInElement ] . stFaceTripled . a3_xIndex[1] );
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEFMD -> d_stListOfFacesQuadrupled [ xIndexInElement ] . stFaceTripled . a3_xIndex[2] );
}
break;
#endif U64
//End XB99/04/27
case GEO_C_xElementSprites:
p_stESt = (GEO_tdstElementSprite*) ( hObject -> d_stListOfElements[ xIndexElement ] );
#ifndef D_THROW_COMPLEX_SPRITE
if( !bInit && p_stESt -> xNbSprites )
{
MTH3D_M_vCopyVector( p_stMinPoint, hObject -> d_stListOfPoints + p_stESt -> d_stListOfSprites [ 0 ] . xCenterPoint );
MTH3D_M_vCopyVector( p_stMaxPoint, hObject -> d_stListOfPoints + p_stESt -> d_stListOfSprites [ 0 ] . xCenterPoint );
bInit = TRUE;
}
for ( xIndexInElement = 0 ; xIndexInElement < p_stESt -> xNbSprites ; xIndexInElement++ )
{
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stESt -> d_stListOfSprites [ xIndexInElement ] . xCenterPoint );
}
#else
if( !bInit )
{
MTH3D_M_vCopyVector( p_stMinPoint, hObject -> d_stListOfPoints + p_stESt -> xCenterPoint );
MTH3D_M_vCopyVector( p_stMaxPoint, hObject -> d_stListOfPoints + p_stESt -> xCenterPoint );
bInit = TRUE;
}
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stESt -> xCenterPoint );
#endif /* D_THROW_COMPLEX_SPRITE */
break;
//XB99/04/27
#ifndef U64
case GEO_C_xElementTMeshes:
break;
#endif U64
//End XB99/04/27
case GEO_C_xElementPoints:
p_stEIP = (GEO_tdstElementPoints*) ( hObject -> d_stListOfElements[ xIndexElement ] );
if( !bInit && p_stEIP -> xNbPoints )
{
MTH3D_M_vCopyVector( p_stMinPoint, hObject -> d_stListOfPoints + p_stEIP -> d_xListOfPointIndex [ 0 ] );
MTH3D_M_vCopyVector( p_stMaxPoint, hObject -> d_stListOfPoints + p_stEIP -> d_xListOfPointIndex [ 0 ] );
bInit = TRUE;
}
for ( xIndexInElement = 0 ; xIndexInElement < p_stEIP -> xNbPoints ; xIndexInElement++ )
{
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEIP -> d_xListOfPointIndex [ xIndexInElement ] );
}
break;
case GEO_C_xElementLines:
p_stEL = (GEO_tdstElementLines*) ( hObject -> d_stListOfElements[ xIndexElement ] );
if( !bInit && p_stEL -> xNbLines )
{
MTH3D_M_vCopyVector( p_stMinPoint, hObject -> d_stListOfPoints + p_stEL -> d_stListOfLineIndex [ 0 ] . a2_xIndex[ 0 ] );
MTH3D_M_vCopyVector( p_stMaxPoint, hObject -> d_stListOfPoints + p_stEL -> d_stListOfLineIndex [ 0 ] . a2_xIndex[ 0 ] );
bInit = TRUE;
}
for ( xIndexInElement = 0 ; xIndexInElement < p_stEL -> xNbLines ; xIndexInElement++ )
{
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEL -> d_stListOfLineIndex [ xIndexInElement ] . a2_xIndex[ 0 ] );
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEL -> d_stListOfLineIndex [ xIndexInElement ] . a2_xIndex[ 1 ] );
}
break;
case GEO_C_xElementSpheres:
p_stES = (GEO_tdstElementSpheres*) ( hObject -> d_stListOfElements[ xIndexElement ] );
if( !bInit && p_stES -> xNbSpheres )
{
MTH3D_M_vCopyVector( p_stMinPoint, hObject -> d_stListOfPoints + p_stES -> d_stListOfSpheres [ 0 ] . xCenterPoint );
MTH3D_M_vCopyVector( p_stMaxPoint, hObject -> d_stListOfPoints + p_stES -> d_stListOfSpheres [ 0 ] . xCenterPoint );
bInit = TRUE;
}
for ( xIndexInElement = 0 ; xIndexInElement < p_stES -> xNbSpheres ; xIndexInElement++ )
{
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stES -> d_stListOfSpheres [ xIndexInElement ] . xCenterPoint );
}
break;
case GEO_C_xElementAlignedBoxes:
p_stEAB = (GEO_tdstElementAlignedBoxes*) ( hObject -> d_stListOfElements[ xIndexElement ] );
if( !bInit && p_stEAB -> xNbAlignedBoxes )
{
MTH3D_M_vCopyVector( p_stMinPoint, hObject -> d_stListOfPoints + p_stEAB -> d_stListOfAlignedBoxes [ 0 ] . xMinPoint );
MTH3D_M_vCopyVector( p_stMaxPoint, hObject -> d_stListOfPoints + p_stEAB -> d_stListOfAlignedBoxes [ 0 ] . xMinPoint );
bInit = TRUE;
}
for ( xIndexInElement = 0 ; xIndexInElement < p_stEAB -> xNbAlignedBoxes ; xIndexInElement++ )
{
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEAB -> d_stListOfAlignedBoxes [ xIndexInElement ] . xMinPoint );
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEAB -> d_stListOfAlignedBoxes [ xIndexInElement ] . xMaxPoint );
}
break;
case GEO_C_xElementCones:
p_stEC = (GEO_tdstElementCones*) ( hObject -> d_stListOfElements[ xIndexElement ] );
if( !bInit && p_stEC -> xNbCones )
{
MTH3D_M_vCopyVector( p_stMinPoint, hObject -> d_stListOfPoints + p_stEC -> d_stListOfCones [ 0 ] . xTopPoint );
MTH3D_M_vCopyVector( p_stMaxPoint, hObject -> d_stListOfPoints + p_stEC -> d_stListOfCones [ 0 ] . xTopPoint );
bInit = TRUE;
}
for ( xIndexInElement = 0 ; xIndexInElement < p_stEC -> xNbCones ; xIndexInElement++ )
{
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEC -> d_stListOfCones [ xIndexInElement ] . xTopPoint );
GEO_fn_vUpdateMinMaxBoxWithPoint( p_stMinPoint, p_stMaxPoint, hObject -> d_stListOfPoints + p_stEC -> d_stListOfCones [ xIndexInElement ] . xBasePoint );
}
break;
//XB99/04/27
#ifndef U64
case GEO_C_xElementAltimap:
break;
#endif U64
//End XB99/04/27
}
}
}
}

View File

@@ -0,0 +1,111 @@
/* (c) Ubi R&D 1997*/
/* See Alain Robin for any comment or question*/
/****************************************************************************/
/* INCLUDES */
/****************************************************************************/
#include "acp_base.h"
#include "cpa_std.h"
/*
#define BOOL ACP_tdxBool
*/
#include "SCR.h"
/*#include "BIN.h"*/
#include "DPT.h"
#include "SPO/Specif/HieLoad.h"
#include "GEO/GeoObj.h"
#include "GLI/LinkTab.h"
#include "GEO/LoadBin.h"
#include "Geo/GeoMem.h"
/****************************************************************************/
/* GLOBAL VARIABLES */
/****************************************************************************/
/*
ACP_tdxBool g_bUseMob=TRUE;
char* GEO_g_p_cLoadBuffer=NULL;
extern SCR_tdst_Link_Table stLinkTableOfGeometric;
extern ACP_tdxBool g_bUseBinaryData;
DWORD dwTotal2=0; // For Benchmark
*/
/*----------------------------------------------------------------------------
// Description : GEO_fn_p_stLoadIndexedTriangle
// Loads an indexed triangle with script file
------------------------------------------------------------------------------
// Methods : Nothing to say
------------------------------------------------------------------------------
// Input : _szSectionName
// Output : The pointer to the indexed triangle
------------------------------------------------------------------------------
// Creation date : Aug 97 Author: Alain Robin
------------------------------------------------------------------------------
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
GEO_tdstElementIndexedTriangles* GEO_fn_p_stLoadIndexedTriangle(char* _szSectionName)
{
SCR_tdst_Cxt_Values *p_stValues ;
SCR_tdst_Link_Value *p_stLinkValue;
unsigned long ulResult;
unsigned int uiPos;
uiPos = 0;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(GLI_p_stGetLinkTableOfElementIndexedTriangle()));
while(p_stLinkValue)
{
if(!strcmpi(SCR_M_p_sz_Link_GetKey(p_stLinkValue) + SCR_M_ul_Link_GetAdditionalLong(p_stLinkValue,1),_szSectionName))
break;
uiPos++;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(GLI_p_stGetLinkTableOfElementIndexedTriangle()));
}
/* p_stLinkValue=BIN_fn_p_stSearchShortKey(GLI_p_stGetLinkTableOfElementIndexedTriangle(),
_szSectionName);*/
if(p_stLinkValue==NULL)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_szSectionName,SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
ulResult = SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0);
return (GEO_tdstElementIndexedTriangles*)ulResult;
}
else
return NULL;
}
else return (GEO_tdstElementIndexedTriangles*)SCR_M_ul_Link_GetValue(p_stLinkValue);
}
/*----------------------------------------------------------------------------
// Description : GEO_fn_hLoadGeometricObject
// Load a geometric object from an ascii script or from a binary script
------------------------------------------------------------------------------
// Methods : Nothing to say
------------------------------------------------------------------------------
// Input : _szSectionName : Name of the section to load
// Output : Handle to the geometric element loaded
------------------------------------------------------------------------------
// Creation date : Jul 97 Author: Alain Robin
------------------------------------------------------------------------------
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
ACP_tdxHandleOfObject GEO_fn_hLoadGeometricObject(char* _szSectionName, unsigned short _uwScriptMode)
{
ACP_tdxHandleOfObject hGeometricObject=NULL;
SCR_tdst_Cxt_Values *p_stVal=NULL;
/* Use script */
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_szSectionName, _uwScriptMode);
hGeometricObject = (ACP_tdxHandleOfObject)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
return hGeometricObject;
}

View File

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

View File

@@ -0,0 +1,249 @@
#ifndef D_THROW_COMPLEX_SPRITE
#include "cpa_std.h"
#include "acp_base.h"
#include "mth.h"
#include "GEO.h"
#include "gmt.h"
#include "mec.h"
/**********************************************************************************************/
/* Name: GEO_xCreateSprite */
/* Goal: create a sprite =:-)*/
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void
GEO_vCreateRotativSprite ( ACP_tdxHandleOfSprite *p_hSprite , ACP_tdxIndex xNbAngles)
{
long liCount;
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeRotativeSprite , 0 );
GEO_M_CPAMalloc (
*p_hSprite ,
GEO_tdstSprite * ,
sizeof ( GEO_tdstSprite ) ,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc (
(*p_hSprite) -> d_xThresholds ,
MTH_tdxReal * ,
sizeof ( MTH_tdxReal ) * xNbAngles ,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc (
(*p_hSprite) -> d_xSpriteDrawMode ,
short * ,
sizeof ( short ) * xNbAngles,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc (
(*p_hSprite) -> d_hMaterial ,
/*ACP_tdxHandleOfMaterial*/ GMT_tdxHandleToGameMaterial * ,
sizeof ( /*ACP_tdxHandleOfMaterial*/ GMT_tdxHandleToGameMaterial ) * xNbAngles,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc (
(*p_hSprite) -> d_xSizeOfSprite ,
MTH2D_tdstVector *,
sizeof ( MTH2D_tdstVector ) * xNbAngles ,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc (
(*p_hSprite) -> d_xDisplacementOfSprite ,
MTH2D_tdstVector * ,
sizeof ( MTH2D_tdstVector ) * xNbAngles ,
E_uwGEONotEnoughtMemory );
MMG_fn_vEndMemoryInfo();
for (liCount = 0; liCount < xNbAngles ; liCount ++)
{
(*p_hSprite) -> d_hMaterial [liCount] = NULL;
(*p_hSprite) -> d_xSpriteDrawMode [liCount] =
GEO_C_lSpriteDrawMode2DRotativ ;
(*p_hSprite) -> d_xSizeOfSprite [liCount] . xX = 1.00f;
(*p_hSprite) -> d_xSizeOfSprite [liCount] . xY = 1.00f;
(*p_hSprite) -> d_xDisplacementOfSprite [liCount] . xX = 0.0f;
(*p_hSprite) -> d_xDisplacementOfSprite [liCount] . xY = 0.0f;
}
(*p_hSprite) -> xNbSprites = xNbAngles ;
}
/**********************************************************************************************/
/* Name: GEO_xSetMaterialOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/* Modif:Alain Robin : Use game material*/
/**********************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void
GEO_vSetMaterialOfSprite ( ACP_tdxHandleOfSprite hSprite ,
ACP_tdxHandleOfMaterial hMaterial ,
ACP_tdxIndex xSpriteNumber)
{
GMT_fn_vSetVisualMaterial(hSprite -> d_hMaterial [ xSpriteNumber ],hMaterial);
}
/**********************************************************************************************/
/* Name: GEO_xGetMaterialOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/* Modif:A.R. : Use GMT*/
/**********************************************************************************************/
void
GEO_vGetMaterialOfSprite ( ACP_tdxHandleOfSprite hSprite ,
ACP_tdxHandleOfMaterial *p_hMaterial ,
ACP_tdxIndex xSpriteNumber)
{
*p_hMaterial = GMT_fn_hGetVisualMaterial(hSprite -> d_hMaterial [ xSpriteNumber ]) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**********************************************************************************************/
/* Name: GEO_xSetGameMaterialOfSprite */
/* Goal: */
/* Code: A.R. / 1.0*/
/**********************************************************************************************/
void
GEO_vSetGameMaterialOfSprite ( ACP_tdxHandleOfSprite hSprite ,
GMT_tdxHandleToGameMaterial hMaterial ,
ACP_tdxIndex xSpriteNumber)
{
hSprite -> d_hMaterial [ xSpriteNumber ] = hMaterial ;
}
/**********************************************************************************************/
/* Name: GEO_xGetGameMaterialOfSprite */
/* Goal: */
/* Code: A.R. / 1.0*/
/**********************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void
GEO_vGetGameMaterialOfSprite ( ACP_tdxHandleOfSprite hSprite ,
GMT_tdxHandleToGameMaterial *p_hMaterial ,
ACP_tdxIndex xSpriteNumber)
{
*p_hMaterial = hSprite -> d_hMaterial [ xSpriteNumber ] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**********************************************************************************************/
/* Name: GEO_xSetThresholdOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void
GEO_vSetThresholdOfSprite ( ACP_tdxHandleOfSprite hSprite ,
MTH_tdxReal xThresholds,
ACP_tdxIndex xSpriteNumber)
{
hSprite -> d_xThresholds [ xSpriteNumber ] = xThresholds;
}
/**********************************************************************************************/
/* Name: GEO_xGetThresholdOfSprite*/
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void
GEO_vGetThresholdOfSprite ( ACP_tdxHandleOfSprite hSprite ,
MTH_tdxReal *p_xThresholds,
ACP_tdxIndex xSpriteNumber)
{
*p_xThresholds = hSprite -> d_xThresholds [ xSpriteNumber ] ;
}
/**********************************************************************************************/
/* Name: GEO_xGetModeOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void
GEO_vGetModeOfSprite ( ACP_tdxHandleOfSprite hSprite ,
short *p_sMode,
ACP_tdxIndex xSpriteNumber)
{
*p_sMode = hSprite -> d_xSpriteDrawMode [ xSpriteNumber ] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**********************************************************************************************/
/* Name: GEO_xSetModeOfSprite */
/* Goal: See "ACP_sprites.doc"*/
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void
GEO_vSetModeOfSprite ( ACP_tdxHandleOfSprite hSprite ,
short sMode,
ACP_tdxIndex xSpriteNumber)
{
hSprite -> d_xSpriteDrawMode [ xSpriteNumber ] = sMode ;
}
/**********************************************************************************************/
/* Name: GEO_xGetModeOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void
GEO_vGetSizeOfSprite ( ACP_tdxHandleOfSprite hSprite ,
MTH2D_tdstVector *p_stSize,
ACP_tdxIndex xSpriteNumber)
{
*p_stSize = hSprite -> d_xSizeOfSprite[ xSpriteNumber ] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**********************************************************************************************/
/* Name: GEO_xSetModeOfSprite */
/* Goal: See "ACP_sprites.doc"*/
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void
GEO_vSetSizeOfSprite ( ACP_tdxHandleOfSprite hSprite ,
MTH2D_tdstVector *p_stSize,
ACP_tdxIndex xSpriteNumber)
{
hSprite -> d_xSizeOfSprite[ xSpriteNumber ] = *p_stSize;
}
/**********************************************************************************************/
/* Name: GEO_xGetDisplacementOfSprite */
/* Goal: */
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void
GEO_vGetDisplacementOfSprite ( ACP_tdxHandleOfSprite hSprite ,
MTH2D_tdstVector *p_stDis,
ACP_tdxIndex xSpriteNumber)
{
*p_stDis = hSprite -> d_xDisplacementOfSprite [ xSpriteNumber ] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**********************************************************************************************/
/* Name: GEO_xGetDisplacementOfSprite */
/* Goal: See "ACP_sprites.doc"*/
/* Code: Philippe Vimont / 1.0*/
/**********************************************************************************************/
void
GEO_vSetDisplacementOfSprite ( ACP_tdxHandleOfSprite hSprite ,
MTH2D_tdstVector *p_stDis,
ACP_tdxIndex xSpriteNumber)
{
hSprite -> d_xDisplacementOfSprite [ xSpriteNumber ] = *p_stDis;
}
#endif /* D_THROW_COMPLEX_SPRITE */