/// <summary> /// Setup constructor /// </summary> /// <param name="view">View to control</param> /// <param name="template">Terrain template</param> /// <param name="model">Terrain model</param> public HomogenousProceduralTerrainViewController( IHomogenousProceduralTerrainView view, IPlanetHomogenousProceduralTerrainTemplate template, IPlanetHomogenousProceduralTerrainModel model ) { Arguments.CheckNotNull( view, "view" ); Arguments.CheckNotNull( template, "template" ); Arguments.CheckNotNull( model, "model" ); view.Template = template; view.Rebuild += OnRebuild; m_Template = template; m_Model = model; }
/// <summary> /// Creates a terrain generator from a model definition /// </summary> private static TerrainGenerator CreateTerrainGenerator( ISpherePlanet planet, IPlanetHomogenousProceduralTerrainModel model ) { float radius = planet.Model.Radius.ToRenderUnits; float height = model.MaximumHeight.ToRenderUnits; TerrainGenerator generator = new TerrainGenerator( TerrainGeometry.Sphere, model.HeightFunction, model.GroundOffsetFunction ); generator.Setup( 1024, radius, radius + height ); generator.SetSmallestStepSize( MinimumStepSize, MinimumStepSize ); return generator; }
/// <summary> /// Creates a view used to edit an homogenous procedural terrain model /// </summary> public IHomogenousProceduralTerrainView CreateHomogenousProcTerrainTemplateView( IPlanetHomogenousProceduralTerrainTemplate template, IPlanetHomogenousProceduralTerrainModel model ) { Arguments.CheckNotNull( model, "model" ); HomogenousProcTerrainTemplateControl control = new HomogenousProcTerrainTemplateControl( ); control.Template = template; return control; }