public ClientChunk[] Process(
            TychaiaGameWorld world, 
            ChunkManagerEntity manager, 
            IGameContext gameContext, 
            IRenderContext renderContext)
        {
            foreach (
                var position in
                    this.m_PredeterminedChunkPositions.GetPurgableAbsolutePositions(
                        new Vector3(
                            world.IsometricCamera.Chunk.X,
                            world.IsometricCamera.Chunk.Y,
                            world.IsometricCamera.Chunk.Z)))
            {
                var chunk = world.ChunkOctree.Get((long)position.X, (long)position.Y, (long)position.Z);
                if (chunk != null)
                {
                    Console.WriteLine("FIXME: PURGING CHUNK");

                    // chunk.Purge();
                }
            }

            return null;
        }
        public ClientChunk[] Process(
            TychaiaGameWorld world,
            ChunkManagerEntity manager,
            IGameContext gameContext,
            IRenderContext renderContext)
        {
            if (this.ShowDebugInfo.ToLower() == "true")
            {
                foreach (var position in this.m_PredeterminedChunkPositions.GetAbsolutePositions(
                    new Vector3(
                        world.IsometricCamera.Chunk.X,
                        world.IsometricCamera.Chunk.Y,
                        world.IsometricCamera.Chunk.Z)))
                {
                    Action<Color> box = color => this.m_DebugCubeRenderer.RenderWireframeCube(
                        renderContext,
                        new Protogame.BoundingBox
                        {
                            X = position.X,
                            Y = position.Y,
                            Z = position.Z,
                            Width = this.m_ChunkSizePolicy.CellVoxelWidth * this.m_ChunkSizePolicy.ChunkCellWidth,
                            Height = this.m_ChunkSizePolicy.CellVoxelHeight * this.m_ChunkSizePolicy.ChunkCellHeight,
                            Depth = this.m_ChunkSizePolicy.CellVoxelDepth * this.m_ChunkSizePolicy.ChunkCellDepth
                        },
                        color);
                    var chunk = this.GetChunkOrGenerate(
                        world.ChunkOctree,
                        world.Level,
                        (long)position.X,
                        (long)position.Y,
                        (long)position.Z);
                    if (!chunk.Generated)
                        box(Color.Yellow);
                    else if (chunk.GraphicsEmpty)
                        box(Color.Red);
                    else
                        box(Color.Green);
                }
            }
            else
            {
                foreach (var position in this.m_PredeterminedChunkPositions.GetAbsolutePositions(
                    new Vector3(
                        world.IsometricCamera.Chunk.X,
                        world.IsometricCamera.Chunk.Y,
                        world.IsometricCamera.Chunk.Z)))
                {
                    this.GetChunkOrGenerate(
                        world.ChunkOctree,
                        world.Level,
                        (long)position.X,
                        (long)position.Y,
                        (long)position.Z);
                }
            }

            return null;
        }
Пример #3
0
 public ChunkManagerEntity(
     TychaiaGameWorld gameWorld, 
     IChunkAI[] chunkAI, 
     IProfiler profiler, 
     IChunkRenderer chunkRenderer)
 {
     this.m_World = gameWorld;
     this.m_ChunkAI = chunkAI;
     this.m_Profiler = profiler;
     this.m_ChunkRenderer = chunkRenderer;
     this.m_ChunksToRenderNext = new ClientChunk[0];
 }
        public ClientChunk[] Process(
            TychaiaGameWorld world, 
            ChunkManagerEntity manager, 
            IGameContext gameContext, 
            IRenderContext renderContext)
        {
            // If the currently focused chunk hasn't changed, then just use
            // the previous list of chunks.
            if (world.IsometricCamera.CurrentFocus == this.m_PreviousFocusChunk && !this.m_FirstProcess)
            {
                return null;
            }

            this.m_FirstProcess = false;
            this.m_PreviousFocusChunk = world.IsometricCamera.CurrentFocus;
            return
                this.m_PredeterminedChunkPositions.GetChunks(
                    world.ChunkOctree,
                    new Vector3(
                        world.IsometricCamera.Chunk.X,
                        world.IsometricCamera.Chunk.Y,
                        world.IsometricCamera.Chunk.Z)).ToArray();
        }