//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File        : Bar3D.cpp: implementation file for the Bar3D classes
// Author      : Viorel Preoteasa
// 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

//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Construction/Destruction of Bar3D
// Date   : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : 
// Author      : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date         :
// By           :
//////////////////////////////////////////////////////////////////////////////////////////////////////
Bar3D::Bar3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, const CString _csName , tdeSaveStatus _eStatus )
	: Shape3D (bModifiable, _p_oEditor, 8, 1, _csName , _eStatus)
{
	CommonBar3D();
}

Bar3D::Bar3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus )
	: Shape3D (bModifiable, _p_oEditor, 8, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
	CommonBar3D();
}

Bar3D::Bar3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, ACP_tdxHandleOfObject _hObject, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus)
	: Shape3D (bModifiable, _p_oEditor, _p_oOwnerFile, _hObject, _csName, _p_cRefPath, _eStatus)
{
	CommonBar3D();
}

 
Bar3D::~Bar3D()
{
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Bar3D
// Date   : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Common initialisation
// Author      : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date         :
// By           :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Bar3D::CommonBar3D()
{
	MTH3D_tdstVector a8_stPoint [8];

	for ( int iCounter=0; iCounter<8; iCounter++) 
		MTH3D_M_vSetVectorElements ( a8_stPoint+iCounter, 0., 0., 0.);

	fn_vSetListOfPoints(8, a8_stPoint);
	
	m_hElement = fn_hCreateElementIndexedTriangle(12,0);
	fn_eSetIndexedTriangle ( m_hElement, 0, 0, 1, 3 );
	fn_eSetIndexedTriangle ( m_hElement, 1, 1, 2, 3 );
	fn_eSetIndexedTriangle ( m_hElement, 2, 4, 5, 1 );
	fn_eSetIndexedTriangle ( m_hElement, 3, 1, 0, 4 );
	fn_eSetIndexedTriangle ( m_hElement, 4, 1, 5, 6 );
	fn_eSetIndexedTriangle ( m_hElement, 5, 1, 6, 2 );
	fn_eSetIndexedTriangle ( m_hElement, 6, 3, 2, 6 );
	fn_eSetIndexedTriangle ( m_hElement, 7, 6, 7, 3 );
	fn_eSetIndexedTriangle ( m_hElement, 8, 0, 3, 7 );
	fn_eSetIndexedTriangle ( m_hElement, 9, 7, 4, 0 );
	fn_eSetIndexedTriangle ( m_hElement, 10, 4, 7, 5 );
	fn_eSetIndexedTriangle ( m_hElement, 11, 6, 5, 7 );

	EndCreate();
}
