@galacean/engine-loader 0.9.0-beta.81 → 0.9.0-beta.82

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.
@@ -1821,6 +1821,8 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1821
1821
  var vertexElements = new Array();
1822
1822
  var vertexCount;
1823
1823
  var bufferBindIndex = 0;
1824
+ var positions;
1825
+ keepMeshData && (positions = new Array(vertexCount));
1824
1826
  for(var attribute in attributes){
1825
1827
  var accessor = accessors[attributes[attribute]];
1826
1828
  var accessorBuffer = GLTFUtil.getAccessorBuffer(context, gltf, accessor);
@@ -1862,16 +1864,24 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1862
1864
  if (accessor.min && accessor.max) {
1863
1865
  min.copyFromArray(accessor.min);
1864
1866
  max.copyFromArray(accessor.max);
1867
+ if (keepMeshData) {
1868
+ var stride1 = vertices.length / attributeCount;
1869
+ for(var j = 0; j < attributeCount; j++){
1870
+ var offset = j * stride1;
1871
+ positions[j] = new miniprogram$1.Vector3(vertices[offset], vertices[offset + 1], vertices[offset + 2]);
1872
+ }
1873
+ }
1865
1874
  } else {
1866
1875
  var position = MeshParser._tempVector3;
1867
1876
  min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
1868
1877
  max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
1869
- var stride1 = vertices.length / attributeCount;
1870
- for(var j = 0; j < attributeCount; j++){
1871
- var offset = j * stride1;
1872
- position.copyFromArray(vertices, offset);
1878
+ var stride2 = vertices.length / attributeCount;
1879
+ for(var j1 = 0; j1 < attributeCount; j1++){
1880
+ var offset1 = j1 * stride2;
1881
+ position.copyFromArray(vertices, offset1);
1873
1882
  miniprogram$1.Vector3.min(min, position, min);
1874
1883
  miniprogram$1.Vector3.max(max, position, max);
1884
+ keepMeshData && (positions[j1] = position.clone());
1875
1885
  }
1876
1886
  }
1877
1887
  if (accessor.normalized) {
@@ -1894,6 +1904,8 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1894
1904
  // BlendShapes
1895
1905
  targets && this._createBlendShape(mesh, gltfMesh, targets, getBlendShapeData);
1896
1906
  mesh.uploadData(!keepMeshData);
1907
+ //@ts-ignore
1908
+ mesh._positions = positions;
1897
1909
  return Promise.resolve(mesh);
1898
1910
  };
1899
1911
  _proto._createBlendShape = function _createBlendShape(mesh, glTFMesh, glTFTargets, getBlendShapeData) {
package/dist/module.js CHANGED
@@ -1816,6 +1816,8 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1816
1816
  var vertexElements = new Array();
1817
1817
  var vertexCount;
1818
1818
  var bufferBindIndex = 0;
1819
+ var positions;
1820
+ keepMeshData && (positions = new Array(vertexCount));
1819
1821
  for(var attribute in attributes){
1820
1822
  var accessor = accessors[attributes[attribute]];
1821
1823
  var accessorBuffer = GLTFUtil.getAccessorBuffer(context, gltf, accessor);
@@ -1857,16 +1859,24 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1857
1859
  if (accessor.min && accessor.max) {
1858
1860
  min.copyFromArray(accessor.min);
1859
1861
  max.copyFromArray(accessor.max);
1862
+ if (keepMeshData) {
1863
+ var stride1 = vertices.length / attributeCount;
1864
+ for(var j = 0; j < attributeCount; j++){
1865
+ var offset = j * stride1;
1866
+ positions[j] = new Vector3(vertices[offset], vertices[offset + 1], vertices[offset + 2]);
1867
+ }
1868
+ }
1860
1869
  } else {
1861
1870
  var position = MeshParser._tempVector3;
1862
1871
  min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
1863
1872
  max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
1864
- var stride1 = vertices.length / attributeCount;
1865
- for(var j = 0; j < attributeCount; j++){
1866
- var offset = j * stride1;
1867
- position.copyFromArray(vertices, offset);
1873
+ var stride2 = vertices.length / attributeCount;
1874
+ for(var j1 = 0; j1 < attributeCount; j1++){
1875
+ var offset1 = j1 * stride2;
1876
+ position.copyFromArray(vertices, offset1);
1868
1877
  Vector3.min(min, position, min);
1869
1878
  Vector3.max(max, position, max);
1879
+ keepMeshData && (positions[j1] = position.clone());
1870
1880
  }
1871
1881
  }
1872
1882
  if (accessor.normalized) {
@@ -1889,6 +1899,8 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1889
1899
  // BlendShapes
1890
1900
  targets && this._createBlendShape(mesh, gltfMesh, targets, getBlendShapeData);
1891
1901
  mesh.uploadData(!keepMeshData);
1902
+ //@ts-ignore
1903
+ mesh._positions = positions;
1892
1904
  return Promise.resolve(mesh);
1893
1905
  };
1894
1906
  _proto._createBlendShape = function _createBlendShape(mesh, glTFMesh, glTFTargets, getBlendShapeData) {