Esempio n. 1
0
        /// <summary>
        /// Processes a <see cref="LODTerrain"/> in a <see cref="MAPTerrainMoHAA"/>.
        /// For MoHAA forks only.
        /// </summary>
        /// <param name="lodTerrain">The <see cref="LODTerrain"/> object to process.</param>
        /// <returns>A <see cref="MAPTerrainMoHAA"/> object to be added to a <see cref="MAPBrush"/> object.</returns>
        private MAPTerrainMoHAA ProcessTerrainMoHAA(LODTerrain lodTerrain)
        {
            string shader = _bsp.textures[lodTerrain.texture].name;

            MAPTerrainMoHAA.Partition partition = new MAPTerrainMoHAA.Partition()
            {
                shader       = shader,
                textureScale = new double[] { 1, 1 },
            };
            MAPTerrainMoHAA terrain = new MAPTerrainMoHAA()
            {
                size   = new Vector2d(9, 9),
                flags  = ((lodTerrain.flags & (1 << 6)) > 0) ? 1 : 0,
                origin = new Vector3d(lodTerrain.x * 64, lodTerrain.y * 64, lodTerrain.baseZ),
            };

            terrain.partitions.Add(partition);
            terrain.partitions.Add(partition);
            terrain.partitions.Add(partition);
            terrain.partitions.Add(partition);
            for (int i = 0; i < 9; ++i)
            {
                for (int j = 0; j < 9; ++j)
                {
                    MAPTerrainMoHAA.Vertex vertex = new MAPTerrainMoHAA.Vertex()
                    {
                        height = lodTerrain.heightmap[i, j] * 2,
                    };
                    terrain.vertices.Add(vertex);
                }
            }
            return(terrain);
        }
Esempio n. 2
0
        /// <summary>
        /// Processes a <see cref="LODTerrain"/> in a <see cref="MAPTerrainMoHAA"/>.
        /// For MoHAA forks only.
        /// </summary>
        /// <param name="lodTerrain">The <see cref="LODTerrain"/> object to process.</param>
        /// <returns>A <see cref="MAPTerrainMoHAA"/> object to be added to a <see cref="MAPBrush"/> object.</returns>
        private MAPTerrainMoHAA ProcessTerrainMoHAA(LODTerrain lodTerrain)
        {
            string shader = _bsp.textures[lodTerrain.TextureIndex].Name;

            MAPTerrainMoHAA.Partition partition = new MAPTerrainMoHAA.Partition()
            {
                shader       = shader,
                textureScale = new float[] { 1, 1 },
            };
            MAPTerrainMoHAA terrain = new MAPTerrainMoHAA()
            {
                size   = new Vector2(9, 9),
                flags  = ((lodTerrain.Flags & (1 << 6)) > 0) ? 1 : 0,
                origin = new Vector3(lodTerrain.X * 64, lodTerrain.Y * 64, lodTerrain.BaseZ),
            };

            terrain.partitions.Add(partition);
            terrain.partitions.Add(partition);
            terrain.partitions.Add(partition);
            terrain.partitions.Add(partition);
            for (int i = 0; i < 9; ++i)
            {
                for (int j = 0; j < 9; ++j)
                {
                    MAPTerrainMoHAA.Vertex vertex = new MAPTerrainMoHAA.Vertex()
                    {
                        height = lodTerrain.Heightmap[i, j] * 2,
                    };
                    terrain.vertices.Add(vertex);
                }
            }
            return(terrain);
        }