First shadow mapping commit
Former-commit-id: 7465a7c3297626f8db8c1ff48a20c0e0d9feb765
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user