BuildSquareMesh() public method

public BuildSquareMesh ( Func shouldNotRenderTile, MaterialFlags materialProperties, RectangleF bounds, string description = null ) : SceneObject
shouldNotRenderTile Func
materialProperties MaterialFlags
bounds RectangleF
description string
return SceneObject
Exemplo n.º 1
0
 public IEnumerable<SceneObject> BuildTerrain(Adt adt, RectangleF bounds)
 {
     foreach (var chunk in adt.MapChunks)
     {
         var offset = chunk.Bounds.Maximum;
         offset.Z = chunk.Bounds.Minimum.Z;
         var meshBuilder = new SquareMeshBuilder(chunk.HeightMap, offset, -MapChunk.TileSize);
         var description = string.Format(DescriptionTemplate, "Terrain", chunk.X, chunk.Y);
         var sceneObject = meshBuilder.BuildSquareMesh(chunk.HasHole, MaterialFlags.None, bounds, description);
         if (sceneObject != null) yield return sceneObject;
     }
 }
Exemplo n.º 2
0
 public IEnumerable <SceneObject> BuildTerrain(Adt adt, RectangleF bounds)
 {
     foreach (var chunk in adt.MapChunks)
     {
         var offset = chunk.Bounds.Maximum;
         offset.Z = chunk.Bounds.Minimum.Z;
         var meshBuilder = new SquareMeshBuilder(chunk.HeightMap, offset, -MapChunk.TileSize);
         var description = string.Format(DescriptionTemplate, "Terrain", chunk.X, chunk.Y);
         var sceneObject = meshBuilder.BuildSquareMesh(chunk.HasHole, MaterialFlags.None, bounds, description);
         if (sceneObject != null)
         {
             yield return(sceneObject);
         }
     }
 }
Exemplo n.º 3
0
        public IEnumerable<SceneObject> BuildLiquid(Adt adt, RectangleF bounds)
        {
            var chunksWithLiquids = from chunk in adt.MapChunks
                                    where chunk.Liquid != null && chunk.Liquid.HeightMap != null
                                    select chunk;

            foreach (var chunk in chunksWithLiquids)
            {
                var offset = chunk.Bounds.Maximum;
                offset.Z = 0;
                var liquid = chunk.Liquid;
                var meshBuilder = new SquareMeshBuilder(liquid.HeightMap, offset, -MapChunk.TileSize);
                var materialProperties = _getLiquidMaterial(liquid.Type);
                var description = string.Format(DescriptionTemplate, "Liquid", chunk.X, chunk.Y);
                var sceneObject = meshBuilder.BuildSquareMesh(liquid.HasHole, materialProperties, bounds, description);
                if (sceneObject != null) yield return sceneObject;
            }
        }
Exemplo n.º 4
0
        public IEnumerable <SceneObject> BuildLiquid(Adt adt, RectangleF bounds)
        {
            var chunksWithLiquids = from chunk in adt.MapChunks
                                    where chunk.Liquid != null && chunk.Liquid.HeightMap != null
                                    select chunk;

            foreach (var chunk in chunksWithLiquids)
            {
                var offset = chunk.Bounds.Maximum;
                offset.Z = 0;
                var liquid             = chunk.Liquid;
                var meshBuilder        = new SquareMeshBuilder(liquid.HeightMap, offset, -MapChunk.TileSize);
                var materialProperties = _getLiquidMaterial(liquid.Type);
                var description        = string.Format(DescriptionTemplate, "Liquid", chunk.X, chunk.Y);
                var sceneObject        = meshBuilder.BuildSquareMesh(liquid.HasHole, materialProperties, bounds, description);
                if (sceneObject != null)
                {
                    yield return(sceneObject);
                }
            }
        }