示例#1
0
        // The simulator wants to set a new heightmap for the terrain.
        public void SetTerrain(float[] heightMap)
        {
            float[] localHeightMap = heightMap;
            // If there are multiple requests for changes to the same terrain between ticks,
            //      only do that last one.
            PhysicsScene.PostTaintObject("TerrainManager.SetTerrain-" + m_worldOffset.ToString(), 0, delegate()
            {
                if (m_worldOffset != Vector3.Zero && MegaRegionParentPhysicsScene != null)
                {
                    // If a child of a mega-region, we shouldn't have any terrain allocated for us
                    ReleaseGroundPlaneAndTerrain();
                    // If doing the mega-prim stuff and we are the child of the zero region,
                    //    the terrain is added to our parent
                    if (MegaRegionParentPhysicsScene is BSScene)
                    {
                        DetailLog("{0},SetTerrain.ToParent,offset={1},worldMax={2}",
                                  BSScene.DetailLogZero, m_worldOffset, m_worldMax);
                        ((BSScene)MegaRegionParentPhysicsScene).TerrainManager.UpdateTerrain(
                            BSScene.CHILDTERRAIN_ID, localHeightMap,
                            m_worldOffset, m_worldOffset + DefaultRegionSize, true);
                    }
                }
                else
                {
                    // If not doing the mega-prim thing, just change the terrain
                    DetailLog("{0},SetTerrain.Existing", BSScene.DetailLogZero);

                    UpdateTerrain(BSScene.TERRAIN_ID, localHeightMap,
                                  m_worldOffset, m_worldOffset + DefaultRegionSize, true);
                }
            });
        }
示例#2
0
 // The simulator wants to set a new heightmap for the terrain.
 public void SetTerrain(float[] heightMap)
 {
     float[] localHeightMap = heightMap;
     // If there are multiple requests for changes to the same terrain between ticks,
     //      only do that last one.
     PhysicsScene.PostTaintObject("TerrainManager.SetTerrain", 0,
                                  delegate() { UpdateTerrain(BSScene.TERRAIN_ID, localHeightMap); });
 }
        // When physical properties are changed the linkset needs to recalculate
        //   its internal properties.
        // This is queued in the 'post taint' queue so the
        //   refresh will happen once after all the other taints are applied.
        public override void Refresh(BSPhysObject requestor)
        {
            base.Refresh(requestor);

            // Queue to happen after all the other taint processing
            PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
            {
                if (HasAnyChildren && IsRoot(requestor))
                {
                    RecomputeLinksetConstraints();
                }
            });
        }
 // Schedule a refresh to happen after all the other taint processing.
 private void ScheduleRebuild(BSPhysObject requestor)
 {
     DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1}",
               requestor.LocalID, Rebuilding);
     // When rebuilding, it is possible to set properties that would normally require a rebuild.
     //    If already rebuilding, don't request another rebuild.
     if (!Rebuilding)
     {
         PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate()
         {
             if (HasAnyChildren)
             {
                 RecomputeLinksetCompound();
             }
         });
     }
 }
 // Schedule a refresh to happen after all the other taint processing.
 protected override void ScheduleRebuild(BSPrimLinkable requestor)
 {
     DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}",
               requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren));
     // When rebuilding, it is possible to set properties that would normally require a rebuild.
     //    If already rebuilding, don't request another rebuild.
     //    If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
     if (!Rebuilding && HasAnyChildren)
     {
         PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate()
         {
             if (HasAnyChildren)
             {
                 RecomputeLinksetCompound();
             }
         });
     }
 }
 // must be called with m_linksetActivityLock or race conditions will haunt you.
 void InternalScheduleRebuild(BSPrimLinkable requestor)
 {
     DetailLog("{0},BSLinksetCompound.InternalScheduleRebuild,,rebuilding={1},hasChildren={2}", requestor.LocalID,
               Rebuilding, HasAnyChildren);
     RebuildScheduled = true;
     PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate()
     {
         if (HasAnyChildren)
         {
             if (AllPartsComplete)
             {
                 RecomputeLinksetCompound();
             }
             else
             {
                 DetailLog(
                     "{0},BSLinksetCompound.InternalScheduleRebuild,,rescheduling because not all children complete",
                     requestor.LocalID);
                 InternalScheduleRebuild(requestor);
             }
         }
         RebuildScheduled = false;
     });
 }