AcTools.Render.Kn5SpecificSpecial.AmbientShadowKn5ObjectRenderer.DrawShadow C# (CSharp) Method

DrawShadow() private method

private DrawShadow ( System.Vector3 from, System.Vector3 up = null ) : void
from System.Vector3
up System.Vector3
return void
        private void DrawShadow(Vector3 from, Vector3? up = null) {
            DeviceContext.OutputMerger.DepthStencilState = null;
            DeviceContext.OutputMerger.BlendState = null;
            DeviceContext.Rasterizer.State = DeviceContextHolder.DoubleSidedState;
            DeviceContext.Rasterizer.SetViewports(_shadowViewport);

            DeviceContext.ClearDepthStencilView(_shadowBuffer.DepthView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1f, 0);
            DeviceContext.OutputMerger.SetTargets(_shadowBuffer.DepthView);

            _shadowCamera.LookAt(Vector3.Normalize(from) * _shadowCamera.FarZ * 0.8f, Vector3.Zero, up ?? Vector3.UnitY);
            _shadowCamera.UpdateViewMatrix();

            if (HideWheels && !_wheelMode) {
                var wheelNodes = new[] {
                    "WHEEL_LF", "WHEEL_LR", "WHEEL_RF", "WHEEL_RR",
                    "HUB_LF", "HUB_LR", "HUB_RF", "HUB_RR",
                    "SUSP_LF", "SUSP_LR", "SUSP_RF", "SUSP_RR",
                };
                _scene.Draw(DeviceContextHolder, _shadowCamera, SpecialRenderMode.Simple, x => !wheelNodes.Contains((x as Kn5RenderableList)?.OriginalNode.Name));
            } else {
                _scene.Draw(DeviceContextHolder, _shadowCamera, SpecialRenderMode.Simple);
            }
        }