First shadow mapping commit

Former-commit-id: 7465a7c3297626f8db8c1ff48a20c0e0d9feb765
This commit is contained in:
Lynix
2015-06-16 14:21:20 +02:00
parent c879bd1656
commit 974df4288f
6 changed files with 190 additions and 28 deletions

View File

@@ -17,7 +17,9 @@
///TODO: Scale ?
NzLight::NzLight(nzLightType type) :
m_type(type)
m_type(type),
m_shadowCastingEnabled(false),
m_shadowMapUpdated(false)
{
SetAmbientFactor((type == nzLightType_Directional) ? 0.2f : 0.f);
SetAttenuation(0.9f);
@@ -177,3 +179,18 @@ void NzLight::MakeBoundingVolume() const
break;
}
}
void NzLight::UpdateShadowMap() const
{
if (m_shadowCastingEnabled)
{
if (!m_shadowMap)
m_shadowMap = NzTexture::New();
m_shadowMap->Create(nzImageType_2D, nzPixelFormat_Depth16, 256, 256);
}
else
m_shadowMap.Reset();
m_shadowMapUpdated = true;
}