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


C# IScene.Render方法代码示例

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


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

示例1: RenderToImposter

		public void RenderToImposter(IScene scene, View3D view)
		{
			try
			{
				if (UseDepth == true)
				{					
					Effect.BeginRender(m_ImposterTargetView, m_DepthView, m_DepthState, m_Background, m_ImposterView.Viewport, m_BackupState);
				}
				else 
				{
					Effect.BeginRender(m_ImposterTargetView, m_Background, m_ImposterView.Viewport, m_BackupState);
				}

				scene.Render(m_ImposterView); 
			}
			finally
			{
				Effect.EndRender(m_BackupState); 
			}
		}
开发者ID:RugCode,项目名称:drg-pt,代码行数:20,代码来源:ImposterFloat.cs

示例2: Render

        /// <summary>
        /// Renders the scene.
        /// </summary>
        /// <param name="scene">The scene object.</param>
        /// <param name="primaryLight">The primary light. Only the primary light casts shadows.</param>
        public void Render(IScene scene, Light primaryLight)
        {
            if (scene == null)
            {
                throw new ArgumentNullException(nameof(scene));
            }

            // Phase 1: Geometry
            {
                this.Phase = Phase.Geometry;

                GPU.Draw(ColorTarget, NormalTarget, PositionTarget, CompositionTarget);
                GPU.Use(Cull.Back, Depth.Test | Depth.Write, Stencil.None, Blend.None);
                GPU.Clear(null);

                scene.Render(this);
            }

            // Phase 2: Shadows
            if (primaryLight != null && primaryLight.Intensity > 0)
            {
                this.Phase = Phase.Shadows;
                this.shadowShader.Use(primaryLight);

                GPU.Draw(TargetBuffer.None);
                GPU.Use(Cull.None, Depth.Test | Depth.Clamp | Depth.Offset, Stencil.Shadows, Blend.None);

                scene.Render(this);
            }

            // Phase 3: Lights
            {
                this.Phase = Phase.Lights;
                this.lightShader.Use()
                    .SetUniform("ColorBuffer", this.ColorBuffer)
                    .SetUniform("NormalBuffer", this.NormalBuffer)
                    .SetUniform("PositionBuffer", this.PositionBuffer)
                    .SetUniform("BufferSize", this.Width, this.Height);

                GPU.Draw(CompositionTarget);

                if (primaryLight != null && primaryLight.Intensity > 0)
                {
                    GPU.Use(Cull.Back, Depth.TestReversed, Stencil.Light, Blend.Additive);
                    GPU.Transform(Matrix4x4.Identity);

                    (this as IRenderer).Render(primaryLight);
                }

                GPU.Use(Cull.Back, Depth.TestReversed, Stencil.None, Blend.Additive);

                scene.Render(this);
            }

            // Phase 4: Effects
            {
                this.Phase = Phase.Effects;

                GPU.Use(Cull.None, Depth.Test, Stencil.None, Blend.Additive);

                scene.Render(this);
            }

            this.Phase = 0;
        }
开发者ID:vetuomia,项目名称:rocket,代码行数:70,代码来源:Renderer.cs


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