示例#1
0
        public static void UpdateLightProxy(MyLight light)
        {
            if ((!light.LightOn || light.LightType == MyLight.LightTypeEnum.None) && light.ProxyId != MyDynamicAABBTree.NullNode)
            {
                m_tree.RemoveProxy(light.ProxyId);
                light.ProxyId = MyDynamicAABBTree.NullNode;
            }

            BoundingBox bbox = BoundingBoxHelper.InitialBox;

            if (light.IsTypePoint || light.IsTypeHemisphere)
            {
                bbox = BoundingBox.CreateFromSphere(light.PointBoundingSphere);
            }
            if (light.IsTypeSpot)
            {
                var box = light.SpotBoundingBox;
                BoundingBoxHelper.AddBBox(box, ref bbox);
            }

            if (light.ProxyId == MyDynamicAABBTree.NullNode)
            {
                light.ProxyId = m_tree.AddProxy(ref bbox, light, 0);
            }
            else
            {
                m_tree.MoveProxy(light.ProxyId, ref bbox, Vector3.Zero);
            }
        }
示例#2
0
        void OnEntityPositionChanged(object sender, EventArgs e)
        {
            MySmallShipBot smallShip = sender as MySmallShipBot;

            if (smallShip != null)
            {
                BoundingBox bbox = new BoundingBox(smallShip.WorldAABB.Min - new Vector3(DANGER_ZONE_SIZE), smallShip.WorldAABB.Max + new Vector3(DANGER_ZONE_SIZE));
                m_dangerZoneStructure.MoveProxy(smallShip.GetDangerZoneID(), ref bbox, Vector3.Zero);
            }
        }
示例#3
0
        internal static int UpdateBvh(MyDynamicAABBTree bvh, LightId lid, bool enabled, int proxy, ref BoundingBox 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);
        }
示例#4
0
        public static void Move(MyEntity entity)
        {
            if (entity.GamePruningProxyId == MyConstants.GAME_PRUNING_STRUCTURE_PROXY_ID_NOT_INSERTED)
            {
                return;
            }

            BoundingBox bbox = entity.WorldAABB;

            if (bbox.Size() == Vector3.Zero)  // remove entities with zero bounding boxes
            {
                Remove(entity);
                return;
            }

            if (entity is MyWayPoint)
            {
                m_waypoints.MoveProxy(entity.GamePruningProxyId, ref bbox, Vector3.Zero);
            }
            else
            {
                m_others.MoveProxy(entity.GamePruningProxyId, ref bbox, Vector3.Zero);
            }
        }
示例#5
0
        internal static int UpdateBvh(MyDynamicAABBTree bvh, LightId lid, bool enabled, int proxy, ref BoundingBox 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;
        }