//Just saves provided arguments. //Display lists are created later, in Draw() called from the main thread. public int Add(ushort[] indices, int indicesCount, VertexPositionTexture[] vertices, int verticesCount, bool transparent, int texture, Vector3 center, float radius) { int id; lock (toadd) { if (empty.Count > 0) { id = MyLinq.First(empty.Keys); empty.Remove(id); } else { id = count; count++; } toadd.Enqueue(new ToAdd() { indices = indices, indicesCount = indicesCount, vertices = vertices, verticesCount = verticesCount, id = id, transparent = transparent, texture = texture, center = center, radius = radius }); } return(id); }
public void Add(T value) { if (!dictionary.ContainsKey(value)) { if (free.Count > 0) { int pos = MyLinq.First(free.Keys); free.Remove(pos); list[pos] = value; dictionary[value] = pos; } else { list.Add(value); dictionary[value] = list.Count - 1; } } }