private void Draw(PPDDevice device, WorkspaceTexture filterTexture, Border border, BorderType type, float thickness) { using (var workspaceTexture = device.Workspace.Get()) { #if BENCHMARK using (var handler = Benchmark.Instance.Start("Copy")) { #endif device.StretchRectangle(device.GetRenderTarget(), workspaceTexture); #if BENCHMARK } #endif effect.Technique = String.Format("{0}{1}Border", type, border.Blend); effect.SetTexture(filterTextureHandle, filterTexture.Texture); effect.SetTexture(lastRenderTargetTextureHandle, workspaceTexture.Texture); effect.SetValue(colorHandle, border.Color); var intThickness = (int)Math.Ceiling(thickness * 2 + 1); effect.SetValue(thicknessHandle, (float)intThickness); effect.SetValue(thickness2Handle, (int)Math.Pow(intThickness, 2)); effect.SetValue(actualThicknessHandle, thickness); 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(); effect.End(); } }
/// <summary> /// サーフェースをコピーします。 /// </summary> /// <param name="src"></param> /// <param name="dest"></param> internal override void StretchRectangle(WorkspaceTexture src, WorkspaceTexture dest) { if (PPDSetting.Setting.ShaderDisabled) { return; } device.StretchRectangle(((Texture.DX9.Surface)src.Surface)._Surface, ((Texture.DX9.Surface)dest.Surface)._Surface, TextureFilter.Point); }
/// <summary> /// コピーします。 /// </summary> /// <param name="device"></param> /// <param name="filterTexture"></param> /// <param name="border"></param> public void Draw(PPDDevice device, WorkspaceTexture filterTexture, Border border) { if (border.Type == BorderType.Center) { Draw(device, filterTexture, border, BorderType.Outside, border.Thickness / 2); Draw(device, filterTexture, border, BorderType.Inside, border.Thickness / 2); } else { Draw(device, filterTexture, border, border.Type, border.Thickness); } }
/// <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(); } }
private void DrawNotNormalBlend(PPDDevice device, AlphaBlendContext context, Matrix m, WorkspaceTexture workspaceTexture, PrimitiveType primitiveType, int primitiveCount, int startIndex, int vertexCount) { #if BENCHMARK using (var handler = Benchmark.Instance.Start("Effect Prepare")) { #endif effect.Technique = techniqueNames[new Tuple <BlendMode, bool, bool, ColorFilterType>(context.BlendMode, context.Texture != null && context.Texture.PA, context.MaskTexture != null, context.FilterCount == 0 ? ColorFilterType.None : context.Filters[context.FilterCount - 1].FilterType)]; effect.SetTexture(textureHandle, context.Texture); effect.SetTexture(lastRenderTargetTextureHandle, workspaceTexture.Texture); effect.SetTexture(maskTextureHandle, context.MaskTexture); if (context.FilterCount > 0) { effect.SetValue(filterInfoHandle, context.Filters[context.FilterCount - 1].ToFilterInfo()); } effect.SetValue(drawInfoHandle, new DrawInfo { Matrix = m, Alpha = context.Alpha, OverlayColor = context.Overlay }); #if BENCHMARK } #endif #if BENCHMARK using (var handler = Benchmark.Instance.Start("Draw")) { #endif var passCount = effect.Begin(); effect.BeginPass(0); effect.CommitChanges(); device.VertexDeclaration = effect.VertexDeclaration; device.SetStreamSource(context.Vertex.VertexBucket.VertexBuffer); device.DrawPrimitives(primitiveType, context.Vertex.Offset + startIndex, primitiveCount); effect.EndPass(); effect.End(); effect.SetTexture(textureHandle, null); #if BENCHMARK } #endif }
/// <summary> /// 描画します。 /// </summary> /// <param name="device"></param> /// <param name="maskTexture"></param> public override void Draw(PPDDevice device, WorkspaceTexture maskTexture) { device.GetModule <MosaicFilter>().Draw(device, maskTexture, Size); }
/// <summary> /// 描画します。 /// </summary> /// <param name="device"></param> /// <param name="maskTexture"></param> public abstract void Draw(PPDDevice device, WorkspaceTexture maskTexture);
public override void Draw(PPDDevice device, WorkspaceTexture maskTexture) { device.GetModule <BorderFilter>().Draw(device, maskTexture, border); }
/// <summary> /// サーフェースをコピーします。 /// </summary> /// <param name="src"></param> /// <param name="dest"></param> internal override void StretchRectangle(WorkspaceTexture src, WorkspaceTexture dest) { Context.CopyResource(((Texture.DX11.Texture)src.Texture)._Texture, ((Texture.DX11.Texture)dest.Texture)._Texture); }
/// <summary> /// 現在のレンダーターゲットを設定します。 /// </summary> /// <param name="workSpaceTexture"></param> internal override void SetRenderTarget(WorkspaceTexture workSpaceTexture) { renderTarget = workSpaceTexture; Context.OutputMerger.SetTargets(((Texture.DX11.Texture)workSpaceTexture.Texture)._RenderTargetView); }
/// <summary> /// 現在のレンダーターゲットを設定します。 /// </summary> /// <param name="workSpaceTexture"></param> internal override void SetRenderTarget(WorkspaceTexture workSpaceTexture) { renderTarget = workSpaceTexture; device.SetRenderTarget(0, ((Texture.DX9.Surface)workSpaceTexture.Surface)._Surface); SetScissorRectImpl(); }