public WeatherSimulationParticles(ICoreClientAPI capi, WeatherSystemClient ws)
 {
     this.capi         = capi;
     this.ws           = ws;
     rand              = new Random(capi.World.Seed + 223123123);
     rainParticleColor = waterColor;
 }
        public WeatherSimulationLightning(ICoreAPI api, WeatherSystemBase weatherSys)
        {
            this.weatherSys = weatherSys;
            weatherSysc     = weatherSys as WeatherSystemClient;
            this.capi       = api as ICoreClientAPI;

            if (api.Side == EnumAppSide.Client)
            {
                LightningAmbient = new AmbientModifier().EnsurePopulated();

                capi.Ambient.CurrentModifiers["lightningambient"] = LightningAmbient;

                capi.Event.ReloadShader += LoadShader;
                LoadShader();

                capi.Event.RegisterRenderer(this, EnumRenderStage.Opaque, "lightning");

                capi.RegisterCommand("lntest", "", "", onCmdLineTest);
            }
            else
            {
                api.Event.RegisterGameTickListener(OnServerTick, 40, 3);

                (api as ICoreServerAPI).RegisterCommand("lntest", "", "", onCmdLineTestServer);
            }
        }
        public WeatherSimulationLightning(ICoreClientAPI capi, WeatherSystemClient weatherSys)
        {
            this.weatherSys  = weatherSys;
            this.capi        = capi;
            LightningAmbient = new AmbientModifier().EnsurePopulated();

            capi.Ambient.CurrentModifiers["lightningambient"] = LightningAmbient;
        }
Beispiel #4
0
        public AuroraRenderer(ICoreClientAPI capi, WeatherSystemClient wsys)
        {
            this.capi = capi;
            capi.Event.RegisterRenderer(this, EnumRenderStage.OIT, "aurora");

            capi.Event.ReloadShader += LoadShader;
            LoadShader();

            renderAurora = capi.Settings.Bool["renderAurora"];
            renderAurora = true;
        }
Beispiel #5
0
        public WeatherSimulationParticles(ICoreClientAPI capi, WeatherSystemClient ws)
        {
            this.capi         = capi;
            this.ws           = ws;
            rand              = new Random(capi.World.Seed + 223123123);
            rainParticleColor = waterColor;

            desertStormAmbient            = new AmbientModifier().EnsurePopulated();
            desertStormAmbient.FogDensity = new WeightedFloat();
            desertStormAmbient.FogColor   = new WeightedFloatArray()
            {
                Value = new float[3]
            };
            desertStormAmbient.FogMin = new WeightedFloat();

            capi.Ambient.CurrentModifiers["desertstorm"] = desertStormAmbient;
        }
        public CloudRenderer(ICoreClientAPI capi, WeatherSystemClient weatherSys)
        {
            this.capi       = capi;
            this.weatherSys = weatherSys;
            rand            = new Random(capi.World.Seed);

            capi.Event.RegisterRenderer(this, EnumRenderStage.OIT, "clouds");
            capi.Event.ReloadShader += LoadShader;

            LoadShader();



            double time = capi.World.Calendar.TotalHours * 60;

            windOffsetX += 2f * time;
            windOffsetZ += 0.1f * time;

            mainThreadState.WindTileOffsetX += (int)(windOffsetX / CloudTileSize);
            windOffsetX %= CloudTileSize;

            mainThreadState.WindTileOffsetZ += (int)(windOffsetZ / CloudTileSize);
            windOffsetZ %= CloudTileSize;

            offThreadState.Set(mainThreadState);
            committedState.Set(mainThreadState);

            InitCloudTiles((8 * capi.World.Player.WorldData.DesiredViewDistance));
            LoadCloudModel();


            capi.Settings.AddWatcher <int>("viewDistance", OnViewDistanceChanged);
            capi.Settings.AddWatcher <bool>("renderClouds", (val) => renderClouds = val);

            renderClouds = capi.Settings.Bool["renderClouds"];

            InitCustomDataBuffers(updateMesh);

            capi.Event.LeaveWorld += () =>
            {
                isShuttingDown = true;
            };

            cloudTileUpdThread = new Thread(new ThreadStart(() =>
            {
                while (!isShuttingDown)
                {
                    if (!newStateRready)
                    {
                        int winddx = (int)windOffsetX / CloudTileSize;
                        int winddz = (int)windOffsetZ / CloudTileSize;

                        int prevx = offThreadState.CenterTilePos.X;
                        int prevz = offThreadState.CenterTilePos.Z;
                        offThreadState.Set(mainThreadState);

                        offThreadState.WindTileOffsetX += winddx;
                        offThreadState.WindTileOffsetZ += winddz;

                        int dx = winddx + prevx - offThreadState.CenterTilePos.X;
                        int dz = winddz + prevz - offThreadState.CenterTilePos.Z;
                        if (dx != 0 || dz != 0)
                        {
                            MoveCloudTilesOffThread(dx, dz);
                        }

                        UpdateCloudTilesOffThread(instantTileBlend ? short.MaxValue : cloudTileBlendSpeed);

                        instantTileBlend = false;
                        newStateRready   = true;
                    }

                    Thread.Sleep(40);
                }
            }));

            cloudTileUpdThread.IsBackground = true;
        }
Beispiel #7
0
 public WeatherSimulationSound(ICoreClientAPI capi, WeatherSystemClient weatherSys)
 {
     this.weatherSys = weatherSys;
     this.capi       = capi;
 }