示例#1
0
        private void InitializeValues(MyPrefabLight prefabLight)
        {
            MyLight light = prefabLight.GetLight();

            m_pointNormalLightColorSlider[0].SetNormalizedValue(light.Color.X);
            m_pointNormalLightColorSlider[1].SetNormalizedValue(light.Color.Y);
            m_pointNormalLightColorSlider[2].SetNormalizedValue(light.Color.Z);
            m_specularLightColorSlider[0].SetNormalizedValue(light.SpecularColor.X);
            m_specularLightColorSlider[1].SetNormalizedValue(light.SpecularColor.Y);
            m_specularLightColorSlider[2].SetNormalizedValue(light.SpecularColor.Z);
            m_pointFallOffSlider.SetValue(light.Falloff);
            m_pointRangeSlider.SetValue(light.Range);
            m_pointIntensitySlider.SetValue(light.Intensity);
            m_pointOffsetSlider.SetValue(light.PointLightOffset);

            m_spotNormalLightColorSlider[0].SetNormalizedValue(light.ReflectorColor.X);
            m_spotNormalLightColorSlider[1].SetNormalizedValue(light.ReflectorColor.Y);
            m_spotNormalLightColorSlider[2].SetNormalizedValue(light.ReflectorColor.Z);
            m_spotFallOffSlider.SetValue(light.ReflectorFalloff);
            m_spotRangeSlider.SetValue(light.ReflectorRange);
            m_spotIntensitySlider.SetValue(light.ReflectorIntensity);
            m_spotAngleSlider.SetValue(light.ReflectorConeDegrees);

            m_pointLightCheckbox.Checked      = (light.LightType & MyLight.LightTypeEnum.PointLight) != 0;
            m_hemisphereLightCheckbox.Checked = (light.LightType & MyLight.LightTypeEnum.Hemisphere) != 0;
            m_spotLightCheckbox.Checked       = (light.LightType & MyLight.LightTypeEnum.Spotlight) != 0;
            m_spotLightShadowDistance.SetValue(light.ShadowDistance);

            m_flashOffsetSlider.SetValue(prefabLight.FlashOffset);

            m_effectComboBox.SelectItemByIndex((int)prefabLight.Effect);

            SetComponentsVisibility();
        }
示例#2
0
        private void DrawColors()
        {
            if (m_prefabLights.Count > 0)
            {
                MyPrefabLight myLight = m_prefabLights[0] as MyPrefabLight;

                MyGuiControlSlider rS = m_spotNormalLightColorSlider[0];
                Color color           = new Color(myLight.GetLight().ReflectorColor);
                color.A = 255;

                if (m_pointLightCheckbox.Visible)
                {
                    rS      = m_pointNormalLightColorSlider[0];
                    color   = new Color(myLight.GetLight().Color);
                    color.A = 255;
                }

                Vector2 posOffset      = new Vector2(-0.08f, -0.005f);
                Vector2 pos            = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(rS.GetPosition() - MyGuiConstants.CONTROLS_DELTA + posOffset);
                Vector2 colorLabelSize = MyGuiManager.GetScreenSizeFromNormalizedSize(new Vector2(0.5f * MyGuiConstants.SLIDER_HEIGHT, 0.5f * MyGuiConstants.SLIDER_HEIGHT));

                // Draw one big final color rectangle to see result of each RGBA component in one
                MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), (int)pos.X, (int)pos.Y, (int)colorLabelSize.X, (int)colorLabelSize.Y, color);

                if (m_pointLightCheckbox.Visible)
                {
                    Vector2 pos2 = MyGuiManager.GetScreenCoordinateFromNormalizedCoordinate(m_specularLightColorSlider[0].GetPosition() - MyGuiConstants.CONTROLS_DELTA + posOffset);

                    Color color2 = new Color(myLight.GetLight().SpecularColor);
                    color2.A = 255;

                    // Draw color rectangles next to each color slider and then draw one big final color rectangle to see result of each RGBA component in one
                    MyGuiManager.DrawSpriteBatch(MyGuiManager.GetBlankTexture(), (int)pos2.X, (int)pos2.Y, (int)colorLabelSize.X, (int)colorLabelSize.Y, color2);
                }
            }
        }