123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- using System;
- namespace Spine
- {
- public class MeshAttachment : Attachment
- {
- public MeshAttachment(string name) : base(name)
- {
- }
- public int HullLength { get; set; }
- public float[] Vertices
- {
- get
- {
- return this.vertices;
- }
- set
- {
- this.vertices = value;
- }
- }
- public float[] RegionUVs
- {
- get
- {
- return this.regionUVs;
- }
- set
- {
- this.regionUVs = value;
- }
- }
- public float[] UVs
- {
- get
- {
- return this.uvs;
- }
- set
- {
- this.uvs = value;
- }
- }
- public int[] Triangles
- {
- get
- {
- return this.triangles;
- }
- set
- {
- this.triangles = value;
- }
- }
- public float R
- {
- get
- {
- return this.r;
- }
- set
- {
- this.r = value;
- }
- }
- public float G
- {
- get
- {
- return this.g;
- }
- set
- {
- this.g = value;
- }
- }
- public float B
- {
- get
- {
- return this.b;
- }
- set
- {
- this.b = value;
- }
- }
- public float A
- {
- get
- {
- return this.a;
- }
- set
- {
- this.a = value;
- }
- }
- public string Path { get; set; }
- public object RendererObject { get; set; }
- public float RegionU { get; set; }
- public float RegionV { get; set; }
- public float RegionU2 { get; set; }
- public float RegionV2 { get; set; }
- public bool RegionRotate { get; set; }
- public float RegionOffsetX
- {
- get
- {
- return this.regionOffsetX;
- }
- set
- {
- this.regionOffsetX = value;
- }
- }
- public float RegionOffsetY
- {
- get
- {
- return this.regionOffsetY;
- }
- set
- {
- this.regionOffsetY = value;
- }
- }
- public float RegionWidth
- {
- get
- {
- return this.regionWidth;
- }
- set
- {
- this.regionWidth = value;
- }
- }
- public float RegionHeight
- {
- get
- {
- return this.regionHeight;
- }
- set
- {
- this.regionHeight = value;
- }
- }
- public float RegionOriginalWidth
- {
- get
- {
- return this.regionOriginalWidth;
- }
- set
- {
- this.regionOriginalWidth = value;
- }
- }
- public float RegionOriginalHeight
- {
- get
- {
- return this.regionOriginalHeight;
- }
- set
- {
- this.regionOriginalHeight = value;
- }
- }
- public int[] Edges { get; set; }
- public float Width { get; set; }
- public float Height { get; set; }
- public void UpdateUVs()
- {
- float regionU = this.RegionU;
- float regionV = this.RegionV;
- float num = this.RegionU2 - this.RegionU;
- float num2 = this.RegionV2 - this.RegionV;
- float[] array = this.regionUVs;
- if (this.uvs == null || this.uvs.Length != array.Length)
- {
- this.uvs = new float[array.Length];
- }
- float[] array2 = this.uvs;
- if (this.RegionRotate)
- {
- int i = 0;
- int num3 = array2.Length;
- while (i < num3)
- {
- array2[i] = regionU + array[i + 1] * num;
- array2[i + 1] = regionV + num2 - array[i] * num2;
- i += 2;
- }
- }
- else
- {
- int j = 0;
- int num4 = array2.Length;
- while (j < num4)
- {
- array2[j] = regionU + array[j] * num;
- array2[j + 1] = regionV + array[j + 1] * num2;
- j += 2;
- }
- }
- }
- public void ComputeWorldVertices(Slot slot, float[] worldVertices)
- {
- Bone bone = slot.bone;
- float num = bone.skeleton.x + bone.worldX;
- float num2 = bone.skeleton.y + bone.worldY;
- float m = bone.m00;
- float m2 = bone.m01;
- float m3 = bone.m10;
- float m4 = bone.m11;
- float[] attachmentVertices = this.vertices;
- int num3 = attachmentVertices.Length;
- if (slot.attachmentVerticesCount == num3)
- {
- attachmentVertices = slot.AttachmentVertices;
- }
- for (int i = 0; i < num3; i += 2)
- {
- float num4 = attachmentVertices[i];
- float num5 = attachmentVertices[i + 1];
- worldVertices[i] = num4 * m + num5 * m2 + num;
- worldVertices[i + 1] = num4 * m3 + num5 * m4 + num2;
- }
- }
- internal float[] vertices;
- internal float[] uvs;
- internal float[] regionUVs;
- internal int[] triangles;
- internal float regionOffsetX;
- internal float regionOffsetY;
- internal float regionWidth;
- internal float regionHeight;
- internal float regionOriginalWidth;
- internal float regionOriginalHeight;
- internal float r = 1f;
- internal float g = 1f;
- internal float b = 1f;
- internal float a = 1f;
- }
- }
|