WWW获取Normal

来源:互联网 发布:穷人该不该谈恋爱 知乎 编辑:程序博客网 时间:2024/06/05 21:03
  1. loadedTexture= www.texture;
  2. normalTexture=newTexture2D(loadedTexture.width,loadedTexture.height,TextureFormat.ARGB32,false);
  3. Color theColour =newColor();
  4. for(int x=0; x<loadedTexture.width; x++){
  5. for(int y=0; y<loadedTexture.height; y++){
  6. theColour.r= loadedTexture.GetPixel(x,y).g;
  7. theColour.g= theColour.r;
  8. theColour.b= theColour.r;
  9. theColour.a= loadedTexture.GetPixel(x,y).r;
  10. normalTexture.SetPixel(x,y, theColour);
  11. }
  12. }
  13. normalTexture.Apply();
0 0