mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-23 19:15:07 -05:00
Updated UniGLTF(refactor importer api)
This commit is contained in:
@@ -61,8 +61,7 @@ public class VRMTest
|
||||
// import
|
||||
context.ParseJson(gltf.ToJson(), new SimpleStorage());
|
||||
//Debug.LogFormat("{0}", context.Json);
|
||||
gltfImporter.Load(context);
|
||||
|
||||
context.Load();
|
||||
AssertAreEqual(go.transform, context.Root.transform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,15 +37,11 @@ namespace VRM
|
||||
public static void LoadFromBytes(VRMImporterContext context)
|
||||
{
|
||||
context.MaterialImporter = new VRMMaterialImporter(context, glTF_VRM_Material.Parse(context.Json));
|
||||
|
||||
gltfImporter.Load(context);
|
||||
|
||||
context.Load();
|
||||
OnLoadModel(context);
|
||||
|
||||
context.ShowMeshes();
|
||||
}
|
||||
|
||||
|
||||
#region OnLoad
|
||||
public static Unit OnLoadModel(VRMImporterContext context)
|
||||
{
|
||||
@@ -299,7 +295,7 @@ namespace VRM
|
||||
for (int i = 0; i < context.GLTF.meshes.Count; ++i)
|
||||
{
|
||||
var meshContext = meshImporter.ReadMesh(context, i);
|
||||
var meshWithMaterials = gltfImporter.BuildMesh(context, meshContext);
|
||||
var meshWithMaterials = MeshImporter.BuildMesh(context, meshContext);
|
||||
var mesh = meshWithMaterials.Mesh;
|
||||
if (string.IsNullOrEmpty(mesh.name))
|
||||
{
|
||||
@@ -315,7 +311,7 @@ namespace VRM
|
||||
{
|
||||
foreach (var x in context.GLTF.nodes)
|
||||
{
|
||||
context.Nodes.Add(gltfImporter.ImportNode(x).transform);
|
||||
context.Nodes.Add(NodeImporter.ImportNode(x).transform);
|
||||
}
|
||||
|
||||
yield return null;
|
||||
@@ -323,18 +319,18 @@ namespace VRM
|
||||
|
||||
static IEnumerator BuildHierarchy(VRMImporterContext context)
|
||||
{
|
||||
var nodes = new List<gltfImporter.TransformWithSkin>();
|
||||
var nodes = new List<NodeImporter.TransformWithSkin>();
|
||||
for (int i = 0; i < context.Nodes.Count; ++i)
|
||||
{
|
||||
nodes.Add(gltfImporter.BuildHierarchy(context, i));
|
||||
nodes.Add(NodeImporter.BuildHierarchy(context, i));
|
||||
}
|
||||
|
||||
gltfImporter.FixCoordinate(context, nodes);
|
||||
NodeImporter.FixCoordinate(context, nodes);
|
||||
|
||||
// skinning
|
||||
for (int i = 0; i < nodes.Count; ++i)
|
||||
{
|
||||
gltfImporter.SetupSkinning(context, nodes, i);
|
||||
NodeImporter.SetupSkinning(context, nodes, i);
|
||||
}
|
||||
|
||||
// connect root
|
||||
@@ -460,7 +456,7 @@ namespace VRM
|
||||
{
|
||||
using (ctx.MeasureTime("BuildMesh"))
|
||||
{
|
||||
return gltfImporter.BuildMesh(ctx, x);
|
||||
return MeshImporter.BuildMesh(ctx, x);
|
||||
}
|
||||
})
|
||||
.ContinueWith(Scheduler.ThreadPool, x => ctx.Meshes.Add(x))
|
||||
|
||||
2
UniGLTF
2
UniGLTF
Submodule UniGLTF updated: 2d708472ef...ae46109baa
Reference in New Issue
Block a user