public void Load(int i) { if (Loaded.Contains(i)) { return; } Loaded.Add(i); LoadQueue.Enqueue(i); }
private void CheckFunc(PointOctreeNode <Integer> .OctreeObject octreeObject) { var objectPosition = DataSet[octreeObject.Obj].Position; var distanceCurrent = Vector3.Distance(cachePosition, objectPosition); if (distanceCurrent > NearRadius && distanceCurrent < FarRadius && !Loaded.Contains(octreeObject.Obj)) { Loaded.Add(octreeObject.Obj); lock (LoadQueue) { LoadQueue.Enqueue(octreeObject.Obj); } } else if ((distanceCurrent < NearRadius || distanceCurrent > FarRadius) && Loaded.Contains(octreeObject.Obj)) { Loaded.Remove(octreeObject.Obj); lock (UnloadQueue) { UnloadQueue.Enqueue(octreeObject.Obj); } } }