public DemoPartitionContext( GraphicsDevice graphicsDevice, ContentManager content, CDLODSettings settings, ICDLODVisibleRanges visibleRanges) { GraphicsDevice = graphicsDevice; Content = content; this.settings = settings; TerrainRenderer = new DemoTerrainRenderer(GraphicsDevice, Content, settings); TerrainRenderer.InitializeMorphConsts(visibleRanges); var heightColors = new HeightColorCollection(); // default settings. heightColors.AddColor(-1.0000f, new Color( 0, 0, 128, 255)); heightColors.AddColor(-0.2500f, new Color( 0, 0, 255, 255)); heightColors.AddColor( 0.0000f, new Color( 0, 128, 255, 255)); heightColors.AddColor( 0.0625f, new Color(240, 240, 64, 255)); heightColors.AddColor( 0.1250f, new Color( 32, 160, 0, 255)); heightColors.AddColor( 0.3750f, new Color(224, 224, 0, 255)); heightColors.AddColor( 0.7500f, new Color(128, 128, 128, 255)); heightColors.AddColor( 1.0000f, new Color(255, 255, 255, 255)); TerrainRenderer.InitializeHeightColors(heightColors); Selection = new CDLODSelection(settings, visibleRanges); }
public void InitializeHeightColors(HeightColorCollection heightColors) { for (int i = 0; i < heightColors.Count; i++) { var hc = heightColors[i]; heightColorBuffer[i] = hc.Color; heightColorPositionBuffer[i] = hc.Position; } effect.HeightColorCount = heightColors.Count; effect.HeightColors = heightColorBuffer; effect.HeightColorPositions = heightColorPositionBuffer; }