UnityEngine.UI.Extensions.CUIGraphic.uiVertexBerp(UnityEngine.UIVertex, UnityEngine.UIVertex, UnityEngine.UIVertex, UnityEngine.UIVertex, float, float)

Here are the examples of the csharp api UnityEngine.UI.Extensions.CUIGraphic.uiVertexBerp(UnityEngine.UIVertex, UnityEngine.UIVertex, UnityEngine.UIVertex, UnityEngine.UIVertex, float, float) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : CUIGraphic.cs
License : MIT License
Project Creator : cmaher

protected void tessellateQuad(List<UIVertex> _quads, int _thisQuadIdx)
        {
            UIVertex v_bottomLeft = _quads[_thisQuadIdx];
            UIVertex v_topLeft = _quads[_thisQuadIdx + 1];
            UIVertex v_topRight = _quads[_thisQuadIdx + 2];
            UIVertex v_bottomRight = _quads[_thisQuadIdx + 3];

            float quadSize = 100.0f / resolution;

            int heightQuadEdgeNum = Mathf.Max(1, Mathf.CeilToInt((v_topLeft.position - v_bottomLeft.position).magnitude / quadSize));
            int widthQuadEdgeNum = Mathf.Max(1, Mathf.CeilToInt((v_topRight.position - v_topLeft.position).magnitude / quadSize));

            int quadIdx = 0;

            for (int x = 0; x < widthQuadEdgeNum; x++)
            {
                for (int y = 0; y < heightQuadEdgeNum; y++, quadIdx++)
                {
                    _quads.Add(new UIVertex());
                    _quads.Add(new UIVertex());
                    _quads.Add(new UIVertex());
                    _quads.Add(new UIVertex());

                    float xRatio = (float)x / widthQuadEdgeNum;
                    float yRatio = (float)y / heightQuadEdgeNum;
                    float xPlusOneRatio = (float)(x + 1) / widthQuadEdgeNum;
                    float yPlusOneRatio = (float)(y + 1) / heightQuadEdgeNum;

                    _quads[_quads.Count - 4] = uiVertexBerp(v_bottomLeft, v_topLeft, v_topRight, v_bottomRight, xRatio, yRatio);
                    _quads[_quads.Count - 3] = uiVertexBerp(v_bottomLeft, v_topLeft, v_topRight, v_bottomRight, xRatio, yPlusOneRatio);
                    _quads[_quads.Count - 2] = uiVertexBerp(v_bottomLeft, v_topLeft, v_topRight, v_bottomRight, xPlusOneRatio, yPlusOneRatio);
                    _quads[_quads.Count - 1] = uiVertexBerp(v_bottomLeft, v_topLeft, v_topRight, v_bottomRight, xPlusOneRatio, yRatio);

                }
            }
        }