mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
names groups
This commit is contained in:
1 parent
3dd0c4916d
commit
3f54e467d8
3 files changed
+24
-19
No files matched your search
+3
-1
@@ -10,7 +10,9 @@
|
|||||||
"hocs",
|
"hocs",
|
||||||
"cooldown",
|
"cooldown",
|
||||||
"Lods",
|
"Lods",
|
||||||
"Skia"
|
"Skia",
|
||||||
|
"RMAO",
|
||||||
|
"Verts"
|
||||||
],
|
],
|
||||||
"userWords": [
|
"userWords": [
|
||||||
"WOTB",
|
"WOTB",
|
||||||
|
|||||||
@@ -255,28 +255,23 @@ public partial class GameInterface
|
|||||||
return gltf.Write($"{tag}/{part}");
|
return gltf.Write($"{tag}/{part}");
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<UObject> CollectMeshes(FStructFallback settings)
|
static List<(string, UObject)> CollectMeshes(FStructFallback settings)
|
||||||
{
|
{
|
||||||
var meshes = new List<UObject>();
|
var meshes = new List<(string, UObject)>();
|
||||||
|
|
||||||
foreach (var property in settings.Properties)
|
foreach (var property in settings.Properties)
|
||||||
{
|
{
|
||||||
var key = property.Name.Text;
|
var key = property.Name.Text;
|
||||||
|
|
||||||
if (key == "CollisionMesh")
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settings.TryGet<UStaticMesh>(key, out var staticMesh))
|
if (settings.TryGet<UStaticMesh>(key, out var staticMesh))
|
||||||
{
|
{
|
||||||
meshes.Add(staticMesh);
|
meshes.Add((key, staticMesh));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.TryGet<USkeletalMesh>(key, out var skeletalMesh))
|
if (settings.TryGet<USkeletalMesh>(key, out var skeletalMesh))
|
||||||
{
|
{
|
||||||
meshes.Add(skeletalMesh);
|
meshes.Add((key, skeletalMesh));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,9 +284,9 @@ public partial class GameInterface
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine(
|
// Console.WriteLine(
|
||||||
$"{key} -> {property.Tag} ({property.TagData}) [{property.PropertyTagFlags}]"
|
// $"{key} -> {property.Tag} ({property.TagData}) [{property.PropertyTagFlags}]"
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
return meshes;
|
return meshes;
|
||||||
|
|||||||
@@ -42,12 +42,14 @@ public class MonoGltf
|
|||||||
};
|
};
|
||||||
readonly byte[] stubBytes = File.ReadAllBytes("../game/stub/small.png");
|
readonly byte[] stubBytes = File.ReadAllBytes("../game/stub/small.png");
|
||||||
|
|
||||||
public MonoGltf(List<UObject> meshes)
|
public MonoGltf(List<(string, UObject)> meshes)
|
||||||
{
|
{
|
||||||
var materialMap = new Dictionary<string, MaterialBuilder>();
|
var materialMap = new Dictionary<string, MaterialBuilder>();
|
||||||
|
|
||||||
foreach (var mesh in meshes)
|
foreach (var (key, mesh) in meshes)
|
||||||
{
|
{
|
||||||
|
var group = new NodeBuilder(key);
|
||||||
|
|
||||||
if (mesh is UStaticMesh staticMesh)
|
if (mesh is UStaticMesh staticMesh)
|
||||||
{
|
{
|
||||||
staticMesh.TryConvert(out var convertedStaticMesh);
|
staticMesh.TryConvert(out var convertedStaticMesh);
|
||||||
@@ -56,7 +58,7 @@ public class MonoGltf
|
|||||||
|
|
||||||
foreach (var section in lod0.Sections!.Value)
|
foreach (var section in lod0.Sections!.Value)
|
||||||
{
|
{
|
||||||
ParseSection(section, materialMap, lod0, lod0.Verts!);
|
scene.AddRigidMesh(ParseSection(section, materialMap, lod0, lod0.Verts!), group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mesh is USkeletalMesh skeletalMesh)
|
else if (mesh is USkeletalMesh skeletalMesh)
|
||||||
@@ -67,13 +69,19 @@ public class MonoGltf
|
|||||||
|
|
||||||
foreach (var section in lod0.Sections!.Value)
|
foreach (var section in lod0.Sections!.Value)
|
||||||
{
|
{
|
||||||
ParseSection(section, materialMap, lod0, lod0.Verts!);
|
scene.AddRigidMesh(ParseSection(section, materialMap, lod0, lod0.Verts!), group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
scene.AddNode(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParseSection(
|
ConfiguredMeshBuilder ParseSection(
|
||||||
CMeshSection section,
|
CMeshSection section,
|
||||||
Dictionary<string, MaterialBuilder> materialMap,
|
Dictionary<string, MaterialBuilder> materialMap,
|
||||||
CBaseMeshLod lod,
|
CBaseMeshLod lod,
|
||||||
@@ -139,7 +147,7 @@ public class MonoGltf
|
|||||||
primitive.AddTriangle((v1, c1), (v2, c2), (v3, c3));
|
primitive.AddTriangle((v1, c1), (v2, c2), (v3, c3));
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.AddRigidMesh(meshBuilder, Matrix4x4.Identity);
|
return meshBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] Write(string name)
|
public byte[] Write(string name)
|
||||||
|
|||||||
Reference in new issue
Block a user