コード例 #1
0
        static void DrawClipBlends(ClipBlends blends, Color inColor, Color outColor, Color backgroundColor)
        {
            switch (blends.inKind)
            {
            case BlendKind.Ease:
                //     2
                //   / |
                //  /  |
                // 0---1
                EditorGUI.DrawRect(blends.inRect, backgroundColor);
                s_BlendVertices[0] = new Vector3(blends.inRect.xMin, blends.inRect.yMax);
                s_BlendVertices[1] = new Vector3(blends.inRect.xMax, blends.inRect.yMax);
                s_BlendVertices[2] = new Vector3(blends.inRect.xMax, blends.inRect.yMin);
                Graphics.DrawPolygonAA(inColor, s_BlendVertices);
                break;

            case BlendKind.Mix:
                // 0---2
                //  \  |
                //   \ |
                //     1
                s_BlendVertices[0] = new Vector3(blends.inRect.xMin, blends.inRect.yMin);
                s_BlendVertices[1] = new Vector3(blends.inRect.xMax, blends.inRect.yMax);
                s_BlendVertices[2] = new Vector3(blends.inRect.xMax, blends.inRect.yMin);
                Graphics.DrawPolygonAA(inColor, s_BlendVertices);
                break;
            }

            if (blends.outKind != BlendKind.None)
            {
                if (blends.outKind == BlendKind.Ease)
                {
                    EditorGUI.DrawRect(blends.outRect, backgroundColor);
                }
                // 0
                // | \
                // |  \
                // 1---2
                s_BlendVertices[0] = new Vector3(blends.outRect.xMin, blends.outRect.yMin);
                s_BlendVertices[1] = new Vector3(blends.outRect.xMin, blends.outRect.yMax);
                s_BlendVertices[2] = new Vector3(blends.outRect.xMax, blends.outRect.yMax);
                Graphics.DrawPolygonAA(outColor, s_BlendVertices);
            }
        }
コード例 #2
0
        static void DrawBlendLine(Rect rect, BlendAngle blendAngle, float width, Color color)
        {
            var     halfWidth = width / 2.0f;
            Vector2 p0, p1;
            var     inverse = 1.0f;

            if (blendAngle == BlendAngle.Descending)
            {
                p0 = rect.min;
                p1 = rect.max;
            }
            else
            {
                p0      = new Vector2(rect.xMax, rect.yMin);
                p1      = new Vector2(rect.xMin, rect.yMax);
                inverse = -1.0f;
            }
            s_BlendLines[0] = new Vector3(p0.x - halfWidth, p0.y + halfWidth * inverse);
            s_BlendLines[1] = new Vector3(p1.x - halfWidth, p1.y + halfWidth * inverse);
            s_BlendLines[2] = new Vector3(p1.x + halfWidth, p1.y - halfWidth * inverse);
            s_BlendLines[3] = new Vector3(p0.x + halfWidth, p0.y - halfWidth * inverse);
            Graphics.DrawPolygonAA(color, s_BlendLines);
        }