1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
public Texture2D texture
{
get
{
return this.CreateTextureFromDownloadedData(false);
}
}
private Texture2D CreateTextureFromDownloadedData(bool markNonReadable)
{
if (!this.WaitUntilDoneIfPossible())
return new Texture2D(2, 2);
if (this._uwr.isNetworkError)
return (Texture2D) null;
DownloadHandler downloadHandler = this._uwr.downloadHandler;
if (downloadHandler == null)
return (Texture2D) null;
Texture2D tex = new Texture2D(2, 2);
tex.LoadImage(downloadHandler.data, markNonReadable);
return tex;
}
public Texture2D(int width, int height)
: this(width, height, TextureFormat.RGBA32, true, false, IntPtr.Zero)
{
}
internal Texture2D(
int width,
int height,
TextureFormat textureFormat,
bool mipChain,
bool linear,
IntPtr nativeTex)
{
if (!this.ValidateFormat(textureFormat))
return;
GraphicsFormat graphicsFormat = GraphicsFormatUtility.GetGraphicsFormat(textureFormat, !linear);
TextureCreationFlags flags = TextureCreationFlags.None;
if (mipChain)
flags |= TextureCreationFlags.MipChain;
if (GraphicsFormatUtility.IsCrunchFormat(textureFormat))
flags |= TextureCreationFlags.Crunch;
Texture2D.Internal_Create(this, width, height, graphicsFormat, flags, nativeTex);
}
|