Place white cubes at object brush positions
This commit is contained in:
parent
f118c151f3
commit
b9172df8c3
|
@ -94,6 +94,7 @@ public partial class Mission : Node3D
|
||||||
_file = new(FileName);
|
_file = new(FileName);
|
||||||
UseChunk<TxList>("TXLIST", LoadTextures);
|
UseChunk<TxList>("TXLIST", LoadTextures);
|
||||||
UseChunk<WorldRep>("WREXT", BuildWrMeshes);
|
UseChunk<WorldRep>("WREXT", BuildWrMeshes);
|
||||||
|
UseChunk<BrList>("BRLIST", PlaceObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UseChunk<T>(string name, Action<T> action)
|
private void UseChunk<T>(string name, Action<T> action)
|
||||||
|
@ -108,6 +109,24 @@ public partial class Mission : Node3D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PlaceObjects(BrList brList)
|
||||||
|
{
|
||||||
|
foreach (var brush in brList.Brushes)
|
||||||
|
{
|
||||||
|
if (brush.media != BrList.Brush.Media.Object)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var pos = brush.position.ToGodotVec3();
|
||||||
|
var cube = new CsgBox3D
|
||||||
|
{
|
||||||
|
Position = pos
|
||||||
|
};
|
||||||
|
AddChild(cube);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void BuildWrMeshes(WorldRep worldRep)
|
private void BuildWrMeshes(WorldRep worldRep)
|
||||||
{
|
{
|
||||||
var cells = worldRep.Cells;
|
var cells = worldRep.Cells;
|
||||||
|
|
Loading…
Reference in New Issue