예제 #1
0
        public void InitializeGeometry(RenderManager RenderManager)
        {
            Geom = new Geometry3D(Name);

            Geom.Shader = RenderManager.Shaders["Water"].Clone();
            Geom.Shader.Parameters["TerrainScale"].SetValue(WorldFile.TerrainScale);
            Geom.Shader.Parameters["HeightScale"].SetValue(WorldFile.HeightScale);

            Geom.Shader.Parameters["TerrainWidth"].SetValue(WorldFile.SX);
            Geom.Shader.Parameters["TerrainLength"].SetValue(WorldFile.SY);

            Geom.Shader.Parameters["WaveMap"].SetValue(RenderManager.Textures["WaveMap1"]);
            Geom.Shader.Parameters["WaveMap2"].SetValue(RenderManager.Textures["WaveMap2"]);
            Geom.Shader.Parameters["FoamMap"].SetValue(RenderManager.Textures["Foam"]);
            Geom.Shader.Parameters["NoiseMap"].SetValue(RenderManager.Textures["Noise"]);

            Geom.Shader.Parameters["NearPlane"].SetValue(RenderManager.Camera.NearPlaneClip);
            Geom.Shader.Parameters["FarPlane"].SetValue(RenderManager.Camera.FarPlaneClip);


            ReflectionRenderTarget.AddClipMap(Name, new Texture2D(RenderManager.Graphics, WorldFile.SX + 1, WorldFile.SY + 1), new Vector3(Position.X, Position.Y, Position.Z), new Vector4(WorldFile.SX * WorldFile.TerrainScale, WorldFile.SY * WorldFile.TerrainScale, WorldFile.HeightScale, 0));
            RefractionRenderTarget.AddClipMap(Name, new Texture2D(RenderManager.Graphics, WorldFile.SX + 1, WorldFile.SY + 1), new Vector3(Position.X, Position.Y, Position.Z), new Vector4(WorldFile.SX * WorldFile.TerrainScale, WorldFile.SY * WorldFile.TerrainScale, WorldFile.HeightScale, 0));
            DepthMapRenderTarget.AddClipMap(Name, new Texture2D(RenderManager.Graphics, WorldFile.SX + 1, WorldFile.SY + 1), new Vector3(Position.X, Position.Y, Position.Z), new Vector4(WorldFile.SX * WorldFile.TerrainScale, WorldFile.SY * WorldFile.TerrainScale, WorldFile.HeightScale, 0));

            ReflectionRenderTarget.SetClipMapPosition(Name, Position);
            RefractionRenderTarget.SetClipMapPosition(Name, Position);
            DepthMapRenderTarget.SetClipMapPosition(Name, Position);

            Geom.HasCull           = false;
            Geom.Position          = WorldFile.GetPosition();
            Geom.RenderBucket      = Geometry3D.RenderQueue.Transparent;
            Geom.CurrentRenderMode = Geometry3D.RenderMode.NonIndexBufferless;
            Geom.VertexCount       = (WorldFile.WaterHeightMap.GetLength(0) - 1) * (WorldFile.WaterHeightMap.GetLength(1) - 1) * 6;
        }
예제 #2
0
        public void CreateWorldFile()
        {
            if (MasteryFile != null)
            {
                if (MasteryFile.HasWorldFile(SelectedChunkX, SelectedChunkY))
                {
                    return;
                }

                //Create 5 LODs
                WorldFile NewWorldFile0 = new WorldFile(0, SelectedChunkX, SelectedChunkY, MasteryFile.Settings.ChunkSize, MasteryFile.Settings.ChunkSize, 0.5f);
                WorldFile NewWorldFile1 = new WorldFile(1, SelectedChunkX, SelectedChunkY, MasteryFile.Settings.ChunkSize, MasteryFile.Settings.ChunkSize, 1.0f);
                WorldFile NewWorldFile2 = new WorldFile(2, SelectedChunkX, SelectedChunkY, MasteryFile.Settings.ChunkSize, MasteryFile.Settings.ChunkSize, 4.0f);
                WorldFile NewWorldFile3 = new WorldFile(3, SelectedChunkX, SelectedChunkY, MasteryFile.Settings.ChunkSize, MasteryFile.Settings.ChunkSize, 8.0f);
                WorldFile NewWorldFile4 = new WorldFile(4, SelectedChunkX, SelectedChunkY, MasteryFile.Settings.ChunkSize, MasteryFile.Settings.ChunkSize, 16.0f);

                //check for worldfile occupying area

                MasteryFile.AddWorldFile(NewWorldFile0);
                MasteryFile.AddWorldFile(NewWorldFile1);
                MasteryFile.AddWorldFile(NewWorldFile2);
                MasteryFile.AddWorldFile(NewWorldFile3);
                MasteryFile.AddWorldFile(NewWorldFile4);

                WorldFileGrid.ChangeGridSize(MasteryFile.Settings.ChunkSize, MasteryFile.Settings.ChunkSize, 0.5f, Render.Graphics);

                CurrentWorldFile = NewWorldFile0;
            }
        }
예제 #3
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);
                }
            }
        }
예제 #4
0
        public TerrainDeformableCoverContainer(RenderManager RenderManager, WorldFile File, TerrainGeometryContainer TerrainGeometry, SettingsContainer WorldSettings, SceneRenderTarget FromBelowDepth)
        {
            WorldFile = File;
            Name      = "Cover: " + File.FileName;
            InitializeGeometry(RenderManager);

            FromBelowDepthTarget = FromBelowDepth;

            TerrainBottom = TerrainGeometry;

            DisplacementTarget = new RenderTarget2D(RenderManager.Graphics, FromBelowDepthTarget.GetWidth(), FromBelowDepthTarget.GetHeight(), false, SurfaceFormat.Single, DepthFormat.Depth24Stencil8);

            DisplacementSimulator = new OffScreenTarget("Displacement", RenderManager.Graphics, RenderManager.Shaders["TerrainCoverDisplacement"].Clone());

            DisplacementSimulator.SetTargetPing(DisplacementTarget);

            DisplacementSimulator.AttachOutPut("HeightMap", Geom.Shader);
            DisplacementSimulator.AddParameter("HeightMap", TerrainGeometry.HeightMap);
            DisplacementSimulator.AddParameter("FarPlane", WorldSettings.FromBelowFarPlane);
            DisplacementSimulator.AddParameter("DepthOffset", WorldFile.TerrainDepth);

            DisplacementSimulator.DebugTextureName = "SceneDepthDebug";

            FromBelowDepthTarget.Attach(DisplacementSimulator.Shader);
            RenderManager.AddOffScreenTarget(DisplacementSimulator);
        }
예제 #5
0
        public void SwitchActiveWorldFile(WorldFile NewActiveWorldFile)
        {
            if (!MasteryFile.ActiveWorldFiles.Contains(NewActiveWorldFile))
            {
                return;
            }
            CurrentWorldFile = NewActiveWorldFile;
            //CurrentWorldFile.UpdateTerrainSize(NSX, NSY, CurrentWorldFile.TerrainScale);

            //TODO
            //Change to WorldFile Scale
            WorldFileGrid.ChangeGridSize(CurrentWorldFile.SX, CurrentWorldFile.SY, 0.5f, Render.Graphics);
        }
예제 #6
0
        public float GetDataValue(Vector2 WorldPosition, Vector2 CenterPosition, string MapName)
        {
            int IDX = (int)Math.Floor(WorldPosition.X / (MasteryFile.Settings.ChunkSize));
            int IDY = (int)Math.Floor(WorldPosition.Y / (MasteryFile.Settings.ChunkSize));

            List <WorldFile> ActiveWorldFiles = MasteryFile.ActiveWorldFiles;

            for (int i = 0; i < ActiveWorldFiles.Count; i++)
            {
                if (ActiveWorldFiles[i].IDX == IDX && ActiveWorldFiles[i].IDY == IDY)
                {
                    int   ArraySize = ActiveWorldFiles[i].GetMapSize(MapName);
                    float ChunkSize = MasteryFile.Settings.ChunkSize;
                    float Scale     = (float)(ChunkSize / ArraySize);

                    Vector2 A  = ActiveWorldFiles[i].GetA();
                    int     LX = (int)Math.Round((WorldPosition.X - A.X) / Scale);
                    int     LY = (int)Math.Round((WorldPosition.Y - A.Y) / Scale);

                    float Value = ActiveWorldFiles[i].GetMapValue(MapName, LX, LY);

                    return(Value);
                }
            }
            //Find closest chunk to CenterPosition

            int CX = (int)Math.Round(CenterPosition.X / (MasteryFile.Settings.ChunkSize));
            int CY = (int)Math.Round(CenterPosition.Y / (MasteryFile.Settings.ChunkSize));

            //Replace above system
            WorldFile ClosestFile = ActiveWorldFiles.Where(x => Math.Abs(CX - x.IDX) < 2 && Math.Abs(CY - x.IDY) < 2).OrderBy(y => Vector2.Distance(new Vector2(IDX, IDY), new Vector2(y.IDX, y.IDY))).Reverse().ToList().First();

            if (ClosestFile != null)
            {
                Vector2 A = ClosestFile.GetA();

                int   ArraySize = ClosestFile.GetMapSize(MapName);
                float ChunkSize = MasteryFile.Settings.ChunkSize;
                float Scale     = (float)(ChunkSize / ArraySize);

                int LX = (int)Math.Round((WorldPosition.X - A.X) / Scale) >= 0 ? (int)Math.Round((WorldPosition.X - A.X) / Scale) : 0;
                int LY = (int)Math.Round((WorldPosition.Y - A.Y) / Scale) >= 0 ? (int)Math.Round((WorldPosition.Y - A.Y) / Scale) : 0;

                LX = LX < ArraySize ? LX : ArraySize - 1;
                LY = LY < ArraySize ? LY : ArraySize - 1;

                return(ClosestFile.GetMapValue(MapName, LX, LY));
            }

            return(0);
        }
예제 #7
0
 public void SwitchActiveWorldFileLOD(int LOD)
 {
     if (CurrentWorldFile != null)
     {
         if (CurrentWorldFile.LODID != LOD)
         {
             WorldFile NewFile = MasteryFile.GetWorldFile(CurrentWorldFile.IDX, CurrentWorldFile.IDY, LOD);
             if (NewFile != null)
             {
                 CurrentWorldFile = NewFile;
             }
         }
     }
 }
예제 #8
0
        public void Update(RenderManager Render, SettingsContainer WorldSettings, Vector3 Position)
        {
            int[]   LOD          = WorldSettings.LOD;
            Vector3 FilePosition = WorldFile.GetPosition();
            float   Distance     = Math.Min(Math.Abs(Position.X - FilePosition.X), Math.Abs(Position.Y - FilePosition.Y));

            if (MaterialData0.Width != WorldFile.MaterialMap.GetLength(0) || MaterialData0.Height != WorldFile.MaterialMap.GetLength(1))
            {
                MaterialData0.Dispose();
                MaterialData1.Dispose();
                MaterialData0 = GraphicsUtil.MaterialMapsToTexture(Render.Graphics, WorldFile.MaterialMap, WorldFile.SecondaryMaterialMap, WorldFile.DecalMaterialMap, WorldFile.DecalMaterialMap);
                MaterialData1 = GraphicsUtil.MaterialMapsToTexture(Render.Graphics, WorldFile.BlendAlphaMap, WorldFile.DecalAlphaMap, WorldFile.DecalAlphaMap, WorldFile.DecalAlphaMap);
            }

            if (WorldFile.HasTerrainUpdate)
            {
                TerrainGeometry.DepthShader.Parameters["TerrainScale"].SetValue(WorldFile.TerrainScale);
                TerrainGeometry.Shader.Parameters["TerrainScale"].SetValue(WorldFile.TerrainScale);
                TerrainGeometry.DepthShader.Parameters["TerrainWidth"].SetValue(WorldFile.SX);
                TerrainGeometry.DepthShader.Parameters["TerrainHeight"].SetValue(WorldFile.SY);

                TerrainGeometry.DepthShader.Parameters["HeightScale"].SetValue(WorldFile.HeightScale);
                TerrainGeometry.Shader.Parameters["HeightScale"].SetValue(WorldFile.HeightScale);

                GraphicsUtil.FillTexture(HeightMap, WorldFile.HeightMap);

                GraphicsUtil.FillTexture(MaterialData0, WorldFile.MaterialMap, WorldFile.SecondaryMaterialMap, WorldFile.DecalMaterialMap, WorldFile.DecalMaterialMap);
                GraphicsUtil.FillTexture(MaterialData1, WorldFile.BlendAlphaMap, WorldFile.DecalAlphaMap, WorldFile.DecalAlphaMap, WorldFile.DecalAlphaMap);

                TerrainGeometry.Shader.Parameters["TerrainWidth"].SetValue(WorldFile.SX);
                TerrainGeometry.Shader.Parameters["TerrainHeight"].SetValue(WorldFile.SY);
                TerrainGeometry.Shader.Parameters["MaterialWidth"].SetValue(WorldFile.MaterialMap.GetLength(0));
                TerrainGeometry.Shader.Parameters["MaterialHeight"].SetValue(WorldFile.MaterialMap.GetLength(1));

                TerrainGeometry.Shader.Parameters["MaterialData0"].SetValue(MaterialData0);
                TerrainGeometry.Shader.Parameters["MaterialData1"].SetValue(MaterialData1);

                TerrainGeometry.Shader.Parameters["HeightMap"].SetValue(HeightMap);
                TerrainGeometry.DepthShader.Parameters["HeightMap"].SetValue(HeightMap);
            }

            Vector3 LightPosition = new Vector3(0, 0, 20);

            TerrainGeometry.Shader.Parameters["CameraPosition"].SetValue(Position);
            TerrainGeometry.Shader.Parameters["LightPosition"].SetValue(WorldSettings.DebugLightPosition);
            TerrainGeometry.Shader.Parameters["LightColor"].SetValue(WorldSettings.DebugDirectLightColor);
            TerrainGeometry.Shader.Parameters["AmbientLightColor"].SetValue(WorldSettings.DebugAmbientLightColor);
            TerrainGeometry.Position = WorldFile.GetPosition();
        }
예제 #9
0
        public void InitializeGeometry(RenderManager RenderManager, SettingsContainer WorldSettings)
        {
            TerrainGeometry = new Geometry3D(Name);

            TerrainGeometry.Shader      = RenderManager.Shaders["Terrain"].Clone();
            TerrainGeometry.DepthShader = RenderManager.Shaders["Depth-Terrain"].Clone();

            TerrainGeometry.Shader.Parameters["TextureSize"].SetValue(1.0f / WorldSettings.TextureSize);

            TerrainGeometry.DepthShader.Parameters["TerrainScale"].SetValue(WorldFile.TerrainScale);
            TerrainGeometry.Shader.Parameters["TerrainScale"].SetValue(WorldFile.TerrainScale);

            TerrainGeometry.Shader.Parameters["TerrainWidth"].SetValue(WorldFile.SX);
            TerrainGeometry.Shader.Parameters["TerrainHeight"].SetValue(WorldFile.SY);
            TerrainGeometry.DepthShader.Parameters["TerrainWidth"].SetValue(WorldFile.SX);
            TerrainGeometry.DepthShader.Parameters["TerrainHeight"].SetValue(WorldFile.SY);

            TerrainGeometry.Shader.Parameters["MaterialWidth"].SetValue(WorldFile.MaterialMap.GetLength(0));
            TerrainGeometry.Shader.Parameters["MaterialHeight"].SetValue(WorldFile.MaterialMap.GetLength(1));

            TerrainGeometry.Shader.Parameters["DiffuseMap"].SetValue(RenderManager.Textures["Terrain-Diffuse"]);
            TerrainGeometry.Shader.Parameters["RoughnessMap"].SetValue(RenderManager.Textures["Terrain-Roughness"]);
            TerrainGeometry.Shader.Parameters["MaterialNormalMap"].SetValue(RenderManager.Textures["Terrain-Normal"]);
            TerrainGeometry.Shader.Parameters["MetalnessMap"].SetValue(RenderManager.Textures["Terrain-Metalness"]);

            TerrainGeometry.Shader.Parameters["DecalDiffuseMap"].SetValue(RenderManager.Textures["TerrainDecal-Diffuse"]);
            TerrainGeometry.Shader.Parameters["DecalMetalnessMap"].SetValue(RenderManager.Textures["TerrainDecal-Roughness"]);
            TerrainGeometry.Shader.Parameters["DecalNormalMap"].SetValue(RenderManager.Textures["TerrainDecal-Normal"]);
            TerrainGeometry.Shader.Parameters["DecalRoughnessMap"].SetValue(RenderManager.Textures["TerrainDecal-Roughness"]);
            TerrainGeometry.Shader.Parameters["DecalToleranceMap"].SetValue(RenderManager.Textures["TerrainDecal-Tolerance"]);

            Vector3 ChunkPosition = new Vector3(WorldFile.IDX * WorldFile.SX * WorldFile.TerrainScale, WorldFile.IDY * WorldFile.SY * WorldFile.TerrainScale, 0);

            TerrainGeometry.Shader.Parameters["Position"].SetValue(ChunkPosition);
            TerrainGeometry.DepthShader.Parameters["Position"].SetValue(ChunkPosition);

            TerrainGeometry.HasCull           = false;
            TerrainGeometry.Position          = WorldFile.GetPosition();
            TerrainGeometry.RenderBucket      = Geometry3D.RenderQueue.Solid;
            TerrainGeometry.CurrentRenderMode = Geometry3D.RenderMode.NonIndexBufferless;
            TerrainGeometry.VertexCount       = (WorldFile.HeightMap.GetLength(0) - 1) * (WorldFile.HeightMap.GetLength(1) - 1) * 6;
        }
예제 #10
0
        public TerrainGeometryContainer(RenderManager RenderManager, SettingsContainer WorldSettings, WorldFile File)
        {
            WorldFile = File;
            Name      = "Terrain: " + File.FileName;
            InitializeGeometry(RenderManager, WorldSettings);

            MaterialData0 = new Texture2D(RenderManager.Graphics, WorldFile.MaterialMap.GetLength(0), File.MaterialMap.GetLength(1));
            MaterialData1 = new Texture2D(RenderManager.Graphics, WorldFile.MaterialMap.GetLength(0), File.MaterialMap.GetLength(1));
            HeightMap     = new Texture2D(RenderManager.Graphics, WorldFile.SX + 1, WorldFile.SY + 1, false, SurfaceFormat.Color);

            //GenerateNormals = new TextureTask(Name + "-GenerateNormals",TaskType.GenerateNormals, TaskStage.PreRenderTarget, TaskUsage.FrameLimit, TaskSwitchType.Ping);
            //GenerateNormals.AddParameter(TextureParameter.InputTexture, HeightMap);
            //GenerateNormals.AddParameter(FloatParameter.TextureWidth0, WorldFile.SX + 1);
            //GenerateNormals.AddParameter(FloatParameter.TextureHeight0, WorldFile.SY + 1);

            //GenerateNormals.SetRenderTarget(NormalMap);
            //GenerateNormals.AttachOutPut("NormalMap", TerrainGeometry.Shader);

            //RenderManager.AddTextureModificationTask(GenerateNormals);
        }
예제 #11
0
        public void InitializeGeometry(RenderManager RenderManager)
        {
            Geom = new Geometry3D(Name);

            Geom.Shader = RenderManager.Shaders["TerrainCover"].Clone();

            Geom.Shader.Parameters["TerrainScale"].SetValue(WorldFile.TerrainScale);
            Geom.Shader.Parameters["TerrainWidth"].SetValue(WorldFile.SX);
            Geom.Shader.Parameters["TerrainHeight"].SetValue(WorldFile.SY);

            Geom.Shader.Parameters["HeightScale"].SetValue(WorldFile.HeightScale);

            Vector3 ChunkPosition = new Vector3(WorldFile.IDX * WorldFile.SX * WorldFile.TerrainScale, WorldFile.IDY * WorldFile.SY * WorldFile.TerrainScale, 0);

            Geom.Shader.Parameters["Position"].SetValue(ChunkPosition);

            Geom.HasCull           = false;
            Geom.Position          = WorldFile.GetPosition();
            Geom.RenderBucket      = Geometry3D.RenderQueue.Transparent;
            Geom.CurrentRenderMode = Geometry3D.RenderMode.NonIndexBufferless;
            Geom.VertexCount       = (WorldFile.HeightMap.GetLength(0) - 1) * (WorldFile.HeightMap.GetLength(1) - 1) * 6;
        }
예제 #12
0
        public CollisionResults RayCastWater(Vector3 Origin, Vector3 Direction, float Range, WorldFile File)
        {
            if (FileManager.MasteryFile == null)
            {
                return(new CollisionResults());
            }

            SettingsContainer Settings         = FileManager.MasteryFile.Settings;
            List <WorldFile>  ActiveWorldFiles = FileManager.MasteryFile.ActiveWorldFiles;

            List <Vector2>   QuadCheck = new List <Vector2>();
            CollisionResults Results   = new CollisionResults();

            int LOD = FileManager.CurrentWorldFile.LODID;

            if (FileManager.CurrentWorldFile != null)
            {
                float TerrainScale = File.TerrainScale;
                float HeightScale  = File.HeightScale;
                int[,] HeightMap      = File.HeightMap;
                int[,] WaterHeightMap = File.WaterHeightMap;
                float Precision = TerrainScale * 0.5f;

                for (float j = 0; j < Range; j += Precision)
                {
                    Vector3 CurrentPosition       = Origin + (Direction * j);
                    Vector3 CurrentVertexPosition = (CurrentPosition - File.GetPosition()) / TerrainScale;

                    int VX = (int)Math.Floor(CurrentVertexPosition.X);
                    int VY = (int)Math.Floor(CurrentVertexPosition.Y);

                    if (VX < 0 || VY < 0 || VX >= HeightMap.GetLength(0) - 1 || VY >= HeightMap.GetLength(1) - 1)
                    {
                        continue;
                    }

                    float MidPoint =
                        (HeightMap[VX, VY] + HeightMap[VX + 1, VY] + HeightMap[VX, VY + 1] + HeightMap[VX + 1, VY + 1] +
                         WaterHeightMap[VX, VY] + WaterHeightMap[VX + 1, VY] + WaterHeightMap[VX, VY + 1] + WaterHeightMap[VX + 1, VY + 1]) / 4;

                    Vector3[] QuadVertices =
                    {
                        new Vector3(0,                       0, (WaterHeightMap[VX,     VY] + HeightMap[VX,         VY]) * HeightScale),
                        new Vector3(TerrainScale,            0, (WaterHeightMap[VX + 1, VY] + HeightMap[VX + 1,     VY]) * HeightScale),
                        new Vector3(0,            TerrainScale, (WaterHeightMap[VX,     VY + 1] + HeightMap[VX,     VY + 1]) * HeightScale),
                        new Vector3(TerrainScale, TerrainScale, (WaterHeightMap[VX + 1, VY + 1] + HeightMap[VX + 1, VY + 1]) * HeightScale)
                    };

                    if (!QuadCheck.Contains(new Vector2(VX, VY)))
                    {
                        QuadCheck.Add(new Vector2(VX, VY));

                        Vector3 VertexWorldPosition = File.GetPosition() + new Vector3(VX * TerrainScale, VY * TerrainScale, 0);
                        for (int k = 0; k < Indices.Length; k += 3)
                        {
                            Vector3 V0 = VertexWorldPosition + QuadVertices[Indices[k]];
                            Vector3 V1 = VertexWorldPosition + QuadVertices[Indices[k + 1]];
                            Vector3 V2 = VertexWorldPosition + QuadVertices[Indices[k + 2]];

                            if (CollisionUtil.Intersect(V0, V1, V2, Origin, Direction))
                            {
                                TerrainWaterContainer WaterGeom = WaterGeometries.Where(x => x.WorldFile.FileName == FileManager.CurrentWorldFile.FileName).First();

                                Vector3         CollisionPoint = CollisionUtil.GetCollisionPoint(V0, V1, V2, Origin, Direction);
                                CollisionResult Result         = new CollisionResult(
                                    V0,
                                    V1,
                                    V2,
                                    Origin,
                                    CollisionPoint,
                                    WaterGeom.Geom);
                                Results.Add(Result);
                            }
                        }
                    }
                }
            }
            return(Results);
        }
예제 #13
0
        public void Update(RenderManager Render, Vector3 Position, Vector3 ViewDirection, float Time)
        {
            int[]   LOD          = WorldSettings.LOD;
            Vector3 FilePosition = WorldFile.GetPosition();
            float   Distance     = Math.Min(Math.Abs(Position.X - FilePosition.X), Math.Abs(Position.Y - FilePosition.Y));

            //TODO
            if (WaterData0.Width != WorldFile.WaterMap.GetLength(0) || WaterData0.Height != WorldFile.WaterMap.GetLength(1))
            {
                WaterData0.Dispose();
                WaterData1.Dispose();
                WaterColorData0.Dispose();
                WaterColorData1.Dispose();

                WaterData0 = GraphicsUtil.MaterialMapsToTexture(Render.Graphics, WorldFile.FlowXMap, WorldFile.FlowYMap, WorldFile.FlowPulseSpeedMap, WorldFile.FlowBackTimeMap);
                WaterData1 = GraphicsUtil.MaterialMapsToTexture(Render.Graphics, WorldFile.WaterMap);

                WaterColorData0 = GraphicsUtil.MaterialMapsToTexture(Render.Graphics, WorldFile.WaterColorR, WorldFile.WaterColorG, WorldFile.WaterColorB, WorldFile.WaterColorA);
                WaterColorData1 = GraphicsUtil.MaterialMapsToTexture(Render.Graphics, WorldFile.WaterNormalMap, WorldFile.WaterFresnelMap, WorldFile.FoamRampMap0, WorldFile.WaterColorFalloffMap);
                WaveData0       = GraphicsUtil.MaterialMapsToTexture(Render.Graphics, WorldFile.WaveLengthMap, WorldFile.WaveHeightMap, WorldFile.WaveHeightMap, WorldFile.WaveLengthMap);
            }

            if (WorldFile.HasTerrainUpdate)
            {
                Geom.Shader.Parameters["TerrainScale"].SetValue(WorldFile.TerrainScale);
                Geom.Shader.Parameters["HeightScale"].SetValue(WorldFile.HeightScale);

                Geom.Shader.Parameters["TerrainWidth"].SetValue(WorldFile.SX);
                Geom.Shader.Parameters["TerrainLength"].SetValue(WorldFile.SY);

                Geom.Shader.Parameters["DataWidth"].SetValue(WorldFile.FlowXMap.GetLength(0));
                Geom.Shader.Parameters["DataHeight"].SetValue(WorldFile.FlowXMap.GetLength(1));

                GraphicsUtil.FillTexture(WaterData0, WorldFile.FlowXMap, WorldFile.FlowYMap, WorldFile.FlowPulseSpeedMap, WorldFile.FlowBackTimeMap);
                GraphicsUtil.FillTexture(WaterData1, WorldFile.WaterMap);
                GraphicsUtil.FillTexture(WaterColorData0, WorldFile.WaterColorR, WorldFile.WaterColorG, WorldFile.WaterColorB, WorldFile.WaterColorA);
                GraphicsUtil.FillTexture(WaterColorData1, WorldFile.WaterNormalMap, WorldFile.WaterFresnelMap, WorldFile.FoamRampMap0, WorldFile.WaterColorFalloffMap);
                GraphicsUtil.FillTexture(WaveData0, WorldFile.WaveLengthMap, WorldFile.WaveHeightMap, WorldFile.FoamRampMap0, WorldFile.WaterColorFalloffMap);

                Geom.Shader.Parameters["WaterDataMap0"].SetValue(WaterData0);
                Geom.Shader.Parameters["WaterDataMap1"].SetValue(WaterData1);
                Geom.Shader.Parameters["ColorDataMap0"].SetValue(WaterColorData0);
                Geom.Shader.Parameters["ColorDataMap1"].SetValue(WaterColorData1);
                Geom.Shader.Parameters["WaveDataMap0"].SetValue(WaveData0);

                Geom.Shader.Parameters["HeightMap"].SetValue(Terrain.HeightMap);

                WaterHeightMap.Dispose();
                WaterHeightMap = GraphicsUtil.MaterialMapsToTexture(Render.Graphics, WorldFile.WaterHeightMap);

                //GraphicsUtil.FillTexture(WaterHeightMap, WorldFile.WaterHeightMap);

                Geom.Shader.Parameters["WaterHeightMap"].SetValue(WaterHeightMap);

                WaterClipMap.Dispose();
                WaterClipMap = GraphicsUtil.MaterialMapsToTexture(Render.Graphics, VoxelUtil.AddValues(WorldFile.HeightMap, WorldFile.WaterHeightMap));

                ReflectionRenderTarget.SetClipPlaneMap(Name, WaterClipMap);
                RefractionRenderTarget.SetClipPlaneMap(Name, WaterClipMap);
                DepthMapRenderTarget.SetClipPlaneMap(Name, WaterClipMap);
            }

            Geom.Shader.Parameters["ShineDamper"].SetValue(WorldSettings.WaterShineDamper);
            Geom.Shader.Parameters["Reflectivity"].SetValue(WorldSettings.WaterReflectivity);
            Geom.Shader.Parameters["MinSpecular"].SetValue(WorldSettings.MinimumSpecular);

            Geom.Shader.Parameters["WaterRepeatTime"].SetValue(WorldSettings.WaterRepeatTime);
            Geom.Shader.Parameters["WaterSpeed"].SetValue(WorldSettings.WaterSpeed);

            Geom.PassSetting    = WorldSettings.WaterPassSetting;
            Geom.PassMipSetting = WorldSettings.WaterPassMipSetting;

            Geom.Shader.Parameters["TexSize"].SetValue(WorldSettings.TextureSize);
            Vector3 ChunkPosition = new Vector3(WorldFile.IDX * WorldFile.SX * WorldFile.TerrainScale, WorldFile.IDY * WorldFile.SX * WorldFile.TerrainScale, 0);

            Geom.Shader.Parameters["Position"].SetValue(ChunkPosition);

            Geom.Position = WorldFile.GetPosition();
        }
예제 #14
0
        //bool FrameCycle = false;

        public TerrainWaterContainer(RenderManager RenderManager, TerrainGeometryContainer TerrainGeometry, Node3D ReflectionNode, Node3D RefractionNode, Node3D PropNode, WorldFile File, SettingsContainer Settings, Vector3 Pos, SceneRenderTarget ReflectionTarget, SceneRenderTarget RefractionTarget, SceneRenderTarget DepthTarget, SceneRenderTarget FromBelowTarget)
        {
            WorldFile     = File;
            WorldSettings = Settings;
            Terrain       = TerrainGeometry;
            Name          = "Water: " + File.FileName;
            Position      = Pos;

            ReflectionRenderTarget = ReflectionTarget;
            RefractionRenderTarget = RefractionTarget;
            DepthMapRenderTarget   = DepthTarget;

            WaterData0 = new Texture2D(RenderManager.Graphics, WorldFile.FlowXMap.GetLength(0), WorldFile.FlowXMap.GetLength(1));
            WaterData1 = new Texture2D(RenderManager.Graphics, WorldFile.WaterMap.GetLength(0), WorldFile.WaterMap.GetLength(1), false, SurfaceFormat.Alpha8);

            WaterColorData0 = new Texture2D(RenderManager.Graphics, WorldFile.WaterColorR.GetLength(0), WorldFile.WaterColorR.GetLength(1));
            WaterColorData1 = new Texture2D(RenderManager.Graphics, WorldFile.WaterNormalMap.GetLength(0), WorldFile.WaterNormalMap.GetLength(1));
            //FoamDataMap0 = new Texture2D(RenderManager.Graphics, WorldFile.FoamRampMap0.GetLength(0), WorldFile.FoamRampMap0.GetLength(1));
            WaveData0 = new Texture2D(RenderManager.Graphics, WorldFile.WaveHeightMap.GetLength(0), WorldFile.WaveHeightMap.GetLength(1));

            InitializeGeometry(RenderManager);
            ReflectionRenderTarget.Attach(Geom);
            RefractionRenderTarget.Attach(Geom);
            DepthMapRenderTarget.Attach(Geom);

            //Depth Input
            FromBelowDepth = FromBelowTarget;

            //DepthTarget0 = new RenderTarget2D(RenderManager.Graphics, 1025, 1025, false, SurfaceFormat.Single, DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.PreserveContents);
            //DepthTarget1 = new RenderTarget2D(RenderManager.Graphics, 1025, 1025, false, SurfaceFormat.Single, DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.PreserveContents);

            //SetHeight = new TextureTask(Name + "SetHeight", TaskType.FillFloat, TaskStage.PreRenderTarget, TaskUsage.FrameLimit,TaskSwitchType.PingPongOut);
            //SetHeight.AddParameter(FloatParameter.ColorFloat, WorldFile.TerrainDepth / Settings.FromBelowFarPlane);
            //SetHeight.SetRenderTarget(DepthTarget0, true);
            //SetHeight.SetRenderTarget(DepthTarget1, false);
            //SetHeight.FrameLimit = 2;

            //Begin PingPong
            //Depth
            //MergeDepth = new TextureTask("MergeDepth", TaskType.MergeMinFloat, TaskStage.PreOffScreenTarget, TaskUsage.Preserve, TaskSwitchType.PingPongIn);
            // MergeDepth.AddParameter(TextureParameter.InputTexture, FromBelowDepth.RenderTarget);

            //MergeDepth.AddParameter(TextureParameter.InputTexture2, (Texture2D)DepthTarget0, true);
            //MergeDepth.AddParameter(TextureParameter.InputTexture2, (Texture2D)DepthTarget1, false);
            //Current Frame Texture
            //MergeDepth.SetRenderTarget(DepthTarget1, true);
            //MergeDepth.SetRenderTarget(DepthTarget0, false);

            //WaterSimulation = new OffScreenTarget(RenderManager.Graphics, RenderManager.Shaders["WaterSimulation"].Clone());
            //NormalGenerator = new OffScreenTarget(RenderManager.Graphics, RenderManager.Shaders["WaterSimulation"].Clone());
            //NormalMap = new RenderTarget2D(RenderManager.Graphics, 1025, 1025);

            //FromBelowDepth.Attach(MergeDepth);
            //WaterSimulation.Attach(NormalGenerator.Shader);
            //WaterSimulation.Attach(Geom.Shader);
            WaterHeightMap = new Texture2D(RenderManager.Graphics, WorldFile.WaterHeightMap.GetLength(0), WorldFile.WaterHeightMap.GetLength(1), false, SurfaceFormat.Color);
            WaterClipMap   = new Texture2D(RenderManager.Graphics, WorldFile.WaterHeightMap.GetLength(0), WorldFile.WaterHeightMap.GetLength(1), false, SurfaceFormat.Color);
            //MergeDepth.DebugTextureName = "SceneWaterReflectionDebug";

            //NormalGenerator.Attach(Geom.Shader);
            //RenderManager.AddTextureModificationTask(SetHeight);
            //RenderManager.AddTextureModificationTask(MergeDepth);

            //RenderManager.AddOffScreenTarget(WaterSimulation);
            //RenderManager.AddOffScreenTarget(NormalGenerator);
        }
예제 #15
0
 public bool HasWorldFile(WorldFile WordFile)
 {
     return(ActiveWorldFiles.Contains(WordFile));
 }
예제 #16
0
        //EdheSmoothMode: 0-None,1-flatten,2-Average
        public void ModifyMultipleChunks(Vector3 CollisionPosition, string MapName, string AdjustMapName, int Shape, int Tool, bool IsPrimary, float Radius, float Flow, float Value, int EdgeSmoothMode, bool AdjustWaterHeight)
        {
            if (MapName == "")
            {
                return;
            }

            int SelectedLOD = CurrentWorldFile.LODID;

            //Editing Bounds
            Vector2          A1 = new Vector2(CollisionPosition.X - Radius, CollisionPosition.Y - Radius);
            Vector2          A2 = new Vector2(CollisionPosition.X + Radius, CollisionPosition.Y + Radius);
            float            V1 = GetDataValue(new Vector2(A1.X, A1.Y), new Vector2(CollisionPosition.X, CollisionPosition.Y), MapName);
            float            V2 = GetDataValue(new Vector2(A2.X, A1.Y), new Vector2(CollisionPosition.X, CollisionPosition.Y), MapName);
            float            V3 = GetDataValue(new Vector2(A1.X, A2.Y), new Vector2(CollisionPosition.X, CollisionPosition.Y), MapName);
            float            V4 = GetDataValue(new Vector2(A2.X, A2.Y), new Vector2(CollisionPosition.X, CollisionPosition.Y), MapName);
            List <WorldFile> ActiveWorldFiles = MasteryFile.ActiveWorldFiles;

            List <object[]> MergeFiles = new List <object[]>();

            //check to see if inside bounding area
            for (int i = 0; i < ActiveWorldFiles.Count; i++)
            {
                if (ActiveWorldFiles[i].LODID != SelectedLOD)
                {
                    continue;
                }

                Vector2 B1 = ActiveWorldFiles[i].GetA();
                Vector2 B2 = ActiveWorldFiles[i].GetB();

                int   ArraySize = ActiveWorldFiles[i].GetMapSize(MapName);
                float ChunkSize = MasteryFile.Settings.ChunkSize;
                float Scale     = (float)(ChunkSize / ArraySize);


                if (ArraySize == 0)
                {
                    continue;
                }

                if (A1.X < B2.X + Scale && A2.X > B1.X - Scale && A1.Y < B2.Y + Scale && A2.Y > B1.Y - Scale)
                {
                    int MinX = (int)Math.Floor((A1.X - B1.X) / Scale) >= 0 ? (int)Math.Floor((A1.X - B1.X) / Scale) : 0;
                    int MinY = (int)Math.Floor((A1.Y - B1.Y) / Scale) >= 0 ? (int)Math.Floor((A1.Y - B1.Y) / Scale) : 0;

                    int MaxX = (int)Math.Floor((A2.X - B1.X) / Scale) < ArraySize ? (int)Math.Floor((A2.X - B1.X) / Scale) : ArraySize - 1;
                    int MaxY = (int)Math.Floor((A2.Y - B1.Y) / Scale) < ArraySize ? (int)Math.Floor((A2.Y - B1.Y) / Scale) : ArraySize - 1;
                    MinX = MinX <= MaxX ? MinX : MaxX;
                    MinY = MinY <= MaxY ? MinY : MaxY;

                    float[,] Q = null;
                    if (Tool == 0 || Tool == 1)
                    {
                        float Val = GetDataValue(new Vector2(CollisionPosition.X, CollisionPosition.Y), new Vector2(CollisionPosition.X, CollisionPosition.Y), MapName);

                        /*
                         * if (Val < 0)
                         * {
                         *  continue;
                         * }
                         */
                        Q = new float[1, 1] {
                            { Val }
                        };
                    }
                    else if (Tool == 2)
                    {
                        float X1 = MinX * Scale + B1.X < A1.X ? A1.X : MinX * Scale + B1.X;
                        float X2 = MaxX * Scale + B1.X > A2.X ? A2.X : MaxX * Scale + B1.X;
                        float Y1 = MinY * Scale + B1.Y < A1.Y ? A1.Y : MinY * Scale + B1.Y;
                        float Y2 = MaxY * Scale + B1.X > A2.Y ? A1.Y : MaxY * Scale + B1.Y;

                        float Q11 = MathUtil.BiLerp(X1, Y1, A1.X, A2.X, A1.Y, A2.Y, V1, V2, V3, V4);
                        float Q21 = MathUtil.BiLerp(X2, Y1, A1.X, A2.X, A1.Y, A2.Y, V1, V2, V3, V4);
                        float Q12 = MathUtil.BiLerp(X1, Y2, A1.X, A2.X, A1.Y, A2.Y, V1, V2, V3, V4);
                        float Q22 = MathUtil.BiLerp(X2, Y2, A1.X, A2.X, A1.Y, A2.Y, V1, V2, V3, V4);

                        /*
                         * if (Q11 < 0.0f || Q21 < 0.0f || Q12 < 0.0f || Q22 < 0.0f)
                         * {
                         *  continue;
                         * }
                         */
                        Q = new float[2, 2] {
                            { Q11, Q21 }, { Q12, Q22 }
                        };
                    }
                    else if (Tool == 3)
                    {
                        /*
                         * if (Value < 0)
                         * {
                         *  continue;
                         * }
                         */
                        Q = new float[1, 1] {
                            { Value }
                        };
                    }
                    else if (Tool == 4)
                    {
                        //TODO
                        //Add Pattern import system
                    }
                    else if (Tool == 5)
                    {
                        float Val1 = GetDataValue(new Vector2(CollisionPosition.X, CollisionPosition.Y), new Vector2(CollisionPosition.X, CollisionPosition.Y), MapName);
                        float Val2 = GetDataValue(new Vector2(CollisionPosition.X, CollisionPosition.Y), new Vector2(CollisionPosition.X, CollisionPosition.Y), AdjustMapName);

                        /*
                         * if (Val1 + Val2 < 0)
                         * {
                         *  continue;
                         * }
                         */
                        Q = new float[1, 1] {
                            { Val1 + Val2 }
                        };
                    }

                    if (AdjustMapName != "")
                    {
                        ActiveWorldFiles[i].ModifyMap(MinX, MaxX, MinY, MaxY, Q, Shape, Tool, IsPrimary, (int)Math.Round(Radius / Scale), Flow, MapName, AdjustMapName, AdjustWaterHeight);
                    }
                    else
                    {
                        ActiveWorldFiles[i].ModifyMap(MinX, MaxX, MinY, MaxY, Q, Shape, Tool, IsPrimary, (int)Math.Round(Radius / Scale), Flow, MapName);
                    }

                    if (EdgeSmoothMode != 0)
                    {
                        if (MinX == 0)
                        {
                            WorldFile OtherFile = MasteryFile.GetWorldFile(ActiveWorldFiles[i].IDX - 1, ActiveWorldFiles[i].IDY, ActiveWorldFiles[i].LODID);
                            if (OtherFile != null)
                            {
                                ActiveWorldFiles[i].MergeEdges(OtherFile, true, MapName, EdgeSmoothMode);
                            }
                        }
                        if (MinY == 0)
                        {
                            WorldFile OtherFile = MasteryFile.GetWorldFile(ActiveWorldFiles[i].IDX, ActiveWorldFiles[i].IDY - 1, ActiveWorldFiles[i].LODID);
                            if (OtherFile != null)
                            {
                                OtherFile.MergeEdges(ActiveWorldFiles[i], false, MapName, EdgeSmoothMode);
                            }
                        }
                        if (MaxX == ArraySize)
                        {
                            WorldFile OtherFile = MasteryFile.GetWorldFile(ActiveWorldFiles[i].IDX + 1, ActiveWorldFiles[i].IDY, ActiveWorldFiles[i].LODID);
                            if (OtherFile != null)
                            {
                                ActiveWorldFiles[i].MergeEdges(OtherFile, true, MapName, EdgeSmoothMode);
                            }
                        }
                        if (MaxY == ArraySize)
                        {
                            WorldFile OtherFile = MasteryFile.GetWorldFile(ActiveWorldFiles[i].IDX, ActiveWorldFiles[i].IDY + 1, ActiveWorldFiles[i].LODID);
                            if (OtherFile != null)
                            {
                                OtherFile.MergeEdges(ActiveWorldFiles[i], false, MapName, EdgeSmoothMode);
                            }
                        }
                    }

                    if (EdgeSmoothMode != 0)
                    {
                        if (MinX == 0)
                        {
                            WorldFile OtherFile = MasteryFile.GetWorldFile(ActiveWorldFiles[i].IDX - 1, ActiveWorldFiles[i].IDY, ActiveWorldFiles[i].LODID);
                            if (OtherFile != null)
                            {
                                MergeFiles.Add(new object[] { ActiveWorldFiles[i], OtherFile, true });
                            }
                        }
                        if (MinY == 0)
                        {
                            WorldFile OtherFile = MasteryFile.GetWorldFile(ActiveWorldFiles[i].IDX, ActiveWorldFiles[i].IDY - 1, ActiveWorldFiles[i].LODID);
                            if (OtherFile != null)
                            {
                                MergeFiles.Add(new object[] { OtherFile, ActiveWorldFiles[i], false });
                            }
                        }
                        if (MaxX == ArraySize - 1)
                        {
                            WorldFile OtherFile = MasteryFile.GetWorldFile(ActiveWorldFiles[i].IDX + 1, ActiveWorldFiles[i].IDY, ActiveWorldFiles[i].LODID);
                            if (OtherFile != null)
                            {
                                MergeFiles.Add(new object[] { ActiveWorldFiles[i], OtherFile, true });
                            }
                        }
                        if (MaxY == ArraySize - 1)
                        {
                            WorldFile OtherFile = MasteryFile.GetWorldFile(ActiveWorldFiles[i].IDX, ActiveWorldFiles[i].IDY + 1, ActiveWorldFiles[i].LODID);
                            if (OtherFile != null)
                            {
                                MergeFiles.Add(new object[] { OtherFile, ActiveWorldFiles[i], false });
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < MergeFiles.Count; i++)
            {
                WorldFile FileA      = (WorldFile)MergeFiles[i][0];
                WorldFile FileB      = (WorldFile)MergeFiles[i][1];
                bool      Isvertical = (bool)MergeFiles[i][2];

                FileA.MergeEdges(FileB, Isvertical, MapName, EdgeSmoothMode);
            }
        }
예제 #17
0
 public void AddWorldFile(WorldFile WorldFile)
 {
     ActiveWorldFiles.Add(WorldFile);
 }