mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-24 03:51:23 -05:00
use BuildMeshAsync. remove EnableLoadBalancing
This commit is contained in:
parent
a5be5e1383
commit
bd0e79d627
|
|
@ -57,9 +57,6 @@ namespace UniGLTF
|
|||
#endregion
|
||||
|
||||
#region Load. Build unity objects
|
||||
|
||||
public bool EnableLoadBalancing;
|
||||
|
||||
public virtual async Awaitable LoadAsync(Func<string, IDisposable> MeasureTime = null)
|
||||
{
|
||||
if (MeasureTime == null)
|
||||
|
|
@ -145,16 +142,7 @@ namespace UniGLTF
|
|||
{
|
||||
using (MeasureTime("BuildMesh"))
|
||||
{
|
||||
MeshWithMaterials meshWithMaterials;
|
||||
if (EnableLoadBalancing)
|
||||
{
|
||||
meshWithMaterials = await MeshImporter.BuildMeshAsync(MaterialFactory, x);
|
||||
}
|
||||
else
|
||||
{
|
||||
meshWithMaterials = MeshImporter.BuildMesh(MaterialFactory, x);
|
||||
}
|
||||
|
||||
var meshWithMaterials = await MeshImporter.BuildMeshAsync(MaterialFactory, x);
|
||||
var mesh = meshWithMaterials.Mesh;
|
||||
|
||||
// mesh name
|
||||
|
|
|
|||
|
|
@ -6,29 +6,6 @@ namespace UniGLTF
|
|||
{
|
||||
public static class ImporterContextExtensions
|
||||
{
|
||||
// /// <summary>
|
||||
// /// ReadAllBytes, Parse, Create GameObject
|
||||
// /// </summary>
|
||||
// /// <param name="path">allbytes</param>
|
||||
// public static void Load(this ImporterContext self, string path)
|
||||
// {
|
||||
// var bytes = File.ReadAllBytes(path);
|
||||
// self.Load(path, bytes);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Parse, Create GameObject
|
||||
// /// </summary>
|
||||
// /// <param name="path">gltf or glb path</param>
|
||||
// /// <param name="bytes">allbytes</param>
|
||||
// public static void Load(this ImporterContext self, string path, byte[] bytes)
|
||||
// {
|
||||
// var parser = new GltfParser();
|
||||
// parser.Parse(path, bytes);
|
||||
// self.Load(parser);
|
||||
// self.Root.name = Path.GetFileNameWithoutExtension(path);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Build unity objects from parsed gltf
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -627,33 +627,6 @@ namespace UniGLTF
|
|||
}
|
||||
}
|
||||
|
||||
public static MeshWithMaterials BuildMesh(MaterialFactory ctx, MeshImporter.MeshContext meshContext)
|
||||
{
|
||||
var (mesh, recalculateTangents) = _BuildMesh(meshContext);
|
||||
|
||||
if (recalculateTangents)
|
||||
{
|
||||
mesh.RecalculateTangents();
|
||||
}
|
||||
|
||||
// 先にすべてのマテリアルを作成済みなのでテクスチャーは生成済み。Resultを使ってよい
|
||||
var result = new MeshWithMaterials
|
||||
{
|
||||
Mesh = mesh,
|
||||
Materials = meshContext.MaterialIndices.Select(x => ctx.GetMaterial(x)).ToArray()
|
||||
};
|
||||
|
||||
if (meshContext.BlendShapes.Count > 0)
|
||||
{
|
||||
var emptyVertices = new Vector3[mesh.vertexCount];
|
||||
foreach (var blendShape in meshContext.BlendShapes)
|
||||
{
|
||||
BuildBlendShape(mesh, meshContext, blendShape, emptyVertices);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Awaitable<MeshWithMaterials> BuildMeshAsync(MaterialFactory ctx, MeshImporter.MeshContext meshContext)
|
||||
{
|
||||
var (mesh, recalculateTangents) = _BuildMesh(meshContext);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user