Ejemplo n.º 1
0
        public void Update(DwarfTime gameTime, Camera camera, GraphicsDevice g)
        {
            var visibleSet = new HashSet <VoxelChunk>();

            GetChunksIntersecting(camera.GetDrawFrustum(), visibleSet);
            RenderList = visibleSet.ToList();
            foreach (var chunk in visibleSet)
            {
                if (chunk.Visible == false)
                {
                    chunk.Visible = true;
                    chunk.Manager.InvalidateChunk(chunk);
                }

                chunk.RenderCycleWhenLastVisible = RenderCycle;
            }

            foreach (var chunk in RenderList)
            {
                if (chunk.RenderCycleWhenLastVisible != RenderCycle)
                {
                    chunk.Visible = false;
                }
            }

            RenderList   = visibleSet.ToList();
            RenderCycle += 1;
        }
Ejemplo n.º 2
0
 public void Update(DwarfTime gameTime, Camera camera, GraphicsDevice g)
 {
     visibilityChunksTimer.Update(gameTime);
     if (visibilityChunksTimer.HasTriggered)
     {
         var visibleSet = new HashSet <VoxelChunk>();
         GetChunksIntersecting(camera.GetDrawFrustum(), visibleSet);
         RenderList = visibleSet.ToList();
     }
 }