missing texture, split map scenes
This commit is contained in:
@@ -30,15 +30,15 @@ namespace Game
|
||||
public class Q3MapImporter : Script
|
||||
{
|
||||
//private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_q1.map";
|
||||
private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_q3.map";
|
||||
//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";
|
||||
|
||||
//private string mapPath = @"C:\dev\Goake\maps\aerowalk\aerowalk.map";
|
||||
public string mapPath = @"C:\dev\Goake\maps\aerowalk\aerowalk.map";
|
||||
//private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\problematic.map";
|
||||
|
||||
Model model;
|
||||
public MaterialBase material;
|
||||
private MaterialBase missingMaterial;
|
||||
|
||||
static void QuickHull(Vector3[] points, out Vector3[] outVertices)
|
||||
{
|
||||
@@ -188,9 +188,15 @@ namespace Game
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
byte[] mapChars = File.ReadAllBytes(mapPath);
|
||||
{
|
||||
var workDir = Directory.GetCurrentDirectory();
|
||||
var matBasePath = Path.Combine(workDir, "Content", "Materials");
|
||||
var assetPath = Path.Combine(matBasePath, "missing.flax");
|
||||
missingMaterial = Content.Load<MaterialBase>(assetPath);
|
||||
}
|
||||
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
byte[] mapChars = File.ReadAllBytes(mapPath);
|
||||
root = MapParser.Parse(mapChars);
|
||||
sw.Stop();
|
||||
|
||||
@@ -201,7 +207,6 @@ namespace Game
|
||||
|
||||
if (!oneMesh)
|
||||
{
|
||||
|
||||
Dictionary<string, MaterialBase> materials = new Dictionary<string, MaterialBase>();
|
||||
{
|
||||
BrushMaterialList brushMaterialList = Engine.GetCustomSettings("BrushMaterialsLegacy")
|
||||
@@ -213,9 +218,8 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var mapRootActor = Actor.AddChild<Actor>();
|
||||
mapRootActor.Name = "MapRootActor";
|
||||
var worldSpawnActor = Actor.AddChild<Actor>();
|
||||
worldSpawnActor.Name = "WorldSpawn";
|
||||
|
||||
List<BrushGeometry> brushGeometries = new List<BrushGeometry>(root.entities[0].brushes.Count);
|
||||
|
||||
@@ -262,8 +266,8 @@ namespace Game
|
||||
else
|
||||
{
|
||||
Console.Print("Material '" + textureName + "' not found for brush");
|
||||
materials.Add(textureName, material);
|
||||
brushMaterial = material;
|
||||
materials.Add(textureName, missingMaterial);
|
||||
brushMaterial = missingMaterial;
|
||||
}
|
||||
}
|
||||
brushMaterials.Add(textureName, brushMaterial);
|
||||
@@ -416,7 +420,7 @@ namespace Game
|
||||
{
|
||||
StaticModel childModel = Actor.AddChild<StaticModel>();
|
||||
childModel.Name = "Brush_" + brushIndex;
|
||||
childModel.Parent = mapRootActor;
|
||||
childModel.Parent = worldSpawnActor;
|
||||
childModel.Model = geom.model;
|
||||
childModel.Position = geom.offset;
|
||||
|
||||
@@ -582,7 +586,7 @@ namespace Game
|
||||
StaticModel childModel = Actor.AddChild<StaticModel>();
|
||||
childModel.Name = "MapModel";
|
||||
childModel.Model = model;
|
||||
childModel.SetMaterial(0, material);
|
||||
childModel.SetMaterial(0, missingMaterial);
|
||||
|
||||
CollisionData collisionData = Content.CreateVirtualAsset<CollisionData>();
|
||||
if (collisionData.CookCollision(CollisionDataType.TriangleMesh, vertices.ToArray(),
|
||||
|
||||
Reference in New Issue
Block a user