From cb2f016455d07e508fd23a8235ec55013b28ecdf Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Sat, 24 Aug 2024 17:36:32 +0100 Subject: [PATCH] We're actually rendering models in the mission now (badly) --- project/code/TMV/Mission.cs | 23 +++++++++++++++++++---- project/code/TMV/Model.cs | 4 ++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/project/code/TMV/Mission.cs b/project/code/TMV/Mission.cs index 4523457..cd3c9c9 100644 --- a/project/code/TMV/Mission.cs +++ b/project/code/TMV/Mission.cs @@ -94,6 +94,7 @@ public partial class Mission : Node3D { ClearMap(); + // TODO: This shouldn't be set for things that aren't actually FMs var fmName = FileName.GetBaseDir().GetFile(); _textureLoader = new TextureLoader(fmName); _file = new(FileName); @@ -209,12 +210,26 @@ public partial class Mission : Node3D continue; } + // Let's try and place an object :) + var fmName = FileName.GetBaseDir().GetFile(); + var objPath = _installPaths.GetObjectPath(fmName, modelName + ".bin"); + objPath ??= _installPaths.GetObjectPath(modelName + ".bin"); + var pos = brush.position.ToGodotVec3(); - var cube = new CsgBox3D + var model = new Model(); + model.Position = pos; + if (objPath != null) { - Position = pos - }; - AddChild(cube); + model.BuildModel("", objPath); + } + AddChild(model); + + // var pos = brush.position.ToGodotVec3(); + // var cube = new CsgBox3D + // { + // Position = pos + // }; + // AddChild(cube); } } diff --git a/project/code/TMV/Model.cs b/project/code/TMV/Model.cs index bec2094..3c639a2 100644 --- a/project/code/TMV/Model.cs +++ b/project/code/TMV/Model.cs @@ -14,7 +14,7 @@ public partial class Model : Node3D modelSelector.LoadModel += BuildModel; } - private void BuildModel(string rootPath, string modelPath) + public void BuildModel(string rootPath, string modelPath) { foreach (var node in GetChildren()) { @@ -28,7 +28,7 @@ public partial class Model : Node3D return; } - // TODO: Remove this disgusting hack + // TODO: Remove this disgusting hack. Not only is it a hack, it doesn't support custom models var baseDir = ProjectSettings.GlobalizePath($"user://objects/tmp"); var options = new EnumerationOptions {