// InfiniteLightProps.cpp : implementation file
//

#include "stdafx.h"
#include "mfc gos.h"
#include "InfiniteLightProps.h"



/////////////////////////////////////////////////////////////////////////////
// CInfiniteLightProps dialog


CInfiniteLightProps::CInfiniteLightProps(CWnd* pParent /*=NULL*/)
	: CDialog(CInfiniteLightProps::IDD, pParent)
{
	//{{AFX_DATA_INIT(CInfiniteLightProps)
	m_Alpha = 0.0f;
	m_Blue = 0.0f;
	m_Green = 0.0f;
	m_Intensity = 0.0f;
	m_LocX = 0.0f;
	m_LocY = 0.0f;
	m_LocZ = 0.0f;
	m_Red = 0.0f;
	//}}AFX_DATA_INIT
}


void CInfiniteLightProps::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CInfiniteLightProps)
	DDX_Text(pDX, IDC_ALPHA, m_Alpha);
	DDX_Text(pDX, IDC_BLUE, m_Blue);
	DDX_Text(pDX, IDC_GREEN, m_Green);
	DDX_Text(pDX, IDC_INTENSITY, m_Intensity);
	DDX_Text(pDX, IDC_LOCX, m_LocX);
	DDX_Text(pDX, IDC_LOCY, m_LocY);
	DDX_Text(pDX, IDC_LOCZ, m_LocZ);
	DDX_Text(pDX, IDC_RED, m_Red);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CInfiniteLightProps, CDialog)
	//{{AFX_MSG_MAP(CInfiniteLightProps)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInfiniteLightProps message handlers
void CInfiniteLightProps::SetData(MLRInfiniteLight *light)
{
Light=*light;

m_Intensity=Light.GetIntensity();
Light.GetColor(m_Red,m_Green,m_Blue);
UnitVector3D loc;
Light.GetInWorldDirection(loc);
m_LocX=loc.x;
m_LocY=loc.y;
m_LocZ=loc.z;

}

MLRInfiniteLight &CInfiniteLightProps::GetData()
{
Light.SetIntensity(m_Intensity);
Light.SetColor(m_Red,m_Green,m_Blue);
Vector3D dir(m_LocX,m_LocY,m_LocZ);
Stuff::LinearMatrix4D mat(true);
mat.AlignLocalAxisToWorldVector(dir,Stuff::Z_Axis,Stuff::Y_Axis,Stuff::X_Axis);
Light.SetLightToWorldMatrix(mat);
return Light;
}

