Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
MtllibStruct.cs
浏览该文件的文档.
1namespace Game {
2 public class MtllibStruct {
3 public Dictionary<string, string> TexturePaths = [];
4
5 public static MtllibStruct Load(Stream stream) {
6 MtllibStruct mtllibStruct = new();
7 using (stream) {
8 StreamReader streamReader = new(stream);
9 string Tkey = null;
10 while (!streamReader.EndOfStream) {
11 string line = streamReader.ReadLine();
12 string[] spl = line.Split([(char)0x09, (char)0x20], StringSplitOptions.None);
13 switch (spl[0]) {
14 case "newmtl": {
15 Tkey = spl[1];
16 break;
17 }
18 case "map_Kd": {
19 if (string.IsNullOrEmpty(Tkey)) {
20 throw new Exception("请先newmtl");
21 }
22 mtllibStruct.TexturePaths.Add(Tkey, spl[1]);
23 break;
24 }
25 }
26 }
27 }
28 return mtllibStruct;
29 }
30 }
31}
static MtllibStruct Load(Stream stream)
Dictionary< string, string > TexturePaths