protected override void CreateShadowMap(EntityLightShadow light) { var shadowMapDesc = light.Light.Shadow as LightShadowMap; // create the shadow map var shadowMap = new ShadowMap { LightDirection = light.Light.Direction, LightPosition = light.Entity.Transformation.Translation, ShadowMapSize = shadowMapDesc.MaxSize, ShadowNearDistance = shadowMapDesc.NearDistance, ShadowFarDistance = shadowMapDesc.FarDistance, CascadeCount = light.Light.Type is LightDirectional ? shadowMapDesc.CascadeCount : 1, // cascades are only supported for directional shadow maps //Fov = light.Light.SpotFieldAngle, Filter = shadowMapDesc.FilterType, Layers = light.Light.Layers }; // find or create the shadow map texture ShadowMapTexture chosenTexture = null; chosenTexture = AllocateOrChooseTexture(shadowMap, shadowMapDesc.FilterType == LightShadowMapFilterType.Variance ? texturesVsm : texturesDefault); shadowMap.Texture = chosenTexture; InternalShadowMaps.Add(shadowMap); light.ShadowMap = shadowMap; }
protected override void CreateShadowMap(EntityLightShadow light) { // create the shadow map var shadowMap = new ShadowMap { LightDirection = light.Light.LightDirection, ShadowMapSize = light.Light.ShadowMapMinSize, ShadowNearDistance = light.Light.ShadowNearDistance, ShadowFarDistance = light.Light.ShadowFarDistance, CascadeCount = light.Light.ShadowMapCascadeCount, Filter = light.Light.ShadowMapFilterType, Layers = light.Light.Layers }; InternalShadowMaps.Add(shadowMap); light.ShadowMap = shadowMap; }