//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File        : Oktaedron3D.cpp: implementation of the Oktaedron3D class.
// Author      : Ionut Grozea
// 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
#define CPA_WANTS_IMPORT

 
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Oktaedron3D::Oktaedron3D
// Date   : 97.11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : constructors to create a new object
// Author      : Ionut Grozea
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date         :
// By           :
//////////////////////////////////////////////////////////////////////////////////////////////////////

Oktaedron3D::Oktaedron3D(BOOL bModifiable, CPA_EditorBase *_p_oEditor, ACP_tdxIndex xNbPoints, ACP_tdxIndex xNbElements, const CString _csName , tdeSaveStatus _eStatus )
	: Shape3D (bModifiable, _p_oEditor, xNbPoints, xNbElements ,_csName , _eStatus)
{
	CommonOktaedron3D();
}

Oktaedron3D::Oktaedron3D(BOOL bModifiable, 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 (bModifiable, _p_oEditor, xNbPoints, xNbElements, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
	CommonOktaedron3D();
}

Oktaedron3D::Oktaedron3D(BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName /*= ""*/, char *_p_cRefPath /*= NULL*/, tdeSaveStatus _eStatus /*= E_ss_Modify*/)
	: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
	CommonOktaedron3D();
}

void Oktaedron3D::CommonOktaedron3D()
{
	MTH3D_tdstVector a6_stPoint [6];

	MTH3D_M_vSetVectorElements ( a6_stPoint,	-0.4f,	0.f,	-0.4f);
	MTH3D_M_vSetVectorElements ( a6_stPoint+1,	0.4f,	0.f,	-0.4f);
	MTH3D_M_vSetVectorElements ( a6_stPoint+2,	0.4f,	0.f,	0.4f);
	MTH3D_M_vSetVectorElements ( a6_stPoint+3,	-0.4f,	0.f,	0.4f);
	MTH3D_M_vSetVectorElements ( a6_stPoint+4,	0.f,	-0.4f,	0.f);
	MTH3D_M_vSetVectorElements ( a6_stPoint+5,	0.f,	0.4f,	0.f);

	this->fn_vSetListOfPoints(6, a6_stPoint);

	ACP_tdxHandleOfElement hElement = this->fn_hCreateElementIndexedTriangle(8,0);
    this->fn_eSetIndexedTriangle ( hElement, 0, 0, 1, 4 );
    this->fn_eSetIndexedTriangle ( hElement, 1, 1, 2, 4 );
    this->fn_eSetIndexedTriangle ( hElement, 2, 2, 3, 4 );
    this->fn_eSetIndexedTriangle ( hElement, 3, 3, 0, 4 );
    this->fn_eSetIndexedTriangle ( hElement, 4, 1, 0, 5 );
    this->fn_eSetIndexedTriangle ( hElement, 5, 2, 1, 5 );
    this->fn_eSetIndexedTriangle ( hElement, 6, 3, 2, 5 );
	this->fn_eSetIndexedTriangle ( hElement, 7, 0, 3, 5 );



	fn_vInitElementSection( m_hElement );
	EndCreate(); 
}

Oktaedron3D::~Oktaedron3D()
{

}
