当前位置: 首页>>代码示例>>C#>>正文


C# IRenderer.Initialize方法代码示例

本文整理汇总了C#中IRenderer.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderer.Initialize方法的具体用法?C# IRenderer.Initialize怎么用?C# IRenderer.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRenderer的用法示例。


在下文中一共展示了IRenderer.Initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SpriteBatch

        /// <summary>
        /// Initializes a new SpriteBatch class.
        /// </summary>
        /// <param name="graphicsManager">The GraphicsManager.</param>
        public SpriteBatch(GraphicsManager graphicsManager)
        {
            if (!graphicsManager.IsSupported)
                throw new NotSupportedException("The specified GraphicsManager is not supported.");

            Renderer = graphicsManager.Create();
            Renderer.Initialize();
        }
开发者ID:ThuCommix,项目名称:Sharpex2D,代码行数:12,代码来源:SpriteBatch.cs

示例2: Init

        public static void Init(GlobalState state)
        {
            if (state != null) { 
                _state = state;
                BaseRenderer.UpdateState((BaseRenderer)BackgroundRenderer, state);
                BaseRenderer.UpdateState((BaseRenderer)MagicRenderer, state);
            }

            if (IsInitialized) return;

            _deviceManager1 = new CommonDX.DeviceManager();
            _deviceManager2 = new CommonDX.DeviceManager();

            _renderer1 = new DxRenderer.BackgroundComposer() { State = _state };
            _renderer2 = new DxRenderer.MagicComposer() { State = _state };


            BackgroundSIS = new SumoNinjaMonkey.Framework.Controls.DrawingSurfaceSIS(
                (gt) => { _renderer1.Update(gt); },
                (tb) => { _renderer1.Render(tb); },
                (dm) => { _renderer1.Initialize(dm); },
                (e1, e2) => { _renderer1.InitializeUI(e1, e2); },
                (uri) => { _renderer1.LoadLocalAsset(uri); },
                () => { _renderer1.Unload(); },
                _deviceManager1);
                //_renderer1, _deviceManager1);



            MagicSIS = new SumoNinjaMonkey.Framework.Controls.DrawingSurfaceSIS(
                (gt) => { _renderer2.Update(gt); },
                (tb) => { _renderer2.Render(tb); },
                (dm) => { _renderer2.Initialize(dm); },
                (e1, e2) => { _renderer2.InitializeUI(e1, e2); },
                (uri) => { _renderer2.LoadLocalAsset(uri); },
                () => { _renderer2.Unload(); },
                _deviceManager2);
                //_renderer2, _deviceManager2);


            IsInitialized = true;

        }
开发者ID:rolandsmeenk,项目名称:ModernApps,代码行数:43,代码来源:RenderingService.cs

示例3: updatePreview

        private void updatePreview()
        {
            Image img = PreviewImage;

            if (ir0 != null)
            {
                ir0.Destroy();
                img.Source = null;
                ir0 = null;
            }

            //
            if (!FilesManager.Instance.ActiveFile.ActiveState.IsComplete)
                return;

            FileState altState = new FileState(FilesManager.Instance.ActiveFile.ActiveState, false);

            // Find output
            Node outputNode = null;

            foreach (Node node in altState.Nodes)
            {
                if (node.inode.IsOutputNode())
                {
                    outputNode = node;
                    break;
                }
            }

            // Find selected node
            oldSelectedVariable = parent.InputVariable;
            Node selectedNode = altState.dictionaryOldToNew[oldSelectedVariable.Node];

            int oldIndex = oldSelectedVariable.Node.Variables.IndexOf(oldSelectedVariable);
            Variable selectedVariable = selectedNode.Variables[oldIndex];

            // Remove output input if it was linked
            if (outputNode.Variables[0].InputType == Variable.InputTypes.Link)
            {
                outputNode.Variables[0].GetLinks()[0].removeConnection();
            }

            // Find var output if it was linked
            if (selectedVariable.GetLinks().Count > 0 && FilesManager.Instance.ActiveFile.ActiveState.Renderer != null)
            {
                Variable outputVariable = selectedVariable.GetLinks()[0].OutputVariable;

                // Create a new connection
                Connection c = new Connection();
                c.OutputVariable = outputVariable;
                c.InputVariable = outputNode.Variables[0];

                // Compile source
                HLSLCompiler comp = new HLSLCompiler(altState);
                comp.Compile();

                ir0 = FilesManager.Instance.ActiveFile.ActiveState.Renderer.Create();
                ImageSource images = ir0.Initialize();
                ir0.SetSourceCode(comp.SourceCode);

                img.Source = images;
            }
        }
开发者ID:DelvarWorld,项目名称:shadercomposer,代码行数:63,代码来源:PreviewWindow.xaml.cs


注:本文中的IRenderer.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。