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


C# RenderContext.PushTagAndRestore方法代码示例

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


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

示例1: DrawCore

        protected override void DrawCore(RenderContext context)
        {
            using (var t1 = context.PushTagAndRestore(SceneCameraSlotCollection.Current, Cameras))
            {
                // Draw the layers
                Layers.Draw(context);

                // Draw the master track
                Master.Draw(context);
            }
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:11,代码来源:SceneGraphicsCompositorLayers.cs

示例2: DrawCore

        protected override void DrawCore(RenderContext context)
        {
            if (!Enabled || Output == null)
            {
                return;
            }

            // Sets the input of the layer (== last Current)
            var currentRenderFrame = context.Tags.Get(RenderFrame.Current);
            
            // Sets the output of the layer 
            // Master is always going to use the Master frame for the current frame.
            var renderFrame = Output.GetRenderFrame(context);

            using (var t1 = context.PushTagAndRestore(CurrentInput, currentRenderFrame))
            {
                context.Tags.Set(RenderFrame.Current, renderFrame);
                Renderers.Draw(context);
            }
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:20,代码来源:SceneGraphicsLayer.cs

示例3: DrawCore

        protected override void DrawCore(RenderContext context, RenderFrame output)
        {
            // Early exit if some properties are null
            if (Mode == null)
            {
                return;
            }

            // Gets the current camera state from the slot
            var camera = context.GetCameraFromSlot(Camera);

            // Draw this camera.
            using (context.PushTagAndRestore(Current, this))
            using (context.PushTagAndRestore(CameraComponentRenderer.Current, camera))
            {
                // Run all pre-renderers
                foreach (var renderer in PreRenderers)
                {
                    renderer.Draw(context);
                }

                // Draw the scene based on its drawing mode (e.g. implementation forward or deferred... etc.)
                Mode.Draw(context);

                // Run all post-renderers
                foreach (var renderer in PostRenderers)
                {
                    renderer.Draw(context);
                }
            }
        }
开发者ID:ItayGal2,项目名称:paradox,代码行数:31,代码来源:SceneCameraRenderer.cs

示例4: Draw

        /// <summary>
        /// Draws this scene instance with the specified context and <see cref="RenderFrame"/>.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="toFrame">To frame.</param>
        /// <param name="compositorOverride">The compositor overload. Set this value to by-pass the default compositor of a scene.</param>
        /// <exception cref="System.ArgumentNullException">
        /// context
        /// or
        /// toFrame
        /// </exception>
        public void Draw(RenderContext context, RenderFrame toFrame, ISceneGraphicsCompositor compositorOverride = null)
        {
            if (context == null) throw new ArgumentNullException("context");
            if (toFrame == null) throw new ArgumentNullException("toFrame");

            // If no scene, then we can return immediately
            if (Scene == null)
            {
                return;
            }

            var graphicsDevice = context.GraphicsDevice;

            bool hasGraphicsBegin = false;

            // Update global time
            var gameTime = context.Time;
            context.GraphicsDevice.Parameters.Set(GlobalKeys.Time, (float)gameTime.Total.TotalSeconds);
            context.GraphicsDevice.Parameters.Set(GlobalKeys.TimeStep, (float)gameTime.Elapsed.TotalSeconds);

            try
            {
                graphicsDevice.Begin();
                hasGraphicsBegin = true;

                // Always clear the state of the GraphicsDevice to make sure a scene doesn't start with a wrong setup 
                graphicsDevice.ClearState();

                // Draw the main scene using the current compositor (or the provided override)
                var graphicsCompositor = compositorOverride ?? Scene.Settings.GraphicsCompositor;
                if (graphicsCompositor != null)
                {
                    // Push context (pop after using)
                    using (context.PushTagAndRestore(RenderFrame.Current, toFrame))
                    using (context.PushTagAndRestore(SceneGraphicsLayer.Master, toFrame))
                    using (context.PushTagAndRestore(Current, this))
                    using (context.PushTagAndRestore(CameraRendererMode.RendererTypesKey, RendererTypes))
                    {
                        graphicsCompositor.Draw(context);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("An exception occurred while rendering", ex);
            }
            finally
            {
                if (hasGraphicsBegin)
                {
                    graphicsDevice.End();
                }
            }
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:65,代码来源:SceneInstance.cs


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