예제 #1
0
 protected override void UpdateBuffers(DeviceContextHolder holder, IShadowsDraw draw)
 {
     foreach (var split in Splits)
     {
         holder.DeviceContext.OutputMerger.SetTargets(split.Buffer.DepthView);
         holder.DeviceContext.ClearDepthStencilView(split.Buffer.DepthView, DepthStencilClearFlags.Depth, 1f, 0);
         draw.DrawSceneForShadows(holder, split.Camera);
     }
 }
예제 #2
0
 protected override void UpdateBuffers(DeviceContextHolder holder, IShadowsDraw draw)
 {
     for (var i = 0; i < 6; i++)
     {
         var view = _targetView[i];
         holder.DeviceContext.OutputMerger.SetTargets(view);
         holder.DeviceContext.ClearDepthStencilView(view, DepthStencilClearFlags.Depth, 1.0f, 0);
         draw.DrawSceneForShadows(holder, _cameras[i]);
     }
 }
예제 #3
0
        protected override void UpdateBuffers(DeviceContextHolder holder, IShadowsDraw draw)
        {
            holder.DeviceContext.OutputMerger.SetTargets(_buffer.DepthView);
            holder.DeviceContext.ClearDepthStencilView(_buffer.DepthView, DepthStencilClearFlags.Depth, 1.0f, 0);

            for (var i = 0; i < 6; i++)
            {
                holder.DeviceContext.Rasterizer.SetViewports(new Viewport(0, i * _buffer.Width, _buffer.Width, _buffer.Width, 0f, 1f));
                draw.DrawSceneForShadows(holder, _cameras[i]);
            }
        }
예제 #4
0
        public void DrawScene(DeviceContextHolder holder, [NotNull] IShadowsDraw draw)
        {
            using (holder.SaveRenderTargetAndViewport()) {
                holder.DeviceContext.Rasterizer.SetViewports(_viewport);
                holder.DeviceContext.Rasterizer.State = _rasterizerState;
                holder.DeviceContext.OutputMerger.DepthStencilState = _depthStencilState;
                holder.DeviceContext.OutputMerger.BlendState        = null;

                UpdateBuffers(holder, draw);

                holder.DeviceContext.Rasterizer.State = null;
                holder.DeviceContext.OutputMerger.DepthStencilState = null;
            }
        }
예제 #5
0
        public void DrawScene(DeviceContextHolder holder, IShadowsDraw draw)
        {
            throw new NotImplementedException();

            //UpdateCameras(position);

            //holder.SaveRenderTargetAndViewport();
            //holder.DeviceContext.Rasterizer.SetViewports(_viewport);
            //for (var i = 0; i < 6; i++) {
            //    holder.DeviceContext.ClearRenderTargetView(_targetView[i], new Color4(0));
            //    holder.DeviceContext.ClearDepthStencilView(_depthTargetView,
            //                                               DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil,
            //                                               1.0f, 0);
            //    holder.DeviceContext.OutputMerger.SetTargets(_depthTargetView, _targetView[i]);
            //    draw.DrawSceneForReflection(holder, _cameras[i]);
            //}

            //holder.DeviceContext.GenerateMips(_view);
            //holder.RestoreRenderTargetAndViewport();
        }
예제 #6
0
        public void DrawScene(DeviceContextHolder holder, IShadowsDraw draw)
        {
            holder.SaveRenderTargetAndViewport();

            holder.DeviceContext.Rasterizer.SetViewports(_viewport);
            holder.DeviceContext.OutputMerger.DepthStencilState = null;
            holder.DeviceContext.OutputMerger.BlendState        = null;
            holder.DeviceContext.Rasterizer.State = _rasterizerState;

            foreach (var split in Splits)
            {
                holder.DeviceContext.OutputMerger.SetTargets(split.Buffer.DepthView);
                holder.DeviceContext.ClearDepthStencilView(split.Buffer.DepthView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1f, 0);
                draw.DrawSceneForShadows(holder, split.Camera);
                holder.DeviceContext.GenerateMips(split.Buffer.View);
            }

            holder.DeviceContext.Rasterizer.State = null;
            holder.DeviceContext.OutputMerger.DepthStencilState = null;
            holder.RestoreRenderTargetAndViewport();
        }
예제 #7
0
 protected override void UpdateBuffers(DeviceContextHolder holder, IShadowsDraw draw)
 {
     holder.DeviceContext.OutputMerger.SetTargets(_buffer.DepthView);
     holder.DeviceContext.ClearDepthStencilView(_buffer.DepthView, DepthStencilClearFlags.Depth, 1f, 0);
     draw.DrawSceneForShadows(holder, _camera);
 }
예제 #8
0
 protected abstract void UpdateBuffers(DeviceContextHolder holder, IShadowsDraw draw);
예제 #9
0
        public void DrawScene(DeviceContextHolder holder, IShadowsDraw draw) {
            holder.SaveRenderTargetAndViewport();

            holder.DeviceContext.Rasterizer.SetViewports(_viewport);
            holder.DeviceContext.OutputMerger.DepthStencilState = null;
            holder.DeviceContext.OutputMerger.BlendState = null;
            holder.DeviceContext.Rasterizer.State = _rasterizerState;

            foreach (var split in Splits) {
                holder.DeviceContext.OutputMerger.SetTargets(split.Buffer.DepthView);
                holder.DeviceContext.ClearDepthStencilView(split.Buffer.DepthView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1f, 0);
                draw.DrawSceneForShadows(holder, split.Camera);
                holder.DeviceContext.GenerateMips(split.Buffer.View);
            }

            holder.DeviceContext.Rasterizer.State = null;
            holder.DeviceContext.OutputMerger.DepthStencilState = null;
            holder.RestoreRenderTargetAndViewport();
        }
예제 #10
0
        public void DrawScene(DeviceContextHolder holder, IShadowsDraw draw) {
            throw new NotImplementedException();

            //UpdateCameras(position);

            //holder.SaveRenderTargetAndViewport();
            //holder.DeviceContext.Rasterizer.SetViewports(_viewport);
            //for (var i = 0; i < 6; i++) {
            //    holder.DeviceContext.ClearRenderTargetView(_targetView[i], new Color4(0));
            //    holder.DeviceContext.ClearDepthStencilView(_depthTargetView,
            //                                               DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil,
            //                                               1.0f, 0);
            //    holder.DeviceContext.OutputMerger.SetTargets(_depthTargetView, _targetView[i]);
            //    draw.DrawSceneForReflection(holder, _cameras[i]);
            //}

            //holder.DeviceContext.GenerateMips(_view);
            //holder.RestoreRenderTargetAndViewport();
        }