public DepthBufferManager(IPluginHost host, IIOFactory factory) { this.host = host; this.factory = factory; ConfigAttribute cattr = new ConfigAttribute("Depth Buffer Mode"); cattr.IsSingle = true; pinmode = this.factory.CreateDiffSpread<eDepthBufferMode>(cattr); pinmode.Changed += Pinmode_Changed; this.currentmode = eDepthBufferMode.None; }
public DepthBufferManager(IPluginHost host, IIOFactory factory) { this.host = host; this.factory = factory; ConfigAttribute cattr = new ConfigAttribute("Depth Buffer Mode"); cattr.IsSingle = true; pinmode = this.factory.CreateDiffSpread <eDepthBufferMode>(cattr); pinmode.Changed += Pinmode_Changed; this.currentmode = eDepthBufferMode.None; }
private void Pinmode_Changed(IDiffSpread <eDepthBufferMode> spread) { if (this.currentmode != spread[0]) { if (this.currentmode == eDepthBufferMode.Standard) { if (this.depthoutputpin != null) { //Destroy depth stencil if (this.depthoutputpin.IOObject[0] != null) { this.depthoutputpin.IOObject[0].Dispose(); } this.depthoutputpin.Dispose(); this.depthformatpin.Dispose(); this.depthformatpin = null; this.depthoutputpin = null; } } if (this.currentmode == eDepthBufferMode.ReadOnly) { if (this.depthinputpin != null) { this.depthinputpin.Dispose(); this.depthinputpin = null; } } this.currentmode = spread[0]; if (this.currentmode == eDepthBufferMode.Standard) { OutputAttribute oattr = new OutputAttribute("Depth Buffer"); oattr.IsSingle = true; this.depthoutputpin = this.factory.CreateIOContainer <Pin <DX11Resource <DX11DepthStencil> > >(oattr); this.depthoutputpin.IOObject[0] = new DX11Resource <DX11DepthStencil>(); ConfigAttribute dfAttr = new ConfigAttribute("Depth Buffer Format"); dfAttr.EnumName = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.DepthStencil); dfAttr.DefaultEnumEntry = DX11EnumFormatHelper.NullDeviceFormats.GetAllowedFormats(FormatSupport.DepthStencil)[0]; dfAttr.IsSingle = true; this.depthformatpin = this.factory.CreateIOContainer <IDiffSpread <EnumEntry> >(dfAttr); this.depthformatpin.IOObject[0] = new EnumEntry(dfAttr.EnumName, 1); this.depthformatpin.IOObject.Changed += depthformatpin_Changed; } if (this.currentmode == eDepthBufferMode.ReadOnly) { InputAttribute oattr = new InputAttribute("Depth Buffer"); oattr.IsSingle = true; this.depthinputpin = this.factory.CreateIOContainer <Pin <DX11Resource <DX11DepthStencil> > >(oattr); } this.NeedReset = true; } }
private void Pinmode_Changed(IDiffSpread<eDepthBufferMode> spread) { if (this.currentmode != spread[0]) { if (this.currentmode == eDepthBufferMode.Standard) { if (this.depthoutputpin != null) { //Destroy depth stencil if (this.depthoutputpin.IOObject[0] != null) { this.depthoutputpin.IOObject[0].Dispose(); } this.depthoutputpin.Dispose(); this.depthformatpin.Dispose(); this.depthformatpin = null; this.depthoutputpin = null; } } if (this.currentmode == eDepthBufferMode.ReadOnly) { if (this.depthinputpin != null) { this.depthinputpin.Dispose(); this.depthinputpin = null; } } this.currentmode = spread[0]; if (this.currentmode == eDepthBufferMode.Standard) { OutputAttribute oattr = new OutputAttribute("Depth Buffer"); oattr.IsSingle = true; this.depthoutputpin = this.factory.CreateIOContainer<Pin<DX11Resource<DX11DepthStencil>>>(oattr); this.depthoutputpin.IOObject[0] = new DX11Resource<DX11DepthStencil>(); ConfigAttribute dfAttr = new ConfigAttribute("Depth Buffer Format"); dfAttr.EnumName = DX11EnumFormatHelper.NullDeviceFormats.GetEnumName(FormatSupport.DepthStencil); dfAttr.DefaultEnumEntry = DX11EnumFormatHelper.NullDeviceFormats.GetAllowedFormats(FormatSupport.DepthStencil)[0]; dfAttr.IsSingle = true; this.depthformatpin = this.factory.CreateIOContainer<IDiffSpread<EnumEntry>>(dfAttr); this.depthformatpin.IOObject[0] = new EnumEntry(dfAttr.EnumName, 1); this.depthformatpin.IOObject.Changed += depthformatpin_Changed; } if (this.currentmode == eDepthBufferMode.ReadOnly) { InputAttribute oattr = new InputAttribute("Depth Buffer"); oattr.IsSingle = true; this.depthinputpin = this.factory.CreateIOContainer<Pin<DX11Resource<DX11DepthStencil>>>(oattr); } this.NeedReset = true; } }