@galacean/engine-loader 2.0.0-alpha.34 → 2.0.0-alpha.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Utils, AssetPromise, AnimationClip, AnimationEvent, Loader, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, ModelMesh, BlendShape, TextureFormat, Texture2D, TextureCube, TextureCubeFace, ReferResource, Entity, resourceLoader, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, BufferAsset, GLCapabilityType, Logger, ContentRestorer, AmbientLight, DiffuseMode, TextureFilterMode, Font, SystemInfo, Animator, IndexFormat, VertexElementFormat, request, InterpolationType, SkinnedMeshRenderer, Transform, PBRMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, TextureUtils, AnimatorStateMachine, JSONAsset, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, TextAsset, AudioClip, AudioManager, PhysicsMaterial, RenderTarget, Scene, BackgroundMode, DirectLight, PointLight, SpotLight, UnlitMaterial } from '@galacean/engine-core';
2
- import { Quaternion, Vector4, Color, Vector3, Vector2, MathUtil, SphericalHarmonics3, BoundingBox, Matrix, Rect } from '@galacean/engine-math';
2
+ import { Quaternion, Vector4, Color, Vector3, Vector2, MathUtil, SphericalHarmonics3, Matrix, BoundingBox, Rect } from '@galacean/engine-math';
3
3
  import { GLCompressedTextureInternalFormat } from '@galacean/engine-rhi-webgl';
4
4
 
5
5
  function _extends() {
@@ -4970,35 +4970,15 @@ var GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
4970
4970
  if (rootBoneIndex !== -1) {
4971
4971
  BoundingBox.transform(mesh.bounds, inverseBindMatrices[rootBoneIndex], skinnedMeshRenderer.localBounds);
4972
4972
  } else {
4973
- // Root bone is not in joints list, we can only compute approximate inverse bind matrix
4974
- // Average all root bone's children inverse bind matrix
4975
- var approximateBindMatrix = new Matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
4976
- var subRootBoneCount = this._computeApproximateBindMatrix(bones, inverseBindMatrices, rootBone, approximateBindMatrix);
4977
- if (subRootBoneCount !== 0) {
4978
- Matrix.multiplyScalar(approximateBindMatrix, 1.0 / subRootBoneCount, approximateBindMatrix);
4979
- BoundingBox.transform(mesh.bounds, approximateBindMatrix, skinnedMeshRenderer.localBounds);
4980
- } else {
4981
- skinnedMeshRenderer.localBounds.copyFrom(mesh.bounds);
4982
- }
4983
- }
4984
- };
4985
- _proto._computeApproximateBindMatrix = function _computeApproximateBindMatrix(jointEntities, inverseBindMatrices, rootEntity, approximateBindMatrix) {
4986
- var subRootBoneCount = 0;
4987
- var children = rootEntity.children;
4988
- for(var i = 0, n = children.length; i < n; i++){
4989
- var rootChild = children[i];
4990
- var index = jointEntities.indexOf(rootChild);
4991
- if (index !== -1) {
4992
- Matrix.add(approximateBindMatrix, inverseBindMatrices[index], approximateBindMatrix);
4993
- subRootBoneCount++;
4994
- } else {
4995
- subRootBoneCount += this._computeApproximateBindMatrix(jointEntities, inverseBindMatrices, rootChild, approximateBindMatrix);
4996
- }
4973
+ // rootBone can be outside skin.joints, so it has no inverse bind matrix
4974
+ var inverseRootBoneWorld = GLTFSceneParser._tempMatrix;
4975
+ Matrix.invert(rootBone.transform.worldMatrix, inverseRootBoneWorld);
4976
+ BoundingBox.transform(mesh.bounds, inverseRootBoneWorld, skinnedMeshRenderer.localBounds);
4997
4977
  }
4998
- return subRootBoneCount;
4999
4978
  };
5000
4979
  return GLTFSceneParser;
5001
4980
  }(GLTFParser);
4981
+ GLTFSceneParser._tempMatrix = new Matrix();
5002
4982
  GLTFSceneParser = __decorate([
5003
4983
  registerGLTFParser(GLTFParserType.Scene)
5004
4984
  ], GLTFSceneParser);