The class manages height colors.
Esempio n. 1
0
        public DemoPartitionContext(
            GraphicsDevice graphicsDevice, ContentManager content, CDLODSettings settings,
            ICDLODVisibleRanges visibleRanges, SampleSourceDelegate noiseSource,
            float noiseMinX, float noiseMinY, float noiseWidth, float noiseHeight)
        {
            GraphicsDevice = graphicsDevice;
            Content = content;
            this.settings = settings;
            NoiseSource = noiseSource;
            NoiseMinX = noiseMinX;
            NoiseMinY = noiseMinY;
            NoiseWidth = noiseWidth;
            NoiseHeight = noiseHeight;

            TerrainRenderer = new DemoTerrainRenderer(GraphicsDevice, Content, settings);
            TerrainRenderer.InitializeMorphConsts(visibleRanges);

            var heightColors = new HeightColorCollection();
            // default settings.
            heightColors.AddColor(-1.0000f, Color.Navy);
            heightColors.AddColor(-0.2500f, Color.Blue);
            heightColors.AddColor( 0.0000f, Color.LightSeaGreen);
            heightColors.AddColor( 0.0625f, Color.Khaki);
            heightColors.AddColor( 0.1250f, Color.DarkGreen);
            heightColors.AddColor( 0.3750f, Color.DarkGoldenrod);
            heightColors.AddColor( 0.7500f, Color.Gray);
            heightColors.AddColor( 1.0000f, Color.White);

            TerrainRenderer.InitializeHeightColors(heightColors);

            Selection = new CDLODSelection(settings, visibleRanges);
        }
Esempio n. 2
0
        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;
        }