//ROMTEAM WorldEditor //////////////////////////////////////////////////////////////////////////////////////// // File : Point3D.cpp: implementation of the Point3D class. // Author : Cristi Petrescu // Date : 97.11 // Description : //////////////////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "ACP_Base.h" #include "ITF.h" #include "incGAM.h" #include "GLI.h" #include "DPT.h" #undef CPA_WANTS_IMPORT #undef CPA_EXPORT #define CPA_WANTS_EXPORT #include "OGD.h" #undef CPA_WANTS_EXPORT #ifndef CPA_WANTS_IMPORT #define CPA_WANTS_IMPORT #endif #include "3dinterf.hpp" #include "DlgPnt3D.hpp" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method : Point3D::Point3D // Date : 97.11 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : constructors to create a new object // make one for each Geometry3D one. No general constructor :-( // Author : Cristi Petrescu ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// Point3D::Point3D (CPA_EditorBase *_p_oEditor, /*ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements,*/ const CString _csName , tdeSaveStatus _eStatus ) : Shape3D (FALSE, _p_oEditor, 1, 1, _csName , _eStatus) { CommonPoint3D (); } Point3D::Point3D (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*/) : Shape3D (FALSE, _p_oEditor, 1, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus) { CommonPoint3D (); } /****????*****///rezolvat ?? ionut Point3D::Point3D (CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Modify*/) : Shape3D (FALSE, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus) { // this seems to be used at load time. // so do not alter the data! // CommonPoint3D (); } // ---------------------------------------------------------------------------- // Description : common implementation for the constructors // ---------------------------------------------------------------------------- void Point3D::CommonPoint3D( ) { // initialise with dummy data MTH3D_tdstVector stPoint = { 0 , 0 , 0 }; fn_vSetListOfPoints (1 , & stPoint); m_hElement = fn_hCreateElementPoints (1); fn_eSetIndexedPoint (m_hElement , 0 , 0); fn_eSetFatnessOfElementPoint (m_hElement , (float) 8.0); fn_vEndCreation (); } Point3D::~Point3D() { } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method :Point3D : GetPoint // Date : 97.11 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : return the 3D coordinates of the point // Author : Cristi Petrescu ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// MTH3D_tdstVector Point3D::GetPoint () { MTH3D_tdstVector stPoint; fn_vGetPoint (0 , & stPoint); return stPoint; } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method :Point3D : SetPoint // Date : 97.11 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : set the 3D coordinates of the point // Author : Cristi Petrescu ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void Point3D::SetPoint (MTH3D_tdstVector * _pPoint) { fn_vSetPoint (0 , _pPoint); //UpdateTestPointPosition (); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method :Point3D : SetPointX // Date : 97.11 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : set the X coordinate of the point // Author : Cristi Petrescu ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void Point3D::SetPointX (GLI_tdxValue _X) { MTH3D_tdstVector stPoint = GetPoint (); MTH3D_M_vSetXofVector (& stPoint , _X); SetPoint (& stPoint); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method :Point3D : SetPointY // Date : 97.11 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : set the Y coordinate of the point // Author : Cristi Petrescu ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void Point3D::SetPointY (GLI_tdxValue _Y) { MTH3D_tdstVector stPoint = GetPoint (); MTH3D_M_vSetYofVector (& stPoint , _Y); SetPoint (& stPoint); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method :Point3D : SetPointZ // Date : 97.11 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : set the Z coordinate of the point // Author : Cristi Petrescu ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void Point3D::SetPointZ (GLI_tdxValue _Z) { MTH3D_tdstVector stPoint = GetPoint (); MTH3D_M_vSetZofVector (& stPoint , _Z); SetPoint (& stPoint); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method :Point3D - SetColorOfPoint // Date : 97.11 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : Set the color of the point : selected or not selected // Author : Cristi Petrescu ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// void Point3D::SetColorOfPoint (BOOL _bSelected) { GMT_tdxHandleToGameMaterial hGameMaterial = GEO_xGetGameMaterialOfElementPoints ((ACP_tdxHandleOfObject) GetData () , m_hElement); ACP_tdxHandleOfMaterial hVisualMaterial = GMT_fn_hGetVisualMaterial (hGameMaterial); GEO_tdstColor stColor; if (_bSelected) // selected -> pink { stColor . xR = 1.0; stColor . xG = 0.5; stColor . xB = 1.0; } else // not selected -> white { stColor . xR = 1.0; stColor . xG = 1.0; stColor . xB = 1.0; } stColor . xA = 1.0; GLI_xSetMaterialColor (hVisualMaterial , & stColor); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // Method :Point3D - _OnLButtonDblClk // Date : 97.11 ////////////////////////////////////////////////////////////////////////////////////////////////////// // Description : launch the modal dialog // Author : Cristi Petrescu ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification : // Date : // By : ////////////////////////////////////////////////////////////////////////////////////////////////////// BOOL Point3D::_OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo) { int iDlgResult; HINSTANCE hOldInst = AfxGetResourceHandle(); AfxSetResourceHandle ( ((CPA_DLLBase*)(GetEditor()))->GetDLLIdentity()->hModule ); CDlgPoint3D dlgPoint3D(this); iDlgResult = dlgPoint3D.DoModal(); AfxSetResourceHandle(hOldInst); if (iDlgResult == IDOK) return TRUE; else return FALSE; }