mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-10 02:27:42 +00:00
Initial CLight integration
This commit is contained in:
@@ -39,6 +39,53 @@ float CLight::GetIntensity() const
|
||||
return x48_cachedIntensity;
|
||||
}
|
||||
|
||||
|
||||
CLight::CLight(const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& dir,
|
||||
const zeus::CColor& color,
|
||||
float distC, float distL, float distQ,
|
||||
float angleC, float angleL, float angleQ)
|
||||
: x0_pos(pos), xc_dir(dir), x18_color(color),
|
||||
x1c_type(ELightType::Custom), x20_spotCutoff(0.f),
|
||||
x24_distC(distC), x28_distL(distL), x2c_distQ(distQ),
|
||||
x30_angleC(angleC), x34_angleL(angleL), x38_angleQ(angleQ),
|
||||
x44_cachedRadius(0.f), x48_cachedIntensity(0.f),
|
||||
x4c_24_intensityDirty(true), x4c_25_radiusDirty(true)
|
||||
{}
|
||||
|
||||
CLight::CLight(ELightType type,
|
||||
const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& dir,
|
||||
const zeus::CColor& color,
|
||||
float cutoff)
|
||||
: x0_pos(pos), xc_dir(dir), x18_color(color),
|
||||
x1c_type(type), x20_spotCutoff(cutoff),
|
||||
x24_distC(0.f), x28_distL(1.f), x2c_distQ(0.f),
|
||||
x30_angleC(0.f), x34_angleL(1.f), x38_angleQ(0.f),
|
||||
x44_cachedRadius(0.f), x48_cachedIntensity(0.f),
|
||||
x4c_24_intensityDirty(true), x4c_25_radiusDirty(true)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ELightType::Spot:
|
||||
{
|
||||
float cosCutoff = std::cos(cutoff * M_PI / 180.0);
|
||||
x30_angleC = 0.f;
|
||||
x34_angleL = -cosCutoff / (1.0 - cosCutoff);
|
||||
x38_angleQ = 1.f / (1.0 - cosCutoff);
|
||||
break;
|
||||
}
|
||||
case ELightType::Directional:
|
||||
{
|
||||
x24_distC = 1.f;
|
||||
x28_distL = 0.f;
|
||||
x2c_distQ = 0.f;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
CLight CLight::BuildDirectional(const zeus::CVector3f& dir, const zeus::CColor& color)
|
||||
{
|
||||
return CLight(ELightType::Directional, kDefaultPosition, dir, color, 180.f);
|
||||
|
||||
Reference in New Issue
Block a user