/// <summary> /// 現在のレンダーターゲットの状態をセットする /// </summary> /// <param name="current">現行レンダーレンダーターゲット</param> /// <param name="old">戻す対象のレンダーターゲット</param> /// <returns></returns> protected int SetCurrentRenderTargetState(MCRenderTargetState current, MCRenderTargetState old = null) { if (current == null) { throw new ArgumentNullException(); } if (old != null) { old.aRefSaveRT = App.ImmediateContext.OutputMerger.GetRenderTargets(8, out old.saveDepth); } ShaderResourceView aSRV = null; App.ImmediateContext.PixelShader.SetShaderResource(0, aSRV); App.ImmediateContext.OutputMerger.SetRenderTargets(current.saveDepth, current.aRefSaveRT); App.ImmediateContext.Rasterizer.SetViewports(current.aVP, current.aVP.Length); return(0); }
/// <summary> /// 現在のレンダーターゲットの状態をセットする /// </summary> /// <param name="current">現行レンダーレンダーターゲット</param> /// <param name="old">戻す対象のレンダーターゲット</param> /// <returns></returns> protected int SetCurrentRenderTargetState(MCBaseTexture current, MCRenderTargetState old) { if (current == null) { throw new ArgumentNullException(); } else if (!current.IsRenderTarget) { throw new ArgumentNullException(); } if (old != null) { current.SetRenderTargets(old); } else { current.SetRenderTargets(); } return(0); }