@galacean/engine 1.1.0-beta.16 → 1.1.0-beta.17
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/browser.js +85 -94
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -37435,116 +37435,116 @@
|
|
|
37435
37435
|
this.data = data;
|
|
37436
37436
|
this._dataView = new DataView(data.buffer, data.byteOffset + byteOffset, byteLength != null ? byteLength : data.byteLength - byteOffset);
|
|
37437
37437
|
this._littleEndian = littleEndian;
|
|
37438
|
-
this.
|
|
37438
|
+
this._position = 0;
|
|
37439
37439
|
this._baseOffset = byteOffset;
|
|
37440
37440
|
};
|
|
37441
37441
|
var _proto = BufferReader.prototype;
|
|
37442
37442
|
_proto.nextUint8 = function nextUint8() {
|
|
37443
|
-
var value = this._dataView.getUint8(this.
|
|
37444
|
-
this.
|
|
37443
|
+
var value = this._dataView.getUint8(this._position);
|
|
37444
|
+
this._position += 1;
|
|
37445
37445
|
return value;
|
|
37446
37446
|
};
|
|
37447
37447
|
_proto.nextUint16 = function nextUint16() {
|
|
37448
|
-
var value = this._dataView.getUint16(this.
|
|
37449
|
-
this.
|
|
37448
|
+
var value = this._dataView.getUint16(this._position, this._littleEndian);
|
|
37449
|
+
this._position += 2;
|
|
37450
37450
|
return value;
|
|
37451
37451
|
};
|
|
37452
37452
|
_proto.nextUint32 = function nextUint32() {
|
|
37453
|
-
var value = this._dataView.getUint32(this.
|
|
37454
|
-
this.
|
|
37453
|
+
var value = this._dataView.getUint32(this._position, this._littleEndian);
|
|
37454
|
+
this._position += 4;
|
|
37455
37455
|
return value;
|
|
37456
37456
|
};
|
|
37457
37457
|
_proto.nextInt32 = function nextInt32() {
|
|
37458
|
-
var value = this._dataView.getInt32(this.
|
|
37459
|
-
this.
|
|
37458
|
+
var value = this._dataView.getInt32(this._position, this._littleEndian);
|
|
37459
|
+
this._position += 4;
|
|
37460
37460
|
return value;
|
|
37461
37461
|
};
|
|
37462
37462
|
_proto.nextInt32Array = function nextInt32Array(len) {
|
|
37463
|
-
var value = new Int32Array(this.data.buffer, this.
|
|
37464
|
-
this.
|
|
37463
|
+
var value = new Int32Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
37464
|
+
this._position += 4 * len;
|
|
37465
37465
|
return value;
|
|
37466
37466
|
};
|
|
37467
37467
|
_proto.nextFloat32 = function nextFloat32() {
|
|
37468
|
-
var value = this._dataView.getFloat32(this.
|
|
37469
|
-
this.
|
|
37468
|
+
var value = this._dataView.getFloat32(this._position, this._littleEndian);
|
|
37469
|
+
this._position += 4;
|
|
37470
37470
|
return value;
|
|
37471
37471
|
};
|
|
37472
37472
|
_proto.nextFloat32Array = function nextFloat32Array(len) {
|
|
37473
|
-
var value = new Float32Array(this.data.buffer, this.
|
|
37474
|
-
this.
|
|
37473
|
+
var value = new Float32Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
37474
|
+
this._position += 4 * len;
|
|
37475
37475
|
return value;
|
|
37476
37476
|
};
|
|
37477
37477
|
_proto.nextUint32Array = function nextUint32Array(len) {
|
|
37478
|
-
var value = new Uint32Array(this.data.buffer, this.
|
|
37479
|
-
this.
|
|
37478
|
+
var value = new Uint32Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
37479
|
+
this._position += 4 * len;
|
|
37480
37480
|
return value;
|
|
37481
37481
|
};
|
|
37482
37482
|
_proto.nextUint8Array = function nextUint8Array(len) {
|
|
37483
|
-
var value = new Uint8Array(this.data.buffer, this.
|
|
37484
|
-
this.
|
|
37483
|
+
var value = new Uint8Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
37484
|
+
this._position += len;
|
|
37485
37485
|
return value;
|
|
37486
37486
|
};
|
|
37487
37487
|
_proto.nextUint64 = function nextUint64() {
|
|
37488
|
-
var left = this._dataView.getUint32(this.
|
|
37489
|
-
var right = this._dataView.getUint32(this.
|
|
37488
|
+
var left = this._dataView.getUint32(this._position, this._littleEndian);
|
|
37489
|
+
var right = this._dataView.getUint32(this._position + 4, this._littleEndian);
|
|
37490
37490
|
var value = left + Math.pow(2, 32) * right;
|
|
37491
|
-
this.
|
|
37491
|
+
this._position += 8;
|
|
37492
37492
|
return value;
|
|
37493
37493
|
};
|
|
37494
37494
|
_proto.nextStr = function nextStr() {
|
|
37495
37495
|
var strByteLength = this.nextUint16();
|
|
37496
|
-
var uint8Array = new Uint8Array(this.data.buffer, this.
|
|
37497
|
-
this.
|
|
37496
|
+
var uint8Array = new Uint8Array(this.data.buffer, this._position + this._dataView.byteOffset, strByteLength);
|
|
37497
|
+
this._position += strByteLength;
|
|
37498
37498
|
return Utils.decodeText(uint8Array);
|
|
37499
37499
|
};
|
|
37500
37500
|
/**
|
|
37501
37501
|
* image data 放在最后
|
|
37502
37502
|
*/ _proto.nextImageData = function nextImageData(count) {
|
|
37503
|
-
return new Uint8Array(this.data.buffer, this.data.byteOffset + this.
|
|
37503
|
+
return new Uint8Array(this.data.buffer, this.data.byteOffset + this._position);
|
|
37504
37504
|
};
|
|
37505
37505
|
_proto.nextImagesData = function nextImagesData(count) {
|
|
37506
37506
|
var imagesLen = new Array(count);
|
|
37507
37507
|
// Start offset of Uint32Array should be a multiple of 4. ref: https://stackoverflow.com/questions/15417310/why-typed-array-constructors-require-offset-to-be-multiple-of-underlying-type-si
|
|
37508
37508
|
for(var i = 0; i < count; i++){
|
|
37509
|
-
var len = this._dataView.getUint32(this.
|
|
37509
|
+
var len = this._dataView.getUint32(this._position, this._littleEndian);
|
|
37510
37510
|
imagesLen[i] = len;
|
|
37511
|
-
this.
|
|
37511
|
+
this._position += 4;
|
|
37512
37512
|
}
|
|
37513
37513
|
var imagesData = [];
|
|
37514
37514
|
for(var i1 = 0; i1 < count; i1++){
|
|
37515
37515
|
var len1 = imagesLen[i1];
|
|
37516
|
-
var buffer = new Uint8Array(this.data.buffer, this._dataView.byteOffset + this.
|
|
37517
|
-
this.
|
|
37516
|
+
var buffer = new Uint8Array(this.data.buffer, this._dataView.byteOffset + this._position, len1);
|
|
37517
|
+
this._position += len1;
|
|
37518
37518
|
imagesData.push(buffer);
|
|
37519
37519
|
}
|
|
37520
37520
|
return imagesData;
|
|
37521
37521
|
};
|
|
37522
37522
|
_proto.skip = function skip(bytes) {
|
|
37523
|
-
this.
|
|
37523
|
+
this._position += bytes;
|
|
37524
37524
|
return this;
|
|
37525
37525
|
};
|
|
37526
37526
|
_proto.scan = function scan(maxByteLength, term) {
|
|
37527
37527
|
if (term === void 0) term = 0x00;
|
|
37528
|
-
var byteOffset = this.
|
|
37528
|
+
var byteOffset = this._position;
|
|
37529
37529
|
var byteLength = 0;
|
|
37530
|
-
while(this._dataView.getUint8(this.
|
|
37530
|
+
while(this._dataView.getUint8(this._position) !== term && byteLength < maxByteLength){
|
|
37531
37531
|
byteLength++;
|
|
37532
|
-
this.
|
|
37532
|
+
this._position++;
|
|
37533
37533
|
}
|
|
37534
|
-
if (byteLength < maxByteLength) this.
|
|
37534
|
+
if (byteLength < maxByteLength) this._position++;
|
|
37535
37535
|
return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength);
|
|
37536
37536
|
};
|
|
37537
37537
|
_create_class(BufferReader, [
|
|
37538
37538
|
{
|
|
37539
37539
|
key: "position",
|
|
37540
37540
|
get: function get() {
|
|
37541
|
-
return this.
|
|
37541
|
+
return this._position;
|
|
37542
37542
|
}
|
|
37543
37543
|
},
|
|
37544
37544
|
{
|
|
37545
37545
|
key: "offset",
|
|
37546
37546
|
get: function get() {
|
|
37547
|
-
return this.
|
|
37547
|
+
return this._position + this._baseOffset;
|
|
37548
37548
|
}
|
|
37549
37549
|
}
|
|
37550
37550
|
]);
|
|
@@ -37605,75 +37605,74 @@
|
|
|
37605
37605
|
var encodedMeshData = JSON.parse(jsonDataString);
|
|
37606
37606
|
// @ts-ignore Vector3 is not compatible with {x: number, y: number, z: number}.
|
|
37607
37607
|
encodedMeshData.bounds && modelMesh.bounds.copyFrom(encodedMeshData.bounds);
|
|
37608
|
-
var offset = Math.ceil(bufferReader.
|
|
37608
|
+
var offset = Math.ceil(bufferReader.offset / 4) * 4 + bufferReader.data.byteOffset;
|
|
37609
37609
|
var buffer = bufferReader.data.buffer;
|
|
37610
|
-
var
|
|
37611
|
-
var float32Array = new Float32Array(buffer, encodedMeshData.positions.start + offset + byteOffset, (encodedMeshData.positions.end - encodedMeshData.positions.start) / 4);
|
|
37610
|
+
var float32Array = new Float32Array(buffer, encodedMeshData.positions.start + offset, (encodedMeshData.positions.end - encodedMeshData.positions.start) / 4);
|
|
37612
37611
|
var vertexCount = float32Array.length / 3;
|
|
37613
37612
|
var positions = float32ArrayToVector3(float32Array, vertexCount);
|
|
37614
37613
|
modelMesh.setPositions(positions);
|
|
37615
37614
|
if (encodedMeshData.normals) {
|
|
37616
|
-
var float32Array1 = new Float32Array(buffer, encodedMeshData.normals.start + offset
|
|
37615
|
+
var float32Array1 = new Float32Array(buffer, encodedMeshData.normals.start + offset, (encodedMeshData.normals.end - encodedMeshData.normals.start) / 4);
|
|
37617
37616
|
var normals = float32ArrayToVector3(float32Array1, vertexCount);
|
|
37618
37617
|
modelMesh.setNormals(normals);
|
|
37619
37618
|
}
|
|
37620
37619
|
if (encodedMeshData.uvs) {
|
|
37621
|
-
var float32Array2 = new Float32Array(buffer, encodedMeshData.uvs.start + offset
|
|
37620
|
+
var float32Array2 = new Float32Array(buffer, encodedMeshData.uvs.start + offset, (encodedMeshData.uvs.end - encodedMeshData.uvs.start) / 4);
|
|
37622
37621
|
modelMesh.setUVs(float32ArrayToVector2(float32Array2, vertexCount));
|
|
37623
37622
|
}
|
|
37624
37623
|
if (encodedMeshData.uv1) {
|
|
37625
|
-
var float32Array3 = new Float32Array(buffer, encodedMeshData.uv1.start + offset
|
|
37624
|
+
var float32Array3 = new Float32Array(buffer, encodedMeshData.uv1.start + offset, (encodedMeshData.uv1.end - encodedMeshData.uv1.start) / 4);
|
|
37626
37625
|
modelMesh.setUVs(float32ArrayToVector2(float32Array3, vertexCount), 1);
|
|
37627
37626
|
}
|
|
37628
37627
|
if (encodedMeshData.uv2) {
|
|
37629
|
-
var float32Array4 = new Float32Array(buffer, encodedMeshData.uv2.start + offset
|
|
37628
|
+
var float32Array4 = new Float32Array(buffer, encodedMeshData.uv2.start + offset, (encodedMeshData.uv2.end - encodedMeshData.uv2.start) / 4);
|
|
37630
37629
|
modelMesh.setUVs(float32ArrayToVector2(float32Array4, vertexCount), 2);
|
|
37631
37630
|
}
|
|
37632
37631
|
if (encodedMeshData.uv3) {
|
|
37633
|
-
var float32Array5 = new Float32Array(buffer, encodedMeshData.uv3.start + offset
|
|
37632
|
+
var float32Array5 = new Float32Array(buffer, encodedMeshData.uv3.start + offset, (encodedMeshData.uv3.end - encodedMeshData.uv3.start) / 4);
|
|
37634
37633
|
modelMesh.setUVs(float32ArrayToVector2(float32Array5, vertexCount), 3);
|
|
37635
37634
|
}
|
|
37636
37635
|
if (encodedMeshData.uv4) {
|
|
37637
|
-
var float32Array6 = new Float32Array(buffer, encodedMeshData.uv4.start + offset
|
|
37636
|
+
var float32Array6 = new Float32Array(buffer, encodedMeshData.uv4.start + offset, (encodedMeshData.uv4.end - encodedMeshData.uv4.start) / 4);
|
|
37638
37637
|
modelMesh.setUVs(float32ArrayToVector2(float32Array6, vertexCount), 4);
|
|
37639
37638
|
}
|
|
37640
37639
|
if (encodedMeshData.uv5) {
|
|
37641
|
-
var float32Array7 = new Float32Array(buffer, encodedMeshData.uv5.start + offset
|
|
37640
|
+
var float32Array7 = new Float32Array(buffer, encodedMeshData.uv5.start + offset, (encodedMeshData.uv5.end - encodedMeshData.uv5.start) / 4);
|
|
37642
37641
|
modelMesh.setUVs(float32ArrayToVector2(float32Array7, vertexCount), 5);
|
|
37643
37642
|
}
|
|
37644
37643
|
if (encodedMeshData.uv6) {
|
|
37645
|
-
var float32Array8 = new Float32Array(buffer, encodedMeshData.uv6.start + offset
|
|
37644
|
+
var float32Array8 = new Float32Array(buffer, encodedMeshData.uv6.start + offset, (encodedMeshData.uv6.end - encodedMeshData.uv6.start) / 4);
|
|
37646
37645
|
modelMesh.setUVs(float32ArrayToVector2(float32Array8, vertexCount), 6);
|
|
37647
37646
|
}
|
|
37648
37647
|
if (encodedMeshData.uv7) {
|
|
37649
|
-
var float32Array9 = new Float32Array(buffer, encodedMeshData.uv7.start + offset
|
|
37648
|
+
var float32Array9 = new Float32Array(buffer, encodedMeshData.uv7.start + offset, (encodedMeshData.uv7.end - encodedMeshData.uv7.start) / 4);
|
|
37650
37649
|
modelMesh.setUVs(float32ArrayToVector2(float32Array9, vertexCount), 7);
|
|
37651
37650
|
}
|
|
37652
37651
|
if (encodedMeshData.colors) {
|
|
37653
|
-
var float32Array10 = new Float32Array(buffer, encodedMeshData.colors.start + offset
|
|
37652
|
+
var float32Array10 = new Float32Array(buffer, encodedMeshData.colors.start + offset, (encodedMeshData.colors.end - encodedMeshData.colors.start) / 4);
|
|
37654
37653
|
modelMesh.setColors(float32ArrayToVColor(float32Array10, vertexCount));
|
|
37655
37654
|
}
|
|
37656
37655
|
if (encodedMeshData.boneWeights) {
|
|
37657
|
-
var float32Array11 = new Float32Array(buffer, encodedMeshData.boneWeights.start + offset
|
|
37656
|
+
var float32Array11 = new Float32Array(buffer, encodedMeshData.boneWeights.start + offset, (encodedMeshData.boneWeights.end - encodedMeshData.boneWeights.start) / 4);
|
|
37658
37657
|
modelMesh.setBoneWeights(float32ArrayToVector4(float32Array11, vertexCount));
|
|
37659
37658
|
}
|
|
37660
37659
|
if (encodedMeshData.boneIndices) {
|
|
37661
|
-
var float32Array12 = new Float32Array(buffer, encodedMeshData.boneIndices.start + offset
|
|
37660
|
+
var float32Array12 = new Float32Array(buffer, encodedMeshData.boneIndices.start + offset, (encodedMeshData.boneIndices.end - encodedMeshData.boneIndices.start) / 4);
|
|
37662
37661
|
modelMesh.setBoneIndices(float32ArrayToVector4(float32Array12, vertexCount));
|
|
37663
37662
|
}
|
|
37664
37663
|
if (encodedMeshData.blendShapes) {
|
|
37665
37664
|
encodedMeshData.blendShapes.forEach(function(blendShapeData) {
|
|
37666
37665
|
var blendShape = new BlendShape(blendShapeData.name);
|
|
37667
37666
|
blendShapeData.frames.forEach(function(frameData) {
|
|
37668
|
-
var positionArray = new Float32Array(buffer, frameData.deltaPosition.start + offset
|
|
37667
|
+
var positionArray = new Float32Array(buffer, frameData.deltaPosition.start + offset, (frameData.deltaPosition.end - frameData.deltaPosition.start) / 4);
|
|
37669
37668
|
var count = positionArray.length / 3;
|
|
37670
37669
|
var deltaPosition = float32ArrayToVector3(positionArray, count);
|
|
37671
37670
|
if (frameData.deltaNormals) {
|
|
37672
|
-
var normalsArray = new Float32Array(buffer, frameData.deltaNormals.start + offset
|
|
37671
|
+
var normalsArray = new Float32Array(buffer, frameData.deltaNormals.start + offset, (frameData.deltaNormals.end - frameData.deltaNormals.start) / 4);
|
|
37673
37672
|
float32ArrayToVector3(normalsArray, count);
|
|
37674
37673
|
}
|
|
37675
37674
|
if (frameData.deltaTangents) {
|
|
37676
|
-
var tangentsArray = new Float32Array(buffer, frameData.deltaTangents.start + offset
|
|
37675
|
+
var tangentsArray = new Float32Array(buffer, frameData.deltaTangents.start + offset, (frameData.deltaTangents.end - frameData.deltaTangents.start) / 4);
|
|
37677
37676
|
float32ArrayToVector4(tangentsArray, count);
|
|
37678
37677
|
}
|
|
37679
37678
|
blendShape.addFrame(frameData.weight, deltaPosition);
|
|
@@ -37684,9 +37683,9 @@
|
|
|
37684
37683
|
if (encodedMeshData.indices) {
|
|
37685
37684
|
var indices = null;
|
|
37686
37685
|
if (encodedMeshData.indices.type === 0) {
|
|
37687
|
-
indices = new Uint16Array(buffer, encodedMeshData.indices.start + offset
|
|
37686
|
+
indices = new Uint16Array(buffer, encodedMeshData.indices.start + offset, (encodedMeshData.indices.end - encodedMeshData.indices.start) / 2);
|
|
37688
37687
|
} else {
|
|
37689
|
-
indices = new Uint32Array(buffer, encodedMeshData.indices.start + offset
|
|
37688
|
+
indices = new Uint32Array(buffer, encodedMeshData.indices.start + offset, (encodedMeshData.indices.end - encodedMeshData.indices.start) / 4);
|
|
37690
37689
|
}
|
|
37691
37690
|
modelMesh.setIndices(indices);
|
|
37692
37691
|
}
|
|
@@ -38879,11 +38878,37 @@
|
|
|
38879
38878
|
_this.get(9),
|
|
38880
38879
|
_this.get(2)
|
|
38881
38880
|
]).then(function() {
|
|
38881
|
+
var glTFResource = _this.glTFResource;
|
|
38882
|
+
if (glTFResource.skins || glTFResource.animations) {
|
|
38883
|
+
_this._createAnimator(_this, glTFResource.animations);
|
|
38884
|
+
}
|
|
38882
38885
|
_this.resourceManager.addContentRestorer(_this.contentRestorer);
|
|
38883
|
-
return
|
|
38886
|
+
return glTFResource;
|
|
38884
38887
|
});
|
|
38885
38888
|
});
|
|
38886
38889
|
};
|
|
38890
|
+
_proto._createAnimator = function _createAnimator(context, animations) {
|
|
38891
|
+
var defaultSceneRoot = context.glTFResource.defaultSceneRoot;
|
|
38892
|
+
var animator = defaultSceneRoot.addComponent(Animator);
|
|
38893
|
+
var animatorController = new AnimatorController();
|
|
38894
|
+
var layer = new AnimatorControllerLayer("layer");
|
|
38895
|
+
var animatorStateMachine = new AnimatorStateMachine();
|
|
38896
|
+
animatorController.addLayer(layer);
|
|
38897
|
+
animator.animatorController = animatorController;
|
|
38898
|
+
layer.stateMachine = animatorStateMachine;
|
|
38899
|
+
if (animations) {
|
|
38900
|
+
for(var i = 0; i < animations.length; i++){
|
|
38901
|
+
var animationClip = animations[i];
|
|
38902
|
+
var name = animationClip.name;
|
|
38903
|
+
var uniqueName = animatorStateMachine.makeUniqueStateName(name);
|
|
38904
|
+
if (uniqueName !== name) {
|
|
38905
|
+
console.warn("AnimatorState name is existed, name: " + name + " reset to " + uniqueName);
|
|
38906
|
+
}
|
|
38907
|
+
var animatorState = animatorStateMachine.addState(uniqueName);
|
|
38908
|
+
animatorState.clip = animationClip;
|
|
38909
|
+
}
|
|
38910
|
+
}
|
|
38911
|
+
};
|
|
38887
38912
|
_proto._handleSubAsset = function _handleSubAsset(resource, type, index) {
|
|
38888
38913
|
var _this = this;
|
|
38889
38914
|
var glTFResourceKey = glTFResourceMap[type];
|
|
@@ -40793,6 +40818,7 @@
|
|
|
40793
40818
|
var promises = new Array();
|
|
40794
40819
|
// parse samplers
|
|
40795
40820
|
for(var j = 0, m = samplers.length; j < m; j++)_loop(j);
|
|
40821
|
+
promises.push(context.get(exports.GLTFParserType.Scene));
|
|
40796
40822
|
return Promise.all(promises).then(function() {
|
|
40797
40823
|
for(var j = 0, m = channels.length; j < m; j++){
|
|
40798
40824
|
var gltfChannel = channels[j];
|
|
@@ -40805,7 +40831,7 @@
|
|
|
40805
40831
|
entity = entity.parent;
|
|
40806
40832
|
}
|
|
40807
40833
|
// If the target node is in the default scene, relativePath will be empty
|
|
40808
|
-
if (
|
|
40834
|
+
if (context.glTFResource.sceneRoots.indexOf(entity) === -1) {
|
|
40809
40835
|
continue;
|
|
40810
40836
|
}
|
|
40811
40837
|
var ComponentType = void 0;
|
|
@@ -41316,7 +41342,6 @@
|
|
|
41316
41342
|
_inherits(GLTFSceneParser, GLTFParser1);
|
|
41317
41343
|
var _proto = GLTFSceneParser.prototype;
|
|
41318
41344
|
_proto.parse = function parse(context, index) {
|
|
41319
|
-
var _this = this;
|
|
41320
41345
|
var _context_glTF = context.glTF, scenes = _context_glTF.scenes, _context_glTF_scene = _context_glTF.scene, scene = _context_glTF_scene === void 0 ? 0 : _context_glTF_scene, glTFResource = context.glTFResource;
|
|
41321
41346
|
var sceneInfo = scenes[index];
|
|
41322
41347
|
var sceneExtensions = sceneInfo.extensions;
|
|
@@ -41346,18 +41371,6 @@
|
|
|
41346
41371
|
}
|
|
41347
41372
|
return Promise.all(promises).then(function() {
|
|
41348
41373
|
GLTFParser.executeExtensionsAdditiveAndParse(sceneExtensions, context, sceneRoot, sceneInfo);
|
|
41349
|
-
if (isDefaultScene) {
|
|
41350
|
-
return Promise.all([
|
|
41351
|
-
context.get(exports.GLTFParserType.Skin),
|
|
41352
|
-
context.get(exports.GLTFParserType.Animation)
|
|
41353
|
-
]).then(function(param) {
|
|
41354
|
-
var skins = param[0], animations = param[1];
|
|
41355
|
-
if (skins || animations) {
|
|
41356
|
-
_this._createAnimator(context, animations);
|
|
41357
|
-
}
|
|
41358
|
-
return sceneRoot;
|
|
41359
|
-
});
|
|
41360
|
-
}
|
|
41361
41374
|
return sceneRoot;
|
|
41362
41375
|
});
|
|
41363
41376
|
};
|
|
@@ -41469,28 +41482,6 @@
|
|
|
41469
41482
|
for(var i = 0; i < glTFMeshPrimitives.length; i++)_loop(i);
|
|
41470
41483
|
return Promise.all(promises);
|
|
41471
41484
|
};
|
|
41472
|
-
_proto._createAnimator = function _createAnimator(context, animations) {
|
|
41473
|
-
var defaultSceneRoot = context.glTFResource.defaultSceneRoot;
|
|
41474
|
-
var animator = defaultSceneRoot.addComponent(Animator);
|
|
41475
|
-
var animatorController = new AnimatorController();
|
|
41476
|
-
var layer = new AnimatorControllerLayer("layer");
|
|
41477
|
-
var animatorStateMachine = new AnimatorStateMachine();
|
|
41478
|
-
animatorController.addLayer(layer);
|
|
41479
|
-
animator.animatorController = animatorController;
|
|
41480
|
-
layer.stateMachine = animatorStateMachine;
|
|
41481
|
-
if (animations) {
|
|
41482
|
-
for(var i = 0; i < animations.length; i++){
|
|
41483
|
-
var animationClip = animations[i];
|
|
41484
|
-
var name = animationClip.name;
|
|
41485
|
-
var uniqueName = animatorStateMachine.makeUniqueStateName(name);
|
|
41486
|
-
if (uniqueName !== name) {
|
|
41487
|
-
console.warn("AnimatorState name is existed, name: " + name + " reset to " + uniqueName);
|
|
41488
|
-
}
|
|
41489
|
-
var animatorState = animatorStateMachine.addState(uniqueName);
|
|
41490
|
-
animatorState.clip = animationClip;
|
|
41491
|
-
}
|
|
41492
|
-
}
|
|
41493
|
-
};
|
|
41494
41485
|
_proto._computeLocalBounds = function _computeLocalBounds(skinnedMeshRenderer, mesh, bones, rootBone, inverseBindMatrices) {
|
|
41495
41486
|
var rootBoneIndex = bones.indexOf(rootBone);
|
|
41496
41487
|
if (rootBoneIndex !== -1) {
|
|
@@ -43354,7 +43345,7 @@
|
|
|
43354
43345
|
], GALACEAN_animation_event);
|
|
43355
43346
|
|
|
43356
43347
|
//@ts-ignore
|
|
43357
|
-
var version = "1.1.0-beta.
|
|
43348
|
+
var version = "1.1.0-beta.17";
|
|
43358
43349
|
console.log("Galacean engine version: " + version);
|
|
43359
43350
|
for(var key in CoreObjects){
|
|
43360
43351
|
Loader.registerClass(key, CoreObjects[key]);
|