public static void FillRadial180(Origin180 origin, float amount, bool clockwise, Rect vertRect, Rect uvRect, Vector3[] verts, Vector2[] uv)
{
switch (origin)
{
case Origin180.Top:
if (amount <= 0.5f)
{
vertRect.width /= 2;
uvRect.width /= 2;
if (clockwise)
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
amount = amount / 0.5f;
FillRadial90(clockwise ? Origin90.TopLeft : Origin90.TopRight, amount, clockwise, vertRect, uvRect, verts, uv);
verts[4] = verts[5] = verts[6] = verts[7] = verts[0];
uv[4] = uv[5] = uv[6] = uv[7] = uv[0];
}
else
{
vertRect.width /= 2;
uvRect.width /= 2;
if (!clockwise)
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
amount = (amount - 0.5f) / 0.5f;
FillRadial90(clockwise ? Origin90.TopRight : Origin90.TopLeft, amount, clockwise, vertRect, uvRect, verts, uv);
if (clockwise)
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
else
{
vertRect.x -= vertRect.width;
uvRect.x -= uvRect.width;
}
NGraphics.FillVertsOfQuad(verts, 4, vertRect);
NGraphics.FillUVOfQuad(uv, 4, uvRect);
}
break;
case Origin180.Bottom:
if (amount <= 0.5f)
{
vertRect.width /= 2;
uvRect.width /= 2;
if (!clockwise)
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
amount = amount / 0.5f;
FillRadial90(clockwise ? Origin90.BottomRight : Origin90.BottomLeft, amount, clockwise, vertRect, uvRect, verts, uv);
verts[4] = verts[5] = verts[6] = verts[7] = verts[0];
uv[4] = uv[5] = uv[6] = uv[7] = uv[0];
}
else
{
vertRect.width /= 2;
uvRect.width /= 2;
if (clockwise)
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
amount = (amount - 0.5f) / 0.5f;
FillRadial90(clockwise ? Origin90.BottomLeft : Origin90.BottomRight, amount, clockwise, vertRect, uvRect, verts, uv);
if (clockwise)
{
vertRect.x -= vertRect.width;
uvRect.x -= uvRect.width;
}
else
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
NGraphics.FillVertsOfQuad(verts, 4, vertRect);
NGraphics.FillUVOfQuad(uv, 4, uvRect);
}
break;
case Origin180.Left:
if (amount <= 0.5f)
{
if (clockwise)
{
vertRect.height /= 2;
uvRect.yMin += uvRect.height / 2;
}
else
{
vertRect.yMin += vertRect.height / 2;
uvRect.yMax -= uvRect.height / 2;
}
amount = amount / 0.5f;
FillRadial90(clockwise ? Origin90.BottomLeft : Origin90.TopLeft, amount, clockwise, vertRect, uvRect, verts, uv);
verts[4] = verts[5] = verts[6] = verts[7] = verts[0];
uv[4] = uv[5] = uv[6] = uv[7] = uv[0];
}
else
{
if (clockwise)
{
vertRect.yMin += vertRect.height / 2;
uvRect.yMax -= uvRect.height / 2;
}
else
{
vertRect.height /= 2;
uvRect.yMin += uvRect.height / 2;
}
amount = (amount - 0.5f) / 0.5f;
FillRadial90(clockwise ? Origin90.TopLeft : Origin90.BottomLeft, amount, clockwise, vertRect, uvRect, verts, uv);
if (clockwise)
{
vertRect.y -= vertRect.height;
uvRect.y += uvRect.height;
}
else
{
vertRect.y += vertRect.height;
uvRect.y -= uvRect.height;
}
NGraphics.FillVertsOfQuad(verts, 4, vertRect);
NGraphics.FillUVOfQuad(uv, 4, uvRect);
}
break;
case Origin180.Right:
if (amount <= 0.5f)
{
if (clockwise)
{
vertRect.yMin += vertRect.height / 2;
uvRect.yMax -= uvRect.height / 2;
}
else
{
vertRect.height /= 2;
uvRect.yMin += uvRect.height / 2;
}
amount = amount / 0.5f;
FillRadial90(clockwise ? Origin90.TopRight : Origin90.BottomRight, amount, clockwise, vertRect, uvRect, verts, uv);
verts[4] = verts[5] = verts[6] = verts[7] = verts[0];
uv[4] = uv[5] = uv[6] = uv[7] = uv[0];
}
else
{
if (clockwise)
{
vertRect.height /= 2;
uvRect.yMin += uvRect.height / 2;
}
else
{
vertRect.yMin += vertRect.height / 2;
uvRect.yMax -= uvRect.height / 2;
}
amount = (amount - 0.5f) / 0.5f;
FillRadial90(clockwise ? Origin90.BottomRight : Origin90.TopRight, amount, clockwise, vertRect, uvRect, verts, uv);
if (clockwise)
{
vertRect.y += vertRect.height;
uvRect.y -= uvRect.height;
}
else
{
vertRect.y -= vertRect.height;
uvRect.y += uvRect.height;
}
NGraphics.FillVertsOfQuad(verts, 4, vertRect);
NGraphics.FillUVOfQuad(uv, 4, uvRect);
}
break;
}
}