@galacean/engine 1.1.0-beta.15 → 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 +137 -133
- 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
|
@@ -29132,9 +29132,7 @@
|
|
|
29132
29132
|
this.property = property;
|
|
29133
29133
|
this.component = target.getComponent(type);
|
|
29134
29134
|
this.cureType = cureType;
|
|
29135
|
-
|
|
29136
|
-
// @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
|
|
29137
|
-
this._isCopyMode = cureType._isCopyMode && !isBlendShape;
|
|
29135
|
+
this._isBlendShape = _instanceof1$2(this.component, SkinnedMeshRenderer);
|
|
29138
29136
|
var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
|
|
29139
29137
|
this._assembler = new assemblerType();
|
|
29140
29138
|
this._assembler.initialize(this);
|
|
@@ -29166,7 +29164,7 @@
|
|
|
29166
29164
|
this._assembler.setTargetValue(this.defaultValue);
|
|
29167
29165
|
};
|
|
29168
29166
|
_proto.getEvaluateValue = function getEvaluateValue(out) {
|
|
29169
|
-
if (this._isCopyMode) {
|
|
29167
|
+
if (this.cureType._isCopyMode) {
|
|
29170
29168
|
this.cureType._setValue(this.baseEvaluateData.value, out);
|
|
29171
29169
|
return out;
|
|
29172
29170
|
} else {
|
|
@@ -29174,14 +29172,14 @@
|
|
|
29174
29172
|
}
|
|
29175
29173
|
};
|
|
29176
29174
|
_proto.saveDefaultValue = function saveDefaultValue() {
|
|
29177
|
-
if (this._isCopyMode) {
|
|
29175
|
+
if (this.cureType._isCopyMode) {
|
|
29178
29176
|
this.cureType._setValue(this.referenceTargetValue, this.defaultValue);
|
|
29179
29177
|
} else {
|
|
29180
29178
|
this.defaultValue = this._assembler.getTargetValue();
|
|
29181
29179
|
}
|
|
29182
29180
|
};
|
|
29183
29181
|
_proto.saveFixedPoseValue = function saveFixedPoseValue() {
|
|
29184
|
-
if (this._isCopyMode) {
|
|
29182
|
+
if (this.cureType._isCopyMode) {
|
|
29185
29183
|
this.cureType._setValue(this.referenceTargetValue, this.fixedPoseValue);
|
|
29186
29184
|
} else {
|
|
29187
29185
|
this.fixedPoseValue = this._assembler.getTargetValue();
|
|
@@ -29190,40 +29188,50 @@
|
|
|
29190
29188
|
_proto.applyValue = function applyValue(value, weight, additive) {
|
|
29191
29189
|
var cureType = this.cureType;
|
|
29192
29190
|
if (additive) {
|
|
29193
|
-
|
|
29194
|
-
|
|
29191
|
+
var assembler = this._assembler;
|
|
29192
|
+
if (cureType._isCopyMode) {
|
|
29193
|
+
var additiveValue = cureType._additiveValue(value, weight, this.referenceTargetValue);
|
|
29194
|
+
// @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
|
|
29195
|
+
if (this._isBlendShape) {
|
|
29196
|
+
assembler.setTargetValue(additiveValue);
|
|
29197
|
+
}
|
|
29195
29198
|
} else {
|
|
29196
|
-
var assembler = this._assembler;
|
|
29197
29199
|
var originValue = assembler.getTargetValue();
|
|
29198
|
-
var
|
|
29199
|
-
assembler.setTargetValue(
|
|
29200
|
+
var additiveValue1 = cureType._additiveValue(value, weight, originValue);
|
|
29201
|
+
assembler.setTargetValue(additiveValue1);
|
|
29200
29202
|
}
|
|
29201
29203
|
} else {
|
|
29202
29204
|
if (weight === 1.0) {
|
|
29203
|
-
if (
|
|
29205
|
+
if (cureType._isCopyMode) {
|
|
29204
29206
|
cureType._setValue(value, this.referenceTargetValue);
|
|
29207
|
+
// @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
|
|
29208
|
+
if (this._isBlendShape) {
|
|
29209
|
+
this._assembler.setTargetValue(this.referenceTargetValue);
|
|
29210
|
+
}
|
|
29205
29211
|
} else {
|
|
29206
29212
|
this._assembler.setTargetValue(value);
|
|
29207
29213
|
}
|
|
29208
29214
|
} else {
|
|
29209
|
-
if (
|
|
29215
|
+
if (cureType._isCopyMode) {
|
|
29210
29216
|
var targetValue = this.referenceTargetValue;
|
|
29211
29217
|
cureType._lerpValue(targetValue, value, weight, targetValue);
|
|
29218
|
+
// @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
|
|
29219
|
+
if (this._isBlendShape) {
|
|
29220
|
+
this._assembler.setTargetValue(targetValue);
|
|
29221
|
+
}
|
|
29212
29222
|
} else {
|
|
29213
29223
|
var originValue1 = this._assembler.getTargetValue();
|
|
29214
|
-
|
|
29215
|
-
var lerpValue = cureType._lerpValue(originValue1, value, weight, originValue1);
|
|
29224
|
+
var lerpValue = cureType._lerpValue(originValue1, value, weight);
|
|
29216
29225
|
this._assembler.setTargetValue(lerpValue);
|
|
29217
29226
|
}
|
|
29218
29227
|
}
|
|
29219
29228
|
}
|
|
29220
29229
|
};
|
|
29221
29230
|
_proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
29222
|
-
if (this._isCopyMode) {
|
|
29231
|
+
if (this.cureType._isCopyMode) {
|
|
29223
29232
|
return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
29224
29233
|
} else {
|
|
29225
|
-
|
|
29226
|
-
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
29234
|
+
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
29227
29235
|
return this.baseEvaluateData.value;
|
|
29228
29236
|
}
|
|
29229
29237
|
};
|
|
@@ -37427,116 +37435,116 @@
|
|
|
37427
37435
|
this.data = data;
|
|
37428
37436
|
this._dataView = new DataView(data.buffer, data.byteOffset + byteOffset, byteLength != null ? byteLength : data.byteLength - byteOffset);
|
|
37429
37437
|
this._littleEndian = littleEndian;
|
|
37430
|
-
this.
|
|
37438
|
+
this._position = 0;
|
|
37431
37439
|
this._baseOffset = byteOffset;
|
|
37432
37440
|
};
|
|
37433
37441
|
var _proto = BufferReader.prototype;
|
|
37434
37442
|
_proto.nextUint8 = function nextUint8() {
|
|
37435
|
-
var value = this._dataView.getUint8(this.
|
|
37436
|
-
this.
|
|
37443
|
+
var value = this._dataView.getUint8(this._position);
|
|
37444
|
+
this._position += 1;
|
|
37437
37445
|
return value;
|
|
37438
37446
|
};
|
|
37439
37447
|
_proto.nextUint16 = function nextUint16() {
|
|
37440
|
-
var value = this._dataView.getUint16(this.
|
|
37441
|
-
this.
|
|
37448
|
+
var value = this._dataView.getUint16(this._position, this._littleEndian);
|
|
37449
|
+
this._position += 2;
|
|
37442
37450
|
return value;
|
|
37443
37451
|
};
|
|
37444
37452
|
_proto.nextUint32 = function nextUint32() {
|
|
37445
|
-
var value = this._dataView.getUint32(this.
|
|
37446
|
-
this.
|
|
37453
|
+
var value = this._dataView.getUint32(this._position, this._littleEndian);
|
|
37454
|
+
this._position += 4;
|
|
37447
37455
|
return value;
|
|
37448
37456
|
};
|
|
37449
37457
|
_proto.nextInt32 = function nextInt32() {
|
|
37450
|
-
var value = this._dataView.getInt32(this.
|
|
37451
|
-
this.
|
|
37458
|
+
var value = this._dataView.getInt32(this._position, this._littleEndian);
|
|
37459
|
+
this._position += 4;
|
|
37452
37460
|
return value;
|
|
37453
37461
|
};
|
|
37454
37462
|
_proto.nextInt32Array = function nextInt32Array(len) {
|
|
37455
|
-
var value = new Int32Array(this.data.buffer, this.
|
|
37456
|
-
this.
|
|
37463
|
+
var value = new Int32Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
37464
|
+
this._position += 4 * len;
|
|
37457
37465
|
return value;
|
|
37458
37466
|
};
|
|
37459
37467
|
_proto.nextFloat32 = function nextFloat32() {
|
|
37460
|
-
var value = this._dataView.getFloat32(this.
|
|
37461
|
-
this.
|
|
37468
|
+
var value = this._dataView.getFloat32(this._position, this._littleEndian);
|
|
37469
|
+
this._position += 4;
|
|
37462
37470
|
return value;
|
|
37463
37471
|
};
|
|
37464
37472
|
_proto.nextFloat32Array = function nextFloat32Array(len) {
|
|
37465
|
-
var value = new Float32Array(this.data.buffer, this.
|
|
37466
|
-
this.
|
|
37473
|
+
var value = new Float32Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
37474
|
+
this._position += 4 * len;
|
|
37467
37475
|
return value;
|
|
37468
37476
|
};
|
|
37469
37477
|
_proto.nextUint32Array = function nextUint32Array(len) {
|
|
37470
|
-
var value = new Uint32Array(this.data.buffer, this.
|
|
37471
|
-
this.
|
|
37478
|
+
var value = new Uint32Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
37479
|
+
this._position += 4 * len;
|
|
37472
37480
|
return value;
|
|
37473
37481
|
};
|
|
37474
37482
|
_proto.nextUint8Array = function nextUint8Array(len) {
|
|
37475
|
-
var value = new Uint8Array(this.data.buffer, this.
|
|
37476
|
-
this.
|
|
37483
|
+
var value = new Uint8Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
37484
|
+
this._position += len;
|
|
37477
37485
|
return value;
|
|
37478
37486
|
};
|
|
37479
37487
|
_proto.nextUint64 = function nextUint64() {
|
|
37480
|
-
var left = this._dataView.getUint32(this.
|
|
37481
|
-
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);
|
|
37482
37490
|
var value = left + Math.pow(2, 32) * right;
|
|
37483
|
-
this.
|
|
37491
|
+
this._position += 8;
|
|
37484
37492
|
return value;
|
|
37485
37493
|
};
|
|
37486
37494
|
_proto.nextStr = function nextStr() {
|
|
37487
37495
|
var strByteLength = this.nextUint16();
|
|
37488
|
-
var uint8Array = new Uint8Array(this.data.buffer, this.
|
|
37489
|
-
this.
|
|
37496
|
+
var uint8Array = new Uint8Array(this.data.buffer, this._position + this._dataView.byteOffset, strByteLength);
|
|
37497
|
+
this._position += strByteLength;
|
|
37490
37498
|
return Utils.decodeText(uint8Array);
|
|
37491
37499
|
};
|
|
37492
37500
|
/**
|
|
37493
37501
|
* image data 放在最后
|
|
37494
37502
|
*/ _proto.nextImageData = function nextImageData(count) {
|
|
37495
|
-
return new Uint8Array(this.data.buffer, this.data.byteOffset + this.
|
|
37503
|
+
return new Uint8Array(this.data.buffer, this.data.byteOffset + this._position);
|
|
37496
37504
|
};
|
|
37497
37505
|
_proto.nextImagesData = function nextImagesData(count) {
|
|
37498
37506
|
var imagesLen = new Array(count);
|
|
37499
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
|
|
37500
37508
|
for(var i = 0; i < count; i++){
|
|
37501
|
-
var len = this._dataView.getUint32(this.
|
|
37509
|
+
var len = this._dataView.getUint32(this._position, this._littleEndian);
|
|
37502
37510
|
imagesLen[i] = len;
|
|
37503
|
-
this.
|
|
37511
|
+
this._position += 4;
|
|
37504
37512
|
}
|
|
37505
37513
|
var imagesData = [];
|
|
37506
37514
|
for(var i1 = 0; i1 < count; i1++){
|
|
37507
37515
|
var len1 = imagesLen[i1];
|
|
37508
|
-
var buffer = new Uint8Array(this.data.buffer, this._dataView.byteOffset + this.
|
|
37509
|
-
this.
|
|
37516
|
+
var buffer = new Uint8Array(this.data.buffer, this._dataView.byteOffset + this._position, len1);
|
|
37517
|
+
this._position += len1;
|
|
37510
37518
|
imagesData.push(buffer);
|
|
37511
37519
|
}
|
|
37512
37520
|
return imagesData;
|
|
37513
37521
|
};
|
|
37514
37522
|
_proto.skip = function skip(bytes) {
|
|
37515
|
-
this.
|
|
37523
|
+
this._position += bytes;
|
|
37516
37524
|
return this;
|
|
37517
37525
|
};
|
|
37518
37526
|
_proto.scan = function scan(maxByteLength, term) {
|
|
37519
37527
|
if (term === void 0) term = 0x00;
|
|
37520
|
-
var byteOffset = this.
|
|
37528
|
+
var byteOffset = this._position;
|
|
37521
37529
|
var byteLength = 0;
|
|
37522
|
-
while(this._dataView.getUint8(this.
|
|
37530
|
+
while(this._dataView.getUint8(this._position) !== term && byteLength < maxByteLength){
|
|
37523
37531
|
byteLength++;
|
|
37524
|
-
this.
|
|
37532
|
+
this._position++;
|
|
37525
37533
|
}
|
|
37526
|
-
if (byteLength < maxByteLength) this.
|
|
37534
|
+
if (byteLength < maxByteLength) this._position++;
|
|
37527
37535
|
return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength);
|
|
37528
37536
|
};
|
|
37529
37537
|
_create_class(BufferReader, [
|
|
37530
37538
|
{
|
|
37531
37539
|
key: "position",
|
|
37532
37540
|
get: function get() {
|
|
37533
|
-
return this.
|
|
37541
|
+
return this._position;
|
|
37534
37542
|
}
|
|
37535
37543
|
},
|
|
37536
37544
|
{
|
|
37537
37545
|
key: "offset",
|
|
37538
37546
|
get: function get() {
|
|
37539
|
-
return this.
|
|
37547
|
+
return this._position + this._baseOffset;
|
|
37540
37548
|
}
|
|
37541
37549
|
}
|
|
37542
37550
|
]);
|
|
@@ -37597,75 +37605,74 @@
|
|
|
37597
37605
|
var encodedMeshData = JSON.parse(jsonDataString);
|
|
37598
37606
|
// @ts-ignore Vector3 is not compatible with {x: number, y: number, z: number}.
|
|
37599
37607
|
encodedMeshData.bounds && modelMesh.bounds.copyFrom(encodedMeshData.bounds);
|
|
37600
|
-
var offset = Math.ceil(bufferReader.
|
|
37608
|
+
var offset = Math.ceil(bufferReader.offset / 4) * 4 + bufferReader.data.byteOffset;
|
|
37601
37609
|
var buffer = bufferReader.data.buffer;
|
|
37602
|
-
var
|
|
37603
|
-
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);
|
|
37604
37611
|
var vertexCount = float32Array.length / 3;
|
|
37605
37612
|
var positions = float32ArrayToVector3(float32Array, vertexCount);
|
|
37606
37613
|
modelMesh.setPositions(positions);
|
|
37607
37614
|
if (encodedMeshData.normals) {
|
|
37608
|
-
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);
|
|
37609
37616
|
var normals = float32ArrayToVector3(float32Array1, vertexCount);
|
|
37610
37617
|
modelMesh.setNormals(normals);
|
|
37611
37618
|
}
|
|
37612
37619
|
if (encodedMeshData.uvs) {
|
|
37613
|
-
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);
|
|
37614
37621
|
modelMesh.setUVs(float32ArrayToVector2(float32Array2, vertexCount));
|
|
37615
37622
|
}
|
|
37616
37623
|
if (encodedMeshData.uv1) {
|
|
37617
|
-
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);
|
|
37618
37625
|
modelMesh.setUVs(float32ArrayToVector2(float32Array3, vertexCount), 1);
|
|
37619
37626
|
}
|
|
37620
37627
|
if (encodedMeshData.uv2) {
|
|
37621
|
-
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);
|
|
37622
37629
|
modelMesh.setUVs(float32ArrayToVector2(float32Array4, vertexCount), 2);
|
|
37623
37630
|
}
|
|
37624
37631
|
if (encodedMeshData.uv3) {
|
|
37625
|
-
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);
|
|
37626
37633
|
modelMesh.setUVs(float32ArrayToVector2(float32Array5, vertexCount), 3);
|
|
37627
37634
|
}
|
|
37628
37635
|
if (encodedMeshData.uv4) {
|
|
37629
|
-
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);
|
|
37630
37637
|
modelMesh.setUVs(float32ArrayToVector2(float32Array6, vertexCount), 4);
|
|
37631
37638
|
}
|
|
37632
37639
|
if (encodedMeshData.uv5) {
|
|
37633
|
-
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);
|
|
37634
37641
|
modelMesh.setUVs(float32ArrayToVector2(float32Array7, vertexCount), 5);
|
|
37635
37642
|
}
|
|
37636
37643
|
if (encodedMeshData.uv6) {
|
|
37637
|
-
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);
|
|
37638
37645
|
modelMesh.setUVs(float32ArrayToVector2(float32Array8, vertexCount), 6);
|
|
37639
37646
|
}
|
|
37640
37647
|
if (encodedMeshData.uv7) {
|
|
37641
|
-
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);
|
|
37642
37649
|
modelMesh.setUVs(float32ArrayToVector2(float32Array9, vertexCount), 7);
|
|
37643
37650
|
}
|
|
37644
37651
|
if (encodedMeshData.colors) {
|
|
37645
|
-
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);
|
|
37646
37653
|
modelMesh.setColors(float32ArrayToVColor(float32Array10, vertexCount));
|
|
37647
37654
|
}
|
|
37648
37655
|
if (encodedMeshData.boneWeights) {
|
|
37649
|
-
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);
|
|
37650
37657
|
modelMesh.setBoneWeights(float32ArrayToVector4(float32Array11, vertexCount));
|
|
37651
37658
|
}
|
|
37652
37659
|
if (encodedMeshData.boneIndices) {
|
|
37653
|
-
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);
|
|
37654
37661
|
modelMesh.setBoneIndices(float32ArrayToVector4(float32Array12, vertexCount));
|
|
37655
37662
|
}
|
|
37656
37663
|
if (encodedMeshData.blendShapes) {
|
|
37657
37664
|
encodedMeshData.blendShapes.forEach(function(blendShapeData) {
|
|
37658
37665
|
var blendShape = new BlendShape(blendShapeData.name);
|
|
37659
37666
|
blendShapeData.frames.forEach(function(frameData) {
|
|
37660
|
-
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);
|
|
37661
37668
|
var count = positionArray.length / 3;
|
|
37662
37669
|
var deltaPosition = float32ArrayToVector3(positionArray, count);
|
|
37663
37670
|
if (frameData.deltaNormals) {
|
|
37664
|
-
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);
|
|
37665
37672
|
float32ArrayToVector3(normalsArray, count);
|
|
37666
37673
|
}
|
|
37667
37674
|
if (frameData.deltaTangents) {
|
|
37668
|
-
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);
|
|
37669
37676
|
float32ArrayToVector4(tangentsArray, count);
|
|
37670
37677
|
}
|
|
37671
37678
|
blendShape.addFrame(frameData.weight, deltaPosition);
|
|
@@ -37676,9 +37683,9 @@
|
|
|
37676
37683
|
if (encodedMeshData.indices) {
|
|
37677
37684
|
var indices = null;
|
|
37678
37685
|
if (encodedMeshData.indices.type === 0) {
|
|
37679
|
-
indices = new Uint16Array(buffer, encodedMeshData.indices.start + offset
|
|
37686
|
+
indices = new Uint16Array(buffer, encodedMeshData.indices.start + offset, (encodedMeshData.indices.end - encodedMeshData.indices.start) / 2);
|
|
37680
37687
|
} else {
|
|
37681
|
-
indices = new Uint32Array(buffer, encodedMeshData.indices.start + offset
|
|
37688
|
+
indices = new Uint32Array(buffer, encodedMeshData.indices.start + offset, (encodedMeshData.indices.end - encodedMeshData.indices.start) / 4);
|
|
37682
37689
|
}
|
|
37683
37690
|
modelMesh.setIndices(indices);
|
|
37684
37691
|
}
|
|
@@ -38871,11 +38878,37 @@
|
|
|
38871
38878
|
_this.get(9),
|
|
38872
38879
|
_this.get(2)
|
|
38873
38880
|
]).then(function() {
|
|
38881
|
+
var glTFResource = _this.glTFResource;
|
|
38882
|
+
if (glTFResource.skins || glTFResource.animations) {
|
|
38883
|
+
_this._createAnimator(_this, glTFResource.animations);
|
|
38884
|
+
}
|
|
38874
38885
|
_this.resourceManager.addContentRestorer(_this.contentRestorer);
|
|
38875
|
-
return
|
|
38886
|
+
return glTFResource;
|
|
38876
38887
|
});
|
|
38877
38888
|
});
|
|
38878
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
|
+
};
|
|
38879
38912
|
_proto._handleSubAsset = function _handleSubAsset(resource, type, index) {
|
|
38880
38913
|
var _this = this;
|
|
38881
38914
|
var glTFResourceKey = glTFResourceMap[type];
|
|
@@ -40785,6 +40818,7 @@
|
|
|
40785
40818
|
var promises = new Array();
|
|
40786
40819
|
// parse samplers
|
|
40787
40820
|
for(var j = 0, m = samplers.length; j < m; j++)_loop(j);
|
|
40821
|
+
promises.push(context.get(exports.GLTFParserType.Scene));
|
|
40788
40822
|
return Promise.all(promises).then(function() {
|
|
40789
40823
|
for(var j = 0, m = channels.length; j < m; j++){
|
|
40790
40824
|
var gltfChannel = channels[j];
|
|
@@ -40797,7 +40831,7 @@
|
|
|
40797
40831
|
entity = entity.parent;
|
|
40798
40832
|
}
|
|
40799
40833
|
// If the target node is in the default scene, relativePath will be empty
|
|
40800
|
-
if (
|
|
40834
|
+
if (context.glTFResource.sceneRoots.indexOf(entity) === -1) {
|
|
40801
40835
|
continue;
|
|
40802
40836
|
}
|
|
40803
40837
|
var ComponentType = void 0;
|
|
@@ -41308,7 +41342,6 @@
|
|
|
41308
41342
|
_inherits(GLTFSceneParser, GLTFParser1);
|
|
41309
41343
|
var _proto = GLTFSceneParser.prototype;
|
|
41310
41344
|
_proto.parse = function parse(context, index) {
|
|
41311
|
-
var _this = this;
|
|
41312
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;
|
|
41313
41346
|
var sceneInfo = scenes[index];
|
|
41314
41347
|
var sceneExtensions = sceneInfo.extensions;
|
|
@@ -41338,18 +41371,6 @@
|
|
|
41338
41371
|
}
|
|
41339
41372
|
return Promise.all(promises).then(function() {
|
|
41340
41373
|
GLTFParser.executeExtensionsAdditiveAndParse(sceneExtensions, context, sceneRoot, sceneInfo);
|
|
41341
|
-
if (isDefaultScene) {
|
|
41342
|
-
return Promise.all([
|
|
41343
|
-
context.get(exports.GLTFParserType.Skin),
|
|
41344
|
-
context.get(exports.GLTFParserType.Animation)
|
|
41345
|
-
]).then(function(param) {
|
|
41346
|
-
var skins = param[0], animations = param[1];
|
|
41347
|
-
if (skins || animations) {
|
|
41348
|
-
_this._createAnimator(context, animations);
|
|
41349
|
-
}
|
|
41350
|
-
return sceneRoot;
|
|
41351
|
-
});
|
|
41352
|
-
}
|
|
41353
41374
|
return sceneRoot;
|
|
41354
41375
|
});
|
|
41355
41376
|
};
|
|
@@ -41461,28 +41482,6 @@
|
|
|
41461
41482
|
for(var i = 0; i < glTFMeshPrimitives.length; i++)_loop(i);
|
|
41462
41483
|
return Promise.all(promises);
|
|
41463
41484
|
};
|
|
41464
|
-
_proto._createAnimator = function _createAnimator(context, animations) {
|
|
41465
|
-
var defaultSceneRoot = context.glTFResource.defaultSceneRoot;
|
|
41466
|
-
var animator = defaultSceneRoot.addComponent(Animator);
|
|
41467
|
-
var animatorController = new AnimatorController();
|
|
41468
|
-
var layer = new AnimatorControllerLayer("layer");
|
|
41469
|
-
var animatorStateMachine = new AnimatorStateMachine();
|
|
41470
|
-
animatorController.addLayer(layer);
|
|
41471
|
-
animator.animatorController = animatorController;
|
|
41472
|
-
layer.stateMachine = animatorStateMachine;
|
|
41473
|
-
if (animations) {
|
|
41474
|
-
for(var i = 0; i < animations.length; i++){
|
|
41475
|
-
var animationClip = animations[i];
|
|
41476
|
-
var name = animationClip.name;
|
|
41477
|
-
var uniqueName = animatorStateMachine.makeUniqueStateName(name);
|
|
41478
|
-
if (uniqueName !== name) {
|
|
41479
|
-
console.warn("AnimatorState name is existed, name: " + name + " reset to " + uniqueName);
|
|
41480
|
-
}
|
|
41481
|
-
var animatorState = animatorStateMachine.addState(uniqueName);
|
|
41482
|
-
animatorState.clip = animationClip;
|
|
41483
|
-
}
|
|
41484
|
-
}
|
|
41485
|
-
};
|
|
41486
41485
|
_proto._computeLocalBounds = function _computeLocalBounds(skinnedMeshRenderer, mesh, bones, rootBone, inverseBindMatrices) {
|
|
41487
41486
|
var rootBoneIndex = bones.indexOf(rootBone);
|
|
41488
41487
|
if (rootBoneIndex !== -1) {
|
|
@@ -42768,27 +42767,32 @@
|
|
|
42768
42767
|
var promises = [];
|
|
42769
42768
|
// parse ambient light
|
|
42770
42769
|
var ambient = data.scene.ambient;
|
|
42771
|
-
|
|
42772
|
-
|
|
42773
|
-
|
|
42774
|
-
|
|
42775
|
-
|
|
42776
|
-
|
|
42777
|
-
|
|
42778
|
-
|
|
42779
|
-
|
|
42780
|
-
|
|
42781
|
-
|
|
42782
|
-
|
|
42783
|
-
|
|
42784
|
-
|
|
42785
|
-
|
|
42786
|
-
|
|
42787
|
-
|
|
42788
|
-
|
|
42789
|
-
|
|
42790
|
-
|
|
42791
|
-
|
|
42770
|
+
if (ambient) {
|
|
42771
|
+
var useCustomAmbient = ambient.specularMode === "Custom";
|
|
42772
|
+
var useSH = ambient.diffuseMode === exports.DiffuseMode.SphericalHarmonics;
|
|
42773
|
+
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
42774
|
+
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
42775
|
+
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
42776
|
+
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
42777
|
+
scene.ambientLight.specularTextureDecodeRGBM = true;
|
|
42778
|
+
if (useCustomAmbient && ambient.customAmbientLight) {
|
|
42779
|
+
promises.push(resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
|
|
42780
|
+
var _ambientLight;
|
|
42781
|
+
scene.ambientLight.specularTexture = (_ambientLight = ambientLight) == null ? void 0 : _ambientLight.specularTexture;
|
|
42782
|
+
}));
|
|
42783
|
+
}
|
|
42784
|
+
if (ambient.ambientLight && (!useCustomAmbient || useSH)) {
|
|
42785
|
+
promises.push(resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
|
|
42786
|
+
if (!useCustomAmbient) {
|
|
42787
|
+
var _ambientLight;
|
|
42788
|
+
scene.ambientLight.specularTexture = (_ambientLight = ambientLight) == null ? void 0 : _ambientLight.specularTexture;
|
|
42789
|
+
}
|
|
42790
|
+
if (useSH) {
|
|
42791
|
+
var _ambientLight1;
|
|
42792
|
+
scene.ambientLight.diffuseSphericalHarmonics = (_ambientLight1 = ambientLight) == null ? void 0 : _ambientLight1.diffuseSphericalHarmonics;
|
|
42793
|
+
}
|
|
42794
|
+
}));
|
|
42795
|
+
}
|
|
42792
42796
|
}
|
|
42793
42797
|
var background = data.scene.background;
|
|
42794
42798
|
scene.background.mode = background.mode;
|
|
@@ -43341,7 +43345,7 @@
|
|
|
43341
43345
|
], GALACEAN_animation_event);
|
|
43342
43346
|
|
|
43343
43347
|
//@ts-ignore
|
|
43344
|
-
var version = "1.1.0-beta.
|
|
43348
|
+
var version = "1.1.0-beta.17";
|
|
43345
43349
|
console.log("Galacean engine version: " + version);
|
|
43346
43350
|
for(var key in CoreObjects){
|
|
43347
43351
|
Loader.registerClass(key, CoreObjects[key]);
|