示例#1
0
        public void GenerateMesh(StaticMesh staticMesh, int x, int y, float numberOfChunksX, float numberOfChunksY)
        {
            var offset = new Vector2(x, y);

            var noiseGenerator = new ChunkNoiseGenerator(offset, _noise);

            var heightMapGenerator = new HeightMapGenerator(noiseGenerator);
            var mesh = heightMapGenerator.GenerateMesh();

            var translationMatrix = Matrix4.CreateTranslation(offset.X - numberOfChunksX / 2.0f, 0, offset.Y - numberOfChunksY / 2.0f);

            staticMesh.ModelMatrix = translationMatrix;
            staticMesh.Color       = _colorCycle.GetNext();
            staticMesh.Update(mesh);
        }
        public void GenerateMesh(StaticMesh staticMesh, int x, int y, float numberOfChunksX, float numberOfChunksY)
        {
            var offset = new Vector2(x, y);

            var noiseGenerator = new ChunkNoiseGenerator(offset, _noise);

            var heightMapGenerator = new HeightMapGenerator(noiseGenerator);
            var mesh = heightMapGenerator.GenerateMesh();

            var translationMatrix = Matrix4.CreateTranslation(offset.X - numberOfChunksX / 2.0f, 0, offset.Y - numberOfChunksY / 2.0f);
            staticMesh.ModelMatrix = translationMatrix;
            staticMesh.Color = _colorCycle.GetNext();
            staticMesh.Update(mesh);
        }