reman3/Rayman_X/cpa/tempgrp/GEO/Element.c

2742 lines
113 KiB
C

/*
////////////////////////////////////////////////////////////////////////////////
// Description : Element.c
//
////////////////////////////////////////////////////////////////////////////////
// Modif : 30 May 1997 - Guenaele - remove old D3D gestion
//
////////////////////////////////////////////////////////////////////////////////
// Creation date :
////////////////////////////////////////////////////////////////////////////////
*/
#include <assert.h>
#include "acp_base.h"
#include "mth.h"
#include "GEO.h"
#include "Gmt.h"
/*************************************************************************************************************/
/* SPRITES*/
/*************************************************************************************************************/
#ifndef _FIRE_DEADCODE_U64_
/* ANNECY MT 20/02/98 {*/
void GEO_vCreateElementSprite (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement *p_hElement ,
ACP_tdxIndex xNbSprites)
{
ACP_tdxIndex xElementToBuild;
GEO_tdstGeometricObject *p_xObjectToSet;
p_xObjectToSet = hObject;
/*Find the element To Create*/
for (xElementToBuild=0;
xElementToBuild<p_xObjectToSet->xNbElements;
xElementToBuild++)
if (hObject->
d_xListOfElementsTypes[xElementToBuild]==GEO_C_xElementNULL)
break;
/*More than p_xObjectToSet->xNbElements have been created so <-*/
if (xElementToBuild==p_xObjectToSet->xNbElements) return;
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild]=GEO_C_xElementSprites;
*p_hElement = xElementToBuild;
p_xObjectToSet->d_stListOfElements[xElementToBuild] = (void*) GEO_p_stAllocElementSprite( xNbSprites );
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_
GEO_tdstElementSprite *GEO_p_stAllocElementSprite( ACP_tdxIndex xNbSprites )
{
GEO_tdstElementSprite *p_stLocalElement;
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementSprite , 0 );
GEO_M_CPAMalloc (
p_stLocalElement ,
GEO_tdstElementSprite *,
sizeof ( GEO_tdstElementSprite ) ,
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfSprites ,
GEO_tdstIndexedSprite * ,
sizeof ( GEO_tdstIndexedSprite ) * xNbSprites ,
E_uwGEONotEnoughtMemory ) ;
MMG_fn_vEndMemoryInfo();
p_stLocalElement -> xNbSprites = xNbSprites;
p_stLocalElement -> xIndexOfParallelBox = GEO_C_xNoParallelBox;
/*ANNECY VL PRT 18/03/98{*/
p_stLocalElement -> cFastDraw = 0;
/*ENDANNECY VL}*/
return p_stLocalElement;
}
/* END ANNECY MT }*/
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_
void GEO_vSetSizeOfIndexedSprite (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfSprite,
MTH2D_tdstVector *p_stSize)
{
GEO_tdstElementSprite *p_stLocalElement;
p_stLocalElement =
( GEO_tdstElementSprite *)
hObject ->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfSprites [ xIndexOfSprite ] . stSize = *p_stSize;
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_
void GEO_vGetSizeOfIndexedSprite (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfSprite,
MTH2D_tdstVector *p_stSize)
{
GEO_tdstElementSprite *p_stLocalElement;
p_stLocalElement =
( GEO_tdstElementSprite *)
hObject ->
d_stListOfElements[hElement];
*p_stSize = p_stLocalElement -> d_stListOfSprites [ xIndexOfSprite ] . stSize;
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_
void GEO_vSetCenterPointOfIndexedSprite (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfSprite,
ACP_tdxIndex xCenterPoint)
{
GEO_tdstElementSprite *p_stLocalElement;
p_stLocalElement =
( GEO_tdstElementSprite *)
hObject ->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfSprites [ xIndexOfSprite ] . xCenterPoint = xCenterPoint;
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_
void GEO_vGetCenterPointOfIndexedSprite ( ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfSprite,
ACP_tdxIndex *p_xCenterPoint)
{
GEO_tdstElementSprite *p_stLocalElement;
p_stLocalElement =
( GEO_tdstElementSprite *)
hObject ->
d_stListOfElements[hElement];
*p_xCenterPoint = p_stLocalElement -> d_stListOfSprites [ xIndexOfSprite ] . xCenterPoint;
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_
void GEO_vSetHandleOfIndexedSprite (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfSprite,
ACP_tdxHandleOfSprite hSprite)
{
GEO_tdstElementSprite *p_stLocalElement;
p_stLocalElement =
( GEO_tdstElementSprite *)
hObject ->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfSprites [ xIndexOfSprite ] . hSprite = hSprite;
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_
void GEO_vGetHandleOfIndexedSprite (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfSprite,
ACP_tdxHandleOfSprite *p_hSprite)
{
GEO_tdstElementSprite *p_stLocalElement;
p_stLocalElement =
( GEO_tdstElementSprite *)
hObject ->
d_stListOfElements[hElement];
*p_hSprite = p_stLocalElement -> d_stListOfSprites [ xIndexOfSprite ] . hSprite ;
}
#endif /* _FIRE_DEADCODE_U64_ */
/*ANNECY JMD {*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_vSetConstraintOfIndexedSprite ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xIndexOfSprite,
MTH3D_tdstVector *p_stAxe) {
GEO_tdstElementSprite *p_stLocalElement;
p_stLocalElement = ( GEO_tdstElementSprite *) hObject->d_stListOfElements[hElement];
p_stLocalElement->d_stListOfSprites[xIndexOfSprite].stAxe = *p_stAxe;
}
void GEO_vSetUVOfIndexedSprite ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xIndexOfSprite,
ACP_tdst2DUVValues *p_stUVpos,
ACP_tdst2DUVValues *p_stUVsize) {
GEO_tdstElementSprite *p_stLocalElement;
p_stLocalElement = ( GEO_tdstElementSprite *) hObject->d_stListOfElements[hElement];
p_stLocalElement->d_stListOfSprites[xIndexOfSprite].stUVpos = *p_stUVpos ;
p_stLocalElement->d_stListOfSprites[xIndexOfSprite].stUVsize = *p_stUVsize ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*END ANNECY JMD }*/
/*************************************************************************************************************/
/* Indexed Triangles*/
/*************************************************************************************************************/
/* ANNECY MT 20/02/98 {*/
void GEO_vCreateElementIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement *p_hElement ,
ACP_tdxIndex xNbFaces,
ACP_tdxIndex xNbElementUV)
{
ACP_tdxIndex xElementToBuild;
GEO_tdstGeometricObject *p_xObjectToSet;
p_xObjectToSet = hObject;
/*Find the element To Create*/
for (xElementToBuild=0;
xElementToBuild<p_xObjectToSet->xNbElements;
xElementToBuild++)
if (hObject->
d_xListOfElementsTypes[xElementToBuild]==GEO_C_xElementNULL)
break;
/*More than p_xObjectToSet->xNbElements have been created so <-*/
if (xElementToBuild==p_xObjectToSet->xNbElements) return;
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild]=GEO_C_xElementIndexedTriangles;
*p_hElement = xElementToBuild;
p_xObjectToSet->d_stListOfElements[xElementToBuild] = (void*) GEO_p_stAllocElementIndexedTriangles( xNbFaces, xNbElementUV );
}
GEO_tdstElementIndexedTriangles *GEO_p_stAllocElementIndexedTriangles( ACP_tdxIndex xNbFaces,
ACP_tdxIndex xNbElementUV)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
/*VLNEWGLI*/
if (xNbElementUV == 0)
xNbElementUV = 1;
/*EVL*/
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementIT , 0 );
GEO_M_CPAMalloc (
p_stLocalElement,
GEO_tdstElementIndexedTriangles * ,
sizeof ( GEO_tdstElementIndexedTriangles ) ,
E_uwGEONotEnoughtMemory ) ;
/*Faces */
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfFacesTripled,
GEO_tdstTripledIndex * ,
sizeof ( GEO_tdstTripledIndex ) * xNbFaces ,
E_uwGEONotEnoughtMemory ) ;
/*UV Index*/
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfFacesTripledIndexUV,
GEO_tdstTripledIndex *,
sizeof ( GEO_tdstTripledIndex ) * xNbFaces ,
E_uwGEONotEnoughtMemory ) ;
/*Colors*/
/* GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfFacesReceivedLightIntensity,
GEO_tdstColor * ,
sizeof ( GEO_tdstColor ) * xNbFaces ,
E_uwGEONotEnoughtMemory ) ;*/
/*Normals*/
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfFacesNormals,
MTH3D_tdstVector * ,
sizeof ( MTH3D_tdstVector ) * xNbFaces ,
E_uwGEONotEnoughtMemory ) ;
/*UV*/
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfElementUV ,
ACP_tdst2DUVValues * ,
sizeof ( ACP_tdst2DUVValues ) * xNbElementUV ,
E_uwGEONotEnoughtMemory ) ;
MMG_fn_vEndMemoryInfo();
p_stLocalElement -> xNbElementUV = xNbElementUV;
p_stLocalElement -> xNbFaces = xNbFaces;
p_stLocalElement -> xNumberOfIndexsUsed = 0;
p_stLocalElement -> d_stListOfIndexUsedByThisElement = NULL;
p_stLocalElement -> xIndexOfParallelBox = GEO_C_xNoParallelBox;
return p_stLocalElement;
}
/* END ANNECY MT }*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void GEO_vSetFaceOfIndexedTriangles (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
ACP_tdxIndex xPoint1,
ACP_tdxIndex xPoint2,
ACP_tdxIndex xPoint3)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfFacesTripled[xIndexOfFace].a3_xIndex[0] = xPoint1;
p_stLocalElement -> d_stListOfFacesTripled[xIndexOfFace].a3_xIndex[1] = xPoint2;
p_stLocalElement -> d_stListOfFacesTripled[xIndexOfFace].a3_xIndex[2] = xPoint3;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void GEO_vGetFaceOfIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
ACP_tdxIndex *p_xPoint1,
ACP_tdxIndex *p_xPoint2,
ACP_tdxIndex *p_xPoint3)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement];
*p_xPoint1 = p_stLocalElement -> d_stListOfFacesTripled[xIndexOfFace].a3_xIndex[0] ;
*p_xPoint2 = p_stLocalElement -> d_stListOfFacesTripled[xIndexOfFace].a3_xIndex[1] ;
*p_xPoint3 = p_stLocalElement -> d_stListOfFacesTripled[xIndexOfFace].a3_xIndex[2] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void GEO_vSetIndexedUVOfFaceOfIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
ACP_tdxIndex xUV1,
ACP_tdxIndex xUV2,
ACP_tdxIndex xUV3)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfFacesTripledIndexUV[xIndexOfFace].a3_xIndex[0] = xUV1 ;
p_stLocalElement -> d_stListOfFacesTripledIndexUV[xIndexOfFace].a3_xIndex[1] = xUV2 ;
p_stLocalElement -> d_stListOfFacesTripledIndexUV[xIndexOfFace].a3_xIndex[2] = xUV3 ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
/* FQ SHADOW*/
/* #ifndef _FIRE_DEADCODE_U64_*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void GEO_vGetIndexedUVOfFaceOfIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
ACP_tdxIndex *p_xUV1,
ACP_tdxIndex *p_xUV2,
ACP_tdxIndex *p_xUV3)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement];
*p_xUV1 = p_stLocalElement -> d_stListOfFacesTripledIndexUV[xIndexOfFace].a3_xIndex[0] ;
*p_xUV2 = p_stLocalElement -> d_stListOfFacesTripledIndexUV[xIndexOfFace].a3_xIndex[1] ;
*p_xUV3 = p_stLocalElement -> d_stListOfFacesTripledIndexUV[xIndexOfFace].a3_xIndex[2] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
#ifndef _FIRE_DEADCODE_U64_
void GEO_vSetReceivedLightIntensityOfFaceOfIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
GEO_tdstColor *p_stReceivedLightIntensity)
{
/* GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfFacesReceivedLightIntensity[xIndexOfFace] = *p_stReceivedLightIntensity;*/
}
void GEO_vGetColorOfFaceOfIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
GEO_tdstColor *p_stReceivedLightIntensity)
{
/* GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement];
*p_stReceivedLightIntensity = p_stLocalElement -> d_stListOfFacesReceivedLightIntensity[xIndexOfFace] ;*/
};
void GEO_vSetNormalOfIndexedTrianges (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
MTH3D_tdstVector *p_stNormal)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfFacesNormals[xIndexOfFace] = *p_stNormal ;
};
void GEO_vGetNormalOfIndexedTrianges (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
MTH3D_tdstVector *p_stNormal)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->d_stListOfElements[hElement];
*p_stNormal = p_stLocalElement -> d_stListOfFacesNormals[xIndexOfFace] ;
};
long GEO_lGetIndexedTriangleNbFaces(ACP_tdxHandleOfObject hObject,ACP_tdxHandleOfElement hElement)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->d_stListOfElements[hElement];
return(p_stLocalElement -> xNbFaces);
};
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void GEO_vSetUVOfIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfUV,
ACP_tdst2DUVValues *p_stUV)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfElementUV[xIndexOfUV] = *p_stUV ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
;
/* FQ SHADOW*/
/*#ifndef _FIRE_DEADCODE_U64_*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void GEO_vGetUVOfIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfUV,
ACP_tdst2DUVValues *p_stUV)
{
GEO_tdstElementIndexedTriangles *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement];
*p_stUV = p_stLocalElement -> d_stListOfElementUV[xIndexOfUV] ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
;
#ifndef _FIRE_DEADCODE_U64_
void GEO_vSetMaterialOfIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxHandleOfMaterial hMaterial)
{
GMT_fn_vSetVisualMaterial(((GEO_tdstElementIndexedTriangles *) hObject->
d_stListOfElements[hElement]) -> hMaterial, hMaterial);
};
void GEO_vGetMaterialOfIndexedTriangles (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxHandleOfMaterial *p_hMaterial)
{
*p_hMaterial = GMT_fn_hGetVisualMaterial(((GEO_tdstElementIndexedTriangles *) hObject->
d_stListOfElements[hElement]) -> hMaterial) ;
};
#endif /* _FIRE_DEADCODE_U64_ */
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetGameMaterialOfIndexedTriangles
// Set the game material of the indexed triangles
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Input : hObject : handle to the geometric object
// hElement : handle to the element
// hMaterial : handle to the game material
// Output : void
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 97 Author : A.R.
/////////////////////////////////////////////////////////////////////////////////////////////////////////// 1_Warning_removed_here_Oliv'_ */
void GEO_vSetGameMaterialOfIndexedTriangles ( ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
GMT_tdxHandleToGameMaterial hMaterial)
{
((GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement]) -> hMaterial = hMaterial;
};
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vGetGameMaterialOfIndexedTriangles
// Get the game material of the indexed triangles
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Input : hObject : handle to the geometric object
// hElement : handle to the element
// p_hMaterial : pointer to the handle to the game material
// Output : void
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 97 Author : A.R.
/////////////////////////////////////////////////////////////////////////////////////////////////////////// 1_Warning_removed_here_Oliv'_ */
void GEO_vGetGameMaterialOfIndexedTriangles ( ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
GMT_tdxHandleToGameMaterial *p_hMaterial)
{
*p_hMaterial = ((GEO_tdstElementIndexedTriangles *)
hObject->
d_stListOfElements[hElement]) -> hMaterial ;
};
#ifdef USE_ALTIMAPS
/*----------------------------------------------------*/
/* ALTIMAPS*/
/*----------------------------------------------------*/
/**********************************************************************************************/
/* Name: GEO_vCreateAltimapElement*/
/* Goal: Creation (allocation) of an Altimap Element*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vCreateElementAltimap( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement *p_hElement,
ACP_tdxIndex xNbVertices,
ACP_tdxIndex xNbSquares,
ACP_tdxIndex xNbVisibleTriangles,
ACP_tdxIndex xNbUVValues,
ACP_tdxIndex xNbMaterials )
{
ACP_tdxIndex xElementToBuild;
GEO_tdstGeometricObject *p_xObjectToSet;
GEO_tdstElementAltimap *p_stAltimapElement;
p_xObjectToSet = hObject;
/*--- Scans the object to set, so as to find an empty element*/
for( xElementToBuild = 0 ; xElementToBuild < p_xObjectToSet->xNbElements ; xElementToBuild ++ )
if( hObject->d_xListOfElementsTypes[xElementToBuild] == GEO_C_xElementNULL )
break;
/*--- Tests if the maximum number of elements have already been created*/
if( xElementToBuild == p_xObjectToSet->xNbElements )
return;
/*--- returns the Altimap element number*/
*p_hElement = xElementToBuild;
/*--- Sets the type of the new element to be built*/
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild] = GEO_C_xElementAltimap;
GEO_M_CPAMalloc( p_xObjectToSet->d_stListOfElements[xElementToBuild],
GEO_tdstElementAltimap *,
sizeof( GEO_tdstElementAltimap ),
E_uwGEONotEnoughtMemory );
p_stAltimapElement = (GEO_tdstElementAltimap *) p_xObjectToSet->d_stListOfElements[xElementToBuild];
/*--- Array of Heights ---*/
GEO_M_CPAMalloc( p_stAltimapElement->d_xHeight,
MTH_tdxReal *,
xNbVertices * sizeof( MTH_tdxReal ),
E_uwGEONotEnoughtMemory );
/*--- Array of Point Normals ---*/
GEO_M_CPAMalloc( p_stAltimapElement->d_stPointNormals,
MTH3D_tdstVector *,
xNbVertices * sizeof( MTH3D_tdstVector ),
E_uwGEONotEnoughtMemory );
/*--- Array of Square Descriptors ---*/
GEO_M_CPAMalloc( p_stAltimapElement->d_stSquare,
GEO_tdstAltimapSquare *,
xNbSquares* sizeof( GEO_tdstAltimapSquare ),
E_uwGEONotEnoughtMemory );
/*--- Array of Face descriptors ---*/
GEO_M_CPAMalloc( p_stAltimapElement->d_stFaces,
GEO_tdstAltimapFace *,
xNbVisibleTriangles * sizeof( GEO_tdstAltimapFace ),
E_uwGEONotEnoughtMemory );
/*--- Array of UV Values ---*/
GEO_M_CPAMalloc( p_stAltimapElement->d_stUVValues,
ACP_tdst2DUVValues *,
xNbUVValues * sizeof( ACP_tdst2DUVValues ),
E_uwGEONotEnoughtMemory );
/*--- Array of Materials handles ---*/
GEO_M_CPAMalloc( p_stAltimapElement->d_hMaterial,
GMT_tdxHandleToGameMaterial *,
xNbMaterials * sizeof( GMT_tdxHandleToGameMaterial ),
E_uwGEONotEnoughtMemory );
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapOrigin*/
/* Goal: Sets the starting point of the Altimap in the SuperObject 3D coordinates system*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vSetAltimapOrigin( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
MTH3D_tdstVector stOrigin )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->stOrigin = stOrigin;
}
/***********************************************************************************************/
/* Name : GEO_vGetAltimapOrigin*/
/* Description : Returns a Vector Containing the starting point of the Altimap*/
/* Author : Marc FASCIA*/
/* Optimized ? : No*/
/***********************************************************************************************/
void GEO_vGetAltimapOrigin( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
MTH3D_tdstVector *stOrigin )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*stOrigin = p_stAltimapElement->stOrigin;
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapSquarePattern*/
/* Goal: Sets the number and the size of squres along both axis*/
/* - Reallocates structure (old datas will be lost) -*/
/* Code: Marc FASCIA*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vSetAltimapSquarePattern( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xWidth,
MTH_tdxReal xSquareDimX,
ACP_tdxIndex xDepth,
MTH_tdxReal xSquareDimY )
{
GEO_tdstElementAltimap *p_stAltimapElement;
ACP_tdxIndex xNbVertices, xNbSquares;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->xWidth = xWidth;
p_stAltimapElement->xDeltaX = xSquareDimX;
p_stAltimapElement->xDepth = xDepth;
p_stAltimapElement->xDeltaY = xSquareDimY;
xNbVertices = (xWidth + 1) * (xDepth + 1);
xNbSquares = xWidth * xDepth;
/*--- Deallocation of old structures ---*/
GEO_M_CPAFree( p_stAltimapElement->d_xHeight );
GEO_M_CPAFree( p_stAltimapElement->d_stPointNormals );
GEO_M_CPAFree( p_stAltimapElement->d_stSquare );
/*--- New structures allocation ---*/
GEO_M_CPAMalloc( p_stAltimapElement->d_xHeight,
MTH_tdxReal *,
xNbVertices * sizeof( MTH_tdxReal ),
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc( p_stAltimapElement->d_stPointNormals,
MTH3D_tdstVector *,
xNbVertices * sizeof( MTH3D_tdstVector ),
E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc( p_stAltimapElement->d_stSquare,
GEO_tdstAltimapSquare *,
xNbSquares * sizeof( GEO_tdstAltimapSquare ),
E_uwGEONotEnoughtMemory );
}
/**********************************************************************************************/
/* Name: GEO_vGetAltimapSquarePattern*/
/* Goal: Returns the number and the size of squres along both axis*/
/* Code: Marc FASCIA*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vGetAltimapSquarePattern( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex *xWidth,
MTH_tdxReal *xSquareDimX,
ACP_tdxIndex *xDepth,
MTH_tdxReal *xSquareDimY )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*xWidth = p_stAltimapElement->xWidth;
*xSquareDimX = p_stAltimapElement->xDeltaX;
*xDepth = p_stAltimapElement->xDepth;
*xSquareDimY = p_stAltimapElement->xDeltaY;
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapNbFaces*/
/* Goal: Sets the number of visible triangles - Reallocates structure (old data lost)*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
extern CPA_EXPORT void
GEO_vSetAltimapNbFaces( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNbFace )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->xNbFaces = xNbFace;
/*--- Deallocation ---*/
GEO_M_CPAFree( p_stAltimapElement->d_stFaces );
/*--- New allocation ---*/
GEO_M_CPAMalloc( p_stAltimapElement->d_stFaces,
GEO_tdstAltimapFace *,
xNbFace * sizeof( GEO_tdstAltimapFace ),
E_uwGEONotEnoughtMemory );
}
/**********************************************************************************************/
/* Name: GEO_vGetAltimapNbFaces*/
/* Goal: Returns the number of visible triangles*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
extern CPA_EXPORT void
GEO_vGetAltimapNbFaces( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex *xNbFace )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*xNbFace = p_stAltimapElement->xNbFaces;
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapNbUVValues*/
/* Goal: Sets the number of mapping coordinates listed - Reallocates structure (old data lost)*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
extern CPA_EXPORT void
GEO_vSetAltimapNbUVValues( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNbUVValues )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->xNbUVValues = xNbUVValues;
/*--- Deallocation ---*/
GEO_M_CPAFree( p_stAltimapElement->d_stUVValues );
/*--- New allocation ---*/
GEO_M_CPAMalloc( p_stAltimapElement->d_stUVValues,
ACP_tdst2DUVValues *,
xNbUVValues * sizeof( ACP_tdst2DUVValues ),
E_uwGEONotEnoughtMemory );
}
/**********************************************************************************************/
/* Name: GEO_vGetAltimapNbUVValues*/
/* Goal: Returns the number of visible triangles*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
extern CPA_EXPORT void
GEO_vGetAltimapNbUVValues( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex *xNbUVValues )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*xNbUVValues = p_stAltimapElement->xNbUVValues;
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapNbMaterials*/
/* Goal: Sets the number of mapping coordinates listed - Reallocates structure (old data lost)*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
extern CPA_EXPORT void
GEO_vSetAltimapNbMaterials( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNbMaterials )
{
GEO_tdstElementAltimap *p_stAltimapElement;
GMT_tdxHandleToGameMaterial *d_hNewArray;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
/*--- New allocation ---*/
GEO_M_CPAMalloc( d_hNewArray,
GMT_tdxHandleToGameMaterial *,
xNbMaterials * sizeof( GMT_tdxHandleToGameMaterial ),
E_uwGEONotEnoughtMemory );
if( xNbMaterials > p_stAltimapElement->xNbMaterials )
memcpy( d_hNewArray,
p_stAltimapElement->d_hMaterial,
p_stAltimapElement->xNbMaterials * sizeof( GMT_tdxHandleToGameMaterial ) );
else
{
ACP_tdxIndex xLoop;
memcpy( d_hNewArray,
p_stAltimapElement->d_hMaterial,
xNbMaterials * sizeof( GMT_tdxHandleToGameMaterial ) );
/*--- Scan the array of faces to change the indexes values that can be now to big*/
for( xLoop = 0 ; xLoop < p_stAltimapElement->xNbFaces ; xLoop ++ )
if( p_stAltimapElement->d_stFaces[ xLoop ].ucMatIndex >= xNbMaterials )
p_stAltimapElement->d_stFaces[ xLoop ].ucMatIndex = xNbMaterials - 1;
}
/*--- Now the datas are ok, uptading the nb of materials*/
p_stAltimapElement->xNbMaterials = xNbMaterials;
/*--- Deallocation ---*/
GEO_M_CPAFree( p_stAltimapElement->d_hMaterial );
/*--- Sets the new Array in the structure ---*/
p_stAltimapElement->d_hMaterial = d_hNewArray;
}
/**********************************************************************************************/
/* Name: GEO_vGetAltimapNbMaterials*/
/* Goal: Returns the number of Game Material used*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
extern CPA_EXPORT void
GEO_vGetAltimapNbMaterials( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex *xNbMaterials )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*xNbMaterials = p_stAltimapElement->xNbMaterials;
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapVertexHeight*/
/* Goal: Sets the height of the indicated Altimap Vertex*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vSetAltimapVertexHeight( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumPoint,
MTH_tdxReal xHeight )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->d_xHeight[ xNumPoint ] = xHeight;
}
/**********************************************************************************************/
/* Name: GEO_vGetAltimapVertexHeight*/
/* Goal: Returns the height of the indicated Altimap Vertex*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vGetAltimapVertexHeight( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumPoint,
MTH_tdxReal *xHeight )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*xHeight = p_stAltimapElement->d_xHeight[ xNumPoint ];
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapPointNormal*/
/* Goal: Sets the normal vector of the indicated Altimap Vertex*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vSetAltimapPointNormal( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumPoint,
MTH3D_tdstVector xNormal )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->d_stPointNormals[xNumPoint] = xNormal;
}
/**********************************************************************************************/
/* Name: GEO_vGetAltimapPointNormal*/
/* Goal: Returns the normal vector of the indicated Altimap Vertex*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vGetAltimapPointNormal( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumPoint,
MTH3D_tdstVector *xNormal )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*xNormal = p_stAltimapElement->d_stPointNormals[xNumPoint];
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapSquare*/
/* Goal: Defines how a square is divided in triangles and wwhere is its first traingle in the arrays*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vSetAltimapSquare( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace,
unsigned char ucTypeOfSquare,
ACP_tdxIndex xIndexOfFirstSquareTriangle )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->d_stSquare[ xNumFace ].ucType = ucTypeOfSquare;
p_stAltimapElement->d_stSquare[ xNumFace ].xFaceIndex = xIndexOfFirstSquareTriangle;
}
/**********************************************************************************************/
/* Name: GEO_vGetAltimapSquare*/
/* Goal: Returns how a square is divided in triangles and wwhere is its first traingle in the arrays*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vGetAltimapSquare( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace,
unsigned char *ucTypeOfSquare,
ACP_tdxIndex *xIndexOfFirstSquareTriangle )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*ucTypeOfSquare = p_stAltimapElement->d_stSquare[ xNumFace ].ucType;
*xIndexOfFirstSquareTriangle = p_stAltimapElement->d_stSquare[ xNumFace ].xFaceIndex;
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapFaceNormal*/
/* Goal: Sets the normal vector of triangle*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vSetAltimapFaceNormal( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace,
MTH3D_tdstVector stNormal )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->d_stFaces[xNumFace].stNormal = stNormal;
}
/**********************************************************************************************/
/* Name: GEO_vGetAltimapFaceNormal*/
/* Goal: Sets the normal vector of triangle*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vGetAltimapFaceNormal( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace,
MTH3D_tdstVector *stNormal )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*stNormal = p_stAltimapElement->d_stFaces[xNumFace].stNormal;
}
/**********************************************************************************************/
/* Name: GEO_vSetAltimapUVIndex*/
/* Goal: Sets the UV Index for the indicated face*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vSetAltimapFaceUVIndex( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace,
ACP_tdxIndex xUVIndex1,
ACP_tdxIndex xUVIndex2,
ACP_tdxIndex xUVIndex3 )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->d_stFaces[xNumFace].xUVIndex[0] = xUVIndex1;
p_stAltimapElement->d_stFaces[xNumFace].xUVIndex[1] = xUVIndex2;
p_stAltimapElement->d_stFaces[xNumFace].xUVIndex[2] = xUVIndex3;
}
/**********************************************************************************************/
/* Name: GEO_vGetAltimapUVIndex*/
/* Goal: Returns the UV Index for the indicated face*/
/* Code: Marc FASCIA - Annecy*/
/* OPTIMIZATION : No*/
/**********************************************************************************************/
void GEO_vGetAltimapFaceUVIndex( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace,
ACP_tdxIndex *xUVIndex1,
ACP_tdxIndex *xUVIndex2,
ACP_tdxIndex *xUVIndex3 )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*xUVIndex1 = p_stAltimapElement->d_stFaces[xNumFace].xUVIndex[0];
*xUVIndex2 = p_stAltimapElement->d_stFaces[xNumFace].xUVIndex[1];
*xUVIndex3 = p_stAltimapElement->d_stFaces[xNumFace].xUVIndex[2];
}
/***********************************************************************************************/
/* Name : GEO_vSetAltimapFaceGameMaterial*/
/* Description : Sets the game material for the indicated face*/
/* Author : Marc FASCIA*/
/* Optimized ? : No*/
/***********************************************************************************************/
void GEO_vSetAltimapFaceMaterialIndex( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace,
unsigned char ucMatIndex )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->d_stFaces[xNumFace].ucMatIndex = ucMatIndex;
}
/***********************************************************************************************/
/* Name : GEO_vGetAltimapFaceGameMaterial*/
/* Description : Returns the game material for the indicated face*/
/* Author : Marc FASCIA*/
/* Optimized ? : No*/
/***********************************************************************************************/
void GEO_vGetAltimapFaceMaterialIndex( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace,
unsigned char *ucMatIndex )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*ucMatIndex = p_stAltimapElement->d_stFaces[xNumFace].ucMatIndex;
}
/***********************************************************************************************/
/* Name : GEO_vSetAltimapUVValue*/
/* Description : Sets an UV value in the Altimap's UV values array*/
/* Author : Marc FASCIA*/
/* Optimized ? : No*/
/***********************************************************************************************/
void GEO_vSetAltimapUVValue( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumUV,
ACP_tdst2DUVValues stUV )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
p_stAltimapElement->d_stUVValues[xNumUV] = stUV;
}
/***********************************************************************************************/
/* Name : GEO_vGetAltimapUVValue*/
/* Description : Returns an UV value from the Altimap's UV values array*/
/* Author : Marc FASCIA*/
/* Optimized ? : No*/
/***********************************************************************************************/
void GEO_vGetAltimapUVValue( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumUV,
ACP_tdst2DUVValues *stUV )
{
GEO_tdstElementAltimap *p_stAltimapElement;
p_stAltimapElement = (GEO_tdstElementAltimap *)hObject->d_stListOfElements[hElement];
*stUV = p_stAltimapElement->d_stUVValues[xNumUV];
}
/*----------------------------------------------------*/
#endif /*USE_ALTIMAPS*/
/*************************************************************************************************************/
/*structure GEO_tdstElementFaceMapDescriptors :*/
/*************************************************************************************************************/
/* ANNECY MT 20/02/98 {*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_xCreateElementFaceMap (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement *p_hElement ,
ACP_tdxIndex xNbFaces)
{
ACP_tdxIndex xElementToBuild;
GEO_tdstGeometricObject *p_xObjectToSet;
p_xObjectToSet = hObject;
/*Find the element To Create*/
for (xElementToBuild=0;
xElementToBuild<p_xObjectToSet->xNbElements;
xElementToBuild++)
if (hObject->
d_xListOfElementsTypes[xElementToBuild]==GEO_C_xElementNULL)
break;
/*More than p_xObjectToSet->xNbElements have been created so <-*/
if (xElementToBuild==p_xObjectToSet->xNbElements) return;
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild]=GEO_C_xElementFaceMapDescriptors ;
p_xObjectToSet->d_stListOfElements[xElementToBuild] = (void*) GEO_p_stAllocElementFaceMap( xNbFaces );
}
GEO_tdstElementFaceMapDescriptors *GEO_p_stAllocElementFaceMap ( ACP_tdxIndex xNbFaces )
{
GEO_tdstElementFaceMapDescriptors *p_stLocalElement;
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementFaceMap , 0 );
GEO_M_CPAMalloc (
p_stLocalElement,
GEO_tdstElementFaceMapDescriptors * ,
sizeof ( GEO_tdstElementFaceMapDescriptors ) ,
E_uwGEONotEnoughtMemory ) ;
/*Faces */
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfFacesQuadrupled ,
GEO_tdstFaceMapTriangle * ,
sizeof ( GEO_tdstFaceMapTriangle ) * xNbFaces ,
E_uwGEONotEnoughtMemory ) ;
/*Colors*/
/* GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfFacesReceivedLightIntensity,
GEO_tdstColor * ,
sizeof ( GEO_tdstColor ) * xNbFaces ,
E_uwGEONotEnoughtMemory ) ;*/
/*Normals*/
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfFacesNormals,
MTH3D_tdstVector * ,
sizeof ( MTH3D_tdstVector ) * xNbFaces,
E_uwGEONotEnoughtMemory ) ;
MMG_fn_vEndMemoryInfo();
p_stLocalElement -> xNbFaces = xNbFaces;
p_stLocalElement -> xIndexOfParallelBox = GEO_C_xNoParallelBox;
return p_stLocalElement;
}
/* END ANNECY MT }*/
void GEO_xSetFaceOfElementFaceMap (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
ACP_tdxIndex xPoint1,
ACP_tdxIndex xPoint2,
ACP_tdxIndex xPoint3,
ACP_tdxHandleOfFMD hFaceMapDescriptor)
{
GEO_tdstElementFaceMapDescriptors *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementFaceMapDescriptors *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfFacesQuadrupled[xIndexOfFace].stFaceTripled.a3_xIndex[0] = xPoint1;
p_stLocalElement -> d_stListOfFacesQuadrupled[xIndexOfFace].stFaceTripled.a3_xIndex[1] = xPoint2;
p_stLocalElement -> d_stListOfFacesQuadrupled[xIndexOfFace].stFaceTripled.a3_xIndex[2] = xPoint3;
p_stLocalElement -> d_stListOfFacesQuadrupled[xIndexOfFace].hFaceMapDescriptor = hFaceMapDescriptor;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_
void GEO_xGetFaceOfElementFaceMap (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
ACP_tdxIndex *p_xPoint1,
ACP_tdxIndex *p_xPoint2,
ACP_tdxIndex *p_xPoint3,
ACP_tdxHandleOfFMD *p_hFaceMapDescriptor)
{
GEO_tdstElementFaceMapDescriptors *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementFaceMapDescriptors *)
hObject->
d_stListOfElements[hElement];
*p_xPoint1 = p_stLocalElement -> d_stListOfFacesQuadrupled[xIndexOfFace].stFaceTripled.a3_xIndex[0] ;
*p_xPoint2 = p_stLocalElement -> d_stListOfFacesQuadrupled[xIndexOfFace].stFaceTripled.a3_xIndex[1] ;
*p_xPoint3 = p_stLocalElement -> d_stListOfFacesQuadrupled[xIndexOfFace].stFaceTripled.a3_xIndex[2] ;
*p_hFaceMapDescriptor = p_stLocalElement -> d_stListOfFacesQuadrupled[xIndexOfFace].hFaceMapDescriptor;
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_xSetNormalOfFaceOfElementFaceMap (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
MTH3D_tdstVector *p_stNormal)
{
GEO_tdstElementFaceMapDescriptors *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementFaceMapDescriptors *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfFacesNormals[xIndexOfFace] = *p_stNormal;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_
void GEO_xGetNormalOfFaceOfElementFaceMap (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
MTH3D_tdstVector *p_stNormal)
{
GEO_tdstElementFaceMapDescriptors *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementFaceMapDescriptors *)
hObject->
d_stListOfElements[hElement];
*p_stNormal = p_stLocalElement -> d_stListOfFacesNormals[xIndexOfFace] ;
}
void GEO_xSetColorOfFaceOfElementFaceMap (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
GEO_tdstColor *p_stReceivedLightIntensity)
{
/* GEO_tdstElementFaceMapDescriptors *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementFaceMapDescriptors *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfFacesReceivedLightIntensity[xIndexOfFace]=*p_stReceivedLightIntensity;*/
}
void GEO_xGetColorOfFaceOfElementFaceMap (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
GEO_tdstColor *p_stReceivedLightIntensity)
{
/* GEO_tdstElementFaceMapDescriptors *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementFaceMapDescriptors *)
hObject->
d_stListOfElements[hElement];
*p_stReceivedLightIntensity=p_stLocalElement -> d_stListOfFacesReceivedLightIntensity[xIndexOfFace];*/
}
/*************************************************************************************************************/
/*structure GEO_tdstElementTMeshes :*/
/*************************************************************************************************************/
/* ANNECY MT 20/02/98 {*/
void GEO_xCreateElementTMesh ( ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement *p_hElement ,
ACP_tdxIndex xNumberOfMeshAtoms ,
ACP_tdxIndex xNumberOfUV ,
ACP_tdxIndex xNbFaces )
{
ACP_tdxIndex xElementToBuild;
GEO_tdstGeometricObject *p_xObjectToSet;
p_xObjectToSet = hObject;
/*Find the element To Create*/
for (xElementToBuild=0;
xElementToBuild<p_xObjectToSet->xNbElements;
xElementToBuild++)
if (hObject->
d_xListOfElementsTypes[xElementToBuild]==GEO_C_xElementNULL)
break;
/*More than p_xObjectToSet->xNbElements have been created so <-*/
if (xElementToBuild==p_xObjectToSet->xNbElements) return;
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild]=GEO_C_xElementTMeshes;
p_xObjectToSet->d_stListOfElements[xElementToBuild] = (void*) GEO_p_stAllocElementTMeshes( xNumberOfMeshAtoms , xNumberOfUV , xNbFaces );
}
GEO_tdstElementTMeshes *GEO_p_stAllocElementTMeshes( ACP_tdxIndex xNumberOfMeshAtoms ,
ACP_tdxIndex xNumberOfUV ,
ACP_tdxIndex xNbFaces )
{
GEO_tdstElementTMeshes *p_stLocalElement;
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementTMeshes , 0 );
GEO_M_CPAMalloc (
p_stLocalElement,
GEO_tdstElementTMeshes * ,
sizeof ( GEO_tdstElementTMeshes ),
E_uwGEONotEnoughtMemory ) ;
/*Atoms*/
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfMeshAtoms,
ACP_tdxIndex * ,
sizeof ( ACP_tdxIndex ) * xNumberOfMeshAtoms,
E_uwGEONotEnoughtMemory ) ;
/*Normals*/
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfFacesNormals ,
MTH3D_tdstVector * ,
sizeof ( MTH3D_tdstVector ) * xNbFaces ,
E_uwGEONotEnoughtMemory ) ;
/*Colors*/
/* GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfFacesReceivedLightIntensity,
GEO_tdstColor * ,
sizeof ( GEO_tdstColor ) * xNbFaces ,
E_uwGEONotEnoughtMemory ) ;*/
/*UV*/
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfElementUV,
ACP_tdst2DUVValues * ,
sizeof ( ACP_tdst2DUVValues ) * xNumberOfUV,
E_uwGEONotEnoughtMemory ) ;
MMG_fn_vEndMemoryInfo();
p_stLocalElement -> xNbFaces = xNbFaces;
p_stLocalElement -> xNbMeshAtoms = p_stLocalElement -> xNbFaces = xNbFaces;
p_stLocalElement -> xIndexOfParallelBox = GEO_C_xNoParallelBox;
return p_stLocalElement;
}
/* END ANNECY MT }*/
void GEO_xSetAtomOfElementTMesh (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfMeshAtom,
ACP_tdxIndex xMeshAtom)
{
GEO_tdstElementTMeshes *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementTMeshes *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfMeshAtoms[xIndexOfMeshAtom]=xMeshAtom;
}
void GEO_xGetAtomOfElementTMesh (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfMeshAtom,
ACP_tdxIndex *p_xMeshAtom)
{
GEO_tdstElementTMeshes *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementTMeshes *)
hObject->
d_stListOfElements[hElement];
*p_xMeshAtom = p_stLocalElement -> d_stListOfMeshAtoms[xIndexOfMeshAtom];
}
void GEO_xSetUVOfAtomOfElementTMesh (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfMeshAtom,
ACP_tdst2DUVValues *p_stUV)
{
GEO_tdstElementTMeshes *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementTMeshes *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfElementUV[xIndexOfMeshAtom] = *p_stUV;
}
void GEO_xGetUVOfAtomOfElementTMesh (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfMeshAtom,
ACP_tdst2DUVValues *p_stUV)
{
GEO_tdstElementTMeshes *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementTMeshes *)
hObject->
d_stListOfElements[hElement];
*p_stUV = p_stLocalElement -> d_stListOfElementUV[xIndexOfMeshAtom];
}
void GEO_xSetNormalOfFaceOfTMesh (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
MTH3D_tdstVector *p_stNormal)
{
GEO_tdstElementTMeshes *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementTMeshes *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfFacesNormals[xIndexOfFace] = *p_stNormal;
}
void GEO_xGetNormalOfFaceOfTMesh (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
MTH3D_tdstVector *p_stNormal)
{
GEO_tdstElementTMeshes *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementTMeshes *)
hObject->
d_stListOfElements[hElement];
*p_stNormal= p_stLocalElement -> d_stListOfFacesNormals[xIndexOfFace];
}
void GEO_xSetColorOfFaceOfTMesh (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
GEO_tdstColor *p_stReceivedLightIntensity)
{
/* GEO_tdstElementTMeshes *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementTMeshes *)
hObject->
d_stListOfElements[hElement];
p_stLocalElement -> d_stListOfFacesReceivedLightIntensity[xIndexOfFace] = *p_stReceivedLightIntensity;*/
}
void GEO_xGetColorOfFaceOfTMesh (
ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xIndexOfFace,
GEO_tdstColor *p_stReceivedLightIntensity)
{
/* GEO_tdstElementTMeshes *p_stLocalElement;
p_stLocalElement =
(GEO_tdstElementTMeshes *)
hObject->
d_stListOfElements[hElement];
*p_stReceivedLightIntensity = p_stLocalElement -> d_stListOfFacesReceivedLightIntensity[xIndexOfFace] ;*/
}
#endif /* _FIRE_DEADCODE_U64_ */
/*************************************************************************************************************/
/* Points elements*/
/*************************************************************************************************************/
/* ANNECY MT 20/02/98 {*/
void GEO_xCreateElementPoints ( ACP_tdxHandleOfObject p_xObjectToSet ,
ACP_tdxHandleOfElement *p_hElement ,
ACP_tdxIndex xNumberOfPoints)
{
ACP_tdxIndex xElementToBuild;
/*Find the element To Create*/
for (xElementToBuild=0;
xElementToBuild<p_xObjectToSet->xNbElements;
xElementToBuild++)
if (p_xObjectToSet->
d_xListOfElementsTypes[xElementToBuild]==GEO_C_xElementNULL)
break;
/*More than p_xObjectToSet->xNbElements have been created so <-*/
if (xElementToBuild==p_xObjectToSet->xNbElements) return;
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild]=GEO_C_xElementPoints;
*p_hElement = xElementToBuild;
p_xObjectToSet->d_stListOfElements[xElementToBuild] = (void*)GEO_p_stAllocElementPoints( xNumberOfPoints );
}
GEO_tdstElementPoints *GEO_p_stAllocElementPoints( ACP_tdxIndex xNumberOfPoints )
{
GEO_tdstElementPoints *p_stLocalElement;
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementPoint , 0 );
GEO_M_CPAMalloc (
p_stLocalElement,
GEO_tdstElementPoints * ,
sizeof ( GEO_tdstElementPoints ),
E_uwGEONotEnoughtMemory ) ;
/*Index of points*/
p_stLocalElement -> xNbPoints = xNumberOfPoints;
GEO_M_CPAMalloc (
p_stLocalElement -> d_xListOfPointIndex,
ACP_tdxIndex * ,
sizeof ( ACP_tdxIndex ) * xNumberOfPoints,
E_uwGEONotEnoughtMemory ) ;
MMG_fn_vEndMemoryInfo();
p_stLocalElement -> xIndexOfParallelBox = GEO_C_xNoParallelBox;
return p_stLocalElement;
}
/* END ANNECY MT }*/
#ifndef _FIRE_DEADCODE_U64_
ACP_tdxIndex GEO_lGetElementPointsNbPoints( ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement )
{
return((( GEO_tdstElementPoints *) hObject ->d_stListOfElements[hElement])-> xNbPoints );
}
void GEO_xSetFatnessOfElementPoints (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
MTH_tdxReal xFatness)
{
(( GEO_tdstElementPoints *) hObject ->d_stListOfElements[hElement])
-> xFatness = xFatness;
}
MTH_tdxReal GEO_xGetFatnessOfElementPoints (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement )
{
return((( GEO_tdstElementPoints *) hObject ->d_stListOfElements[hElement ])-> xFatness );
}
ACP_tdxIndex GEO_xGetIndexOfElementPoints (ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfPoint)
{
return((( GEO_tdstElementPoints *) hObject ->d_stListOfElements[hElement ])
-> d_xListOfPointIndex[xNumberOfPoint] );
}
void GEO_xSetMaterialOfElementPoints (ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxHandleOfMaterial hMaterial)
{
GMT_fn_vSetVisualMaterial((( GEO_tdstElementPoints *) hObject
->d_stListOfElements[hElement ])
-> hMaterial, hMaterial);
}
ACP_tdxHandleOfMaterial GEO_xGetMaterialOfElementPoints (ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return GMT_fn_hGetVisualMaterial(((( GEO_tdstElementPoints *) hObject
->d_stListOfElements[hElement ])
-> hMaterial));
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_xSetGameMaterialOfElementPoints (ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
GMT_tdxHandleToGameMaterial hMaterial)
{
(( GEO_tdstElementPoints *) hObject ->d_stListOfElements[hElement ])
-> hMaterial = hMaterial;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
GMT_tdxHandleToGameMaterial GEO_xGetGameMaterialOfElementPoints (ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return((( GEO_tdstElementPoints *) hObject ->d_stListOfElements[hElement ])
-> hMaterial);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_xSetIndexOfElementPoints (ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfPoint,
ACP_tdxIndex xIndexOfPoint)
{
(( GEO_tdstElementPoints *) hObject ->d_stListOfElements[ hElement ])
-> d_xListOfPointIndex[xNumberOfPoint] = xIndexOfPoint;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*************************************************************************************************************/
/* Lines elements*/
/*************************************************************************************************************/
/* ANNECY MT 20/02/98 {*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_xCreateElementLines ( ACP_tdxHandleOfObject p_xObjectToSet ,
ACP_tdxHandleOfElement *p_hElement ,
ACP_tdxIndex xNumberOfLines)
{
ACP_tdxIndex xElementToBuild;
/*Find the element To Create*/
for (xElementToBuild=0;
xElementToBuild<p_xObjectToSet->xNbElements;
xElementToBuild++)
if (p_xObjectToSet->
d_xListOfElementsTypes[xElementToBuild]==GEO_C_xElementNULL)
break;
/*More than p_xObjectToSet->xNbElements have been created so <-*/
if (xElementToBuild==p_xObjectToSet->xNbElements) return;
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild]=GEO_C_xElementLines;
*p_hElement = xElementToBuild;
p_xObjectToSet->d_stListOfElements[xElementToBuild] = (void*) GEO_p_stAllocElementLines( xNumberOfLines );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
GEO_tdstElementLines *GEO_p_stAllocElementLines( ACP_tdxIndex xNumberOfLines )
{
GEO_tdstElementLines *p_stLocalElement;
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementLine , 0 );
GEO_M_CPAMalloc (
p_stLocalElement,
GEO_tdstElementLines * ,
sizeof ( GEO_tdstElementLines ) ,
E_uwGEONotEnoughtMemory ) ;
/*Index of lines*/
p_stLocalElement -> xNbLines = xNumberOfLines;
GEO_M_CPAMalloc (
p_stLocalElement -> d_stListOfLineIndex ,
GEO_tdstDoubledIndex * ,
sizeof ( GEO_tdstDoubledIndex ) * xNumberOfLines,
E_uwGEONotEnoughtMemory ) ;
GEO_M_CPAMalloc (
p_stLocalElement -> d_hListOfLinesMaterial ,
/*ACP_tdxHandleOfMaterial*/GMT_tdxHandleToGameMaterial * ,
sizeof ( /*ACP_tdxHandleOfMaterial*/ GMT_tdxHandleToGameMaterial ) * xNumberOfLines,
E_uwGEONotEnoughtMemory ) ;
MMG_fn_vEndMemoryInfo();
p_stLocalElement -> xIndexOfParallelBox = GEO_C_xNoParallelBox;
return p_stLocalElement;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_
ACP_tdxIndex GEO_lGetElementLinesNbLines( ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement )
{
return((( GEO_tdstElementLines *) hObject ->d_stListOfElements[hElement]) -> xNbLines );
}
void GEO_xSetThicknessOfElementLines (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
MTH_tdxReal xThickness)
{
(( GEO_tdstElementLines *) hObject ->d_stListOfElements[hElement])
-> xThickness = xThickness ;
}
MTH_tdxReal GEO_xGetThicknessOfElementLines (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement )
{
return ((( GEO_tdstElementLines *) hObject ->d_stListOfElements[hElement]) -> xThickness );
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_xSetIndexOfElementLines (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xLineToSet,
GEO_tdstDoubledIndex *p_xIndexNumber)
{
(( GEO_tdstElementLines *) hObject ->d_stListOfElements[hElement ])
-> d_stListOfLineIndex[xLineToSet] = *p_xIndexNumber;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_
void GEO_xGetIndexOfElementLines (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xLineToGet,
GEO_tdstDoubledIndex *p_xIndexNumber)
{
*p_xIndexNumber = ((( GEO_tdstElementLines *) hObject ->d_stListOfElements[hElement ])
-> d_stListOfLineIndex[xLineToGet] );
}
void GEO_xSetMaterialOfElementLines (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xLineToSet,
ACP_tdxHandleOfMaterial hMaterial)
{
GMT_fn_vSetVisualMaterial((( GEO_tdstElementLines *) hObject
->d_stListOfElements[hElement ])
-> d_hListOfLinesMaterial[xLineToSet], hMaterial);
}
void GEO_xGetMaterialOfElementLines (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xLineToGet,
ACP_tdxHandleOfMaterial *p_hMaterial)
{
*p_hMaterial = GMT_fn_hGetVisualMaterial(((( GEO_tdstElementLines *) hObject ->d_stListOfElements[hElement ])
-> d_hListOfLinesMaterial[xLineToGet] ));
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_xSetGameMaterialOfElementLines (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xLineToSet,
GMT_tdxHandleToGameMaterial hMaterial)
{
(( GEO_tdstElementLines *) hObject ->d_stListOfElements[hElement ])
-> d_hListOfLinesMaterial[xLineToSet] = hMaterial;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_
void GEO_xGetGameMaterialOfElementLines (ACP_tdxHandleOfObject hObject ,
ACP_tdxHandleOfElement hElement ,
ACP_tdxIndex xLineToGet,
GMT_tdxHandleToGameMaterial *p_hMaterial)
{
*p_hMaterial = ((( GEO_tdstElementLines *) hObject ->d_stListOfElements[hElement ])
-> d_hListOfLinesMaterial[xLineToGet] );
}
#endif /* _FIRE_DEADCODE_U64_ */
/*************************************************************************************************************/
/* Spheres elements*/
/*************************************************************************************************************/
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vCreateElementSpheres()
// Create spheres element
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
/* ANNECY MT 20/02/98 {*/
void GEO_vCreateElementSpheres ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement *p_hElement,
ACP_tdxIndex xNbSpheres )
{
ACP_tdxIndex xElementToBuild;
GEO_tdstGeometricObject *p_xObjectToSet;
p_xObjectToSet = hObject;
/*Find the element To Create*/
for ( xElementToBuild = 0 ; xElementToBuild < p_xObjectToSet->xNbElements ; xElementToBuild++ )
if ( hObject->d_xListOfElementsTypes[xElementToBuild] == GEO_C_xElementNULL )
break;
/*More than p_xObjectToSet->xNbElements have been created so <-*/
if ( xElementToBuild == p_xObjectToSet->xNbElements )
return;
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild] = GEO_C_xElementSpheres;
*p_hElement = xElementToBuild;
p_xObjectToSet->d_stListOfElements[xElementToBuild] = (void*) GEO_p_stAllocElementSpheres( xNbSpheres );
}
GEO_tdstElementSpheres *GEO_p_stAllocElementSpheres( ACP_tdxIndex xNbSpheres )
{
GEO_tdstElementSpheres *p_stLocalElement;
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementSphere , 0 );
GEO_M_CPAMalloc (
p_stLocalElement ,
GEO_tdstElementSpheres * ,
sizeof ( GEO_tdstElementSpheres ) ,
E_uwGEONotEnoughtMemory ) ;
/*Spheres */
GEO_M_CPAMalloc (
p_stLocalElement->d_stListOfSpheres ,
GEO_tdstIndexedSphere * ,
sizeof ( GEO_tdstIndexedSphere ) * xNbSpheres ,
E_uwGEONotEnoughtMemory ) ;
MMG_fn_vEndMemoryInfo();
p_stLocalElement->xNbSpheres = xNbSpheres;
p_stLocalElement -> xIndexOfParallelBox = GEO_C_xNoParallelBox;
return p_stLocalElement;
}
/* END ANNECY MT }*/
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetCenterPointOfIndexedSphere()
// Set the index of a sphere center
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vSetCenterPointOfIndexedSphere ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfSphere,
ACP_tdxIndex xIndexOfPoint )
{
(( GEO_tdstElementSpheres *)hObject->d_stListOfElements[ hElement ])
->d_stListOfSpheres[xNumberOfSphere].xCenterPoint = xIndexOfPoint;
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_xGetCenterPointOfIndexedSphere()
// Get the index of a sphere center
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
ACP_tdxIndex GEO_xGetCenterPointOfIndexedSphere ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfSphere )
{
return( (( GEO_tdstElementSpheres *)hObject->d_stListOfElements[ hElement ])
->d_stListOfSpheres[xNumberOfSphere].xCenterPoint );
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetRadiusOfIndexedSphere()
// Set the radius of a sphere
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vSetRadiusOfIndexedSphere ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfSphere,
MTH_tdxReal xRadius )
{
(( GEO_tdstElementSpheres *) hObject ->d_stListOfElements[ hElement ])
-> d_stListOfSpheres[xNumberOfSphere].xRadius = xRadius;
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_xGetRadiusOfIndexedSphere()
// Get the radius of a sphere
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
MTH_tdxReal GEO_xGetRadiusOfIndexedSphere ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfSphere )
{
return( (( GEO_tdstElementSpheres *)hObject->d_stListOfElements[ hElement ])
->d_stListOfSpheres[xNumberOfSphere].xRadius );
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetMaterialOfIndexedSphere()
// Set the material of a sphere
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
// Modifications : Use GMT
// Modification date : feb 97 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vSetMaterialOfIndexedSphere ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfSphere,
ACP_tdxHandleOfMaterial hMaterial )
{
GMT_fn_vSetVisualMaterial((( GEO_tdstElementSpheres *)hObject
->d_stListOfElements[ hElement ])
->d_stListOfSpheres[xNumberOfSphere].hMaterial, hMaterial);
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetGameMaterialOfIndexedSphere()
// Set the game material of a sphere
////////////////////////////////////////////////////////////////////////////////
// Input : hObject : handle to the geometric object
// hElement : handle to the element
// xNumberOfSphere : number of the sphere
// hMaterial : handle to the game material
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 1997 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vSetGameMaterialOfIndexedSphere ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfSphere,
GMT_tdxHandleToGameMaterial hMaterial )
{
(( GEO_tdstElementSpheres *)hObject->d_stListOfElements[ hElement ])
->d_stListOfSpheres[xNumberOfSphere].hMaterial = hMaterial;
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vGetIndexedSphereNbSpheres ()
// Get the number of spheres in element
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
ACP_tdxIndex GEO_lGetIndexedSphereNbSpheres ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return((( GEO_tdstElementSpheres *)hObject->d_stListOfElements[ hElement ])->xNbSpheres) ;
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_hGetMaterialOfIndexedSphere()
// Get the material of a sphere
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
// Modifications : Use GMT
// Modification date : Feb 97 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
#ifndef _FIRE_DEADCODE_U64_
ACP_tdxHandleOfMaterial GEO_hGetMaterialOfIndexedSphere ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfSphere )
{
return GMT_fn_hGetVisualMaterial( (( GEO_tdstElementSpheres *)hObject
->d_stListOfElements[ hElement ])
->d_stListOfSpheres[xNumberOfSphere].hMaterial );
}
#endif /* _FIRE_DEADCODE_U64_ */
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_hGetMaterialOfIndexedSphere()
// Get the game material of a sphere
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 1997 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
GMT_tdxHandleToGameMaterial GEO_hGetGameMaterialOfIndexedSphere ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfSphere )
{
return( (( GEO_tdstElementSpheres *)hObject->d_stListOfElements[ hElement ])
->d_stListOfSpheres[xNumberOfSphere].hMaterial );
}
/*************************************************************************************************************/
/* Aligned Boxes elements*/
/*************************************************************************************************************/
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vCreateElementAlignedBoxes()
// Create aligned boxes element
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
/* ANNECY MT 20/02/98 {*/
void GEO_vCreateElementAlignedBoxes ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement *p_hElement,
ACP_tdxIndex xNbAlignedBoxes )
{
ACP_tdxIndex xElementToBuild;
GEO_tdstGeometricObject *p_xObjectToSet;
p_xObjectToSet = hObject;
/*Find the element To Create*/
for ( xElementToBuild = 0 ; xElementToBuild < p_xObjectToSet->xNbElements ; xElementToBuild++ )
if ( hObject->d_xListOfElementsTypes[xElementToBuild] == GEO_C_xElementNULL )
break;
/*More than p_xObjectToSet->xNbElements have been created so <-*/
if ( xElementToBuild == p_xObjectToSet->xNbElements )
return;
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild] = GEO_C_xElementAlignedBoxes;
*p_hElement = xElementToBuild;
p_xObjectToSet->d_stListOfElements[xElementToBuild] = (void*) GEO_p_stAllocElementAlignedBoxes( xNbAlignedBoxes );
}
GEO_tdstElementAlignedBoxes *GEO_p_stAllocElementAlignedBoxes( ACP_tdxIndex xNbAlignedBoxes )
{
GEO_tdstElementAlignedBoxes *p_stLocalElement;
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementAlignedBox , 0 );
GEO_M_CPAMalloc (
p_stLocalElement ,
GEO_tdstElementAlignedBoxes * ,
sizeof ( GEO_tdstElementAlignedBoxes ),
E_uwGEONotEnoughtMemory ) ;
/*Boxes */
GEO_M_CPAMalloc (
p_stLocalElement->d_stListOfAlignedBoxes ,
GEO_tdstIndexedAlignedBox * ,
sizeof ( GEO_tdstIndexedAlignedBox ) * xNbAlignedBoxes,
E_uwGEONotEnoughtMemory ) ;
MMG_fn_vEndMemoryInfo();
p_stLocalElement->xNbAlignedBoxes = xNbAlignedBoxes;
p_stLocalElement -> xIndexOfParallelBox = GEO_C_xNoParallelBox;
return p_stLocalElement;
}
/* ANNECY MT }*/
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_lGetAlignedBoxNbBoxes()
// Get the number of aligned boxes in element
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
ACP_tdxIndex GEO_lGetAlignedBoxNbBoxes ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return ((( GEO_tdstElementAlignedBoxes *)hObject->d_stListOfElements[ hElement ])->xNbAlignedBoxes);
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetMinMaxPointOfIndexedAlignedBox()
// Set the min max of a box
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
/*XB*/
/*#ifndef _FIRE_DEADCODE_U64_*/
/*End XB*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_vSetMinMaxPointOfIndexedAlignedBox ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfAlignedBox,
ACP_tdxIndex xMinPoint,
ACP_tdxIndex xMaxPoint )
{
(( GEO_tdstElementAlignedBoxes *)hObject->d_stListOfElements[ hElement ])
->d_stListOfAlignedBoxes[xNumberOfAlignedBox].xMinPoint = xMinPoint;
(( GEO_tdstElementAlignedBoxes *)hObject->d_stListOfElements[ hElement ])
->d_stListOfAlignedBoxes[xNumberOfAlignedBox].xMaxPoint = xMaxPoint;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vGetMinMaxPointOfIndexedAlignedBox()
// Get the min max of a box
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vGetMinMaxPointOfIndexedAlignedBox ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfAlignedBox,
ACP_tdxIndex *p_xMinPoint,
ACP_tdxIndex *p_xMaxPoint )
{
*p_xMinPoint = (( GEO_tdstElementAlignedBoxes *)hObject->d_stListOfElements[ hElement ])
->d_stListOfAlignedBoxes[xNumberOfAlignedBox].xMinPoint;
*p_xMaxPoint = (( GEO_tdstElementAlignedBoxes *)hObject->d_stListOfElements[ hElement ])
->d_stListOfAlignedBoxes[xNumberOfAlignedBox].xMaxPoint;
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetMaterialOfIndexedAlignedBox()
// Set the material of a box
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
// Modifications : Use GMT
// Modification date : Feb 97 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_vSetMaterialOfIndexedAlignedBox ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfAlignedBox,
ACP_tdxHandleOfMaterial hMaterial )
{
GMT_fn_vSetVisualMaterial((( GEO_tdstElementAlignedBoxes *)hObject
->d_stListOfElements[ hElement ])
->d_stListOfAlignedBoxes[xNumberOfAlignedBox].hMaterial,
hMaterial);
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vGetMaterialOfIndexedAlignedBox()
// Get the material of a box
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 28 nov 1996 Author : FPI
////////////////////////////////////////////////////////////////////////////////
// Modifications : Use GMT
// Modification date : Feb 97 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
ACP_tdxHandleOfMaterial GEO_vGetMaterialOfIndexedAlignedBox ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfAlignedBox )
{
return GMT_fn_hGetVisualMaterial( (( GEO_tdstElementAlignedBoxes *)hObject
->d_stListOfElements[ hElement ])
->d_stListOfAlignedBoxes[xNumberOfAlignedBox].hMaterial );
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetGameMaterialOfIndexedAlignedBox()
// Set the game material of a box
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 1997 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vSetGameMaterialOfIndexedAlignedBox ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfAlignedBox,
GMT_tdxHandleToGameMaterial hMaterial )
{
(( GEO_tdstElementAlignedBoxes *)hObject->d_stListOfElements[ hElement ])
->d_stListOfAlignedBoxes[xNumberOfAlignedBox].hMaterial = hMaterial;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*XB*/
/*#endif /* _FIRE_DEADCODE_U64_ */
/*End XB*/
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vGetGameMaterialOfIndexedAlignedBox()
// Get the game material of a box
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 1997 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
GMT_tdxHandleToGameMaterial GEO_vGetGameMaterialOfIndexedAlignedBox ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfAlignedBox )
{
return( (( GEO_tdstElementAlignedBoxes *)hObject->d_stListOfElements[ hElement ])
->d_stListOfAlignedBoxes[xNumberOfAlignedBox].hMaterial );
}
/*************************************************************************************************************/
/* Cones elements*/
/*************************************************************************************************************/
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vCreateElementCones()
// Create cones element
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 20 jan 1997 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
/* ANNECY MT 20/02/98 {*/
void GEO_vCreateElementCones ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement *p_hElement,
ACP_tdxIndex xNbCones )
{
ACP_tdxIndex xElementToBuild;
GEO_tdstGeometricObject *p_xObjectToSet;
p_xObjectToSet = hObject;
/*Find the element To Create*/
for ( xElementToBuild = 0 ; xElementToBuild < p_xObjectToSet->xNbElements ; xElementToBuild++ )
if ( hObject->d_xListOfElementsTypes[xElementToBuild] == GEO_C_xElementNULL )
break;
/*More than p_xObjectToSet->xNbElements have been created so <-*/
if ( xElementToBuild == p_xObjectToSet->xNbElements )
return;
p_xObjectToSet->d_xListOfElementsTypes[xElementToBuild] = GEO_C_xElementCones;
*p_hElement = xElementToBuild;
p_xObjectToSet->d_stListOfElements[xElementToBuild] = (void*) GEO_p_stAllocElementCones( xNbCones );
}
GEO_tdstElementCones *GEO_p_stAllocElementCones( ACP_tdxIndex xNbCones )
{
GEO_tdstElementCones *p_stLocalElement;
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeGeometricObject , MMG_C_lSubTypeElementCone , 0 );
GEO_M_CPAMalloc (
p_stLocalElement ,
GEO_tdstElementCones * ,
sizeof ( GEO_tdstElementCones ) ,
E_uwGEONotEnoughtMemory ) ;
/*Cones*/
GEO_M_CPAMalloc (
p_stLocalElement->d_stListOfCones ,
GEO_tdstIndexedCone * ,
sizeof ( GEO_tdstIndexedCone ) * xNbCones ,
E_uwGEONotEnoughtMemory ) ;
MMG_fn_vEndMemoryInfo();
p_stLocalElement->xNbCones = xNbCones;
p_stLocalElement -> xIndexOfParallelBox = GEO_C_xNoParallelBox;
return p_stLocalElement;
}
/* END ANNECY MT }*/
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_lGetConeNbCones()
// Get the number of cones in element
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 20 jan 1997 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
ACP_tdxIndex GEO_lGetConeNbCones ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return ((( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])->xNbCones);
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetPointsOfIndexedCone()
// Set the points of a cone
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 20 jan 1997 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vSetPointsOfIndexedCone ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfCone,
ACP_tdxIndex xTopPoint,
ACP_tdxIndex xBasePoint )
{
(( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])
->d_stListOfCones[xNumberOfCone].xTopPoint = xTopPoint;
(( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])
->d_stListOfCones[xNumberOfCone].xBasePoint = xBasePoint;
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vGetPointsOfIndexedCone()
// Get the points of a cone
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 20 jan 1997 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
/*XB980507*/
/*#ifndef _FIRE_DEADCODE_U64_*/
/*End XB*/
void GEO_vGetPointsOfIndexedCone ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfCone,
ACP_tdxIndex *p_xTopPoint,
ACP_tdxIndex *p_xBasePoint )
{
*p_xTopPoint = (( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])
->d_stListOfCones[xNumberOfCone].xTopPoint;
*p_xBasePoint = (( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])
->d_stListOfCones[xNumberOfCone].xBasePoint;
}
/*XB980507*/
/*#endif /* _FIRE_DEADCODE_U64_ */
/*End XB*/
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetRadiusOfIndexedCone()
// Set the radius of a cone
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 20 jan 1997 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vSetRadiusOfIndexedCone ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfCone,
MTH_tdxReal xRadius )
{
(( GEO_tdstElementCones *) hObject ->d_stListOfElements[ hElement ])
-> d_stListOfCones[xNumberOfCone].xBaseRadius = xRadius;
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_xGetRadiusOfIndexedCone()
// Get the radius of a cone
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 20 jan 1997 Author : FPI
////////////////////////////////////////////////////////////////////////////////
*/
#ifndef _FIRE_DEADCODE_U64_
MTH_tdxReal GEO_xGetRadiusOfIndexedCone ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfCone )
{
return( (( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])
->d_stListOfCones[xNumberOfCone].xBaseRadius );
}
#endif /* _FIRE_DEADCODE_U64_ */
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetMaterialOfIndexedCone()
// Set the material of a cone
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 20 jan 1997 Author : FPI
////////////////////////////////////////////////////////////////////////////////
// Modifications : Use GMT
// Modification date : Feb 97 Author A.R.
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vSetMaterialOfIndexedCone ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfCone,
ACP_tdxHandleOfMaterial hMaterial )
{
GMT_fn_vSetVisualMaterial((( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])
->d_stListOfCones[xNumberOfCone].hMaterial, hMaterial);
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vGetMaterialOfIndexedCone()
// Get the material of a cone
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : 20 jan 1997 Author : FPI
////////////////////////////////////////////////////////////////////////////////
// Modifications : Use GMT
// Modification date : Feb 97 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
#ifndef _FIRE_DEADCODE_U64_
ACP_tdxHandleOfMaterial GEO_vGetMaterialOfIndexedCone ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfCone )
{
return GMT_fn_hGetVisualMaterial( (( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])
->d_stListOfCones[xNumberOfCone].hMaterial );
}
#endif /* _FIRE_DEADCODE_U64_ */
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetGameMaterialOfIndexedCone()
// Set the game material of a cone
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 1997 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
void GEO_vSetGameMaterialOfIndexedCone ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfCone,
GMT_tdxHandleToGameMaterial hMaterial )
{
(( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])
->d_stListOfCones[xNumberOfCone].hMaterial = hMaterial;
}
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vGetGameMaterialOfIndexedCone()
// Get the game material of a cone
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 1997 Author : A.R.
////////////////////////////////////////////////////////////////////////////////
*/
GMT_tdxHandleToGameMaterial GEO_vGetGameMaterialOfIndexedCone ( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumberOfCone )
{
return( (( GEO_tdstElementCones *)hObject->d_stListOfElements[ hElement ])
->d_stListOfCones[xNumberOfCone].hMaterial );
}
/* ANNECY MT 20/02/98 {*/
/*
////////////////////////////////////////////////////////////////////////////////
// Description : GEO_vSetParallelBoxOfElementIndexedTriangles
// Set the parallel box of an element indexed triangle
////////////////////////////////////////////////////////////////////////////////
// Input :
// Output :
////////////////////////////////////////////////////////////////////////////////
// Creation date : Feb 1998 Author : Marc Trabucato
////////////////////////////////////////////////////////////////////////////////
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_vSetParallelBoxOfElementIndexedTriangles( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace)
{
((GEO_tdstElementIndexedTriangles*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox = xNumFace;
}
ACP_tdxIndex GEO_xGetParallelBoxOfElementIndexedTriangles( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return( ((GEO_tdstElementIndexedTriangles*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox );
}
void GEO_vSetParallelBoxOfElementFaceMapDescriptors( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace)
{
((GEO_tdstElementFaceMapDescriptors*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox = xNumFace;
}
ACP_tdxIndex GEO_xGetParallelBoxOfElementFaceMapDescriptors( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return( ((GEO_tdstElementFaceMapDescriptors*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox );
}
void GEO_vSetParallelBoxOfElementSprites( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace)
{
((GEO_tdstElementSprite*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox = xNumFace;
}
ACP_tdxIndex GEO_xGetParallelBoxOfElementSprites( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return( ((GEO_tdstElementSprite*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox );
}
void GEO_vSetParallelBoxOfElementTMeshes( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace)
{
((GEO_tdstElementTMeshes*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox = xNumFace;
}
ACP_tdxIndex GEO_xGetParallelBoxOfElementTMeshes( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return( ((GEO_tdstElementTMeshes*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox );
}
void GEO_vSetParallelBoxOfElementPoints( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace)
{
((GEO_tdstElementPoints*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox = xNumFace;
}
ACP_tdxIndex GEO_xGetParallelBoxOfElementPoints( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return( ((GEO_tdstElementPoints*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox );
}
void GEO_vSetParallelBoxOfElementLines( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace)
{
((GEO_tdstElementLines*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox = xNumFace;
}
ACP_tdxIndex GEO_xGetParallelBoxOfElementLines( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return( ((GEO_tdstElementLines*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox );
}
void GEO_vSetParallelBoxOfElementAlignedBoxes( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace)
{
((GEO_tdstElementAlignedBoxes*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox = xNumFace;
}
ACP_tdxIndex GEO_xGetParallelBoxOfElementAlignedBoxes( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return( ((GEO_tdstElementAlignedBoxes*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox );
}
void GEO_vSetParallelBoxOfElementSpheres( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace)
{
((GEO_tdstElementSpheres*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox = xNumFace;
}
ACP_tdxIndex GEO_xGetParallelBoxOfElementSpheres( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return( ((GEO_tdstElementSpheres*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox );
}
void GEO_vSetParallelBoxOfElementCones( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement,
ACP_tdxIndex xNumFace)
{
((GEO_tdstElementCones*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox = xNumFace;
}
ACP_tdxIndex GEO_xGetParallelBoxOfElementCones( ACP_tdxHandleOfObject hObject,
ACP_tdxHandleOfElement hElement)
{
return( ((GEO_tdstElementCones*)hObject->d_stListOfElements[ hElement ]) -> xIndexOfParallelBox );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ANNECY MT }*/