public DX11NodesFactory(IHDEHost hdehost, DotNetPluginFactory dnfactory, INodeInfoFactory ni, IORegistry ioreg, ILogger logger)
        {
            DX11EnumFormatHelper.CreateNullDeviceFormat();

            this.hdehost = hdehost;
            this.ioreg = ioreg;
            this.logger = logger;
            this.hdehost.RootNode.Removed += new Core.CollectionDelegate<INode2>(RootNode_Removed);

            DX11ResourceRegistry reg = new DX11ResourceRegistry();

            this.ioreg.Register(reg, true);

            this.hdehost.MainLoop.OnPresent += GraphEventService_OnPresent;
            this.hdehost.MainLoop.OnPrepareGraph += GraphEventService_OnPrepareGraph;
            this.hdehost.MainLoop.OnRender += GraphEventService_OnRender;

            this.displaymanager = new DX11DisplayManager();
            this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager);

               this.graphbuilder = new DX11GraphBuilder<IDX11ResourceProvider>(hdehost, reg);
               this.graphbuilder.RenderRequest += graphbuilder_OnRenderRequest;
               this.rendermanager = new DX11RenderManager(this.devicemanager, this.graphbuilder,this.logger);

            DX11GlobalDevice.DeviceManager = this.devicemanager;
            DX11GlobalDevice.RenderManager = this.rendermanager;

            this.BuildAAEnum();
        }
        public DX11NodesFactory(IHDEHost hdehost, DotNetPluginFactory dnfactory, INodeInfoFactory ni, IORegistry ioreg, ILogger logger)
        {
            //Attach lib core path and plugins path

            string path = Path.GetDirectoryName(typeof(DX11DeviceRenderer).Assembly.Location);
            string vvvvpath = Path.GetDirectoryName(Application.ExecutablePath);

            string varpath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Process);
            varpath += ";" + path;

            vvvvpath = Path.Combine(vvvvpath, "packs\\dx11\\nodes\\plugins");
            varpath += ";" + path;

            Environment.SetEnvironmentVariable("Path", varpath, EnvironmentVariableTarget.Process);

            DX11EnumFormatHelper.CreateNullDeviceFormat();

            this.hdehost = hdehost;
            this.ioreg = ioreg;
            this.logger = logger;
            this.hdehost.RootNode.Removed += new Core.CollectionDelegate<INode2>(RootNode_Removed);

            DX11ResourceRegistry reg = new DX11ResourceRegistry();

            this.ioreg.Register(reg, true);

            this.hdehost.MainLoop.OnPresent += GraphEventService_OnPresent;
            this.hdehost.MainLoop.OnPrepareGraph += GraphEventService_OnPrepareGraph;
            this.hdehost.MainLoop.OnRender += GraphEventService_OnRender;

            this.displaymanager = new DX11DisplayManager();

            this.DirectWriteFactory = new DWriteFactory(SlimDX.DirectWrite.FactoryType.Shared);

            string[] args = Environment.GetCommandLineArgs();

            foreach (string s in args)
            {
                string sl = s.ToLower();
                if (sl.StartsWith("/dx11mode:"))
                {
                    sl = sl.Replace("/dx11mode:", "");

                    if (sl == "permonitor")
                    {
                        this.devicemanager = new DX11PerMonitorDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl == "peradapter")
                    {
                        this.devicemanager = new DX11PerAdapterDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl.StartsWith("force"))
                    {
                        sl = sl.Replace("force", "");
                        try
                        {
                            int i = int.Parse(sl);
                            if (i >= 0 && i < this.displaymanager.AdapterCount)
                            {
                                this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager, i);
                            }
                        }
                        catch
                        {

                        }
                    }
                }
            }

            if (this.devicemanager == null)
            {
                this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager);
            }

               this.graphbuilder = new DX11GraphBuilder<IDX11ResourceProvider>(hdehost, reg);
               this.graphbuilder.RenderRequest += graphbuilder_OnRenderRequest;
               this.rendermanager = new DX11RenderManager(this.devicemanager, this.graphbuilder,this.logger);

            DX11GlobalDevice.DeviceManager = this.devicemanager;
            DX11GlobalDevice.RenderManager = this.rendermanager;

            this.BuildAAEnum();
        }
Exemple #3
0
        public DX11NodesFactory(IHDEHost hdehost, DotNetPluginFactory dnfactory, INodeInfoFactory ni, IORegistry ioreg, ILogger logger)
        {
            DX11EnumFormatHelper.CreateNullDeviceFormat();

            this.hdehost = hdehost;
            this.ioreg = ioreg;
            this.logger = logger;
            this.hdehost.RootNode.Removed += new Core.CollectionDelegate<INode2>(RootNode_Removed);

            DX11ResourceRegistry reg = new DX11ResourceRegistry();

            this.ioreg.Register(reg, true);

            this.hdehost.MainLoop.OnPresent += GraphEventService_OnPresent;
            this.hdehost.MainLoop.OnPrepareGraph += GraphEventService_OnPrepareGraph;
            this.hdehost.MainLoop.OnRender += GraphEventService_OnRender;

            this.displaymanager = new DX11DisplayManager();

            string[] args = Environment.GetCommandLineArgs();

            foreach (string s in args)
            {
                string sl = s.ToLower();
                if (sl.StartsWith("/dx11mode:"))
                {
                    sl = sl.Replace("/dx11mode:", "");

                    if (sl == "permonitor")
                    {
                        this.devicemanager = new DX11PerMonitorDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl == "peradapter")
                    {
                        this.devicemanager = new DX11PerAdapterDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl.StartsWith("force"))
                    {
                        sl = sl.Replace("force", "");
                        try
                        {
                            int i = int.Parse(sl);
                            if (i >= 0 && i < this.displaymanager.AdapterCount)
                            {
                                this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager, i);
                            }
                        }
                        catch
                        {

                        }
                    }
                }
            }

            if (this.devicemanager == null)
            {
                this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager);
            }

               this.graphbuilder = new DX11GraphBuilder<IDX11ResourceProvider>(hdehost, reg);
               this.graphbuilder.RenderRequest += graphbuilder_OnRenderRequest;
               this.rendermanager = new DX11RenderManager(this.devicemanager, this.graphbuilder,this.logger);

            DX11GlobalDevice.DeviceManager = this.devicemanager;
            DX11GlobalDevice.RenderManager = this.rendermanager;

            this.BuildAAEnum();
        }