We're actually rendering models in the mission now (badly)
This commit is contained in:
parent
de4f3d6381
commit
cb2f016455
|
@ -94,6 +94,7 @@ public partial class Mission : Node3D
|
||||||
{
|
{
|
||||||
ClearMap();
|
ClearMap();
|
||||||
|
|
||||||
|
// TODO: This shouldn't be set for things that aren't actually FMs
|
||||||
var fmName = FileName.GetBaseDir().GetFile();
|
var fmName = FileName.GetBaseDir().GetFile();
|
||||||
_textureLoader = new TextureLoader(fmName);
|
_textureLoader = new TextureLoader(fmName);
|
||||||
_file = new(FileName);
|
_file = new(FileName);
|
||||||
|
@ -209,12 +210,26 @@ public partial class Mission : Node3D
|
||||||
continue;
|
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 pos = brush.position.ToGodotVec3();
|
||||||
var cube = new CsgBox3D
|
var model = new Model();
|
||||||
|
model.Position = pos;
|
||||||
|
if (objPath != null)
|
||||||
{
|
{
|
||||||
Position = pos
|
model.BuildModel("", objPath);
|
||||||
};
|
}
|
||||||
AddChild(cube);
|
AddChild(model);
|
||||||
|
|
||||||
|
// var pos = brush.position.ToGodotVec3();
|
||||||
|
// var cube = new CsgBox3D
|
||||||
|
// {
|
||||||
|
// Position = pos
|
||||||
|
// };
|
||||||
|
// AddChild(cube);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ public partial class Model : Node3D
|
||||||
modelSelector.LoadModel += BuildModel;
|
modelSelector.LoadModel += BuildModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BuildModel(string rootPath, string modelPath)
|
public void BuildModel(string rootPath, string modelPath)
|
||||||
{
|
{
|
||||||
foreach (var node in GetChildren())
|
foreach (var node in GetChildren())
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ public partial class Model : Node3D
|
||||||
return;
|
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 baseDir = ProjectSettings.GlobalizePath($"user://objects/tmp");
|
||||||
var options = new EnumerationOptions
|
var options = new EnumerationOptions
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue