// KerkytheaPage.cpp : implementation file
//

#include "stdafx.h"
#include "..\at3ddll.h"
#include "MSVC_Test_At3dx_Dll.h"
#include "KerkytheaPage.h"
#include "At3dData.h"

extern CAt3dData* at3dData;

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CKerkytheaPage property page

IMPLEMENT_DYNCREATE(CKerkytheaPage, CPropertyPage)

CKerkytheaPage::CKerkytheaPage() : CPropertyPage(CKerkytheaPage::IDD)
{
	//{{AFX_DATA_INIT(CKerkytheaPage)
	m_KerkytheaDirectionalFallOff = _T("");
	m_KerkytheaDirectionalHotSpot = _T("");
	m_KerkytheaDirectionalMultiplier = _T("");
	m_KerkytheaPointAsSpot = FALSE;
	m_KerkytheaPointFallOff = _T("");
	m_KerkytheaPointHotSpot = _T("");
	m_KerkytheaPointMultiplier = _T("");
	m_KerkytheaPointUp = FALSE;
	m_KerkytheaRadianceAsEmitter = FALSE;
	m_KerkytheaSpotFallOff = _T("");
	m_KerkytheaSpotHotFraction = _T("");
	m_KerkytheaSpotHotSpot = _T("");
	m_KerkytheaSpotMultiplier = _T("");
	m_KerkytheaSpotReplace = FALSE;
	m_KerkytheaUseHotFraction = FALSE;
	m_KerkytheaUseRadiance = FALSE;
	m_KerkytheaDirectionalSaveAs_Group = -1;
	m_KerkytheaDirectionalAttenuation_Group = -1;
	m_KerkytheaPointAttenuation_Group = -1;
	m_KerkytheaSpotAttenuation_Group = -1;
	m_KerkytheaUsePngAlphaMasks = FALSE;
	m_KerkytheaDirectionalRadius = _T("");
	m_KerkytheaDirectionalShadow = FALSE;
	m_KerkytheaDirectionalSoftShadow = FALSE;
	m_KerkytheaDirectionalNegative = FALSE;
	m_KerkytheaDirectionalCausticPhotons = FALSE;
	m_KerkytheaDirectionalGlobalPhotons = FALSE;
	m_KerkytheaPointRadius = _T("");
	m_KerkytheaPointShadow = FALSE;
	m_KerkytheaPointSoftShadow = FALSE;
	m_KerkytheaPointNegative = FALSE;
	m_KerkytheaPointGlobalPhotons = FALSE;
	m_KerkytheaPointCausticPhotons = FALSE;
	m_KerkytheaSpotRadius = _T("");
	m_KerkytheaSpotShadow = FALSE;
	m_KerkytheaSpotSoftShadow = FALSE;
	m_KerkytheaSpotNegative = FALSE;
	m_KerkytheaSpotGlobalPhotons = FALSE;
	m_KerkytheaSpotCausticPhotons = FALSE;
	//}}AFX_DATA_INIT
}

CKerkytheaPage::~CKerkytheaPage()
{
}

void CKerkytheaPage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CKerkytheaPage)
	DDX_Text(pDX, IDC_KERKYTHEADIRECTIONALFALLOFF, m_KerkytheaDirectionalFallOff);
	DDX_Text(pDX, IDC_KERKYTHEADIRECTIONALHOTSPOT, m_KerkytheaDirectionalHotSpot);
	DDX_Text(pDX, IDC_KERKYTHEADIRECTIONALMULTIPLIER, m_KerkytheaDirectionalMultiplier);
	DDX_Check(pDX, IDC_KERKYTHEAPOINTASSPOT, m_KerkytheaPointAsSpot);
	DDX_Text(pDX, IDC_KERKYTHEAPOINTFALLOFF, m_KerkytheaPointFallOff);
	DDX_Text(pDX, IDC_KERKYTHEAPOINTHOTSPOT, m_KerkytheaPointHotSpot);
	DDX_Text(pDX, IDC_KERKYTHEAPOINTMULTIPLIER, m_KerkytheaPointMultiplier);
	DDX_Check(pDX, IDC_KERKYTHEAPOINTUP, m_KerkytheaPointUp);
	DDX_Check(pDX, IDC_KERKYTHEARADIANCEASEMITTER, m_KerkytheaRadianceAsEmitter);
	DDX_Text(pDX, IDC_KERKYTHEASPOTFALLOFF, m_KerkytheaSpotFallOff);
	DDX_Text(pDX, IDC_KERKYTHEASPOTHOTFRACTION, m_KerkytheaSpotHotFraction);
	DDX_Text(pDX, IDC_KERKYTHEASPOTHOTSPOT, m_KerkytheaSpotHotSpot);
	DDX_Text(pDX, IDC_KERKYTHEASPOTMULTIPLIER, m_KerkytheaSpotMultiplier);
	DDX_Check(pDX, IDC_KERKYTHEASPOTREPLACE, m_KerkytheaSpotReplace);
	DDX_Check(pDX, IDC_KERKYTHEAUSEHOTFRACTION, m_KerkytheaUseHotFraction);
	DDX_Check(pDX, IDC_KERKYTHEAUSERADIANCE, m_KerkytheaUseRadiance);
	DDX_Radio(pDX, IDC_KERKYTHEADIRECTIONALASOMNI, m_KerkytheaDirectionalSaveAs_Group);
	DDX_Radio(pDX, IDC_KERKYTHEADIRECTIONALATTENUATION1, m_KerkytheaDirectionalAttenuation_Group);
	DDX_Radio(pDX, IDC_KERKYTHEAPOINTATTENUATION1, m_KerkytheaPointAttenuation_Group);
	DDX_Radio(pDX, IDC_KERKYTHEASPOTATTENUATION1, m_KerkytheaSpotAttenuation_Group);
	DDX_Check(pDX, IDC_KERKYTHEAUSEPNGALPHAMASKS, m_KerkytheaUsePngAlphaMasks);
	DDX_Text(pDX, IDC_KERKYTHEADIRECTIONALRADIUS, m_KerkytheaDirectionalRadius);
	DDX_Check(pDX, IDC_KERKYTHEADIRECTIONALSHADOW, m_KerkytheaDirectionalShadow);
	DDX_Check(pDX, IDC_KERKYTHEADIRECTIONALSOFTSHADOW, m_KerkytheaDirectionalSoftShadow);
	DDX_Check(pDX, IDC_KERKYTHEADIRECTIONALNEGATIVE, m_KerkytheaDirectionalNegative);
	DDX_Check(pDX, IDC_KERKYTHEADIRECTIONALCAUSTICPHOTONS, m_KerkytheaDirectionalCausticPhotons);
	DDX_Check(pDX, IDC_KERKYTHEADIRECTIONALGLOBALPHOTONS, m_KerkytheaDirectionalGlobalPhotons);
	DDX_Text(pDX, IDC_KERKYTHEAPOINTRADIUS, m_KerkytheaPointRadius);
	DDX_Check(pDX, IDC_KERKYTHEAPOINTSHADOW, m_KerkytheaPointShadow);
	DDX_Check(pDX, IDC_KERKYTHEAPOINTSOFTSHADOW, m_KerkytheaPointSoftShadow);
	DDX_Check(pDX, IDC_KERKYTHEAPOINTNEGATIVE, m_KerkytheaPointNegative);
	DDX_Check(pDX, IDC_KERKYTHEAPOINTGLOBALPHOTONS, m_KerkytheaPointGlobalPhotons);
	DDX_Check(pDX, IDC_KERKYTHEAPOINTCAUSTICPHOTONS, m_KerkytheaPointCausticPhotons);
	DDX_Text(pDX, IDC_KERKYTHEASPOTRADIUS, m_KerkytheaSpotRadius);
	DDX_Check(pDX, IDC_KERKYTHEASPOTSHADOW, m_KerkytheaSpotShadow);
	DDX_Check(pDX, IDC_KERKYTHEASPOTSOFTSHADOW, m_KerkytheaSpotSoftShadow);
	DDX_Check(pDX, IDC_KERKYTHEASPOTNEGATIVE, m_KerkytheaSpotNegative);
	DDX_Check(pDX, IDC_KERKYTHEASPOTGLOBALPHOTONS, m_KerkytheaSpotGlobalPhotons);
	DDX_Check(pDX, IDC_KERKYTHEASPOTCAUSTICPHOTONS, m_KerkytheaSpotCausticPhotons);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CKerkytheaPage, CPropertyPage)
	//{{AFX_MSG_MAP(CKerkytheaPage)
	ON_BN_CLICKED(IDC_KERKYTHEAUSERADIANCE, OnKerkytheauseradiance)
	ON_BN_CLICKED(IDC_KERKYTHEARADIANCEASEMITTER, OnKerkythearadianceasemitter)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALASOMNI, OnKerkytheadirectionalasomni)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALASSUN, OnKerkytheadirectionalassun)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALASSPOT, OnKerkytheadirectionalasspot)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALATTENUATION1, OnKerkytheadirectionalattenuation1)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALATTENUATION2, OnKerkytheadirectionalattenuation2)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALATTENUATION3, OnKerkytheadirectionalattenuation3)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTUP, OnKerkytheapointup)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTASSPOT, OnKerkytheapointasspot)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTATTENUATION1, OnKerkytheapointattenuation1)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTATTENUATION2, OnKerkytheapointattenuation2)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTATTENUATION3, OnKerkytheapointattenuation3)
	ON_BN_CLICKED(IDC_KERKYTHEASPOTATTENUATION1, OnKerkytheaspotattenuation1)
	ON_BN_CLICKED(IDC_KERKYTHEASPOTATTENUATION2, OnKerkytheaspotattenuation2)
	ON_BN_CLICKED(IDC_KERKYTHEASPOTATTENUATION3, OnKerkytheaspotattenuation3)
	ON_BN_CLICKED(IDC_KERKYTHEAUSEHOTFRACTION, OnKerkytheausehotfraction)
	ON_BN_CLICKED(IDC_KERKYTHEASPOTREPLACE, OnKerkytheaspotreplace)
	ON_BN_CLICKED(IDC_KERKYTHEAGETDATA, OnKerkytheagetdata)
	ON_BN_CLICKED(IDC_KERKYTHEASETDATA, OnKerkytheasetdata)
	ON_BN_CLICKED(IDC_KERKYTHEAUSEPNGALPHAMASKS, OnKerkytheausepngalphamasks)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALSHADOW, OnKerkytheadirectionalshadow)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALSOFTSHADOW, OnKerkytheadirectionalsoftshadow)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALNEGATIVE, OnKerkytheadirectionalnegative)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALGLOBALPHOTONS, OnKerkytheadirectionalglobalphotons)
	ON_BN_CLICKED(IDC_KERKYTHEADIRECTIONALCAUSTICPHOTONS, OnKerkytheadirectionalcausticphotons)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTSHADOW, OnKerkytheapointshadow)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTSOFTSHADOW, OnKerkytheapointsoftshadow)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTNEGATIVE, OnKerkytheapointnegative)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTGLOBALPHOTONS, OnKerkytheapointglobalphotons)
	ON_BN_CLICKED(IDC_KERKYTHEAPOINTCAUSTICPHOTONS, OnKerkytheapointcausticphotons)
	ON_BN_CLICKED(IDC_KERKYTHEASPOTSHADOW, OnKerkytheaspotshadow)
	ON_BN_CLICKED(IDC_KERKYTHEASPOTSOFTSHADOW, OnKerkytheaspotsoftshadow)
	ON_BN_CLICKED(IDC_KERKYTHEASPOTNEGATIVE, OnKerkytheaspotnegative)
	ON_BN_CLICKED(IDC_KERKYTHEASPOTGLOBALPHOTONS, OnKerkytheaspotglobalphotons)
	ON_BN_CLICKED(IDC_KERKYTHEASPOTCAUSTICPHOTONS, OnKerkytheaspotcausticphotons)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CKerkytheaPage message handlers

BOOL CKerkytheaPage::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	// TODO: Add extra initialization here
	UpdateKerkytheaDisplay();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CKerkytheaPage::OnKerkytheauseradiance() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaUseRadianceFlag = (m_KerkytheaUseRadiance) ? 1 : 0;
}

void CKerkytheaPage::OnKerkythearadianceasemitter() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaRadianceEmitterFlag = (m_KerkytheaRadianceAsEmitter) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheadirectionalasomni() 
{
	at3dData->kerkytheaDirectionalAsSpotFlag = 0;
}

void CKerkytheaPage::OnKerkytheadirectionalassun() 
{
	at3dData->kerkytheaDirectionalAsSpotFlag = 1;
}

void CKerkytheaPage::OnKerkytheadirectionalasspot() 
{
	at3dData->kerkytheaDirectionalAsSpotFlag = 2;
}

void CKerkytheaPage::OnKerkytheadirectionalattenuation1() 
{
	at3dData->kerkytheaDirectionalAttenuationFlag = 0;
}

void CKerkytheaPage::OnKerkytheadirectionalattenuation2() 
{
	at3dData->kerkytheaDirectionalAttenuationFlag = 1;
}

void CKerkytheaPage::OnKerkytheadirectionalattenuation3() 
{
	at3dData->kerkytheaDirectionalAttenuationFlag = 2;
}

void CKerkytheaPage::OnKerkytheapointup() 
{
	UpdateData(TRUE);
  at3dData->kerkytheaPointUpFlag = (m_KerkytheaPointUp) ? 1 : 0;	
}

void CKerkytheaPage::OnKerkytheapointasspot() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaPointAsSpotFlag = (m_KerkytheaPointAsSpot) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheapointattenuation1() 
{
	at3dData->kerkytheaPointAttenuationFlag = 0;
}

void CKerkytheaPage::OnKerkytheapointattenuation2() 
{
	at3dData->kerkytheaPointAttenuationFlag = 1;
}

void CKerkytheaPage::OnKerkytheapointattenuation3() 
{
	at3dData->kerkytheaPointAttenuationFlag = 2;
}

void CKerkytheaPage::OnKerkytheaspotattenuation1() 
{
	at3dData->kerkytheaSpotAttenuationFlag = 0;
}

void CKerkytheaPage::OnKerkytheaspotattenuation2() 
{
	at3dData->kerkytheaSpotAttenuationFlag = 1;
}

void CKerkytheaPage::OnKerkytheaspotattenuation3() 
{
	at3dData->kerkytheaSpotAttenuationFlag = 2;
}

void CKerkytheaPage::OnKerkytheausehotfraction() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaSpotUseHotFractionFlag = (m_KerkytheaUseHotFraction) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheaspotreplace() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaSpotReplaceFlag = (m_KerkytheaSpotReplace) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheagetdata() 
{
  at3dData->kerkytheaUseRadianceFlag            = At3d_ReadFlag(LIBFLAG_KERKYTHEA_USE_RADIANCE);
  at3dData->kerkytheaRadianceEmitterFlag        = At3d_ReadFlag(LIBFLAG_KERKYTHEA_RADIANCE_EMITTER);
  at3dData->kerkytheaUsePngAlphaMasksFlag       = At3d_ReadFlag(LIBFLAG_KERKYTHEA_USE_PNG_ALPHA_MASKS);

	at3dData->kerkytheaDirectionalAsSpotFlag      = At3d_ReadFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_AS_SPOT);
  at3dData->kerkytheaPointAsSpotFlag            = At3d_ReadFlag(LIBFLAG_KERKYTHEA_POINT_AS_SPOT);
  at3dData->kerkytheaPointUpFlag                = At3d_ReadFlag(LIBFLAG_KERKYTHEA_POINT_UP);
  at3dData->kerkytheaDirectionalAttenuationFlag = At3d_ReadFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_ATTENUATION);
  at3dData->kerkytheaPointAttenuationFlag       = At3d_ReadFlag(LIBFLAG_KERKYTHEA_POINT_ATTENUATION);
  at3dData->kerkytheaSpotAttenuationFlag        = At3d_ReadFlag(LIBFLAG_KERKYTHEA_SPOT_ATTENUATION);
  at3dData->kerkytheaSpotReplaceFlag            = At3d_ReadFlag(LIBFLAG_KERKYTHEA_SPOT_REPLACE);
  at3dData->kerkytheaSpotUseHotFractionFlag     = At3d_ReadFlag(LIBFLAG_KERKYTHEA_SPOT_USE_HOT_FRACTION);

	at3dData->kerkytheaDirectionalShadowFlag         = At3d_ReadFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_SHADOW);
  at3dData->kerkytheaDirectionalSoftShadowFlag     = At3d_ReadFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_SOFT_SHADOW);
  at3dData->kerkytheaDirectionalGlobalPhotonsFlag  = At3d_ReadFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_GLOBAL_PHOTONS);
  at3dData->kerkytheaDirectionalCausticPhotonsFlag = At3d_ReadFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_CAUSTIC_PHOTONS);
  at3dData->kerkytheaDirectionalNegativeFlag       = At3d_ReadFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_NEGATIVE);

  at3dData->kerkytheaPointShadowFlag         = At3d_ReadFlag(LIBFLAG_KERKYTHEA_POINT_SHADOW);
  at3dData->kerkytheaPointSoftShadowFlag     = At3d_ReadFlag(LIBFLAG_KERKYTHEA_POINT_SOFT_SHADOW);
  at3dData->kerkytheaPointGlobalPhotonsFlag  = At3d_ReadFlag(LIBFLAG_KERKYTHEA_POINT_GLOBAL_PHOTONS);
  at3dData->kerkytheaPointCausticPhotonsFlag = At3d_ReadFlag(LIBFLAG_KERKYTHEA_POINT_CAUSTIC_PHOTONS);
  at3dData->kerkytheaPointNegativeFlag       = At3d_ReadFlag(LIBFLAG_KERKYTHEA_POINT_NEGATIVE);

  at3dData->kerkytheaSpotShadowFlag         = At3d_ReadFlag(LIBFLAG_KERKYTHEA_SPOT_SHADOW);
  at3dData->kerkytheaSpotSoftShadowFlag     = At3d_ReadFlag(LIBFLAG_KERKYTHEA_SPOT_SOFT_SHADOW);
  at3dData->kerkytheaSpotGlobalPhotonsFlag  = At3d_ReadFlag(LIBFLAG_KERKYTHEA_SPOT_GLOBAL_PHOTONS);
  at3dData->kerkytheaSpotCausticPhotonsFlag = At3d_ReadFlag(LIBFLAG_KERKYTHEA_SPOT_CAUSTIC_PHOTONS);
  at3dData->kerkytheaSpotNegativeFlag       = At3d_ReadFlag(LIBFLAG_KERKYTHEA_SPOT_NEGATIVE);


  At3d_Kerkythea_GetMultiplier(0, &at3dData->kerkytheaDirectionalMultiplier);
  At3d_Kerkythea_GetMultiplier(1, &at3dData->kerkytheaPointMultiplier);
  At3d_Kerkythea_GetMultiplier(2, &at3dData->kerkytheaSpotMultiplier);

  At3d_Kerkythea_GetSpotFallOff(0, &at3dData->kerkytheaDirectionalFallOff);
  At3d_Kerkythea_GetSpotFallOff(1, &at3dData->kerkytheaPointFallOff);
  At3d_Kerkythea_GetSpotFallOff(2, &at3dData->kerkytheaSpotFallOff);

  At3d_Kerkythea_GetSpotHotSpot(0, &at3dData->kerkytheaDirectionalHotSpot);
  At3d_Kerkythea_GetSpotHotSpot(1, &at3dData->kerkytheaPointHotSpot);
  At3d_Kerkythea_GetSpotHotSpot(2, &at3dData->kerkytheaSpotHotSpot);

  At3d_Kerkythea_GetSpotHotFraction(&at3dData->kerkytheaSpotHotFraction);

	At3d_Kerkythea_GetRadius(0, &at3dData->kerkytheaDirectionalRadius);
  At3d_Kerkythea_GetRadius(1, &at3dData->kerkytheaPointRadius);
  At3d_Kerkythea_GetRadius(2, &at3dData->kerkytheaSpotRadius);

  UpdateKerkytheaDisplay();	
}

void CKerkytheaPage::OnKerkytheasetdata() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaDirectionalMultiplier = (float)atof(m_KerkytheaDirectionalMultiplier);
  
  at3dData->kerkytheaPointMultiplier = (float)atof(m_KerkytheaPointMultiplier);
  

  at3dData->kerkytheaSpotMultiplier = (float)atof(m_KerkytheaSpotMultiplier);
  
  at3dData->kerkytheaDirectionalFallOff = (float)atof(m_KerkytheaDirectionalFallOff);
  
  at3dData->kerkytheaPointFallOff = (float)atof(m_KerkytheaPointFallOff);
  
  at3dData->kerkytheaSpotFallOff = (float)atof(m_KerkytheaSpotFallOff);
  
  at3dData->kerkytheaDirectionalHotSpot = (float)atof(m_KerkytheaDirectionalHotSpot);
  
  at3dData->kerkytheaPointHotSpot = (float)atof(m_KerkytheaPointHotSpot);
  
  at3dData->kerkytheaSpotHotSpot = (float)atof(m_KerkytheaSpotHotSpot);
  
  at3dData->kerkytheaSpotHotFraction = (float)atof(m_KerkytheaSpotHotFraction);
  
	at3dData->kerkytheaDirectionalRadius = (float)atof(m_KerkytheaDirectionalRadius);
  
  at3dData->kerkytheaPointRadius = (float)atof(m_KerkytheaPointRadius);
  
  at3dData->kerkytheaSpotRadius = (float)atof(m_KerkytheaSpotRadius);


  At3d_WriteFlag(LIBFLAG_KERKYTHEA_USE_RADIANCE, at3dData->kerkytheaUseRadianceFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_RADIANCE_EMITTER, at3dData->kerkytheaRadianceEmitterFlag);
	At3d_WriteFlag(LIBFLAG_KERKYTHEA_USE_PNG_ALPHA_MASKS, at3dData->kerkytheaUsePngAlphaMasksFlag);

  At3d_WriteFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_AS_SPOT, at3dData->kerkytheaDirectionalAsSpotFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_POINT_AS_SPOT, at3dData->kerkytheaPointAsSpotFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_POINT_UP, at3dData->kerkytheaPointUpFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_ATTENUATION, at3dData->kerkytheaDirectionalAttenuationFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_POINT_ATTENUATION, at3dData->kerkytheaPointAttenuationFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_SPOT_ATTENUATION, at3dData->kerkytheaSpotAttenuationFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_SPOT_REPLACE, at3dData->kerkytheaSpotReplaceFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_SPOT_USE_HOT_FRACTION, at3dData->kerkytheaSpotUseHotFractionFlag);

	At3d_WriteFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_SHADOW, at3dData->kerkytheaDirectionalShadowFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_SOFT_SHADOW, at3dData->kerkytheaDirectionalSoftShadowFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_GLOBAL_PHOTONS, at3dData->kerkytheaDirectionalGlobalPhotonsFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_CAUSTIC_PHOTONS, at3dData->kerkytheaDirectionalCausticPhotonsFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_DIRECTIONAL_NEGATIVE, at3dData->kerkytheaDirectionalNegativeFlag);

  At3d_WriteFlag(LIBFLAG_KERKYTHEA_POINT_SHADOW, at3dData->kerkytheaPointShadowFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_POINT_SOFT_SHADOW, at3dData->kerkytheaPointSoftShadowFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_POINT_GLOBAL_PHOTONS, at3dData->kerkytheaPointGlobalPhotonsFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_POINT_CAUSTIC_PHOTONS, at3dData->kerkytheaPointCausticPhotonsFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_POINT_NEGATIVE, at3dData->kerkytheaPointNegativeFlag);

  At3d_WriteFlag(LIBFLAG_KERKYTHEA_SPOT_SHADOW, at3dData->kerkytheaSpotShadowFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_SPOT_SOFT_SHADOW, at3dData->kerkytheaSpotSoftShadowFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_SPOT_GLOBAL_PHOTONS, at3dData->kerkytheaSpotGlobalPhotonsFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_SPOT_CAUSTIC_PHOTONS, at3dData->kerkytheaSpotCausticPhotonsFlag);
  At3d_WriteFlag(LIBFLAG_KERKYTHEA_SPOT_NEGATIVE, at3dData->kerkytheaSpotNegativeFlag);


  At3d_Kerkythea_SetMultiplier(0, at3dData->kerkytheaDirectionalMultiplier);
  At3d_Kerkythea_SetMultiplier(1, at3dData->kerkytheaPointMultiplier);
  At3d_Kerkythea_SetMultiplier(2, at3dData->kerkytheaSpotMultiplier);

  At3d_Kerkythea_SetSpotFallOff(0, at3dData->kerkytheaDirectionalFallOff);
  At3d_Kerkythea_SetSpotFallOff(1, at3dData->kerkytheaPointFallOff);
  At3d_Kerkythea_SetSpotFallOff(2, at3dData->kerkytheaSpotFallOff);

  At3d_Kerkythea_SetSpotHotSpot(0, at3dData->kerkytheaDirectionalHotSpot);
  At3d_Kerkythea_SetSpotHotSpot(1, at3dData->kerkytheaPointHotSpot);
  At3d_Kerkythea_SetSpotHotSpot(2, at3dData->kerkytheaSpotHotSpot);

  At3d_Kerkythea_SetSpotHotFraction(at3dData->kerkytheaSpotHotFraction);

	At3d_Kerkythea_SetRadius(0, at3dData->kerkytheaDirectionalRadius);
  At3d_Kerkythea_SetRadius(1, at3dData->kerkytheaPointRadius);
  At3d_Kerkythea_SetRadius(2, at3dData->kerkytheaSpotRadius);
}

void CKerkytheaPage::UpdateKerkytheaDisplay()
{
	m_KerkytheaUseRadiance = (at3dData->kerkytheaUseRadianceFlag) ? 1 : 0;
  m_KerkytheaRadianceAsEmitter = (at3dData->kerkytheaRadianceEmitterFlag) ? 1 : 0;
	m_KerkytheaUsePngAlphaMasks = (at3dData->kerkytheaUsePngAlphaMasksFlag) ? 1 : 0;

  m_KerkytheaDirectionalSaveAs_Group = at3dData->kerkytheaDirectionalAsSpotFlag;

  m_KerkytheaDirectionalAttenuation_Group = at3dData->kerkytheaDirectionalAttenuationFlag;

  m_KerkytheaPointUp = (at3dData->kerkytheaPointUpFlag) ? 1 : 0;
  m_KerkytheaPointAsSpot = (at3dData->kerkytheaPointAsSpotFlag) ? 1 : 0;

  m_KerkytheaPointAttenuation_Group = at3dData->kerkytheaPointAttenuationFlag;

  m_KerkytheaSpotAttenuation_Group = at3dData->kerkytheaSpotAttenuationFlag;

  m_KerkytheaUseHotFraction = (at3dData->kerkytheaSpotUseHotFractionFlag) ? 1 : 0;
  m_KerkytheaSpotReplace    = (at3dData->kerkytheaSpotReplaceFlag) ? 1 : 0;

	m_KerkytheaDirectionalShadow         = (at3dData->kerkytheaDirectionalShadowFlag) ? 1 : 0;
  m_KerkytheaDirectionalSoftShadow     = (at3dData->kerkytheaDirectionalSoftShadowFlag) ? 1 : 0;
  m_KerkytheaDirectionalGlobalPhotons  = (at3dData->kerkytheaDirectionalGlobalPhotonsFlag) ? 1 : 0;
  m_KerkytheaDirectionalCausticPhotons = (at3dData->kerkytheaDirectionalCausticPhotonsFlag) ? 1 : 0;
  m_KerkytheaDirectionalNegative       = (at3dData->kerkytheaDirectionalNegativeFlag) ? 1 : 0;

  m_KerkytheaPointShadow         = (at3dData->kerkytheaPointShadowFlag) ? 1 : 0;
  m_KerkytheaPointSoftShadow     = (at3dData->kerkytheaPointSoftShadowFlag) ? 1 : 0;
  m_KerkytheaPointGlobalPhotons  = (at3dData->kerkytheaPointGlobalPhotonsFlag) ? 1 : 0;
  m_KerkytheaPointCausticPhotons = (at3dData->kerkytheaPointCausticPhotonsFlag) ? 1 : 0;
  m_KerkytheaPointNegative       = (at3dData->kerkytheaPointNegativeFlag) ? 1 : 0;

  m_KerkytheaSpotShadow         = (at3dData->kerkytheaSpotShadowFlag) ? 1 : 0;
  m_KerkytheaSpotSoftShadow     = (at3dData->kerkytheaSpotSoftShadowFlag) ? 1 : 0;
  m_KerkytheaSpotGlobalPhotons  = (at3dData->kerkytheaSpotGlobalPhotonsFlag) ? 1 : 0;
  m_KerkytheaSpotCausticPhotons = (at3dData->kerkytheaSpotCausticPhotonsFlag) ? 1 : 0;
  m_KerkytheaSpotNegative       = (at3dData->kerkytheaSpotNegativeFlag) ? 1 : 0;

  m_KerkytheaDirectionalMultiplier.Format("%.4f", at3dData->kerkytheaDirectionalMultiplier);
  m_KerkytheaPointMultiplier.Format("%.4f", at3dData->kerkytheaPointMultiplier);
  m_KerkytheaSpotMultiplier.Format("%.4f", at3dData->kerkytheaSpotMultiplier);

  m_KerkytheaDirectionalFallOff.Format("%.4f", at3dData->kerkytheaDirectionalFallOff);
  m_KerkytheaPointFallOff.Format("%.4f", at3dData->kerkytheaPointFallOff);
  m_KerkytheaSpotFallOff.Format("%.4f", at3dData->kerkytheaSpotFallOff);

  m_KerkytheaDirectionalHotSpot.Format("%.4f", at3dData->kerkytheaDirectionalHotSpot);
  m_KerkytheaPointHotSpot.Format("%.4f", at3dData->kerkytheaPointHotSpot);
  m_KerkytheaSpotHotSpot.Format("%.4f", at3dData->kerkytheaSpotHotSpot);

  m_KerkytheaSpotHotFraction.Format("%.4f", at3dData->kerkytheaSpotHotFraction);
	
	m_KerkytheaDirectionalRadius.Format("%.4f", at3dData->kerkytheaDirectionalRadius);
	m_KerkytheaPointRadius.Format("%.4f", at3dData->kerkytheaPointRadius);
	m_KerkytheaSpotRadius.Format("%.4f", at3dData->kerkytheaSpotRadius);

	UpdateData(FALSE);
}

void CKerkytheaPage::OnKerkytheausepngalphamasks() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaUsePngAlphaMasksFlag = (m_KerkytheaUsePngAlphaMasks) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheadirectionalshadow() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaDirectionalShadowFlag = (m_KerkytheaDirectionalShadow) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheadirectionalsoftshadow() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaDirectionalSoftShadowFlag = (m_KerkytheaDirectionalSoftShadow) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheadirectionalnegative() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaDirectionalNegativeFlag = (m_KerkytheaDirectionalNegative) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheadirectionalglobalphotons() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaDirectionalGlobalPhotonsFlag = (m_KerkytheaDirectionalGlobalPhotons) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheadirectionalcausticphotons() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaDirectionalCausticPhotonsFlag = (m_KerkytheaDirectionalCausticPhotons) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheapointshadow() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaPointShadowFlag = (m_KerkytheaPointShadow) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheapointsoftshadow() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaPointSoftShadowFlag = (m_KerkytheaPointSoftShadow) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheapointnegative() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaPointNegativeFlag = (m_KerkytheaPointNegative) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheapointglobalphotons() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaPointGlobalPhotonsFlag = (m_KerkytheaPointGlobalPhotons) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheapointcausticphotons() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaPointCausticPhotonsFlag = (m_KerkytheaPointCausticPhotons) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheaspotshadow() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaSpotShadowFlag = (m_KerkytheaSpotShadow) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheaspotsoftshadow() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaSpotSoftShadowFlag = (m_KerkytheaSpotSoftShadow) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheaspotnegative() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaSpotNegativeFlag = (m_KerkytheaSpotNegative) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheaspotglobalphotons() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaSpotGlobalPhotonsFlag = (m_KerkytheaSpotGlobalPhotons) ? 1 : 0;
}

void CKerkytheaPage::OnKerkytheaspotcausticphotons() 
{
	UpdateData(TRUE);
	at3dData->kerkytheaSpotCausticPhotonsFlag = (m_KerkytheaSpotCausticPhotons) ? 1 : 0;
}
