Initial basic sub object transformation

This commit is contained in:
Jarrod Doyle 2024-12-07 10:05:12 +00:00
parent beae881f37
commit 59582bdfb8
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 19 additions and 0 deletions

View File

@ -49,6 +49,25 @@ public class ModelLoader
GD.Print($"Failed to load model file: {modelPath}"); GD.Print($"Failed to load model file: {modelPath}");
return null; return null;
} }
// Transform subobjs
// TODO: Traverse children properly
// TODO: Apply to normals
// TODO: Apply joints(??)
foreach (var subObj in modelFile.Objects)
{
if (subObj.Type == 0)
{
continue;
}
for (var i = subObj.PointIdx; i < subObj.PointIdx + subObj.PointCount; i++)
{
var v = modelFile.Vertices[i];
v = System.Numerics.Vector3.Transform(v, subObj.Transform);
modelFile.Vertices[i] = v;
}
}
var materials = new List<StandardMaterial3D>(); var materials = new List<StandardMaterial3D>();
foreach (var material in modelFile.Materials) foreach (var material in modelFile.Materials)