예제 #1
0
SpotLight::SpotLight(const Vector3f& color, float intensity, const Attenuation& attenuation, float viewAngle, 
                     int shadowMapSizeAsPowerOf2, float shadowSoftness, float lightBleedReductionAmount, float minVariance) :
	PointLight(color, intensity, attenuation, Shader("forward-spot")),
	m_cutoff(cos(viewAngle/2))
{
	if(shadowMapSizeAsPowerOf2 != 0)
	{
		SetShadowInfo(ShadowInfo(Matrix4f().InitPerspective(viewAngle, 1.0, 0.1, GetRange()), false, shadowMapSizeAsPowerOf2,
		                             shadowSoftness, lightBleedReductionAmount, minVariance));
	}
}
예제 #2
0
DirectionalLight::DirectionalLight(const Vector3f& color, float intensity, int shadowMapSizeAsPowerOf2, 
	                 float shadowArea, float shadowSoftness, float lightBleedReductionAmount, float minVariance) :
	BaseLight(color, intensity, Shader("forward-directional")),
	m_halfShadowArea(shadowArea / 2.0f)
{
	if(shadowMapSizeAsPowerOf2 != 0)
	{
		SetShadowInfo(ShadowInfo(Matrix4f().InitOrthographic(-m_halfShadowArea, m_halfShadowArea, -m_halfShadowArea, 
		                                                      m_halfShadowArea, -m_halfShadowArea, m_halfShadowArea), 
								 true, shadowMapSizeAsPowerOf2, shadowSoftness, lightBleedReductionAmount, minVariance));
	}
}
예제 #3
0
rendering::lighting::DirectionalLight::DirectionalLight(const math::Transform& transform, const Color& color, math::Real intensity, int shaderId,
	int terrainShaderId, int noShadowShaderId, int noShadowTerrainShaderId,
	bool shadowInfoFlipFacesEnabled, int shadowInfoShadowMapSizeAsPowerOf2, math::Real shadowInfoShadowSoftness,
	math::Real shadowInfoLightBleedingReductionFactor, math::Real shadowInfoMinVariance, math::Real halfShadowArea) :
	BaseLight(transform, color, intensity, shaderId, terrainShaderId, noShadowShaderId, noShadowTerrainShaderId, shadowInfoShadowMapSizeAsPowerOf2 != 0),
	m_halfShadowArea(halfShadowArea)
{
	if (IsShadowingEnabled())
	{
		SetShadowInfo(math::Matrix4D(-m_halfShadowArea, m_halfShadowArea, -m_halfShadowArea, m_halfShadowArea, -m_halfShadowArea, m_halfShadowArea),
			true, shadowInfoShadowMapSizeAsPowerOf2, shadowInfoShadowSoftness, shadowInfoLightBleedingReductionFactor, shadowInfoMinVariance);
	}
}