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


C# IRenderContext.ApplyTechnique方法代码示例

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


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

示例1: Render

        /// <summary>
        /// Renders the ocean
        /// </summary>
        /// <param name="context">Rendering context</param>
        public override void Render( IRenderContext context )
        {
            if ( Planet == null || Planet.PlanetModel.OceanModel == null )
            {
                return;
            }

            GameProfiles.Game.Rendering.PlanetRendering.OceanRendering.Begin( );

            float seaLevel = ( SpherePlanet.PlanetModel.Radius + Planet.PlanetModel.OceanModel.SeaLevel ).ToRenderUnits;
            seaLevel /= 10.0f;
            Graphics.Renderer.PushTransform( TransformType.LocalToWorld );
            Graphics.Renderer.Scale( TransformType.LocalToWorld, seaLevel, seaLevel, seaLevel );

            m_WaveAnimation.UpdateAnimation( context.RenderTime );
            m_Technique.Effect.Parameters[ "OceanTexture0" ].Set( m_WaveAnimation.SourceTexture );
            m_Technique.Effect.Parameters[ "OceanTexture1" ].Set( m_WaveAnimation.DestinationTexture );
            m_Technique.Effect.Parameters[ "OceanTextureT" ].Set( m_WaveAnimation.LocalT );

            context.ApplyTechnique( m_Technique, m_OceanGeometry );

            Graphics.Renderer.PopTransform( TransformType.LocalToWorld );

            GameProfiles.Game.Rendering.PlanetRendering.OceanRendering.End( );
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:29,代码来源:SpherePlanetOceanRenderer.cs

示例2: DeepRender

        /// <summary>
        /// Renders the atmosphere
        /// </summary>
        /// <param name="context">Rendering context</param>
        public void DeepRender( IRenderContext context )
        {
            if ( Planet == null || Planet.PlanetModel.AtmosphereModel == null )
            {
                return;
            }

            SetupAtmosphereEffectParameters( m_Techniques.Effect, false, true );
            context.ApplyTechnique( m_Techniques, AtmosphereGeometry );
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:14,代码来源:SpherePlanetAtmosphereRenderer.cs

示例3: Render

 /// <summary>
 /// Renders the cloud model
 /// </summary>
 /// <param name="context">Rendering context</param>
 public override void Render( IRenderContext context )
 {
     if ( Planet == null || Planet.PlanetModel.CloudModel == null )
     {
         return;
     }
     if ( m_CloudSphere == null || HasCloudModelChanged( ) )
     {
         m_CloudSphere = CreateCloudSphere( );
     }
     SetupCloudEffectParameters( m_Technique.Effect );
     context.ApplyTechnique( m_Technique, m_CloudSphere );
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:17,代码来源:SpherePlanetCloudRenderer.cs

示例4: Render

        public void Render( IRenderContext context )
        {
            if ( Planet.EnableTerrainRendering )
            {
                ms_TerrainRenderer.Render( context, Planet, m_PlanetTexture );
            }
            else
            {
                UniCamera.PushAstroRenderTransform( TransformType.LocalToWorld, Planet.Transform );

                m_PlanetTechnique.Effect.Parameters[ "TerrainSampler" ].Set( m_PlanetTexture );
                m_PlanetTechnique.Effect.Parameters[ "CloudSampler" ].Set( m_CloudTexture );
                m_PlanetTechnique.Effect.Parameters[ "CloudTransform" ].Set( m_CloudOffsetTransform );
                context.ApplyTechnique( m_PlanetTechnique, m_PlanetGeometry );

                float cloudLayerScale = 1.01f;
                Graphics.Renderer.Scale( TransformType.LocalToWorld, cloudLayerScale, cloudLayerScale, cloudLayerScale );
                m_CloudTechnique.Effect.Parameters[ "CloudSampler" ].Set( m_CloudTexture );
                m_CloudTechnique.Effect.Parameters[ "CloudTransform" ].Set( m_CloudOffsetTransform );
                context.ApplyTechnique( m_CloudTechnique, m_PlanetGeometry );

                Graphics.Renderer.PopTransform( TransformType.LocalToWorld );
            }

            m_CloudAngle = Utils.Wrap( m_CloudAngle + Constants.DegreesToRadians * 0.01f, 0, Constants.TwoPi );
            m_CloudOffsetTransform.SetXRotation( m_CloudAngle );
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:27,代码来源:OpenGlSpherePlanetRenderer.cs

示例5: Render

        /// <summary>
        /// Renders the terrain
        /// </summary>
        /// <param name="context">Terrain rendering context</param>
        public override void Render( IRenderContext context )
        {
            if ( Planet == null )
            {
                throw new InvalidOperationException( "Can't render terrain patches without first setting planet object" );
            }

            GameProfiles.Game.Rendering.PlanetRendering.TerrainRendering.Begin( );

            UpdatePatches( UniCamera.Current );

            m_Vertices.VertexBuffer.Begin( );
            context.ApplyTechnique( m_Technique, m_PatchRenderer );
            m_Vertices.VertexBuffer.End( );

            GameProfiles.Game.Rendering.PlanetRendering.TerrainRendering.End( );

            //if ( DebugInfo.ShowPatchInfo )
            //{
            //    m_Patches[ 0 ].DebugRender( );
            //}

            if ( DebugInfo.ShowPendingTerrainBuildItemCount )
            {
                DebugText.Write( "Pending terrain build items: " + TerrainPatchBuilder.PendingBuildItems );
            }

            if ( DebugInfo.ShowTerrainLeafNodeCount )
            {
                int leafCount = 0;
                foreach ( TerrainPatch patch in m_RootPatches )
                {
                    leafCount += patch.CountNodesWithVertexData( );
                }

                DebugText.Write( "Terrain leaf nodes: {0}", leafCount );
            }
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:42,代码来源:PlanetTerrainPatchRenderer.cs

示例6: Render

 /// <summary>
 /// Renders this object
 /// </summary>
 /// <param name="context">Rendering context</param>
 public void Render( IRenderContext context )
 {
     context.ApplyTechnique( m_Technique, m_Geometry );
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:8,代码来源:PlanetSurface.cs

示例7: Render

        public void Render( IRenderContext context, SpherePlanet planet, ITexture planetTerrainTexture )
        {
            Graphics.Renderer.PushTransform( TransformType.LocalToWorld );
            {
                IUniCamera curCam = UniCamera.Current;
                UniTransform transform = planet.Transform;
                double scale = 1.0 / 100000.0;
                float x = ( float )( UniUnits.Metres.FromUniUnits( transform.Position.X - curCam.Position.X ) * scale );
                float y = ( float )( UniUnits.Metres.FromUniUnits( transform.Position.Y - curCam.Position.Y ) * scale );
                float z = ( float )( UniUnits.Metres.FromUniUnits( transform.Position.Z - curCam.Position.Z ) * scale );

                Graphics.Renderer.SetTransform( TransformType.LocalToWorld, new Point3( x, y, z ), transform.XAxis, transform.YAxis, transform.ZAxis );

                float radius = ( float )( ( UniUnits.Metres.FromUniUnits( planet.Radius ) * scale ) / TerrainPatch.PlanetRadius );
                Graphics.Renderer.Scale( TransformType.LocalToWorld, radius, radius, radius );
            }

            m_PlanetTerrainTechnique.Effect.Parameters[ "TerrainSampler" ].Set( planetTerrainTexture );

            m_Builder.BeginPatchRendering( );
            context.ApplyTechnique( m_PlanetTerrainTechnique, RenderPatches );
            m_Builder.EndPatchRendering( );

            //	Graphics.Renderer.PushRenderState( m_PatchRenderState );
            //	Graphics.Renderer.PopRenderState( );
            Graphics.Renderer.PopTransform( TransformType.LocalToWorld );
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:27,代码来源:PlanetTerrainRenderer.cs

示例8: Render

 /// <summary>
 /// Renders this mesh
 /// </summary>
 public void Render( IRenderContext context )
 {
     context.ApplyTechnique( m_Technique.Technique, RenderMesh );
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:7,代码来源:OpenGlMesh.cs

示例9: Render

        /// <summary>
        /// Renders the view
        /// </summary>
        public void Render( IRenderContext context )
        {
            if ( PreRender != null )
            {
                PreRender( context );
            }
            IRenderer renderer = Graphics.Renderer;
            Rectangle oldRect = renderer.Viewport;

            int x = ( int )( m_ViewRect.Left * oldRect.Width );
            int y = ( int )( m_ViewRect.Top * oldRect.Height );
            int w = ( int )( m_ViewRect.Width * oldRect.Width );
            int h = ( int )( m_ViewRect.Height * oldRect.Height );
            Graphics.Renderer.SetViewport( x, y, w, h );

            renderer.ClearDepth( 1.0f );
            //	renderer.ClearColourToVerticalGradient( Color.DarkSeaGreen, Color.LightSeaGreen );
            renderer.ClearColour( ClearColour );

            if ( m_Camera != null )
            {
                m_Camera.Begin( );
            }
            context.ApplyTechnique( m_Technique, m_Renderable );

            if ( m_Camera != null )
            {
                m_Camera.End( );
            }

            if ( m_ShowFps )
            {
                m_FpsDisplay.Render( context );
            }

            Graphics.Renderer.SetViewport( oldRect.Left, oldRect.Top, oldRect.Width, oldRect.Height );
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:40,代码来源:Viewer.cs


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