private void DrawGlass(PPDDevice device, AlphaBlendContext context, Matrix m, PrimitiveType primitiveType, int primitiveCount, int startIndex, int vertexCount) { using (var workspaceTexture = device.Workspace.Get()) { Flush(); #if BENCHMARK using (var handler = Benchmark.Instance.Start("Copy")) { #endif device.StretchRectangle(device.GetRenderTarget(), workspaceTexture); #if BENCHMARK } #endif using (var tempWorkspaceTexture = device.Workspace.Get()) using (var tempWorkspaceTexture2 = device.Workspace.Get()) { context.BlendMode = BlendMode.Normal; var renderTarget = device.GetRenderTarget(); device.SetRenderTarget(tempWorkspaceTexture); device.Clear(); device.SetRenderTarget(tempWorkspaceTexture2); device.Clear(); device.SetRenderTarget(tempWorkspaceTexture); DrawNotNormalBlend(device, context, m, tempWorkspaceTexture2, primitiveType, primitiveCount, startIndex, vertexCount); device.SetRenderTarget(renderTarget); device.GetModule <GlassFilter>().Draw(device, tempWorkspaceTexture.Texture, workspaceTexture.Texture); } } }
/// <summary> /// 描画します /// </summary> /// <param name="device"></param> /// <param name="weights"></param> public void Draw(PPDDevice device, float[] weights) { if (PPDSetting.Setting.ShaderDisabled) { return; } using (var tempWorkSpace = device.Workspace.Get()) { effect.SetValue(weightsHandle, weights); effect.SetTexture(textureHandle, device.GetRenderTarget().Texture); var renderTarget = device.GetRenderTarget(); device.SetRenderTarget(tempWorkSpace); device.Clear(); var passCount = effect.Begin(); effect.BeginPass(0); DrawQuad(device); effect.EndPass(); device.SetRenderTarget(renderTarget); device.Clear(); effect.SetTexture(textureHandle, tempWorkSpace.Texture); effect.BeginPass(1); DrawQuad(device); effect.EndPass(); effect.End(); } }
/// <summary> /// コピーします。 /// </summary> /// <param name="device"></param> /// <param name="filterTexture"></param> /// <param name="size"></param> public void Draw(PPDDevice device, WorkspaceTexture filterTexture, int size) { using (var workspaceTexture = device.Workspace.Get()) using (var xTexture = device.Workspace.Get()) { #if BENCHMARK using (var handler = Benchmark.Instance.Start("Copy")) { #endif device.StretchRectangle(device.GetRenderTarget(), workspaceTexture); #if BENCHMARK } #endif var renderTarget = device.GetRenderTarget(); device.SetRenderTarget(xTexture); device.Clear(); effect.Technique = "Mosaic"; effect.SetTexture(filterTextureHandle, filterTexture.Texture); effect.SetTexture(lastRenderTargetTextureHandle, workspaceTexture.Texture); effect.SetValue(sizeHandle, size); var passCount = effect.Begin(); effect.BeginPass(0); effect.CommitChanges(); device.VertexDeclaration = effect.VertexDeclaration; var screenVertex = device.GetModule <ShaderCommon>().ScreenVertex; device.SetStreamSource(screenVertex.VertexBucket.VertexBuffer); device.DrawPrimitives(PrimitiveType.TriangleStrip, screenVertex.Offset, 2); effect.EndPass(); device.SetRenderTarget(renderTarget); effect.SetTexture(xTextureHandle, xTexture.Texture); effect.BeginPass(1); effect.CommitChanges(); device.DrawPrimitives(PrimitiveType.TriangleStrip, screenVertex.Offset, 2); effect.EndPass(); effect.End(); } }