Exemplo n.º 1
0
    private void startTileThreadDistant()
    {

        //Create a new thread to calculate the first tile in tileQueue
        if (tileCreationThreadDistant == null)
        {

            //If list is not empty
            if (tileQueueDistant.Count > 0)
            {

                //Ensure the tile is still relevent and hasn't been created in past
                if (tileQueueTouchedDistant.Contains(tileQueueDistant[0]))
                {
                    
                    string tileID = tileQueueDistant[0].x.ToString() + ":" + tileQueueDistant[0].y.ToString();

                    tileCreationThreadDistant = new TileCreationThread();
                    tileCreationThreadDistant.InData = tileQueueDistant[0];
                    tileCreationThreadDistant.InHeightMapSize = m_heightMapSizeLowRes;
                    tileCreationThreadDistant.InTerrainSize = terrainSize;
                    tileCreationThreadDistant.Start();

                }

                else tileQueueDistant.RemoveAt(0);

            }

        }

    }
Exemplo n.º 2
0
    private void taskHeightMapThreadDistant()
    {
        //Is a thread active
        if (tileCreationThreadDistant != null)
        {

            //Check status of thread task
            if (tileCreationThreadDistant.Update())
            {

                string tileID = tileCreationThreadDistant.OutTileID;
                HeightMapsDistant[tileID] = tileCreationThreadDistant.OutData;
                tileQueueDistant.RemoveAt(0);
                tileQueueDistantNonIndex.Remove(tileID);
                tileCreationThreadDistant = null;


            }

        }

    }
Exemplo n.º 3
0
    private void taskHeightMapThread()
    {
        //Is a thread active
        if (tileCreationThread != null)
        {

            //Check status of thread task
            if (tileCreationThread.Update())
            {

                string tileID = tileCreationThread.OutTileID;
                float[,] htmap = new float[m_heightMapSizeHighRes, m_heightMapSizeHighRes];
                htmap = tileCreationThread.OutData;
                HeightMaps.Add(tileID, htmap);
                //tileClassifications[terrainUsage[tileID]] = tileCreationThread.OutTerrainClassification;
                RiverMeshHeights[tileID] = tileCreationThread.RiverWaterMeshVertices;
                tileQueue.RemoveAt(0);
                tileQueueNonIndex.Remove(tileID);
                tileCreationThread = null;
                
            }

        }

    }