Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
151 lines
3.7 KiB
C++
151 lines
3.7 KiB
C++
// SpotLightProps.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "mfc gos.h"
|
|
#include "SpotLightProps.h"
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSpotLightProps dialog
|
|
|
|
|
|
CSpotLightProps::CSpotLightProps(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CSpotLightProps::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CSpotLightProps)
|
|
m_Alpha = 0.0f;
|
|
m_Blue = 0.0f;
|
|
m_Green = 0.0f;
|
|
m_Intensity = 0.0f;
|
|
m_PosX = 0.0f;
|
|
m_PosY = 0.0f;
|
|
m_PosZ = 0.0f;
|
|
m_DirX = 0.0f;
|
|
m_DirY = 0.0f;
|
|
m_DirZ = 0.0f;
|
|
m_Spread = 0.0f;
|
|
m_Red = 0.0f;
|
|
m_InnerRange = 0.0f;
|
|
m_OuterRange = 0.0f;
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CSpotLightProps::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CSpotLightProps)
|
|
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_POSX, m_PosX);
|
|
DDX_Text(pDX, IDC_POSY, m_PosY);
|
|
DDX_Text(pDX, IDC_POSZ, m_PosZ);
|
|
DDX_Text(pDX, IDC_DIRX, m_DirX);
|
|
DDX_Text(pDX, IDC_DIRY, m_DirY);
|
|
DDX_Text(pDX, IDC_DIRZ, m_DirZ);
|
|
DDX_Text(pDX, IDC_SPREADANGLE, m_Spread);
|
|
DDX_Text(pDX, IDC_RED, m_Red);
|
|
DDX_Text(pDX, IDC_INNERRANGE2, m_InnerRange);
|
|
DDX_Text(pDX, IDC_OUTERRANGE2, m_OuterRange);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CSpotLightProps, CDialog)
|
|
//{{AFX_MSG_MAP(CSpotLightProps)
|
|
// NOTE: the ClassWizard will add message map macros here
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSpotLightProps message handlers
|
|
void CSpotLightProps::SetData(MLRSpotLight *light)
|
|
{
|
|
m_Intensity = light->GetIntensity();
|
|
light->GetColor(m_Red,m_Green,m_Blue);
|
|
Point3D pos;
|
|
UnitVector3D dir;
|
|
light->GetInWorldDirection(dir);
|
|
light->GetInWorldPosition(pos);
|
|
m_PosX=pos.x;
|
|
m_PosY=pos.y;
|
|
m_PosZ=pos.z;
|
|
m_DirX=dir.x;
|
|
m_DirY=dir.y;
|
|
m_DirZ=dir.z;
|
|
|
|
m_InnerRange=light->GetFalloffNear();
|
|
m_OuterRange=light->GetFalloffFar();
|
|
|
|
Stuff::Radian Angle;
|
|
light->GetSpreadAngle(&Angle);
|
|
Stuff::Degree deg;
|
|
deg=Angle;
|
|
m_Spread=deg.angle;
|
|
}
|
|
|
|
void CSpotLightProps::SetData(MLRProjectLight *light)
|
|
{
|
|
m_Intensity = light->GetIntensity();
|
|
light->GetColor(m_Red,m_Green,m_Blue);
|
|
Point3D pos;
|
|
UnitVector3D dir;
|
|
light->GetInWorldDirection(dir);
|
|
light->GetInWorldPosition(pos);
|
|
m_PosX=pos.x;
|
|
m_PosY=pos.y;
|
|
m_PosZ=pos.z;
|
|
m_DirX=dir.x;
|
|
m_DirY=dir.y;
|
|
m_DirZ=dir.z;
|
|
|
|
m_InnerRange=light->GetFalloffNear();
|
|
m_OuterRange=light->GetFalloffFar();
|
|
|
|
Stuff::Radian Angle;
|
|
light->GetSpreadAngle(&Angle);
|
|
Stuff::Degree deg;
|
|
deg=Angle;
|
|
m_Spread=deg.angle;
|
|
}
|
|
|
|
void CSpotLightProps::GetData(MLRSpotLight *Light)
|
|
{
|
|
Light->SetIntensity(m_Intensity);
|
|
Light->SetColor(m_Red,m_Green,m_Blue);
|
|
Vector3D dir(m_DirX,m_DirY,m_DirZ);
|
|
Point3D pos(m_PosX,m_PosY,m_PosZ);
|
|
Stuff::LinearMatrix4D mat(pos);
|
|
mat.AlignLocalAxisToWorldVector(dir,Stuff::Z_Axis,Stuff::Y_Axis,Stuff::X_Axis);
|
|
Light->SetLightToWorldMatrix(mat);
|
|
Stuff::Radian Angle;
|
|
Stuff::Degree deg;
|
|
deg=m_Spread;
|
|
Angle=deg;
|
|
Light->SetSpreadAngle(Angle);
|
|
|
|
Light->SetFalloffDistance(m_InnerRange, m_OuterRange);
|
|
}
|
|
|
|
void CSpotLightProps::GetData(MLRProjectLight *pLight)
|
|
{
|
|
pLight->SetIntensity(m_Intensity);
|
|
pLight->SetColor(m_Red,m_Green,m_Blue);
|
|
Vector3D dir(m_DirX,m_DirY,m_DirZ);
|
|
Point3D pos(m_PosX,m_PosY,m_PosZ);
|
|
Stuff::LinearMatrix4D mat(pos);
|
|
mat.AlignLocalAxisToWorldVector(dir,Stuff::Z_Axis,Stuff::Y_Axis,Stuff::X_Axis);
|
|
pLight->SetLightToWorldMatrix(mat);
|
|
Stuff::Radian Angle;
|
|
Stuff::Degree deg;
|
|
deg=m_Spread;
|
|
Angle=deg;
|
|
pLight->SetSpreadAngle(Angle);
|
|
|
|
pLight->SetFalloffDistance(m_InnerRange, m_OuterRange);
|
|
}
|
|
|