示例#1
0
        /*
         * public void UpdateTerrainSize(int NX, int NY, float NS)
         * {
         *  SX = NX;
         *  SY = NY;
         *  TerrainScale = NS;
         *
         *  HeightMap = VoxelUtil.MergeFields(new int[SX + 1, SY + 1],  HeightMap);
         *  VoxelUtil.ReplaceValue(HeightMap, 0, (int)Math.Round(TerrainDepth / HeightScale));
         *
         *  MaterialMap = VoxelUtil.MergeFields(new byte[SX * MaterialDensity, SY * MaterialDensity], MaterialMap);
         *  SecondaryMaterialMap = VoxelUtil.MergeFields(new byte[SX * MaterialDensity, SY * MaterialDensity], SecondaryMaterialMap);
         *  BlendAlphaMap = VoxelUtil.MergeFields(new byte[SX * MaterialDensity, SY * MaterialDensity], BlendAlphaMap);
         *  DecalMaterialMap = VoxelUtil.MergeFields(new byte[SX * MaterialDensity, SY * MaterialDensity], DecalMaterialMap);
         *  DecalAlphaMap = VoxelUtil.MergeFields(new byte[SX * MaterialDensity, SY * MaterialDensity], DecalAlphaMap);
         *
         *  WaterHeightMap = VoxelUtil.MergeFields(new int[SX + 1, SY + 1], WaterHeightMap);
         *
         *  FlowXMap = VoxelUtil.MergeFields( VoxelUtil.ReturnReplaceValue(new byte[SX, SY], 0, 128), FlowXMap);
         *  FlowYMap = VoxelUtil.MergeFields( VoxelUtil.ReturnReplaceValue(new byte[SX, SY], 0, 128), FlowYMap);
         *  FlowBackTimeMap = VoxelUtil.MergeFields( new byte[SX, SY], FlowBackTimeMap);
         *  FlowPulseSpeedMap = VoxelUtil.MergeFields(new byte[SX, SY], FlowPulseSpeedMap);
         *
         *  WaterMap = VoxelUtil.MergeFields( new byte[SX, SY], WaterMap);
         *  WaveLengthMap = VoxelUtil.MergeFields(new byte[SX + 1, SY + 1], WaveLengthMap);
         *  WaveHeightMap = VoxelUtil.MergeFields(new byte[SX + 1, SY + 1], WaveHeightMap);
         *
         *  WaterAlphaMap = VoxelUtil.MergeFields(new byte[SX * WaterColorDensity + 1, SY * WaterColorDensity + 1], WaterAlphaMap);
         *  WaterFresnelMap = VoxelUtil.MergeFields(new byte[SX * WaterColorDensity + 1, SY * WaterColorDensity + 1], WaterFresnelMap);
         *  FoamRampMap0 = VoxelUtil.MergeFields(new byte[SX * WaterColorDensity + 1, SY * WaterColorDensity + 1], FoamRampMap0);
         *  WaterColorFalloffMap = VoxelUtil.MergeFields(new byte[SX * WaterColorDensity + 1, SY * WaterColorDensity + 1], WaterColorFalloffMap);
         *
         *  WaterColorR = VoxelUtil.MergeFields(new byte[SX * WaterColorDensity + 1, SY * WaterColorDensity + 1], WaterColorR);
         *  WaterColorG = VoxelUtil.MergeFields(new byte[SX * WaterColorDensity + 1, SY * WaterColorDensity + 1], WaterColorG);
         *  WaterColorB = VoxelUtil.MergeFields(new byte[SX * WaterColorDensity + 1, SY * WaterColorDensity + 1], WaterColorB);
         *  WaterColorA = VoxelUtil.MergeFields(new byte[SX * WaterColorDensity + 1, SY * WaterColorDensity + 1], WaterColorA);
         *
         *  //VoxelUtil.ReturnReplaceValue(new byte[SX, SY], 0, 128);
         *  //VoxelUtil.ReturnReplaceValue(new byte[SX, SY], 0, 128);
         *
         *  //VoxelUtil.ReplaceValue(FoamPulseSpeedMap, 0, 128);
         *  //VoxelUtil.ReplaceValue(FoamPulseOffsetMap, 0, 128);
         *
         *  HasTerrainUpdate = true;
         * }
         */

        public void MergeEdges(WorldFile OtherFile, bool IsVertical, string MapName, int MergeMode)
        {
            int[,] IntArray     = new int[0, 0];
            byte[,] ByteArray   = new byte[0, 0];
            float[,] FloatArray = new float[0, 0];

            object Map      = GetMap(MapName);
            object OtherMap = OtherFile.GetMap(MapName);

            if (Map != null && OtherMap != null)
            {
                if (Map.GetType() == IntArray.GetType())
                {
                    TerrainUtil.MergeEdges((int[, ])Map, (int[, ])OtherMap, IsVertical, MergeMode);
                }
                else if (Map.GetType() == ByteArray.GetType())
                {
                    TerrainUtil.MergeEdges((byte[, ])Map, (byte[, ])OtherMap, IsVertical, MergeMode);
                }
                else if (Map.GetType() == FloatArray.GetType())
                {
                    TerrainUtil.MergeEdges((float[, ])Map, (float[, ])OtherMap, IsVertical, MergeMode);
                }
            }
        }