Наследование: IChunkCollector, IHasVisualizableProperties
Пример #1
0
 private static RectangleF GetSceneBounds(Adt adt, float padding)
 {
     return new RectangleF
     {
         Top = adt.Bounds.Maximum.Y + padding,
         Right = adt.Bounds.Maximum.X + padding,
         Bottom = adt.Bounds.Minimum.Y - padding,
         Left = adt.Bounds.Minimum.X - padding,
     };
 }
Пример #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;
     }
 }
Пример #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;
            }
        }
Пример #4
0
 private static Scene MergeIntoScene(Adt adt, IEnumerable<SceneObject> terrain, IEnumerable<SceneObject> liquids, 
     IEnumerable<SceneObject> doodads, IEnumerable<SceneObject> wmos)
 {
     return new Scene
     {
         Adt = adt,
         Terrain = terrain,
         Liquids = liquids,
         Doodads = doodads,
         Wmos = wmos
     };
 }
Пример #5
0
 private static IEnumerable<IModelDefinition> DefinedWmos(Adt adt)
 {
     var allRefs = new HashSet<int>(adt.MapChunks.Where(m => m.WmoReferences != null).SelectMany(m => m.WmoReferences));
     return adt.WmoDefinitions.Where((d, i) => allRefs.Contains(i));
 }