This commit is contained in:
2023-03-02 22:07:43 +02:00
parent 1a0709d113
commit 5e48806b8c
21 changed files with 145 additions and 82 deletions

View File

@@ -41,7 +41,7 @@ namespace Game
[ExecuteInEditMode]
public class Q3MapImporter : Script
{
//private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_q1.map";
//private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_q1.map";u8
//private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_q3.map";
//private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_valve.map";
//private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\dm4.map";
@@ -414,7 +414,9 @@ namespace Game
string mapPath_ = mapPath;
if (!File.Exists(mapPath_))
mapPath_ = Path.Combine(Directory.GetCurrentDirectory(), mapPath_);
mapPath_ = Path.Combine(Directory.GetCurrentDirectory(), mapPath);
if (!File.Exists(mapPath_))
mapPath_ = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", mapPath);
byte[] mapChars = File.ReadAllBytes(mapPath_);
root = MapParser.Parse(mapChars);
@@ -661,17 +663,10 @@ namespace Game
if (mesh.vertices.Count == 0)
continue;
var tassk = Task.Run(() =>
{
List<int> indices = new List<int>();
foreach (var ind in mesh.indices)
indices.Add((int)ind);
geom.model.LODs[0].Meshes[i].UpdateMesh(mesh.vertices.ToArray(), indices.ToArray(), mesh.normals.ToArray() /*,
null, mesh.uvs*/);
geom.model.LODs[0].Meshes[i].MaterialSlotIndex = i;
geom.model.MaterialSlots[i].Material = geom.meshes[i].material;
});
tassk.Wait();
geom.model.LODs[0].Meshes[i].UpdateMesh(mesh.vertices, mesh.indices, mesh.normals,
null, mesh.uvs);
geom.model.LODs[0].Meshes[i].MaterialSlotIndex = i;
geom.model.MaterialSlots[i].Material = geom.meshes[i].material;
}
//Not supported yet, should be done here
@@ -1109,7 +1104,7 @@ namespace Game
break;
}
Console.Print("entity parsing time: " + sw.Elapsed.TotalMilliseconds + "ms");
//Console.Print("entity parsing time: " + sw.Elapsed.TotalMilliseconds + "ms");
}