public static void FillRadial360(Origin360 origin, float amount, bool clockwise, Rect vertRect, Rect uvRect, Vector3[] verts, Vector2[] uv)
{
switch (origin)
{
case Origin360.Top:
if (amount < 0.5f)
{
amount = amount / 0.5f;
vertRect.width /= 2;
uvRect.width /= 2;
if (clockwise)
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
FillRadial180(clockwise ? Origin180.Left : Origin180.Right, amount, clockwise, vertRect, uvRect, verts, uv);
verts[8] = verts[9] = verts[10] = verts[11] = verts[7];
uv[8] = uv[9] = uv[10] = uv[11] = uv[7];
}
else
{
vertRect.width /= 2;
uvRect.width /= 2;
if (!clockwise)
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
amount = (amount - 0.5f) / 0.5f;
FillRadial180(clockwise ? Origin180.Right : Origin180.Left, 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, 8, vertRect);
NGraphics.FillUVOfQuad(uv, 8, uvRect);
}
break;
case Origin360.Bottom:
if (amount < 0.5f)
{
amount = amount / 0.5f;
vertRect.width /= 2;
uvRect.width /= 2;
if (!clockwise)
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
FillRadial180(clockwise ? Origin180.Right : Origin180.Left, amount, clockwise, vertRect, uvRect, verts, uv);
verts[8] = verts[9] = verts[10] = verts[11] = verts[7];
uv[8] = uv[9] = uv[10] = uv[11] = uv[7];
}
else
{
vertRect.width /= 2;
uvRect.width /= 2;
if (clockwise)
{
vertRect.x += vertRect.width;
uvRect.x += uvRect.width;
}
amount = (amount - 0.5f) / 0.5f;
FillRadial180(clockwise ? Origin180.Left : Origin180.Right, 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, 8, vertRect);
NGraphics.FillUVOfQuad(uv, 8, uvRect);
}
break;
case Origin360.Left:
if (amount < 0.5f)
{
amount = amount / 0.5f;
if (clockwise)
{
vertRect.height /= 2;
uvRect.yMin += uvRect.height / 2;
}
else
{
vertRect.yMin += vertRect.height / 2;
uvRect.yMax -= uvRect.height / 2;
}
FillRadial180(clockwise ? Origin180.Bottom : Origin180.Top, amount, clockwise, vertRect, uvRect, verts, uv);
verts[8] = verts[9] = verts[10] = verts[11] = verts[7];
uv[8] = uv[9] = uv[10] = uv[11] = uv[7];
}
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;
FillRadial180(clockwise ? Origin180.Top : Origin180.Bottom, 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, 8, vertRect);
NGraphics.FillUVOfQuad(uv, 8, uvRect);
}
break;
case Origin360.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;
FillRadial180(clockwise ? Origin180.Top : Origin180.Bottom, amount, clockwise, vertRect, uvRect, verts, uv);
verts[8] = verts[9] = verts[10] = verts[11] = verts[7];
uv[8] = uv[9] = uv[10] = uv[11] = uv[7];
}
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;
FillRadial180(clockwise ? Origin180.Bottom : Origin180.Top, 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, 8, vertRect);
NGraphics.FillUVOfQuad(uv, 8, uvRect);
}
break;
}
}