private void Simulate()
        {
            terrainField.SetFilterMode(FilterMode.Point);
            water.SetFilterMode(FilterMode.Point);;
            //sedimentDeposition.SetFilterMode(FilterMode.Point);

            if (simulateWaterFlow)
            {
                // add rain
                if (rainInputAmount > 0.0f)
                {
                    water.main.ChangeValue(new Vector4(rainInputAmount, 0f, 0f, 0f), WorldSide.EntireMap.getArea());
                }


                if (waterInputAmount > 0f)
                {
                    water.main.ChangeValueGauss(waterInputPoint, waterInputRadius, new Vector4(waterInputAmount, 0f, 0f, 0f));
                }
                if (waterDrainageAmount > 0f)
                {
                    water.main.ChangeValueGaussZeroControl(waterDrainagePoint, waterDrainageRadius, new Vector4(waterDrainageAmount * -1f, 0f, 0f, 0f));
                    terrainField.ChangeValueGaussZeroControl(waterDrainagePoint, waterDrainageRadius, new Vector4(0f, 0f, 0f, waterDrainageAmount * -1f));
                }

                //set specified levels of water and terrain at oceans
                foreach (var item in oceans)
                {
                    Rect rect = item.getPartOfMap(1);
                    water.main.SetValue(new Vector4(oceanWaterLevel, 0f, 0f, 0f), rect);
                    terrainField.SetValue(new Vector4(oceanDestroySedimentsLevel, 0f, 0f, 0f), rect);
                }

                water.Flow(terrainField.READ);
                water.CalcWaterVelocity(timeStep);
            }



            if (simulateWaterErosion)
            {
                water.SimulateErosion(terrainField, dissolvingConstant, minTiltAngle, TERRAIN_LAYERS, timeStep);
            }

            //if (simulateRigolith)
            //{
            //    DisintegrateAndDeposit ();
            //    FlowLiquid(regolithField, regolithOutFlow, regolithDamping);
            //}
            if (simulateTectonics)
            {
                terrainField.MoveByVelocity(magmaVelocity.READ, 1f, 0.03f, 1f, shader);
            }
            if (simulateSlippage)
            {
                ApplySlippage();
            }

            lava.SetFilterMode(FilterMode.Point);
            lava.Flow(terrainField.READ);
            if (lavaInputAmount > 0f)
            {
                //lava.main.ChangeValueGaussWithHeat(lavaInputPoint, lavaInputRadius, new Vector4(lavaInputAmount, 0f, 0f, 1500f));
                lava.main.ChangeValueGaussWithHeat(lavaInputPoint, lavaInputRadius, new Vector4(lavaInputAmount, 0f, 0f, 1500f));
            }
            if (heatExchange)
            {
                lava.HeatExchange();
            }
            lava.SetFilterMode(FilterMode.Bilinear);

            if (simulateWaterFlow)
            {
                /// Evaporate water everywhere
                if (evaporationConstant > 0.0f)
                {
                    water.main.ChangeValueZeroControl(evaporationConstant * -1f);
                }
            }

            terrainField.SetFilterMode(FilterMode.Bilinear);
            water.SetFilterMode(FilterMode.Bilinear);

            //sedimentDeposition.SetFilterMode(FilterMode.Bilinear);
        }
예제 #2
0
 public void SetFilterMode(FilterMode mode)
 {
     main.SetFilterMode(mode);
 }