Advertisement
Sc2ad

Texture2d

Jun 3rd, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. public class Texture2DAssetData : AssetData
  2. {
  3. public const int ClassID = 28;
  4.  
  5. public string name;
  6. public int forcedFallbackFormat;
  7. public int downscaleFallback;
  8. public int width;
  9. public int height;
  10. public int completeImageSize;
  11. public int textureFormat;
  12. public int mipCount;
  13. public bool isReadable;
  14. public bool streamingMips;
  15.  
  16. public int streamingMipsPriority;
  17. public int imageCount;
  18. public int textureDimension;
  19.  
  20. public int filterMode;
  21. public int anisotropic;
  22. public float mipBias;
  23. public int wrapU;
  24. public int wrapV;
  25. public int wrapW;
  26.  
  27. public int lightmapFormat;
  28. public int colorSpace;
  29. public byte[] imageData;
  30.  
  31. public int offset;
  32. public int size;
  33. public string path;
  34.  
  35. private const int CoverPowerOfTwo = 8;
  36. public static Texture2DAssetData CoverFromImageFile(string filePath, string levelID) {
  37. int coverDim = 1 << CoverPowerOfTwo;
  38. byte[] imageData = Utils.ImageFileToMipData(filePath, coverDim);
  39. return new Texture2DAssetData() {
  40. name = levelID + "Cover",
  41. forcedFallbackFormat = 4,
  42. downscaleFallback = 0,
  43. width = coverDim,
  44. height = coverDim,
  45. completeImageSize = imageData.Length,
  46. textureFormat = 3,
  47. mipCount = CoverPowerOfTwo+1,
  48. isReadable = false,
  49. streamingMips = false,
  50. streamingMipsPriority = 0,
  51. imageCount = 1,
  52. textureDimension = 2,
  53. filterMode = 2,
  54. anisotropic = 1,
  55. mipBias = -1,
  56. wrapU = 1,
  57. wrapV = 1,
  58. wrapW = 0,
  59. lightmapFormat = 6,
  60. colorSpace = 1,
  61. imageData = imageData,
  62. offset = 0,
  63. size = 0,
  64. path = "",
  65. };
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement