internal OverlayModel(ImageModelTextureCache cache) { this.cache = cache; cache.Changed += CacheOnChanged; Overlays.CollectionChanged += OverlaysOnCollectionChanged; var blendDesc = new BlendStateDescription { AlphaToCoverageEnable = false, IndependentBlendEnable = false }; blendDesc.RenderTarget[0].IsBlendEnabled = true; blendDesc.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All; // C' = a_src * c_src + (1.0 - a_src) * a_dst blendDesc.RenderTarget[0].BlendOperation = BlendOperation.Add; blendDesc.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha; blendDesc.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha; // A' = (1.0 - a_src) * a_dst (inverse alpha, render target starts with a == 1) blendDesc.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add; blendDesc.RenderTarget[0].SourceAlphaBlend = BlendOption.Zero; blendDesc.RenderTarget[0].DestinationAlphaBlend = BlendOption.InverseSourceAlpha; blendState = new BlendState(Device.Get().Handle, blendDesc); }
public Models(int numPipelines = 1) { NumPipelines = numPipelines; CheckDeviceCapabilities(); SharedModel = new SharedModel(); Images = new ImagesModel(SharedModel.ScaleShader); TextureCache = new ImageModelTextureCache(Images); Filter = new FiltersModel(Images); Progress = new ProgressModel(); for (int i = 0; i < numPipelines; ++i) { pipelines.Add(new ImagePipeline(i)); pipelines.Last().PropertyChanged += PipeOnPropertyChanged; } Pipelines = pipelines; // pipeline controller pipelineController = new PipelineController(this); }