Пример #1
0
        private void landPatchCallbackCulled(Simulator simulator, int x, int y, int width, float[] data)
        {
            SimulatorCull sc;
            ulong         regionhandle = simulator.Handle;

            lock (SimulatorCullings)
                if (!SimulatorCullings.TryGetValue(regionhandle, out sc))
                {
                    SimulatorCullings[regionhandle] = sc = new SimulatorCull(simulator);
                }
            lock (sc)
            {
                SimPatchInfo p   = new SimPatchInfo(simulator, x, y, width, data);
                Vector3d     p3d = p.pos;
                p3d.Z = CameraPosition.Z;
                if (Vector3d.Distance(CameraPosition, p3d) > LandSightDistance)
                {
                    sc.PatchesCulled.Add(p);
                    return;
                }
                else
                {
                    if (sc.PatchesSent.Contains(p))
                    {
                        return;
                    }
                    sc.PatchesSent.Add(p);
                }
            }
            landPatchCallback(simulator, x, y, width, data);
        }
Пример #2
0
 public override bool Equals(object obj)
 {
     if (obj is SimPatchInfo)
     {
         SimPatchInfo other = (SimPatchInfo)obj;
         return(simulator == other.simulator && x == other.x && y == other.y);
     }
     return(false);
 }
Пример #3
0
 private void landPatchCallbackCulled(Simulator simulator, int x, int y, int width, float[] data)
 {
     SimulatorCull sc;
     ulong regionhandle = simulator.Handle;
     lock (SimulatorCullings)
         if (!SimulatorCullings.TryGetValue(regionhandle, out sc))
         {
             SimulatorCullings[regionhandle] = sc = new SimulatorCull(simulator);
         }
     lock (sc)
     {
         SimPatchInfo p = new SimPatchInfo(simulator, x, y, width, data);
         Vector3d p3d = p.pos;
         p3d.Z = CameraPosition.Z;
         if (Vector3d.Distance(CameraPosition, p3d) > LandSightDistance)
         {
             sc.PatchesCulled.Add(p);
             return;
         }
         else
         {
             if (sc.PatchesSent.Contains(p)) return;
             sc.PatchesSent.Add(p);
         }
     }
     landPatchCallback(simulator, x, y, width, data);
 }