public static void Move(MyEntity entity) { if (entity.GamePruningProxyId != MyConstants.PRUNING_PROXY_ID_UNITIALIZED) { BoundingBoxD bbox = GetEntityAABB(entity); if (bbox.Size == Vector3D.Zero) // remove entities with zero bounding boxes { Remove(entity); return; } m_aabbTree.MoveProxy(entity.GamePruningProxyId, ref bbox, Vector3D.Zero); if (entity.TargetPruningProxyId != MyConstants.PRUNING_PROXY_ID_UNITIALIZED) { m_targetsTree.MoveProxy(entity.TargetPruningProxyId, ref bbox, Vector3D.Zero); } if (entity.SensablePruningProxyId != MyConstants.PRUNING_PROXY_ID_UNITIALIZED) { m_sensableTree.MoveProxy(entity.SensablePruningProxyId, ref bbox, Vector3D.Zero); } var voxelMap = entity as MyVoxelMap; if (voxelMap != null) { m_voxelMapsTree.MoveProxy(voxelMap.VoxelMapPruningProxyId, ref bbox, Vector3D.Zero); } } }
private static void MoveInternal(MyEntity entity) { if (entity.Parent != null) { return; } VRage.ProfilerShort.Begin(string.Format("Move:{0}", (entity.GetTopMostParent() == entity ? "Topmost" : "Child"))); if (entity.TopMostPruningProxyId != MyConstants.PRUNING_PROXY_ID_UNITIALIZED) { BoundingBoxD bbox = GetEntityAABB(entity); if (bbox.Size == Vector3D.Zero) // remove entities with zero bounding boxes { Remove(entity); VRage.ProfilerShort.End(); return; } var voxelMap = entity as MyVoxelBase; if (voxelMap != null) { m_voxelMapsTree.MoveProxy(voxelMap.VoxelMapPruningProxyId, ref bbox, Vector3D.Zero); } if (entity.TopMostPruningProxyId != MyConstants.PRUNING_PROXY_ID_UNITIALIZED) { m_topMostEntitiesTree.MoveProxy(entity.TopMostPruningProxyId, ref bbox, Vector3D.Zero); } } VRage.ProfilerShort.End(); }
public static void MovePlaceArea(MyPlaceArea area) { if (area.PlaceAreaProxyId != MyConstants.PRUNING_PROXY_ID_UNITIALIZED) { BoundingBoxD box = area.PositionComp.WorldAABB; m_aabbTree.MoveProxy(area.PlaceAreaProxyId, ref box, Vector3.Zero); } }
public static void MoveBroadcaster(MyRadioBroadcaster broadcaster) { if (broadcaster.RadioProxyID != MyConstants.PRUNING_PROXY_ID_UNITIALIZED) { BoundingBoxD box = BoundingBoxD.CreateFromSphere(new BoundingSphereD(broadcaster.BroadcastPosition, broadcaster.BroadcastRadius)); m_aabbTree.MoveProxy(broadcaster.RadioProxyID, ref box, Vector3.Zero); } }
private void ObjectMoved(ProceduralObject item) { if (item.m_proxyID < 0) { return; } m_tree.MoveProxy(item.m_proxyID, ref item.m_boundingBox, Vector3D.Zero); }
private static void MoveInternal(MyEntity entity) { if (entity.Parent != null) { return; } ProfilerShort.Begin(string.Format("Move:{0}", (entity.GetTopMostParent() == entity ? "Topmost" : "Child"))); if (entity.TopMostPruningProxyId != MyVRageConstants.PRUNING_PROXY_ID_UNITIALIZED) { BoundingBoxD bbox = GetEntityAABB(entity); if (bbox.Size == Vector3D.Zero) // remove entities with zero bounding boxes { Remove(entity); ProfilerShort.End(); return; } var voxelMap = entity as MyVoxelBase; if (voxelMap != null) { m_voxelMapsTree.MoveProxy(voxelMap.VoxelMapPruningProxyId, ref bbox, Vector3D.Zero); } if (entity.TopMostPruningProxyId != MyVRageConstants.PRUNING_PROXY_ID_UNITIALIZED) { bool stat = IsEntityStatic(entity); // Swap trees if necessary. if (stat != entity.StaticForPruningStructure) { if (entity.StaticForPruningStructure) { m_staticObjectsTree.RemoveProxy(entity.TopMostPruningProxyId); entity.TopMostPruningProxyId = m_dynamicObjectsTree.AddProxy(ref bbox, entity, 0); } else { m_dynamicObjectsTree.RemoveProxy(entity.TopMostPruningProxyId); entity.TopMostPruningProxyId = m_staticObjectsTree.AddProxy(ref bbox, entity, 0); } entity.StaticForPruningStructure = stat; } else { if (entity.StaticForPruningStructure) { m_staticObjectsTree.MoveProxy(entity.TopMostPruningProxyId, ref bbox, Vector3D.Zero); } else { m_dynamicObjectsTree.MoveProxy(entity.TopMostPruningProxyId, ref bbox, Vector3D.Zero); } } } } ProfilerShort.End(); }
public void MoveShield(DefenseShields shield) { if (shield.DtreeProxyId == -1) { return; } BoundingBoxD worldAabb = shield.WebBox; _aabbTree.MoveProxy(shield.DtreeProxyId, ref worldAabb, Vector3.Zero); }
public void UpdatePosition(ref BoundingBoxD box, T obj) { int index; if (indexes.TryGetValue(obj, out index)) { tree.MoveProxy(index, ref box, Vector3D.Zero); boxes[index].Box = box; } }
public void Move(AABBEntity entity) { int proxyId = GetProxyIdForEntity(entity); if (proxyId != PROXY_ID_UNITIALIZED) { BoundingBoxD bbox = GetEntityAABB(entity); if (bbox.Size == Vector3D.Zero) // remove entities with zero bounding boxes { Remove(entity); return; } MathTree.MoveProxy(proxyId, ref bbox, Vector3D.Zero); } }
internal static int UpdateBvh(MyDynamicAABBTreeD bvh, LightId lid, bool enabled, int proxy, ref BoundingBoxD aabb) { if (enabled && proxy == -1) { return(bvh.AddProxy(ref aabb, lid, 0)); } else if (enabled && proxy != -1) { bvh.MoveProxy(proxy, ref aabb, Vector3.Zero); return(proxy); } else { bvh.RemoveProxy(proxy); } return(-1); }
internal static int UpdateBvh(MyDynamicAABBTreeD bvh, LightId lid, bool enabled, int proxy, ref BoundingBoxD aabb) { if(enabled && proxy == -1) { return bvh.AddProxy(ref aabb, lid, 0); } else if(enabled && proxy != -1) { bvh.MoveProxy(proxy, ref aabb, Vector3.Zero); return proxy; } else { bvh.RemoveProxy(proxy); } return -1; }
void OnRootMoved(IMyReplicable replicable) { BoundingBoxD aabb = replicable.GetAABB(); m_rootsAABB.MoveProxy(m_proxies[replicable], ref aabb, Vector3D.One); }