void CustomFill (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
{
Vector4 v = drawingDimensions;
Vector4 u = drawingUVs;
Color32 c = drawingColor;
int countTriangle = 9;
//计算宽高;
float width = v.z - v.x;
float height = v.w - v.y;
float radius = width / 2;
float widthUvs = u.z - u.x;
float heightUvs = u.w - u.y;
float uvsRadHeight = heightUvs / 2;
float uvsRadWidth = widthUvs / 2;
float angle = 0;
float radian = 0;
for (int cnt = 0; cnt < 360; cnt++) {
angle = 1f * cnt;
radian = Mathf.Deg2Rad * angle;
float tempY = radius * Mathf.Sin (radian);
float tempX = radius * Mathf.Cos (radian);
float tempYUvs = uvsRadHeight * Mathf.Sin (radian);
float tempXUvs = uvsRadWidth * Mathf.Cos (radian);
verts.Add (new Vector3 (v.x, v.y + radius));
verts.Add (new Vector3 (v.x + radius - tempX, v.w - radius + tempY));
verts.Add (new Vector3 (v.z, v.w - radius));
verts.Add (new Vector3 (v.z, v.y + radius));
uvs.Add (new Vector2 (u.x, u.y + uvsRadHeight));
uvs.Add (new Vector2 (u.x + uvsRadWidth - tempXUvs, u.w - uvsRadHeight + tempYUvs));
uvs.Add (new Vector2 (u.z, u.w - uvsRadHeight));
uvs.Add (new Vector2 (u.z, u.y + uvsRadHeight));
cols.Add (c);
cols.Add (c);
cols.Add (c);
cols.Add (c);
}
}
360个三角拼接而成。。木有效率可言。。待优化。。
mathf.Sin()是弧度 不是角度。。。需要转换下。。