Assets/Lib.Spine/spine-unity/SkeletonExtensions.cs
/// <summary>Calculates world vertices and fills a Vector2 buffer.</summary>
/// <param name="a">The VertexAttachment</param>
/// <param name="slot">Slot where the attachment belongs.</param>
/// <param name="buffer">Correctly-sized buffer. Use attachment's .WorldVerticesLength to get the correct size. If null, a new Vector2[] of the correct size will be allocated.</param>
Calculates world vertices and fills a Vector2 buffer.
Calculates world vertices and fills a Vector2 buffer .
public static Vector2[] GetWorldVertices (this VertexAttachment a, Slot slot, Vector2[] buffer) {
			int worldVertsLength = a.worldVerticesLength;
			int bufferTargetSize = worldVertsLength >> 1;
			buffer = buffer ?? new Vector2[bufferTargetSize];
			if (buffer.Length < bufferTargetSize) throw new System.ArgumentException(string.Format("Vector2 buffer too small. {0} requires an array of size {1}. Use the attachment's .WorldVerticesLength to get the correct size.", a.Name, worldVertsLength), "buffer");
			var floats = new float[worldVertsLength];
			a.ComputeWorldVertices(slot, floats);
			for (int i = 0, n = worldVertsLength >> 1; i < n; i++) {
				int j = i * 2;
				buffer[i] = new Vector2(floats[j], floats[j + 1]);
			}
			return buffer;
		}
public static Vector2 [ ] GetWorldVertices ( this VertexAttachment a , Slot slot , Vector2 [ ] buffer ) { int worldVertsLength = a . worldVerticesLength ; int bufferTargetSize = worldVertsLength >> 1 ; buffer = buffer ?? new Vector2 [ bufferTargetSize ] ; if ( buffer . Length < bufferTargetSize ) throw new System . ArgumentException ( string . Format ( " " , a . Name , worldVertsLength ) , " " ) ; var floats = new float [ worldVertsLength ] ; a . ComputeWorldVertices ( slot , floats ) ; for ( int i = 0 , n = worldVertsLength >> 1 ; i < n ; i ++ ) { int j = i * 2 ; buffer [ i ] = new Vector2 ( floats [ j ] , floats [ j + 1 ] ) ; } return buffer ; }
Calculates world vertices and fills a Vector2 buffer.
Calculates world vertices and fills a Vector2 buffer .
VertexAttachment
this
slot
Slot
Slot where the attachment belongs.
Slot where the attachment belongs .
buffer
Vector2[]
Correctly-sized buffer. Use attachment's .WorldVerticesLength to get the correct size. If null, a new Vector2[] of the correct size will be allocated.
Correctly - sized buffer . Use attachment ' s . WorldVerticesLength to get the correct size . If null a new Vector2 [] of the correct size will be allocated .
a
None