コード例 #1
0
        protected override void UpdateShadows(ShadowsDirectional shadows, Vector3 center)
        {
            _pcssParamsSet = false;

            var splits = GetShadowsNumSplits();

            if (splits == null)
            {
                // everything is shadowed
                _numSplits = -1;
            }
            else
            {
                shadows.SetSplits(DeviceContextHolder, GetSplits(splits.Value, CarNode?.BoundingBox?.GetSize().Length() ?? 4f));
                shadows.SetMapSize(DeviceContextHolder, ShadowMapSize);
                base.UpdateShadows(shadows, center);

                _numSplits = splits.Value;

                var effect = Effect;
                effect.FxShadowMapSize.Set(new Vector2(ShadowMapSize, 1f / ShadowMapSize));
                effect.FxShadowMaps.SetResourceArray(shadows.Splits.Take(splits.Value).Select(x => x.View).ToArray());
                effect.FxShadowViewProj.SetMatrixArray(
                    shadows.Splits.Take(splits.Value).Select(x => x.ShadowTransform).ToArray());
            }
        }