Advertisement
Guest User

Untitled

a guest
Mar 16th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1.  // fill the color maps with the 2D arrays of pixel colors
  2.         currentBuild.pixelColorMaps = new Color[textureList.Length][,];
  3.  
  4.         for (int currentTextureIndex = 0; currentTextureIndex < textureList.Length; currentTextureIndex++)
  5.         {
  6.             Texture2D currentTexture = textureList[currentTextureIndex];
  7.             currentBuild.pixelColorMaps[currentTextureIndex] = new Color[currentTexture.width,currentTexture.height];
  8.            
  9.             Color[] flattenedColorMap = currentTexture.GetPixels();
  10.  
  11.             for (int currentPixelIndex = 0; currentPixelIndex < flattenedColorMap.Length; currentPixelIndex++)
  12.             {
  13.                 int xIndex = currentPixelIndex % currentTexture.width;
  14.                 int yIndex = currentPixelIndex / currentTexture.height;
  15.                 currentBuild.pixelColorMaps[currentTextureIndex][xIndex,yIndex] = flattenedColorMap[currentPixelIndex];
  16.             }
  17.  
  18.  
  19.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement