Exemple #1
0
        public override void Initialize()
        {
            _vertexBuildChunkProcessor = new VertexBuildChunkProcessor(GraphicsDevice);
            _lightingChunkProcessor    = new LightingChunkProcessor();

            base.Initialize();
        }
        public void Initialize()
        {
            _vertexBuildChunkProcessor = new VertexBuildChunkProcessor(_graphicsDevice);
            _lightingChunkProcessor    = new LightingChunkProcessor();

            Debug.WriteLine("Generate initial chunks");
            _world.visitChunks(DoGenerate, GENERATE_RANGE_HIGH);
            Debug.WriteLine("Light initial chunks");
            _world.visitChunks(DoLighting, LIGHT_RANGE);
            Debug.WriteLine("Build initial chunks");
            _world.visitChunks(DoBuild, BUILD_RANGE);
        }
Exemple #3
0
        public void Initialize()
        {
            _vertexBuildChunkProcessor = new VertexBuildChunkProcessor(_graphicsDevice);
            _lightingChunkProcessor    = new LightingChunkProcessor();

            Debug.WriteLine("Generate initial chunks");
            _world.visitChunks(DoInitialGenerate, GENERATE_RANGE);
            Debug.WriteLine("Light initial chunks");
            _world.visitChunks(DoLighting, LIGHT_RANGE);
            Debug.WriteLine("Build initial chunks");
            _world.visitChunks(DoBuild, BUILD_RANGE);

            #region debugFont Rectangle
            debugRectTexture = new Texture2D(_graphicsDevice, 1, 1);
            Color[] texcol = new Color[1];
            debugRectTexture.GetData(texcol);
            texcol[0] = Color.Black;
            debugRectTexture.SetData(texcol);

            genQVector2         = new Vector2(580, 0);
            lightQVector2       = new Vector2(580, 16);
            buildQVector2       = new Vector2(580, 32);
            memVector2          = new Vector2(580, 48);
            backgroundRectangle = new Rectangle(580, 0, 100, 144);
            #endregion

            #region Thread creation
            _workerQueueThread              = new Thread(new ThreadStart(WorkerThread));
            _workerQueueThread.Priority     = ThreadPriority.Highest;
            _workerQueueThread.IsBackground = true;
            _workerQueueThread.Start();

            _workerRemoveThread              = new Thread(new ThreadStart(WorkerRemoveThread));
            _workerRemoveThread.Priority     = ThreadPriority.Highest;
            _workerRemoveThread.IsBackground = true;
            _workerRemoveThread.Start();

            //_workerGenerateQueueThread = new Thread(new ThreadStart(WorkerGenerateQueueThread));
            //_workerGenerateQueueThread.Priority = ThreadPriority.AboveNormal;
            //_workerGenerateQueueThread.IsBackground = true;
            //_workerGenerateQueueThread.Name = "WorkerGenerateQueueThread";
            //_workerGenerateQueueThread.Start();

            //_workerLightingQueueThread = new Thread(new ThreadStart(WorkerLightingQueueThread));
            //_workerLightingQueueThread.Priority = ThreadPriority.AboveNormal;
            //_workerLightingQueueThread.IsBackground = true;
            //_workerLightingQueueThread.Name = "WorkerLightingQueueThread";
            //_workerLightingQueueThread.Start();

            //_workerBuildQueueThread = new Thread(new ThreadStart(WorkerBuildQueueThread));
            //_workerBuildQueueThread.Priority = ThreadPriority.AboveNormal;
            //_workerBuildQueueThread.IsBackground = true;
            //_workerBuildQueueThread.Name = "WorkerBuildQueueThread";
            //_workerBuildQueueThread.Start();

            _workerCheckThread              = new Thread(new ThreadStart(WorkerCheckThread));
            _workerCheckThread.Priority     = ThreadPriority.Highest;
            _workerCheckThread.IsBackground = true;
            _workerCheckThread.Name         = "WorkerCheckThread";
            _workerCheckThread.Start();
            #endregion
        }