diff --git a/CHANGELOG.md b/CHANGELOG.md index 449b7ba4..ed779443 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [5.0.0] - UNRELEASED + +### Updated +- updated to GLTFast 6.0.1 by @harrisonhough in [#XXX]() + ## [4.0.1] - 2023.11.14 ### Fixed diff --git a/Runtime/GLTF/GltFastGameObjectInstantiator.cs b/Runtime/GLTF/GltFastGameObjectInstantiator.cs index 30f53400..5d688e14 100644 --- a/Runtime/GLTF/GltFastGameObjectInstantiator.cs +++ b/Runtime/GLTF/GltFastGameObjectInstantiator.cs @@ -23,8 +23,7 @@ public GltFastGameObjectInstantiator( public override void AddPrimitive( uint nodeIndex, string meshName, - Mesh mesh, - int[] materialIndices, + MeshResult meshResult, uint[] joints = null, uint? rootJoint = null, float[] morphTargetWeights = null, @@ -53,18 +52,18 @@ public override void AddPrimitive( Renderer renderer; - var hasMorphTargets = mesh.blendShapeCount > 0; + var hasMorphTargets = meshResult.mesh.blendShapeCount > 0; if (joints == null && !hasMorphTargets) { - var meshFilter = meshGo.AddComponent(); - meshFilter.mesh = mesh; - var meshRenderer = meshGo.AddComponent(); - renderer = meshRenderer; + var mf = meshGo.AddComponent(); + mf.mesh = meshResult.mesh; + var mr = meshGo.AddComponent(); + renderer = mr; } else { - var skinnedMeshRenderer = meshGo.AddComponent(); - skinnedMeshRenderer.updateWhenOffscreen = m_Settings.SkinUpdateWhenOffscreen; + var smr = meshGo.AddComponent(); + smr.updateWhenOffscreen = m_Settings.SkinUpdateWhenOffscreen; if (joints != null) { var bones = new Transform[joints.Length]; @@ -73,28 +72,28 @@ public override void AddPrimitive( var jointIndex = joints[j]; bones[j] = m_Nodes[jointIndex].transform; } - skinnedMeshRenderer.bones = bones; + smr.bones = bones; if (rootJoint.HasValue) { - skinnedMeshRenderer.rootBone = m_Nodes[rootJoint.Value].transform; + smr.rootBone = m_Nodes[rootJoint.Value].transform; } } - skinnedMeshRenderer.sharedMesh = mesh; + smr.sharedMesh = meshResult.mesh; if (morphTargetWeights != null) { for (var i = 0; i < morphTargetWeights.Length; i++) { var weight = morphTargetWeights[i]; - skinnedMeshRenderer.SetBlendShapeWeight(i, weight); + smr.SetBlendShapeWeight(i, weight); } } - renderer = skinnedMeshRenderer; + renderer = smr; } - var materials = new Material[materialIndices.Length]; + var materials = new Material[meshResult.materialIndices.Length]; for (var index = 0; index < materials.Length; index++) { - Material material = m_Gltf.GetMaterial(materialIndices[index]) ?? m_Gltf.GetDefaultMaterial(); + var material = m_Gltf.GetMaterial(meshResult.materialIndices[index]) ?? m_Gltf.GetDefaultMaterial(); materials[index] = material; } diff --git a/package.json b/package.json index 253910bb..71630a4d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "changelogUrl": "https://github.com/readyplayerme/rpm-unity-sdk-core/blob/main/CHANGELOG.md", "licensesUrl": "https://github.com/readyplayerme/rpm-unity-sdk-core/blob/main/LICENSE.md", "dependencies": { - "com.unity.cloud.gltfast": "5.0.4", + "com.unity.cloud.gltfast": "6.0.1", "com.unity.nuget.newtonsoft-json": "3.0.2" }, "keywords": [