UnityEditor.TimeArea.DrawVerticalLineFast C# (CSharp) Method

DrawVerticalLineFast() public static method

public static DrawVerticalLineFast ( float x, float minY, float maxY, Color color ) : void
x float
minY float
maxY float
color Color
return void
        public static void DrawVerticalLineFast(float x, float minY, float maxY, Color color)
        {
            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                GL.Color(color);
                GL.Vertex(new Vector3(x - 0.5f, minY, 0f));
                GL.Vertex(new Vector3(x + 0.5f, minY, 0f));
                GL.Vertex(new Vector3(x + 0.5f, maxY, 0f));
                GL.Vertex(new Vector3(x - 0.5f, maxY, 0f));
            }
            else
            {
                GL.Color(color);
                GL.Vertex(new Vector3(x, minY, 0f));
                GL.Vertex(new Vector3(x, maxY, 0f));
            }
        }

Usage Example

示例#1
0
        public void TimeRuler(Rect position, float frameRate, bool labels, bool useEntireHeight, float alpha)
        {
            Color color = GUI.color;

            GUI.BeginGroup(position);
            if (Event.current.type != EventType.Repaint)
            {
                GUI.EndGroup();
            }
            else
            {
                TimeArea.InitStyles();
                HandleUtility.ApplyWireMaterial();
                if (Application.platform == RuntimePlatform.WindowsEditor)
                {
                    GL.Begin(7);
                }
                else
                {
                    GL.Begin(1);
                }
                Color backgroundColor = GUI.backgroundColor;
                this.SetTickMarkerRanges();
                this.hTicks.SetTickStrengths(3f, 80f, true);
                Color textColor = TimeArea.styles.TimelineTick.normal.textColor;
                textColor.a = 0.75f * alpha;
                for (int level = 0; level < this.hTicks.tickLevels; ++level)
                {
                    float   b            = this.hTicks.GetStrengthOfLevel(level) * 0.9f;
                    float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(level, true);
                    for (int index = 0; index < ticksAtLevel.Length; ++index)
                    {
                        if ((double)ticksAtLevel[index] >= (double)this.hRangeMin && (double)ticksAtLevel[index] <= (double)this.hRangeMax)
                        {
                            int   num1 = Mathf.RoundToInt(ticksAtLevel[index] * frameRate);
                            float num2 = !useEntireHeight ? (float)((double)position.height * (double)Mathf.Min(1f, b) * 0.699999988079071) : position.height;
                            TimeArea.DrawVerticalLineFast(this.FrameToPixel((float)num1, frameRate, position), (float)((double)position.height - (double)num2 + 0.5), position.height - 0.5f, new Color(1f, 1f, 1f, b / 0.5f) * textColor);
                        }
                    }
                }
                GL.End();
                if (labels)
                {
                    float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(this.hTicks.GetLevelWithMinSeparation(40f), false);
                    for (int index = 0; index < ticksAtLevel.Length; ++index)
                    {
                        if ((double)ticksAtLevel[index] >= (double)this.hRangeMin && (double)ticksAtLevel[index] <= (double)this.hRangeMax)
                        {
                            int frame = Mathf.RoundToInt(ticksAtLevel[index] * frameRate);
                            GUI.Label(new Rect(Mathf.Floor(this.FrameToPixel((float)frame, frameRate, position)) + 3f, -3f, 40f, 20f), this.FormatFrame(frame, frameRate), TimeArea.styles.TimelineTick);
                        }
                    }
                }
                GUI.EndGroup();
                GUI.backgroundColor = backgroundColor;
                GUI.color           = color;
            }
        }
All Usage Examples Of UnityEditor.TimeArea::DrawVerticalLineFast