6 public struct Point : IEquatable<Point> {
41 IEnumerable<Point> points,
56 TmpPositions.Count = 0;
63 float num = MathF.Abs(bevelSize);
65 TmpPathPoints.Count = 0;
77 float.PositiveInfinity,
82 TmpPositions2.Count = 0;
95 if (antialiasSize > 0f) {
96 TmpPathPoints.Count = 0;
97 float outerRadiusR = num + antialiasSize;
109 float.PositiveInfinity,
114 TmpPathPoints.Count = 0;
126 float.PositiveInfinity,
134 TmpIndices.Count = 0;
143 if (antialiasSize > 0f) {
144 TmpPathPoints.Count = 0;
156 float.PositiveInfinity,
167 TmpPositions.Count = 0;
170 TmpNormals.Count = 0;
172 TmpPathPoints.Count = 0;
184 float.PositiveInfinity,
188 TmpIndices.Count = 0;
200 IEnumerable<Point> points,
227 DynamicArray<VertexPositionColorTexture> triangleVertices = batch.TriangleVertices;
230 item.TexCoord = position.XY * vector + textureOffset;
231 triangleVertices.
Add(item);
233 foreach (
int triangleIndex
in TmpBatch.TriangleIndices) {
234 batch.TriangleIndices.Add(triangleIndex + count);
244 float roundingRadius,
251 TmpQuadPoints.Count = 0;
278 float roundingRadius,
285 TmpQuadPoints.Count = 0;
309 for (
int i = 0; i < positions.
Count; i++) {
311 if (value != vector) {
312 positions[count++] = value;
316 positions.Count = count;
319 static void Triangulate(DynamicArray<Vector2> source, DynamicArray<int> destination) {
320 TmpIndicesTriangulation.Count = source.
Count;
321 for (
int i = 0; i < source.
Count; i++) {
325 int num = TmpIndicesTriangulation.Count - 1;
335 Vector2 vector2 = source[num3];
336 Vector2 vector3 = source[num4];
337 if (
Vector2.
Cross(vector2 - vector, vector3 - vector2) >= 0f) {
348 destination.
Add(num2);
349 destination.
Add(num3);
350 destination.
Add(num4);
362 for (
int i = 0; i < points.
Count; i++) {
367 float num = directional *
Vector2.
Dot(v, directionToLight);
369 value.InnerColorL *= color;
370 value.InnerColorR *= color;
371 value.OuterColorL *= color;
372 value.OuterColorR *= color;
373 points[index] = value;
377 for (
int j = 0; j < points.
Count; j++) {
388 value2.InnerColorL *= color2;
389 value2.InnerColorR *= color2;
390 value2.OuterColorL *= color2;
391 value2.OuterColorR *= color2;
392 points[index4] = value2;
407 DynamicArray<PathRenderer.Point> result) {
408 foreach (
Vector2 position
in positions) {
412 InnerRadiusL = innerRadiusL,
413 InnerRadiusR = innerRadiusR,
414 OuterRadiusL = outerRadiusL,
415 OuterRadiusR = outerRadiusR,
416 InnerColorL = innerColorL,
417 InnerColorR = innerColorR,
418 OuterColorL = outerColorL,
419 OuterColorR = outerColorR,
420 LengthScale = lengthScale,
421 MiterLimit = miterLimit
427 static void RoundCorners(DynamicArray<Point> points,
bool loop,
float pixelsPerUnit,
float bevelSize, DynamicArray<Vector2> result) {
428 int num = loop ? points.Count : points.Count - 2;
429 for (
int i = 0; i < num; i++) {
430 Point point = points[i];
431 Point point2 = points[(i + 1) % points.
Count];
432 Point point3 = points[(i + 2) % points.
Count];
453 DynamicArray<Vector2> result) {
456 float num = vector.
Length();
457 float num2 = vector2.
Length();
458 float num3 =
MathUtils.
Min(num * 0.49f, num2 * 0.49f, radius);
460 Vector2 vector3 = vector / num;
461 Vector2 vector4 = vector2 / num2;
462 Vector2 vector5 = p1 + vector3 * num3;
463 Vector2 vector6 = p1 + vector4 * num3;
469 if (vector7.HasValue) {
473 float num6 = (num4 + bevelSize) * pixelsPerUnit;
474 float num7 = MathF.Acos(1f - num5 / num6);
475 count = !
float.IsNaN(num7) ? (int)Math.Clamp(MathF.Ceiling(((
float)Math.PI / num7 - 4f) / 4f), 0f, 50f) : 0;
480 for (
int i = 1; i <= count; i++) {
481 float x = num8 + num9 * i / (count + 1);
482 Vector2 item = vector7.Value +
new Vector2(num4 * MathF.Sin(x), num4 * MathF.Cos(x));
void AddRange(IEnumerable< T > items)
readonly DynamicArray< int > TriangleIndices
readonly DynamicArray< VertexPositionColor > TriangleVertices
readonly DynamicArray< VertexPositionColorTexture > TriangleVertices
static int Min(int x1, int x2)
static float NormalizeAngle(float angle)
static int Max(int x1, int x2)
static void GeneratePathPoints(DynamicArray< Vector2 > positions, float innerRadiusL, float innerRadiusR, float outerRadiusL, float outerRadiusR, Color innerColorL, Color innerColorR, Color outerColorL, Color outerColorR, float lengthScale, float miterLimit, DynamicArray< PathRenderer.Point > result)
static void LightPoints(DynamicArray< PathRenderer.Point > points, bool loop, bool flatShading, Vector2 directionToLight, float directional, float ambient)
static void QueueQuad(FlatBatch2D batch, Vector2 p1, Vector2 p2, float pixelsPerUnit, float antialiasSize, float bevelSize, float roundingRadius, int roundingCount, bool flatShading, Color centerColor, Color bevelColor, float directional, float ambient)
static FlatBatch2D TmpBatch
static void QueueShapeShadow(FlatBatch2D batch, IEnumerable< Point > points, float pixelsPerUnit, float shadowSize, Color shadowColor)
static DynamicArray< Vector2 > TmpPositions
static void Triangulate(DynamicArray< Vector2 > source, DynamicArray< int > destination)
static void QueueShape(FlatBatch2D batch, IEnumerable< Point > points, float pixelsPerUnit, float antialiasSize, float bevelSize, bool flatShading, Color centerColor, Color bevelColor, float directional, float ambient)
static DynamicArray< Vector2 > TmpNormals
static void RoundCorners(DynamicArray< Point > points, bool loop, float pixelsPerUnit, float bevelSize, DynamicArray< Vector2 > result)
static DynamicArray< Point > TmpPoints
static void QueueShape(TexturedBatch2D batch, IEnumerable< Point > points, Vector2 textureScale, Vector2 textureOffset, float pixelsPerUnit, float antialiasSize, float bevelSize, bool flatShading, Color centerColor, Color bevelColor, float directional, float ambient)
static DynamicArray< int > TmpIndicesTriangulation
static DynamicArray< int > TmpIndices
static DynamicArray< PathRenderer.Point > TmpPathPoints
static void RemoveDuplicates(DynamicArray< Vector2 > positions)
static DynamicArray< Point > TmpQuadPoints
static void RoundCorner(Vector2 p0, Vector2 p1, Vector2 p2, float radius, int count, float pixelsPerUnit, float bevelSize, DynamicArray< Vector2 > result)
static DynamicArray< Vector2 > TmpPositions2
static void QueueQuad(TexturedBatch2D batch, Vector2 p1, Vector2 p2, Vector2 textureScale, Vector2 textureOffset, float pixelsPerUnit, float antialiasSize, float bevelSize, float roundingRadius, int roundingCount, bool flatShading, Color centerColor, Color bevelColor, float directional, float ambient)
static void GeneratePathNormals(DynamicArray< Vector2 > positions, DynamicArray< bool > visibility, bool loop, DynamicArray< Vector2 > normals)
static void QueuePath(FlatBatch2D batch, DynamicArray< Point > points, DynamicArray< bool > visibility, bool loop, bool flatShading, float depth=0f)
static ? Vector2 Intersection(Line2 l1, Line2 l2)
static float Dot(Vector2 v1, Vector2 v2)
static float Cross(Vector2 v1, Vector2 v2)
static readonly Vector2 Zero
static readonly Vector2 UnitY
static Vector2 Normalize(Vector2 v)
static float Angle(Vector2 v1, Vector2 v2)
static float Distance(Vector2 v1, Vector2 v2)
static Vector2 Perpendicular(Vector2 v)