private static void EnqueueHistory(MyVoxelDataRequest request) { using (m_historyLock.AcquireExclusiveUsing()) { if (UnculledRequestHistory.Count >= MAX_UNCULLED_HISTORY) { UnculledRequestHistory.Dequeue(); } request.Target = null; UnculledRequestHistory.Enqueue(request); } MyConcurrentHashSet <Vector3I> sizes; if (!KnownLodSizes.TryGetValue(request.Lod, out sizes)) { sizes = new MyConcurrentHashSet <Vector3I>(); if (!KnownLodSizes.TryAdd(request.Lod, sizes)) { sizes = KnownLodSizes[request.Lod]; } } sizes.Add(request.maxInLod - request.minInLod + Vector3I.One); }
public void RegisterFromAssembly(Assembly assembly) { #if XB1 // XB1_ALLINONEASSEMBLY System.Diagnostics.Debug.Assert(m_registered == false); if (m_registered == true) { return; } m_registered = true; foreach (var type in MyAssembly.GetTypes().Where(t => typeof(MyExternalReplicable).IsAssignableFrom(t) && !t.IsAbstract)) #else // !XB1 foreach (var type in assembly.GetTypes().Where(t => typeof(MyExternalReplicable).IsAssignableFrom(t) && !t.IsAbstract)) #endif // !XB1 { var objType = type.FindGenericBaseTypeArgument(typeof(MyExternalReplicable <>)); if (objType != null && !m_objTypeToExternalReplicableType.ContainsKey(objType)) { Debug.Assert(type.HasDefaultConstructor(), string.Format("Type '{0}' should have public constructor", type.Name)); m_objTypeToExternalReplicableType.TryAdd(objType, type); } } }
// Don't call remove reference on this, this shape is pooled public HkShape GetDebrisShape(MyModel model, HkShapeType shapeType) { MyModelShapeInfo info = new MyModelShapeInfo(); info.Model = model; info.ShapeType = shapeType; HkShape shape; if (!m_shapes.TryGetValue(info, out shape)) { shape = CreateShape(model, shapeType); m_shapes.TryAdd(info, shape); } return(shape); }