/* (c) Ubi Studios 1996*/
/* See Vincent Greco for any comment or question*/
 
#ifndef __3DOBJECT_HPP__
#define __3DOBJECT_HPP__
 
#ifdef CPA_WANTS_IMPORT
#pragma message("=================================================================================")
#pragma message("=================================================================================")
#pragma message("WARNING, use of 3DGEOM DLL objects with CPA_WANTS_IMPORT defined.")
#pragma message("=================================================================================")
#pragma message("=================================================================================")
#endif
 
/****************************************/
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
/****************************************/
 
class SectionElement;
 
/****************************************/
/* enums*/
/****************************************/
 
typedef enum
{
    C_Ok, C_BadElement, C_BadValue
}
tdeGeomResult;
 
typedef enum
{
    C_Set, C_Inc
}
tdeModifType;
 
typedef enum
{
    C_X, C_Y, C_Z
}
tdeCompoType;
 
/****************************************/
/* structs*/
/****************************************/
/* BEGIN CPA2 Cristi Petrescu 98-02-*/
/* In a modification we do not need to keep the value. This can be retrieved at save time from the object data*/
/* Remember: in the mdf files we keep the update values, not the backup*/
/* END CPA2 Cristi Petrescu 98-02-*/
typedef struct tdstModifPoint_
{
    ACP_tdxIndex		xIndexOfPoint;
	/* BEGIN CPA2 Cristi Petrescu 98-02-*/
	/*MTH3D_tdstVector	st3DPoint;*/
	/* END CPA2 Cristi Petrescu 98-02-*/
}
tdstModifPoint;
 
typedef struct tdstModifGMT_
{
    ACP_tdxHandleOfElement  hElement;
    ACP_tdxIndex            xElementType;
    ACP_tdxIndex            xIndexInElement;
	/* BEGIN CPA2 Cristi Petrescu 98-02-*/
	/*CString					csGameMaterialName;*/
	GMT_tdxHandleToGameMaterial hGameMaterial;
	/* END CPA2 Cristi Petrescu 98-02-*/
}
tdstModifGMT;
 
typedef struct tdstModifFMD_
{
    ACP_tdxIndex xElementIT;
    ACP_tdxIndex xIndexFaceIT;
    ACP_tdxIndex xElementFMD;
    ACP_tdxIndex xIndexFaceFMD;
} tdstModifFMD ;
 
typedef struct tdstInfoFMD_
{
    ACP_tdxHandleOfFMD hFMD;
    SectionElement *p_oSectionElementFMD;
} tdstInfoFMD;
 
/****************************************/
/* classes*/
/****************************************/
class SectionElement : public CPA_SectionObject
{
/* datas*/
private:
    void	*m_hElement;
/* methods*/
public:
    SectionElement(const CString csReferencedSectionName, char *p_szDataPath, SCR_tdpfn_Ntfy_Callback pCallBack,
                   void *pSectionData = NULL, BOOL bExistingSection = TRUE)
                  :CPA_SectionObject(csReferencedSectionName, p_szDataPath, pCallBack, pSectionData, bExistingSection)
    {}
 
    void  SetElement  (void *_hElement)  { m_hElement = _hElement; }
    void *hGetElement (void)             { return m_hElement; }
};
 
class CPA_EXPORT Geometry3D : public CPA_ModifiableObject, public CPA_EdMot<ACP_tdxHandleOfObject>
{
/* datas*/
private:
    ACP_tdxHandleOfObject       m_hBoundingVolume;
    BOOL                        m_bMustRecomputeBdV;
    BOOL                        m_bEndCreated;
    CPA_SectionObject           *m_p_oModifSection;
    /*CPA_SectionObject           *m_p_oModifListSection;*/
    CPA_List<tdstModifPoint>    m_oListOfModifiedPoints;
    CPA_List<tdstModifGMT>      m_oListOfGMTModif;
    CPA_List<tdstModifFMD>      m_oListOfFMDModif;
    BOOL                        m_bMustSaveFMD;
    CPA_List<tdstInfoFMD>       m_oListOfFMD;
    long                        m_lUniqueFMD;
public:
/*ROMTEAM WorldEditor (Viorel Preoteasa) 20/01/98*/
	void fn_vSetMustRecomputeBdV(BOOL B = TRUE){m_bMustRecomputeBdV = B;}
/*ENDROMTEAM WorldEditor (Viorel Preoteasa)*/
 
/*ROMTEAM WorldEditor (Cristian Stegaru) 01/98*/
    CPA_List<SectionElement>    m_oListOfElementSections;
/*ENDROMTEAM WorldEditor (Cristian Stegaru)*/
 
/**/
/**/
/* methods on 3DObject.cpp*/
/**/
/**/
public:
    static void StaticInit(CPA_MainWorld *_p_oMainWorld);
    /* constructor to encapsulate an existing engine object*/
    Geometry3D(CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName = "", char *_p_cRefPath = NULL, tdeSaveStatus _eStatus = E_ss_Modify);
    /* constructor to create and save a new object*/
    Geometry3D(CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, CPA_BaseObject *_p_oOwnerFile, const CString _csName = "", char *_p_cRefPath = NULL, tdeSaveStatus _eStatus = E_ss_Responsible);
    /* constructor to create and a new object which can't be save*/
    Geometry3D(CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, const CString _csName = "", tdeSaveStatus _eStatus = E_ss_NoSave);
 
    ~Geometry3D();
    /* virtual member overlapped*/
 
    /* CPA_BaseObject*/
    void *GetData         (void)                                    { return (void*)GetStruct(); }
    long GetDataType      (void)                                    { return HIE_C_ulEDT_Geometric; }
	/* to choose unicity criteria*/
    tdeMissingCriteria fn_eCheckUnicity (const CString csNewName)   { return fn_eCheckUnicityWithOwner(csNewName); }
    /* CPA_SaveObject*/
	/* virtual functions*/
    BOOL fn_bCanBeModified (void);
 
    void fn_vUpdateSectionName    (void);
    void fn_vNotifySave           (void);
    void fn_vNotifyUnSave         (void);
    void fn_vNotifyRestore        (void);
    void fn_vNotifyRename         (void);
 
    void fn_vNotifySaveObject     (void);
    void fn_vNotifyUnSaveObject   (void);
    void fn_vNotifyRestoreObject  (void);
    void fn_vNotifyRenameObject	  (void);
 
    void fn_vNotifySaveElement    (ACP_tdxHandleOfElement _hElement);
    void fn_vNotifyUnSaveElement  (ACP_tdxHandleOfElement _hElement);
    void fn_vNotifyRestoreElement (ACP_tdxHandleOfElement _hElement);
    void fn_vNotifyRenameElement  (ACP_tdxHandleOfElement _hElement);
 
    /* Modif Section*/
    void SetExistingModifSection    (BOOL _bExists);
	/* BEGIN CPA2 Cristi Petrescu 98-02-*/
	void mfn_vComputeModifSectionName                   (char *_p_cFileName);
	void mfn_vLoadModifSection						    (void);
	void mfn_vCreateModifSection						(char *szModifSectionName = NULL);
	/* END CPA2 Cristi Petrescu 98-02-*/
    /*void SetExistingModifListSection(BOOL _bExists);*/
 
    /* Load CallBack*/
    static SCR_tde_Anl_ReturnValue CallBackLoad         (SCR_tdst_File_Description *_p_stFile, char *_pszName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);
    static SCR_tde_Anl_ReturnValue CallBackLoadModif    (SCR_tdst_File_Description *_p_stFile, char *_pszName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);
    /*static SCR_tde_Anl_ReturnValue CallBackLoadModifList(SCR_tdst_File_Description *_p_stFile, char *_pszName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);*/
 
    /* Save CallBack*/
    static void CallBackSaveModifGeometricObject    ( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);
    /*static void CallBackSaveModifListGeometricObject( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);*/
	static void CallBackSaveGeometricObject	        ( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);
	static void CallBackSaveGeometricElement        ( SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);
 
	static void CallBackSaveElementIndexedTriangle		(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementIndexedTriangles *p_stElement);
	static void CallBackSaveElementFaceMapDescriptors	(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementFaceMapDescriptors *p_stElement);
    static void CallBackSaveFaceMapDescriptors          (SCR_tdst_File_Description *p_stFile, char *p_szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);
	static void CallBackSaveElementSprites				(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementSprite *p_stElement);
	static void CallBackSaveElementTMeshes				(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementTMeshes *p_stElement);
	static void CallBackSaveElementPoints				(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementPoints *p_stElement);
	static void CallBackSaveElementLines				(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementLines *p_stElement);
	static void CallBackSaveElementSpheres				(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementSpheres *p_stElement);
	static void CallBackSaveElementAlignedBox			(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementAlignedBoxes *p_stElement);
	static void CallBackSaveElementCones				(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementCones *p_stElement);
	/* BEGIN CPA2 Cristi Petrescu 98-03-*/
#ifdef USE_ALTIMAPS
	static void CallBackSaveElementAltimap				(SCR_tdst_File_Description *p_stFile, char *p_szSectionName, GEO_tdstElementAltimap *p_stElement);
#endif
	/* END CPA2 Cristi Petrescu 98-03-*/
 
    /**/
    void mfn_vSaveModifications     (FILE *_pFile, char *_szIdentity);
    BOOL mfn_bMustSaveModifications (void);
    BOOL mfn_bMustSaveFMD           (void)      { return m_bMustSaveFMD; }
    void mfn_vSaveFMD               (void);
 
/*ROMTEAM WorldEditor (Cristian Stegaru 12/97)*/
	virtual void mfn_vInitElement (char *szFileReference, char *szClassPath, BOOL bSectionExists = FALSE);
	void mfn_vRefreshElement ();
/*ENDROMTEAM WorldEditor (Cristian Stegaru)*/
 
protected:
    /* MODIFICATIONS*/
    void            fn_vInitModifSections       (void);
    void            fn_vInitFMD                 (void);
/* points*/
    void            fn_vClearModificationsList  (void);
    void            fn_vAddModification         (ACP_tdxIndex _xIndex/*, MTH3D_tdstVector *_p_st3DPoint*/);
    tdstModifPoint *fn_p_stGetModification      (ACP_tdxIndex _xIndex);
    void            fn_vOwnerSetPoint           (ACP_tdxIndex xNumPoint,MTH3D_tdstVector *p_stPoint);
/* material*/
    void            fn_vClearGMTModificationsList(void);
    void            fn_vAddGMTModification     (ACP_tdxHandleOfElement _hElement, ACP_tdxIndex _xIndexInElement, GMT_tdxHandleToGameMaterial _hGameMaterial);
    tdstModifGMT   *fn_p_stGetGMTModification  (ACP_tdxHandleOfElement _hElement, ACP_tdxIndex _xIndexInElement);
    void            fn_vOwnerSetMaterial       (ACP_tdxHandleOfElement _hElement, ACP_tdxIndex _xIndexInElement, GMT_tdxHandleToGameMaterial _hGameMaterial);
/* FMD*/
    void            fn_vClearFMDModificationsList(void);
    void            fn_vAddFMDModification     (ACP_tdxIndex xElementIT, ACP_tdxIndex xFaceIT, ACP_tdxIndex xElementFMD, ACP_tdxIndex xFaceFMD);
    void            fn_vDelFMDModification     (ACP_tdxIndex xElementIT, ACP_tdxIndex xFaceIT, ACP_tdxIndex xElementFMD, ACP_tdxIndex xFaceFMD);
    tdstModifFMD   *fn_p_stGetFMDModification  (ACP_tdxIndex xElementIT, ACP_tdxIndex xFaceIT, ACP_tdxIndex xElementFMD, ACP_tdxIndex xFaceFMD);
/**/
/**/
/* methods on 3DObject.cxx*/
/**/
/**/
public:
    /**/
    /* object modifications*/
    /**/
    void fn_vGetPoint           (ACP_tdxIndex xNumPoint,MTH3D_tdstVector *p_stPoint);
    void fn_vSetPoint           (ACP_tdxIndex xNumPoint,MTH3D_tdstVector *p_stPoint);
    void fn_vTranslatePoint     (ACP_tdxIndex _xPoint,MTH3D_tdstVector *_p_st3DTranslation);
    void fn_vSetOnState         (CString _ocsModificationType, BOOL _bInitialState);
 
    ACP_tdxIndex         fn_xGetNbIndexedElements   (ACP_tdxHandleOfElement _hElement);
    static char         *mfn_p_szGetGameMaterialName(GMT_tdxHandleToGameMaterial hGameMaterial);
    CPA_BaseObject		*fn_p_oGetGameMaterial      (ACP_tdxHandleOfElement _hElement, ACP_tdxIndex _xIndexInElement = 0);
    void                 fn_vSetGameMaterial        (ACP_tdxHandleOfElement _hElement, ACP_tdxIndex _xIndexInElement, CPA_BaseObject *_p_oGMT);
    void                 fn_vSetEngineGameMaterial  (ACP_tdxHandleOfElement _hElement, ACP_tdxIndex _xIndexInElement, GMT_tdxHandleToGameMaterial _hGameMaterial);
    /**/
    /* bounding volume*/
    /**/
    ACP_tdxHandleOfObject   fn_hGetBoundingVolume       (void);
    void                    fn_vComputeBoundingVolume   (BOOL _bRecompute = FALSE);
    /**/
    /* element construction*/
    /**/
    tdeGeomResult           fn_vSetListOfPoints (ACP_tdxIndex xNbPoints, MTH3D_tdstVector *p_stPoint);
    void                    fn_vEndCreation     (void);
	void					fn_vAllocAndComputeListOfPointsMaterial(void);
/* spheres*/
    ACP_tdxHandleOfElement  fn_hCreateElementSpheres(ACP_tdxIndex xNbSpheres);
    tdeGeomResult           fn_eSetIndexedSphere    (ACP_tdxHandleOfElement hElementSphere, ACP_tdxIndex xIndexOfSphere, ACP_tdxIndex xCenter, MTH_tdxReal xRadius);
/* aligned box*/
    ACP_tdxHandleOfElement  fn_hCreateElementAlignedBox (ACP_tdxIndex xNbAlignedBoxes);
    tdeGeomResult           fn_eSetAlignedBox           (ACP_tdxHandleOfElement hElementAlignedBox, ACP_tdxIndex xNumberOfAlignedBox, ACP_tdxIndex xMinPoint, ACP_tdxIndex xMaxPoint);
/* cone*/
    ACP_tdxHandleOfElement  fn_hCreateElementCone   (ACP_tdxIndex xNbCones);
    tdeGeomResult           fn_eSetCone             (ACP_tdxHandleOfElement hElementCone, ACP_tdxIndex xNumberOfCone, ACP_tdxIndex xTopPoint, ACP_tdxIndex xBasePoint, MTH_tdxReal xBaseRadius);
    tdeGeomResult           fn_eSetConePoints       (ACP_tdxHandleOfElement hElementCone, ACP_tdxIndex xNumberOfCone, ACP_tdxIndex xTopPoint, ACP_tdxIndex xBasePoint);
    tdeGeomResult           fn_eSetConeBaseRadius   (ACP_tdxHandleOfElement hElementCone, ACP_tdxIndex xNumberOfCone, MTH_tdxReal xBaseRadius);
    tdeGeomResult           fn_eGetConePoints       (ACP_tdxHandleOfElement hElementCone, ACP_tdxIndex xNumberOfCone, ACP_tdxIndex *_p_xTopPoint, ACP_tdxIndex *_p_xBasePoint);
    MTH_tdxReal             fn_xGetConeBaseRadius   (ACP_tdxHandleOfElement hElementCone, ACP_tdxIndex xNumberOfCone);
/* indexed triangle*/
    ACP_tdxHandleOfElement  fn_hCreateElementIndexedTriangle    (ACP_tdxIndex xNbFaces, ACP_tdxIndex xNbElementUV);
    tdeGeomResult           fn_eSetIndexedTriangle              (ACP_tdxHandleOfElement hElementIT, ACP_tdxIndex xNumberOfFace, ACP_tdxIndex xPoint1, ACP_tdxIndex xPoint2, ACP_tdxIndex xPoint3);
    tdeGeomResult           fn_eGetIndexedTrianglePoints        (ACP_tdxHandleOfElement hElementIT, ACP_tdxIndex xNumberOfFace, ACP_tdxIndex *_p_xPt1, ACP_tdxIndex *_p_xPt2, ACP_tdxIndex *_p_xPt3);
/* BEGIN CPA2 Cristi Petrescu 98-03-*/
	/* altimap*/
#ifdef USE_ALTIMAPS
	ACP_tdxHandleOfElement  fn_hCreateElementAltimap (ACP_tdxIndex xNbVertices, ACP_tdxIndex xNbSquares, ACP_tdxIndex	xNbVisibleTriangles, ACP_tdxIndex xNbUVValues, ACP_tdxIndex xNbMaterials);
#endif
	/* END CPA2 Cristi Petrescu 98-03-*/
/* point*/
    ACP_tdxHandleOfElement  fn_hCreateElementPoints         (ACP_tdxIndex xNumberOfPoints);
    tdeGeomResult           fn_eSetIndexedPoint             (ACP_tdxHandleOfElement hElementPoint, ACP_tdxIndex xNumberOfPoint, ACP_tdxIndex xIndexOfPoint);
    tdeGeomResult           fn_eSetFatnessOfElementPoint    (ACP_tdxHandleOfElement hElementPoint, MTH_tdxReal xFatness);
    ACP_tdxIndex            fn_xGetIndexedPointPoint        (ACP_tdxHandleOfElement hElementPoint, ACP_tdxIndex xNumberOfPoint);
    MTH_tdxReal             fn_xGetFatness                  (ACP_tdxHandleOfElement hElementPoint, ACP_tdxIndex xNumberOfPoint);
/* sphere transformations*/
    tdeGeomResult fn_eGetCenter     (MTH3D_tdstVector *p_st3DCenter, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
    tdeGeomResult fn_eGetCenterX    (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
    tdeGeomResult fn_eGetCenterY    (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
    tdeGeomResult fn_eGetCenterZ    (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
 
    tdeGeomResult fn_eSetCenter     (MTH3D_tdstVector *p_stPoint, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
    tdeGeomResult fn_eSetCenterX    (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
    tdeGeomResult fn_eSetCenterY    (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
    tdeGeomResult fn_eSetCenterZ    (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
 
    tdeGeomResult fn_eGetRadius     (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
 
    tdeGeomResult fn_eSetRadius     (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
 
    /* Aligned box*/
    tdeGeomResult fn_eGetMinPoint   (MTH3D_tdstVector *p_st3DPoint, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eSetMinPoint   (MTH3D_tdstVector *p_st3DPoint, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eSetMinPointX  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eSetMinPointY  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eSetMinPointZ  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eIncMinPointX  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eIncMinPointY  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eIncMinPointZ  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
 
    tdeGeomResult fn_eGetMaxPoint   (MTH3D_tdstVector *p_st3DPoint, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eSetMaxPoint   (MTH3D_tdstVector *p_st3DPoint, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eSetMaxPointX  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eSetMaxPointY  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eSetMaxPointZ  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eIncMaxPointX  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eIncMaxPointY  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eIncMaxPointZ  (MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
	/* BEGIN CPA2 Cristi Petrescu 98-03-*/
	/* Use the Engine functions please (GEO_...)*/
	/* or the Altimap3D object*/
	/* Altimaps transf*/
	/*tdeGeomResult fn_eGetOrigin		   (MTH3D_tdstVector *p_st3DPoint, ACP_tdxHandleOfElement hElement);*/
	/*tdeGeomResult fn_eSetOrigin		   (MTH3D_tdstVector  st3DPoint, ACP_tdxHandleOfElement hElement);*/
	/*tdeGeomResult fn_eGetSquarePattern (ACP_tdxIndex *p_xWidth, MTH_tdxReal *p_xSquareDimX, ACP_tdxIndex *p_xDepth, MTH_tdxReal *p_xSquareDimY, ACP_tdxHandleOfElement hElement);*/
	/*tdeGeomResult fn_eSetSquarePattern (ACP_tdxIndex  xWidth, MTH_tdxReal  xSquareDimX, ACP_tdxIndex  xDepth, MTH_tdxReal  xSquareDimY, ACP_tdxHandleOfElement hElement);*/
	/*tdeGeomResult fn_eSetNbFaces       (ACP_tdxIndex xNbSquares, ACP_tdxHandleOfElement hElement);*/
	/* END CPA2 Cristi Petrescu 98-03-*/
/* indexed triangles transformations*/
    void fn_vMoveFaceToFaceDescriptors(ACP_tdxIndex xElementIT, ACP_tdxIndex xFaceIT, ACP_tdxIndex *p_xElementFMD, ACP_tdxIndex *p_xFaceFMD);
    void fn_vMoveFaceDescriptorsToFace(ACP_tdxIndex xElementFMD, ACP_tdxIndex xFaceFMD, ACP_tdxIndex xElementIT, ACP_tdxIndex xFaceIT);
    /**/
    /* type verification*/
    /**/
    BOOL fn_bIsSphere                   (ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumSphere = 0);
    BOOL fn_bIsAlignedBox               (ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    BOOL fn_bIsCone                     (ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumCone = 0);
    BOOL fn_bIsIndexedTriangle          (ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumIT = 0);
    BOOL fn_bIsPoint                    (ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumPoint = 0);
    BOOL fn_bIsLine                     (ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumLine = 0);
	/* BEGIN CPA2 Cristi Petrescu 98-03-*/
	BOOL fn_bIsAltimap					(ACP_tdxHandleOfElement hElement);
	/* END CPA2 Cristi Petrescu 98-03-*/
    BOOL fn_bIsFMD                      (ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumFace = 0);
/*ROMTEAM WorldEditor (Viorel Preoteasa 20/01/98) */
public:
    void          fn_vEndModification       (void);
/*protected:*/
/*  void          fn_vEndModification       (void);*/
/*ENDROMTEAM WorldEditor (Viorel Preoteasa) */
    GMT_tdxHandleToGameMaterial fn_hGetDefaultGameMaterial  (void);
 
	/*CPA2 Stegaru Cristian 98-05*/
	ACP_tdxIndex		mfn_iGetFacesNumber ();
	MTH3D_tdstVector	mfn_3dvGetMinCoordinates ();
	MTH3D_tdstVector	mfn_3dvGetMaxCoordinates ();
	MTH3D_tdstVector	mfn_3dvGetSizes ();	/*dX, dY, dZ*/
	/*End CPA2 Stegaru Cristian 98-05*/
protected:
    void          fn_vEndGMTModification    (ACP_tdxHandleOfElement hElement, ACP_tdxIndex xDataElementIndex = 0);
    tdeGeomResult fn_eModifyMinPoint        (tdeModifType eModif,tdeCompoType eCompo,MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
    tdeGeomResult fn_eModifyMaxPoint        (tdeModifType eModif,tdeCompoType eCompo,MTH_tdxReal *p_xValue, ACP_tdxHandleOfElement hElement, ACP_tdxIndex xNumBox = 0);
 
    GMT_tdxHandleToGameMaterial fn_hGetGameMaterial         (ACP_tdxHandleOfElement _hElement, ACP_tdxIndex _xIndexInElement);
 
    void fn_vComputeElementReferencedSectionName            (char *_szSectionName, ACP_tdxHandleOfElement _hElement);
    void fn_vInitElementSection                             (ACP_tdxHandleOfElement _hElement);
};
 
#endif /*__3DOBJECT_HPP__*/
