/// <summary> /// /// </summary> public void BeginRender(GraphicsContext context) { GraphicsCore.CurrentDrawCamera = camera_; context.SetRenderTargets(frameBuffer_.color_buffer_, frameBuffer_.depth_stencil_); context.SetViewport(new SlimDX.Direct3D11.Viewport(0, 0, frameBuffer_.depth_stencil_.Width, frameBuffer_.depth_stencil_.Height)); context.ClearDepthStencil(frameBuffer_.depth_stencil_, 1.0f); ShaderManager.UserShaderBindHandler += shadowMapDrawShaderFunc_; }
/// <summary> /// /// </summary> public void EndRender(GraphicsContext context) { ShaderManager.UserShaderBindHandler -= shadowMapDrawShaderFunc_; // Generate SM blurFrameBuffer_.color_buffer_[0] = blurMap_[0]; context.SetRenderTargets(blurFrameBuffer_.color_buffer_, blurFrameBuffer_.depth_stencil_); context.SetViewport(new SlimDX.Direct3D11.Viewport(0, 0, blurFrameBuffer_.color_buffer_[0].Width, blurFrameBuffer_.color_buffer_[0].Height)); blurPrim_.GetMaterial().SetShader(shaderName_[(int)type_]); blurPrim_.GetMaterial().SetShaderViewPS(0, shadowMap_); blurPrim_.Draw(context); blurFrameBuffer_.color_buffer_[0] = blurMap_[1]; context.SetRenderTargets(blurFrameBuffer_.color_buffer_, blurFrameBuffer_.depth_stencil_); blurPrim_.GetMaterial().SetShader("GaussianBlurV"); blurPrim_.GetMaterial().SetShaderViewPS(0, blurMap_[0]); blurPrim_.Draw(context); blurFrameBuffer_.color_buffer_[0] = blurMap_[0]; context.SetRenderTargets(blurFrameBuffer_.color_buffer_, blurFrameBuffer_.depth_stencil_); blurPrim_.GetMaterial().SetShader("GaussianBlurH"); blurPrim_.GetMaterial().SetShaderViewPS(0, blurMap_[1]); blurPrim_.Draw(context); }