UnityEditor.ColorPicker.Update1DSlider C# (CSharp) 메소드

Update1DSlider() 개인적인 정적인 메소드

private static Update1DSlider ( Texture2D tex, int xSize, float const1, float const2, float &oldConst1, float &oldConst2, int idx, bool hsvSpace, float scale, float exposureValue, bool forceUpdate, TonemappingType tonemappingType ) : Texture2D
tex UnityEngine.Texture2D
xSize int
const1 float
const2 float
oldConst1 float
oldConst2 float
idx int
hsvSpace bool
scale float
exposureValue float
forceUpdate bool
tonemappingType TonemappingType
리턴 UnityEngine.Texture2D
        private static Texture2D Update1DSlider(Texture2D tex, int xSize, float const1, float const2, ref float oldConst1, ref float oldConst2, int idx, bool hsvSpace, float scale, float exposureValue, bool forceUpdate, TonemappingType tonemappingType)
        {
            if (((tex == null) || (const1 != oldConst1)) || ((const2 != oldConst2) || forceUpdate))
            {
                if (tex == null)
                {
                    tex = MakeTexture(xSize, 2);
                }
                Color[] retval = new Color[xSize * 2];
                Color black = Color.black;
                Color rightGradient = Color.black;
                switch (idx)
                {
                    case 0:
                        black = new Color(0f, const1, const2, 1f);
                        rightGradient = new Color(1f, 0f, 0f, 0f);
                        break;

                    case 1:
                        black = new Color(const1, 0f, const2, 1f);
                        rightGradient = new Color(0f, 1f, 0f, 0f);
                        break;

                    case 2:
                        black = new Color(const1, const2, 0f, 1f);
                        rightGradient = new Color(0f, 0f, 1f, 0f);
                        break;

                    case 3:
                        black = new Color(0f, 0f, 0f, 1f);
                        rightGradient = new Color(1f, 1f, 1f, 0f);
                        break;
                }
                FillArea(xSize, 2, retval, black, rightGradient, new Color(0f, 0f, 0f, 0f));
                if (hsvSpace)
                {
                    HSVToRGBArray(retval, scale);
                }
                else
                {
                    ScaleColors(retval, scale);
                }
                DoTonemapping(retval, exposureValue, tonemappingType);
                oldConst1 = const1;
                oldConst2 = const2;
                tex.SetPixels(retval);
                tex.Apply();
            }
            return tex;
        }

Usage Example

예제 #1
0
        private void HSVSliders()
        {
            bool changed = GUI.changed;

            GUI.changed       = false;
            this.m_HueTexture = ColorPicker.Update1DSlider(this.m_HueTexture, 64, 1f, 1f, ref this.m_HueTextureS, ref this.m_HueTextureV, 0, true);
            this.m_SatTexture = ColorPicker.Update1DSlider(this.m_SatTexture, 8, this.m_H, Mathf.Max(this.m_V, 0.2f), ref this.m_SatTextureH, ref this.m_SatTextureV, 1, true);
            this.m_ValTexture = ColorPicker.Update1DSlider(this.m_ValTexture, 8, this.m_H, this.m_S, ref this.m_ValTextureH, ref this.m_ValTextureS, 2, true);
            float num  = (float)((int)Mathf.Round(this.m_H * 359f));
            float num2 = (float)((int)Mathf.Round(this.m_S * 255f));
            float num3 = (float)((int)Mathf.Round(this.m_V * 255f));

            num  = this.TexturedSlider(this.m_HueTexture, "H", num, 0f, 359f);
            num2 = this.TexturedSlider(this.m_SatTexture, "S", num2, 0f, 255f);
            num3 = this.TexturedSlider(this.m_ValTexture, "V", num3, 0f, 255f);
            if (GUI.changed)
            {
                this.m_H = num / 359f;
                this.m_S = num2 / 255f;
                this.m_V = num3 / 255f;
                this.HSVToRGB();
            }
            GUI.changed |= changed;
        }
All Usage Examples Of UnityEditor.ColorPicker::Update1DSlider