Exemplo n.º 1
0
 IEnumerator FillTexturesThreaded()
 {
     threadShouldBeWorking = new AutoResetEvent(false);
     thread = new Thread(FillTextures);
     thread.IsBackground = true;
     thread.Start();
     for (int i = 0; i < links.Length; i++)
     {
         currentLink = links[i];
         currentLink.AllocateTextures();
         if (currentLink.diagram.isCubemap)
         {
             for (CubemapFace d = CubemapFace.PositiveX; d <= CubemapFace.NegativeZ; d++)
             {
                 currentLink.currentDirection = d;
                 threadFinished = false;
                 threadShouldBeWorking.Set();
                 while (!threadFinished)
                 {
                     yield return(null);
                 }
                 currentLink.AssignCubemapFaces(buffers);
             }
         }
         else
         {
             threadFinished = false;
             threadShouldBeWorking.Set();
             while (!threadFinished)
             {
                 yield return(null);
             }
         }
         currentLink.ApplyTextures(buffers);
         currentLink.AssignTexturesToMaterials();
     }
     currentLink = null;
     threadShouldBeWorking.Set();
     FinishGenerating();
 }
Exemplo n.º 2
0
 void FillTexturesImmediately()
 {
     for (int i = 0; i < links.Length; i++)
     {
         DiagramMaterialLink link = links[i];
         link.AllocateTextures();
         if (link.diagram.isCubemap)
         {
             for (CubemapFace d = CubemapFace.PositiveX; d <= CubemapFace.NegativeZ; d++)
             {
                 link.currentDirection = d;
                 link.Process(ref buffers);
                 link.AssignCubemapFaces(buffers);
             }
         }
         else
         {
             link.Process(ref buffers);
         }
         link.ApplyTextures(buffers);
         link.AssignTexturesToMaterials();
     }
     FinishGenerating();
 }