mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[csharp] Cleanup VertexAttachment id threadsafety
This commit is contained in:
parent
61a5058a5c
commit
5e0ff3694d
@ -34,17 +34,9 @@ namespace Spine {
|
|||||||
/// <summary>>An attachment with vertices that are transformed by one or more bones and can be deformed by a slot's vertices.</summary>
|
/// <summary>>An attachment with vertices that are transformed by one or more bones and can be deformed by a slot's vertices.</summary>
|
||||||
public class VertexAttachment : Attachment {
|
public class VertexAttachment : Attachment {
|
||||||
static int nextID = 0;
|
static int nextID = 0;
|
||||||
static Object nextIdLock = new Object();
|
static readonly Object nextIdLock = new Object();
|
||||||
static int GetNextID () {
|
|
||||||
int returnValue;
|
|
||||||
lock (nextIdLock) {
|
|
||||||
returnValue = nextID;
|
|
||||||
nextID++;
|
|
||||||
}
|
|
||||||
return returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal readonly int id = (VertexAttachment.GetNextID() & 65535) << 11;
|
internal readonly int id;
|
||||||
internal int[] bones;
|
internal int[] bones;
|
||||||
internal float[] vertices;
|
internal float[] vertices;
|
||||||
internal int worldVerticesLength;
|
internal int worldVerticesLength;
|
||||||
@ -55,8 +47,12 @@ namespace Spine {
|
|||||||
public float[] Vertices { get { return vertices; } set { vertices = value; } }
|
public float[] Vertices { get { return vertices; } set { vertices = value; } }
|
||||||
public int WorldVerticesLength { get { return worldVerticesLength; } set { worldVerticesLength = value; } }
|
public int WorldVerticesLength { get { return worldVerticesLength; } set { worldVerticesLength = value; } }
|
||||||
|
|
||||||
public VertexAttachment (String name)
|
public VertexAttachment (string name)
|
||||||
: base(name) {
|
: base(name) {
|
||||||
|
|
||||||
|
lock (VertexAttachment.nextIdLock) {
|
||||||
|
id = (VertexAttachment.nextID++ & 65535) << 11;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ComputeWorldVertices (Slot slot, float[] worldVertices) {
|
public void ComputeWorldVertices (Slot slot, float[] worldVertices) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user