本文整理汇总了C#中Quad.Points方法的典型用法代码示例。如果您正苦于以下问题:C# Quad.Points方法的具体用法?C# Quad.Points怎么用?C# Quad.Points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quad
的用法示例。
在下文中一共展示了Quad.Points方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawOnQuad
public void DrawOnQuad(ref MadList<Vector3> vertices, ref MadList<Color32> colors, ref MadList<Vector2> uv,
ref MadList<int> triangles) {
bool invert = fillType == FillType.RadialCCW;
var matrix = TransformMatrix();
var bounds = GetBounds();
var topLeftQuad = new Quad(invert);
var topRightQuad = new Quad(invert);
var bottomRightQuad = new Quad(invert);
var bottomLeftQuad = new Quad(invert);
topLeftQuad.anchor = Quad.Point.BottomRight;
topRightQuad.anchor = Quad.Point.BottomLeft;
bottomRightQuad.anchor = Quad.Point.TopLeft;
bottomLeftQuad.anchor = Quad.Point.TopRight;
var topLeftQuad2 = new Quad(topLeftQuad);
var topRightQuad2 = new Quad(topRightQuad);
var bottomRightQuad2 = new Quad(bottomRightQuad);
var bottomLeftQuad2 = new Quad(bottomLeftQuad);
// creating 8 quads instead of 8 because when using offset it may display one additional quad
// and the simplest way is to create 8 quads and wrap around
Quad[] ordered = new Quad[8];
if (!invert) {
ordered[0] = topRightQuad;
ordered[1] = bottomRightQuad;
ordered[2] = bottomLeftQuad;
ordered[3] = topLeftQuad;
ordered[4] = topRightQuad2;
ordered[5] = bottomRightQuad2;
ordered[6] = bottomLeftQuad2;
ordered[7] = topLeftQuad2;
} else {
ordered[7] = topRightQuad2;
ordered[6] = bottomRightQuad2;
ordered[5] = bottomLeftQuad2;
ordered[4] = topLeftQuad2;
ordered[3] = topRightQuad;
ordered[2] = bottomRightQuad;
ordered[1] = bottomLeftQuad;
ordered[0] = topLeftQuad;
}
float rOffset = radialFillOffset % 1;
if (rOffset < 0) {
rOffset += 1;
}
float fillValue = Mathf.Clamp01(this.fillValue) * radialFillLength;
float fillStart = rOffset * 4;
float fillEnd = (rOffset + fillValue) * 4;
for (int i = Mathf.FloorToInt(fillStart); i < Mathf.CeilToInt(fillEnd); ++i) {
var quad = ordered[i % 8];
if (i < fillStart) {
quad.offset = fillStart - i;
} else {
quad.offset = 0;
}
if (fillEnd > i + 1) {
quad.progress = 1 - quad.offset;
} else {
quad.progress = fillEnd - i - quad.offset;
}
}
float sx = initialSize.x;
float sy = initialSize.y;
float sx2 = sx / 2;
float sy2 = sy / 2;
// collect points anv uvs
List<Vector2[]> genPoints = new List<Vector2[]>();
List<Vector2[]> genUvs = new List<Vector2[]>();
genPoints.Add(topRightQuad.Points(sx2, sy, sx, sy2));
genUvs.Add(topRightQuad.Points(0.5f, 1, 1, 0.5f));
genPoints.Add(topRightQuad2.Points(sx2, sy, sx, sy2));
genUvs.Add(topRightQuad2.Points(0.5f, 1, 1, 0.5f));
genPoints.Add(bottomRightQuad.Points(sx2, sy2, sx, 0));
genUvs.Add(bottomRightQuad.Points(0.5f, 0.5f, 1, 0));
genPoints.Add(bottomRightQuad2.Points(sx2, sy2, sx, 0));
genUvs.Add(bottomRightQuad2.Points(0.5f, 0.5f, 1, 0));
genPoints.Add(bottomLeftQuad.Points(0, sy2, sx2, 0));
genUvs.Add(bottomLeftQuad.Points(0, 0.5f, 0.5f, 0));
genPoints.Add(bottomLeftQuad2.Points(0, sy2, sx2, 0));
genUvs.Add(bottomLeftQuad2.Points(0, 0.5f, 0.5f, 0));
genPoints.Add(topLeftQuad.Points(0, sy, sx2, sy2));
genUvs.Add(topLeftQuad.Points(0, 1, 0.5f, 0.5f));
genPoints.Add(topLeftQuad2.Points(0, sy, sx2, sy2));
//.........这里部分代码省略.........