コード例 #1
0
        public override void CleanUp()
        {
            base.CleanUp();

            mesh   = null;
            convex = null;
        }
コード例 #2
0
        public override void CleanUp()
        {
            base.CleanUp();

            mesh   = null;
            mobile = null;
        }
コード例 #3
0
ファイル: MCCMCCPairHandler.cs プロジェクト: Morphan1/Voxalia
        public override void CleanUp()
        {
            base.CleanUp();

            mesh = null;
            mobile = null;
        }
コード例 #4
0
ファイル: RegionChunks.cs プロジェクト: Morphan1/Voxalia
 public void AddChunk(FullChunkObject mesh)
 {
     if (mesh == null)
     {
         return;
     }
     PhysicsWorld.Add(mesh);
 }
コード例 #5
0
ファイル: Chunk.cs プロジェクト: Morphan1/Voxalia
 public void AddToWorld()
 {
     if (FCO != null)
     {
         return;
     }
     if (CSize == CHUNK_SIZE)
     {
         FCO = new FullChunkObject(WorldPosition.ToVector3() * CHUNK_SIZE, BlocksInternal);
         FCO.CollisionRules.Group = CollisionUtil.WorldSolid;
         OwningRegion.AddChunk(FCO);
         IsAdded = true;
     }
 }
コード例 #6
0
 public override void CleanUp()
 {
     convex = null;
     mesh   = null;
     for (int i = ActivePairs.Count - 1; i >= 0; --i)
     {
         ReturnPair(ActivePairs.Values[i]);
         ActivePairs.Values[i].CleanUp();
     }
     ActivePairs.Clear();
     ActivePairs.Dispose();
     activePairsBackBuffer.Dispose();
     base.CleanUp();
 }
コード例 #7
0
 public override void Initialize(Collidable newCollidableA, Collidable newCollidableB)
 {
     convex = newCollidableA as ConvexCollidable;
     mesh   = newCollidableB as FullChunkObject;
     if (convex == null || mesh == null)
     {
         convex = newCollidableB as ConvexCollidable;
         mesh   = newCollidableA as FullChunkObject;
         if (convex == null || mesh == null)
         {
             throw new ArgumentException("Inappropriate types used to initialize contact manifold.");
         }
     }
     ActivePairs           = new QuickDictionary <Vector3i, GeneralConvexPairTester>(BufferPools <Vector3i> .Locking, BufferPools <GeneralConvexPairTester> .Locking, BufferPools <int> .Locking, 3);
     activePairsBackBuffer = new QuickDictionary <Vector3i, GeneralConvexPairTester>(BufferPools <Vector3i> .Locking, BufferPools <GeneralConvexPairTester> .Locking, BufferPools <int> .Locking, 3);
 }
コード例 #8
0
 public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
 {
     if (noRecurse)
     {
         return;
     }
     noRecurse = true;
     mesh      = entryA as FullChunkObject;
     convex    = entryB as ConvexCollidable;
     if (mesh == null || convex == null)
     {
         mesh   = entryB as FullChunkObject;
         convex = entryA as ConvexCollidable;
         if (mesh == null || convex == null)
         {
             throw new ArgumentException("Inappropriate types used to initialize pair.");
         }
     }
     broadPhaseOverlap = new BroadPhaseOverlap(convex, mesh, broadPhaseOverlap.CollisionRule);
     UpdateMaterialProperties(convex.Entity != null ? convex.Entity.Material : null, mesh.Material);
     base.Initialize(entryA, entryB);
     noRecurse = false;
 }
コード例 #9
0
 public override void CleanUp()
 {
     convex = null;
     mesh = null;
     for (int i = ActivePairs.Count - 1; i >= 0; --i)
     {
         ReturnPair(ActivePairs.Values[i]);
         ActivePairs.Values[i].CleanUp();
     }
     ActivePairs.Clear();
     ActivePairs.Dispose();
     activePairsBackBuffer.Dispose();
     base.CleanUp();
 }
コード例 #10
0
 public override void Initialize(Collidable newCollidableA, Collidable newCollidableB)
 {
     convex = newCollidableA as ConvexCollidable;
     mesh = newCollidableB as FullChunkObject;
     if (convex == null || mesh == null)
     {
         convex = newCollidableB as ConvexCollidable;
         mesh = newCollidableA as FullChunkObject;
         if (convex == null || mesh == null)
         {
             throw new ArgumentException("Inappropriate types used to initialize contact manifold.");
         }
     }
     ActivePairs = new QuickDictionary<Vector3i, GeneralConvexPairTester>(BufferPools<Vector3i>.Locking, BufferPools<GeneralConvexPairTester>.Locking, BufferPools<int>.Locking, 3);
     activePairsBackBuffer = new QuickDictionary<Vector3i, GeneralConvexPairTester>(BufferPools<Vector3i>.Locking, BufferPools<GeneralConvexPairTester>.Locking, BufferPools<int>.Locking, 3);
 }
コード例 #11
0
ファイル: Region.cs プロジェクト: Morphan1/Voxalia
 public void AddChunk(FullChunkObject mesh)
 {
     PhysicsWorld.Add(mesh);
 }
コード例 #12
0
ファイル: Region.cs プロジェクト: Morphan1/Voxalia
 public void RemoveChunkQuiet(FullChunkObject mesh)
 {
     PhysicsWorld.Remove(mesh);
 }
コード例 #13
0
ファイル: PlayerEntity.cs プロジェクト: Morphan1/Voxalia
 public void UpdateForPacketFromServer(double gtt, long ID, Location pos, Location vel, bool _pup)
 {
     ServerLocation = pos;
     if (ServerFlags.HasFlag(YourStatusFlags.INSECURE_MOVEMENT))
     {
         return;
     }
     if (InVehicle)
     {
         return;
     }
     // TODO: big solid entities!
     double now = TheRegion.GlobalTickTimeLocal;
     if (TheClient.CVars.n_movemode.ValueI == 2)
     {
         // TODO: Remove outsider chunks!
         for (int x = -1; x <= 1; x++)
         {
             for (int y = -1; y <= 1; y++)
             {
                 for (int z = -1; z <= 1; z++)
                 {
                     Vector3i ch = TheRegion.ChunkLocFor(pos) + new Vector3i(x, y, z);
                     Chunk chunk = TheRegion.GetChunk(ch);
                     if (chunk == null)
                     {
                         continue;
                     }
                     if (!NMTWOMeshes.ContainsKey(ch))
                     {
                         if (chunk.FCO != null)
                         {
                             FullChunkObject im = new FullChunkObject(chunk.FCO.Position, chunk.FCO.ChunkShape);
                             NMTWOWorld.Add(im);
                             NMTWOMeshes[ch] = im;
                         }
                     }
                 }
             }
         }
         AddUIS();
         int xf = 0;
         double jumpback = gtt - lGTT;
         if (jumpback < 0)
         {
             return;
         }
         double target = TheRegion.GlobalTickTimeLocal - jumpback;
         UserInputSet past = null;
         while (xf < Input.Length)
         {
             UserInputSet uis = Input[xf];
             if (uis.GlobalTimeLocal < target)
             {
                 past = uis;
                 Input.Pop();
                 continue;
             }
             else if (xf == 0)
             {
                 double mult = Math.Max(Math.Min(jumpback / TheClient.CVars.n_movement_adjustment.ValueD, 1.0), 0.01);
                 NMTWOSetPosition(uis.Position + (pos - uis.Position) * mult);
                 NMTWOSetVelocity(uis.Velocity + (vel - uis.Velocity) * mult);
             }
             xf++;
             double delta;
             if (xf < 2)
             {
                 if (past == null)
                 {
                     continue;
                 }
                 delta = uis.GlobalTimeLocal - target;
                 SetBodyMovement(NMTWOCBody, past);
             }
             else
             {
                 UserInputSet prev = Input[xf - 2];
                 delta = uis.GlobalTimeLocal - prev.GlobalTimeLocal;
                 SetBodyMovement(NMTWOCBody, prev);
             }
             SetMoveSpeed(NMTWOCBody, uis);
             if (!_pup)
             {
                 NMTWOTryToJump(uis);
             }
             lPT = uis.GlobalTimeLocal;
             NMTWOWorld.Update((float)delta);
             FlyForth(NMTWOCBody, uis, delta); // TODO: Entirely disregard NWTWOWorld if flying?
         }
         AddUIS();
         SetPosition(NMTWOGetPosition());
         SetVelocity(new Location(NMTWOCBody.Body.LinearVelocity));
         pup = _pup;
         lGTT = gtt;
     }
     else
     {
         double delta = lPT - now;
         Location dir = pos - TheClient.Player.GetPosition();
         if (dir.LengthSquared() < TheClient.CVars.n_movement_maxdistance.ValueF * TheClient.CVars.n_movement_maxdistance.ValueF)
         {
             SetPosition(GetPosition() + dir / Math.Max(TheClient.CVars.n_movement_adjustment.ValueF / delta, 1));
             Location veldir = vel - GetVelocity();
             SetVelocity(GetVelocity() + veldir / Math.Max(TheClient.CVars.n_movement_adjustment.ValueF / delta, 1));
         }
         else
         {
             TheClient.Player.SetPosition(pos);
             TheClient.Player.SetVelocity(vel);
         }
         lPT = now;
     }
 }
コード例 #14
0
        public override void CleanUp()
        {
            base.CleanUp();

            mesh = null;
            convex = null;
        }
コード例 #15
0
ファイル: Chunk.cs プロジェクト: Morphan1/Voxalia
 /// <summary>
 /// Sync only.
 /// </summary>
 public void AddToWorld()
 {
     foreach (Entity e in entsToSpawn)
     {
         OwningRegion.SpawnEntity(e);
     }
     entsToSpawn.Clear();
     foreach (SyncScheduleItem s in fixesToRun)
     {
         s.MyAction.Invoke();
     }
     fixesToRun.Clear();
     if (Flags.HasFlag(ChunkFlags.ISCUSTOM))
     {
         return;
     }
     if (FCO != null)
     {
         return;
     }
     FCO = new FullChunkObject(WorldPosition.ToVector3() * CHUNK_SIZE, BlocksInternal);
     FCO.CollisionRules.Group = CollisionUtil.WorldSolid;
     OwningRegion.AddChunk(FCO);
     OwningRegion.AddCloudsToNewChunk(this);
     ChunkDetect();
 }
コード例 #16
0
ファイル: RegionChunks.cs プロジェクト: Morphan1/Voxalia
 public void RemoveChunkQuiet(FullChunkObject mesh)
 {
     if (mesh == null)
     {
         return;
     }
     if (TheServer.ShuttingDown)
     {
         return;
     }
     PhysicsWorld.Remove(mesh);
 }
コード例 #17
0
 public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
 {
     if (noRecurse)
     {
         return;
     }
     noRecurse = true;
     mesh = entryA as FullChunkObject;
     convex = entryB as ConvexCollidable;
     if (mesh == null || convex == null)
     {
         mesh = entryB as FullChunkObject;
         convex = entryA as ConvexCollidable;
         if (mesh == null || convex == null)
         {
             throw new ArgumentException("Inappropriate types used to initialize pair.");
         }
     }
     broadPhaseOverlap = new BroadPhaseOverlap(convex, mesh, broadPhaseOverlap.CollisionRule);
     UpdateMaterialProperties(convex.Entity != null ? convex.Entity.Material : null, mesh.Material);
     base.Initialize(entryA, entryB);
     noRecurse = false;
 }
コード例 #18
0
ファイル: Chunk.cs プロジェクト: Morphan1/Voxalia
 /// <summary>
 /// Sync only.
 /// </summary>
 public void UnloadSafely(Action callback = null)
 {
     SaveAsNeeded(callback);
     clearentities();
     if (FCO != null)
     {
         OwningRegion.RemoveChunkQuiet(FCO);
         FCO = null;
     }
     OwningRegion.RemoveCloudsFrom(this);
 }