예제 #1
0
        internal static void UpdateSettings(uint id, MyAtmosphereSettings settings)
        {
            MyAtmosphere atmosphere;
            if (settings.MieColorScattering.X == 0.0f)
            {
                settings.MieColorScattering = new Vector3(settings.MieScattering);
            }
            if (settings.Intensity == 0.0f)
            {
                settings.Intensity = 1.0f;
            }
            if (settings.AtmosphereTopModifier == 0.0f)
            {
                settings.AtmosphereTopModifier = 1.0f;
            }
            if (settings.SeaLevelModifier == 0.0f)
            {
                settings.SeaLevelModifier = 1.0f;
            }
            if (settings.RayleighHeightSpace == 0.0f)
            {
                settings.RayleighHeightSpace = settings.RayleighHeight;
            }
            if (settings.RayleighTransitionModifier == 0.0f)
            {
                settings.RayleighTransitionModifier = 1.0f;
            }

            if (Atmospheres.TryGetValue(id, out atmosphere))
            {
                atmosphere.Settings = settings;
                Atmospheres[id] = atmosphere;
                RecomputeAtmospheres();
            }
        }
        void OnPickPlanet(MyGuiControlButton button)
        {
            var results = new List<MyLineSegmentOverlapResult<MyEntity>>();
            var ray = new LineD(MySector.MainCamera.Position, MySector.MainCamera.ForwardVector);
            MyGamePruningStructure.GetAllEntitiesInRay(ref ray, results);

            float closestPlanetDistance = float.MaxValue;
            MyPlanet closestPlanet = null;

            foreach (var result in results)
            {
                var planet = result.Element as MyPlanet;
                if (planet != null && planet.EntityId != m_selectedPlanetEntityID)
                {
                    if (result.Distance < closestPlanetDistance)
                    {
                        closestPlanet = planet;
                    }
                }
            }

            if (closestPlanet != null)
            {
                m_selectedPlanetEntityID = closestPlanet.EntityId;
                m_atmosphereSettings = closestPlanet.AtmosphereSettings;
                m_originalAtmosphereSettings = m_atmosphereSettings;
                RecreateControls(false);
            }
        }
 void OnResetButtonClicked(MyGuiControlButton button)
 {
     m_atmosphereSettings = MyAtmosphereSettings.Defaults();
     RecreateControls(false);
     UpdateAtmosphere();
 }
 void OnRestoreButtonClicked(MyGuiControlButton button)
 {
     m_atmosphereSettings = m_originalAtmosphereSettings;
     RecreateControls(false);
     UpdateAtmosphere();
 }
 public void UpdateAtmosphereSettings(MyAtmosphereSettings settings)
 {
     MyRenderProxy.UpdateAtmosphereSettings(m_renderObjectIDs[m_atmosphereRenderIndex], settings);
 }
예제 #6
0
        internal static void UpdateSettings(uint id, MyAtmosphereSettings settings)
        {
            MyAtmosphere atmosphere;
            if (settings.MieColorScattering.X == 0.0f)
            {
                settings.MieColorScattering = new Vector3(settings.MieScattering);
            }
            if (settings.Intensity == 0.0f)
            {
                settings.Intensity = 1.0f;
            }
            if (settings.AtmosphereTopModifier == 0.0f)
            {
                settings.AtmosphereTopModifier = 1.0f;
            }
            if (settings.SeaLevelModifier == 0.0f)
            {
                settings.SeaLevelModifier = 1.0f;
            }
            if (settings.RayleighHeightSpace == 0.0f)
            {
                settings.RayleighHeightSpace = settings.RayleighHeight;
            }
            if (settings.RayleighTransitionModifier == 0.0f)
            {
                settings.RayleighTransitionModifier = 1.0f;
            }

            if (Atmospheres.TryGetValue(id, out atmosphere))
            {
                atmosphere.Settings = settings;
                Atmospheres[id] = atmosphere;
                RecomputeAtmospheres();
            }
        }