/// <summary> /// Renders this object /// </summary> /// <param name="context">Rendering context</param> public override void Render( IUniRenderContext context ) { if ( context.CurrentPass != UniRenderPass.CloseObjects ) { return; } IPlanetOceanModel ocean = GetModel<IPlanetOceanModel>( ); if ( ocean == null ) { return; } GameProfiles.Game.Rendering.PlanetRendering.OceanRendering.Begin( ); float seaLevel = ( Planet.Model.Radius + ocean.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( ); }
/// <summary> /// Renders this object /// </summary> /// <param name="context">Rendering context</param> public override void Render( IUniRenderContext context ) { if ( context.CurrentPass != UniRenderPass.FarObjects ) { return; } using ( GameProfiles.Game.Rendering.PlanetRendering.FlatPlanetRendering.Enter( ) ) { IRenderable geometry = Geometry; UpdateMarbleTexture( ); ISpherePlanetCloudRenderer cloudRenderer = Planet.Renderer.GetRenderer<ISpherePlanetCloudRenderer>( ); if ( cloudRenderer != null ) { cloudRenderer.SetupCloudEffect( m_Technique.Effect ); } if ( m_MarbleTexture != null ) { m_Technique.Effect.Parameters[ "MarbleTexture" ].Set( m_MarbleTexture ); } ITerrainPackTextureProvider packTextures = Planet.Renderer.GetRenderer<ITerrainPackTextureProvider>( ); if ( packTextures == null ) { return; } m_Technique.Effect.Parameters[ "TerrainPackTexture" ].Set( packTextures.PackTexture ); m_Technique.Effect.Parameters[ "TerrainTypeTexture" ].Set( packTextures.LookupTexture ); m_Technique.Apply( context, geometry ); } }
/// <summary> /// Renders the atmosphere /// </summary> /// <param name="context">Rendering context</param> public override void Render( IUniRenderContext context ) { if ( context.CurrentPass != UniRenderPass.FarObjects ) { return; } SetupAtmosphereEffectParameters( context.Camera, m_Techniques.Effect, false, true ); context.ApplyTechnique( m_Techniques, AtmosphereGeometry ); }
/// <summary> /// Renders this object /// </summary> /// <param name="context">Rendering context</param> public override void Render( IUniRenderContext context ) { IPlanetSimpleCloudModel simpleCloudModel = GetModel<IPlanetSimpleCloudModel>( ); if ( simpleCloudModel == null ) { DestroyCloudShell( ); return; } if ( DoesCloudShellRequireRebuild( simpleCloudModel ) ) { BuildCloudShell( simpleCloudModel ); } SetupCloudEffectParameters( m_Technique.Effect ); context.ApplyTechnique( m_Technique, m_CloudShell ); }
/// <summary> /// Renders this object /// </summary> /// <param name="context">Rendering context</param> public override void Render( IUniRenderContext context ) { if ( context.CurrentPass != UniRenderPass.FarObjects ) { return; } if ( m_Vertices == null || HasRingModelChanged( ) ) { if ( !RebuildRingGeometry( ) ) { return; } } m_Texture.Begin( ); m_State.Begin( ); m_Vertices.Draw( PrimitiveType.TriStrip ); m_State.End( ); m_Texture.End( ); }
/// Renders this object /// </summary> /// <param name="context">Rendering context</param> public override void Render( IUniRenderContext context ) { // if ( context.CurrentPass != UniRenderPass.CloseObjects ) if ( context.RenderFarObjects ) { return; } // Get ocean model IPlanetOceanModel model = Planet.Model.GetModel<IPlanetOceanModel>( ); if ( model == null ) { return; } // Create ocean geometry Units.Metres expectedGeometryRadius = Planet.Model.Radius.ToMetres + model.SeaLevel; if ( ( m_FarGeometry == null ) || ( expectedGeometryRadius != m_GeometryRadius ) ) { m_FarGeometry = CreateGeoSphere( expectedGeometryRadius, 40 ); } // Render ocean GameProfiles.Game.Rendering.PlanetRendering.OceanRendering.Begin( ); m_WaveAnimation.UpdateAnimation( context.RenderTime ); SetupOceanTexturesInEffect( m_Technique.Effect ); context.ApplyTechnique( m_Technique, m_FarGeometry ); GameProfiles.Game.Rendering.PlanetRendering.OceanRendering.End( ); }
/// <summary> /// Renders this object /// </summary> /// <param name="context">Rendering context</param> public override void Render( IUniRenderContext context ) { if ( context.CurrentPass == UniRenderPass.FarObjects ) { return; } GameProfiles.Game.Rendering.PlanetRendering.TerrainRendering.Begin( ); // Reflected objects require flipped face windings bool flipWinding = ( context.CurrentPass == UniRenderPass.CloseReflectedObjects ); m_Technique.Planet = Planet; if ( m_FrameCountAtLastUpdate != context.RenderFrameCounter ) { m_Renderer.Update( context.Camera, Planet.Transform ); m_FrameCountAtLastUpdate = context.RenderFrameCounter; } m_Renderer.Render( context, context.Camera, m_Technique, flipWinding ); GameProfiles.Game.Rendering.PlanetRendering.TerrainRendering.End( ); }
/// <summary> /// Renders this object /// </summary> /// <param name="context">Rendering context</param> public void Render( IUniRenderContext context ) { m_Renderer.Render( context ); }