//ROMTEAM WorldEditor
////////////////////////////////////////////////////////////////////////////////////////
// File        : Arrow3D.cpp: implementation file for the Arrow3D 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
#define CPA_WANTS_IMPORT

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

Arrow3D::Arrow3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus )
	: Shape3D (bModifiable, _p_oEditor, 13, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
	CommonArrow3D();
}

Arrow3D::Arrow3D (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)
{
	CommonArrow3D();
}

 
Arrow3D::~Arrow3D()
{
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CommonArrow3D
// Date   : 97-11
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Common initialisation
// Author      : Viorel Preoteasa - CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date         :
// By           :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void Arrow3D::CommonArrow3D()
{
	MTH3D_tdstVector a13_stPoint [13];

	MTH3D_M_vSetVectorElements ( a13_stPoint, -0.05f, -0.05f, -0.6f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+1, 0.05f,-0.05f,-0.6f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+2, 0.05f,0.05f,-0.6f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+3, -0.05f,0.05f,-0.6f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+4, -0.05f,-0.05f,-0.2f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+5, 0.05f,-0.05f,-0.2f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+6, 0.05f,0.05f,-0.2f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+7, -0.05f,0.05f,-0.2f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+8, -0.1f,-0.1f,-0.2f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+9, 0.1f,-0.1f,-0.2f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+10, 0.1f,0.1f,-0.2f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+11, -0.1f,0.1f,-0.2f);
	MTH3D_M_vSetVectorElements ( a13_stPoint+12, 0.f,0.f,0.0f);

	for ( int i=0; i<13; i++ )
	{
		MTH3D_M_vMulScalarVector(a13_stPoint+i,2.f, a13_stPoint+i);
	}
	fn_vSetListOfPoints(13, a13_stPoint);
	m_hElement = fn_hCreateElementIndexedTriangle(22,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,8, 9, 4 );
	fn_eSetIndexedTriangle ( m_hElement, 11,9, 5, 4 );
	fn_eSetIndexedTriangle ( m_hElement, 12,9, 10,5 );
	fn_eSetIndexedTriangle ( m_hElement, 13,5, 10,6);
	fn_eSetIndexedTriangle ( m_hElement, 14,6, 10,11 );
	fn_eSetIndexedTriangle ( m_hElement, 15,6, 11,7 );
	fn_eSetIndexedTriangle ( m_hElement, 16,11,8, 7 );
	fn_eSetIndexedTriangle ( m_hElement, 17,7, 8, 4);
	fn_eSetIndexedTriangle ( m_hElement, 18,9, 12,10);
	fn_eSetIndexedTriangle ( m_hElement, 19,10,12,11);
	fn_eSetIndexedTriangle ( m_hElement, 20,11,12,8);
	fn_eSetIndexedTriangle ( m_hElement, 21,8, 12,9 );
	
	EndCreate();
}



//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : Construction/Destruction of DoubleArrow3D
// Date   : 98-05
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : 
// Author      : Ionut Grozea- CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date         :
// By           :
//////////////////////////////////////////////////////////////////////////////////////////////////////
DoubleArrow3D::DoubleArrow3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, const CString _csName , tdeSaveStatus _eStatus )
	: Shape3D (bModifiable, _p_oEditor, 18, 1, _csName , _eStatus)
{
	CommonDoubleArrow3D();
}

DoubleArrow3D::DoubleArrow3D (BOOL bModifiable, CPA_EditorBase *_p_oEditor, CPA_BaseObject *_p_oOwnerFile, const CString _csName, char *_p_cRefPath, tdeSaveStatus _eStatus )
	: Shape3D (bModifiable, _p_oEditor, 18, 1, _p_oOwnerFile, _csName, _p_cRefPath, _eStatus)
{
	CommonDoubleArrow3D();
}

DoubleArrow3D::DoubleArrow3D (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)
{
	CommonDoubleArrow3D();
}

 
DoubleArrow3D::~DoubleArrow3D()
{
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CommonDoubleArrow3d
// Date   : 98-05
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Common initialisation
// Author      : Ionut Grozea- CPA2
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date         :
// By           :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void DoubleArrow3D::CommonDoubleArrow3D()
{
	MTH3D_tdstVector a18_stPoint [18];

	MTH3D_M_vSetVectorElements ( a18_stPoint, -0.05f, -0.05f, -0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+1, 0.05f,-0.05f,-0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+2, 0.05f,0.05f,-0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+3, -0.05f,0.05f,-0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+4, -0.05f,-0.05f,0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+5, 0.05f,-0.05f,0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+6, 0.05f,0.05f,0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+7, -0.05f,0.05f,0.2f);


	MTH3D_M_vSetVectorElements ( a18_stPoint+8, -0.1f,-0.1f,0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+9, 0.1f,-0.1f,0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+10, 0.1f,0.1f,0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+11, -0.1f,0.1f,0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+12, 0.f,0.f,0.4f);

	MTH3D_M_vSetVectorElements ( a18_stPoint+13, -0.1f,-0.1f,-0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+14, 0.1f,-0.1f,-0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+15, 0.1f,0.1f,-0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+16, -0.1f,0.1f,-0.2f);
	MTH3D_M_vSetVectorElements ( a18_stPoint+17, 0.f,0.f,-0.4f);


	for ( int i=0; i<18; i++ )
	{
		MTH3D_M_vMulScalarVector(a18_stPoint+i,2.f,a18_stPoint+i);
	}
	fn_vSetListOfPoints(18, a18_stPoint);
	m_hElement = fn_hCreateElementIndexedTriangle(34,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,8, 9, 4 );
	fn_eSetIndexedTriangle ( m_hElement, 11,9, 5, 4 );
	fn_eSetIndexedTriangle ( m_hElement, 12,9, 10,5 );
	fn_eSetIndexedTriangle ( m_hElement, 13,5, 10,6);
	fn_eSetIndexedTriangle ( m_hElement, 14,6, 10,11 );
	fn_eSetIndexedTriangle ( m_hElement, 15,6, 11,7 );
	fn_eSetIndexedTriangle ( m_hElement, 16,11,8, 7 );
	fn_eSetIndexedTriangle ( m_hElement, 17,7, 8, 4);
	fn_eSetIndexedTriangle ( m_hElement, 18,9, 12,10);
	fn_eSetIndexedTriangle ( m_hElement, 19,10,12,11);
	fn_eSetIndexedTriangle ( m_hElement, 20,11,12,8);
	fn_eSetIndexedTriangle ( m_hElement, 21,8, 12,9 );


	fn_eSetIndexedTriangle ( m_hElement, 22,14, 13, 0 );
	fn_eSetIndexedTriangle ( m_hElement, 23,1, 14, 0 );
	fn_eSetIndexedTriangle ( m_hElement, 24,15, 14,1 );
	fn_eSetIndexedTriangle ( m_hElement, 25,15, 1,2);
	fn_eSetIndexedTriangle ( m_hElement, 26,15, 2,16 );
	fn_eSetIndexedTriangle ( m_hElement, 27,16, 2,3 );
	fn_eSetIndexedTriangle ( m_hElement, 28,13,16, 3 );
	fn_eSetIndexedTriangle ( m_hElement, 29,13, 3, 0);

	fn_eSetIndexedTriangle ( m_hElement, 30,15, 17,14);
	fn_eSetIndexedTriangle ( m_hElement, 31,14,17,13);
	fn_eSetIndexedTriangle ( m_hElement, 32,13,17,16);
	fn_eSetIndexedTriangle ( m_hElement, 33,16, 17,15 );

	

	EndCreate();
}

 
