PSSMDemo.ShadowMap.Draw C# (CSharp) Method

Draw() public method

シャドウ マップを描画します。
public Draw ( Matrix eyeView, Matrix eyeProjection, Matrix lightView, Matrix lightProjection, DrawShadowCastersCallback drawShadowCasters ) : void
eyeView Matrix 表示カメラのビュー行列。
eyeProjection Matrix 表示カメラの射影行列。
lightView Matrix ライト カメラのビュー行列。
lightProjection Matrix ライト カメラの射影行列。
drawShadowCasters DrawShadowCastersCallback 投影オブジェクト描画コールバック。
return void
        public void Draw(
            Matrix eyeView, Matrix eyeProjection,
            Matrix lightView, Matrix lightProjection,
            DrawShadowCastersCallback drawShadowCasters)
        {
            if (drawShadowCasters == null) throw new ArgumentNullException("drawShadowCasters");

            PrepareRenderTarget();

            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            GraphicsDevice.BlendState = BlendState.Opaque;

            // エフェクトを設定。
            shadowMapEffect.View = lightView;
            shadowMapEffect.Projection = lightProjection;

            GraphicsDevice.SetRenderTarget(RenderTarget);
            GraphicsDevice.Clear(Color.White);

            // 描画をコールバック。
            // 描画する投影オブジェクトの選別は、コールバックされる側のクラスで決定。
            drawShadowCasters(eyeView, eyeProjection, shadowMapEffect);

            GraphicsDevice.SetRenderTarget(null);
        }