Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
Texture2DReader.cs
浏览该文件的文档.
2using Engine.Media;
3
4namespace Game.IContentReader {
6 public override string Type => "Engine.Graphics.Texture2D";
7 public override string[] DefaultSuffix => ["astc", "astcsrgb", "webp", "png", "jpg", "jpeg"];
8
9 public override object Get(ContentInfo[] contents) {
10 ContentInfo contentInfo = contents[0];
11 if (contentInfo.ContentPath == "Fonts/Pericles") {
12 return Texture2D.Load(ContentManager.Get<Image>(contentInfo.ContentPath, contentInfo.ContentSuffix), 3);
13 }
14 string suffix = contentInfo.ContentSuffix.ToLower();
15 return suffix switch {
16#if DIRECT3D11
17 ".astc" or ".astcsrgb" => throw new NotImplementedException(),
18#else
19 ".astc" => CompressedTexture2D.Load(contentInfo.Duplicate()),
20 ".astcsrgb" => CompressedTexture2D.Load(contentInfo.Duplicate(), false),
21#endif
22 _ => Texture2D.Load(ContentManager.Get<Image>(contentInfo.ContentPath, suffix))
23 };
24 }
25 }
26}
static new CompressedTexture2D Load(Stream stream, bool linear=true, int mipLevelsCount=1)
static Texture2D Load(LegacyImage image, int mipLevelsCount=1)
static object Get(Type type, string name)
override object Get(ContentInfo[] contents)