@galacean/engine 1.2.0-beta.2 → 1.2.0-beta.4
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/LICENSE +2 -2
- package/dist/browser.js +93 -54
- package/dist/browser.js.map +1 -0
- package/dist/browser.min.js +2 -1
- package/dist/browser.min.js.map +1 -0
- 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/.DS_Store +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright (c) 2020 - present Ant Group
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
21
|
+
THE SOFTWARE.
|
package/dist/browser.js
CHANGED
|
@@ -2242,11 +2242,11 @@
|
|
|
2242
2242
|
var unit = xx + yy + zz + ww;
|
|
2243
2243
|
var test = 2 * (x * w - y * z);
|
|
2244
2244
|
if (test > (1 - MathUtil.zeroTolerance) * unit) {
|
|
2245
|
-
out._x = Math.atan2(2.0 * (w * y - x * z),
|
|
2245
|
+
out._x = Math.atan2(2.0 * (w * y - x * z), xx + ww - yy - zz);
|
|
2246
2246
|
out._y = Math.PI / 2;
|
|
2247
2247
|
out._z = 0;
|
|
2248
2248
|
} else if (test < -(1 - MathUtil.zeroTolerance) * unit) {
|
|
2249
|
-
out._x = Math.atan2(2.0 * (w * y - x * z),
|
|
2249
|
+
out._x = Math.atan2(2.0 * (w * y - x * z), xx + ww - yy - zz);
|
|
2250
2250
|
out._y = -Math.PI / 2;
|
|
2251
2251
|
out._z = 0;
|
|
2252
2252
|
} else {
|
|
@@ -9794,7 +9794,8 @@
|
|
|
9794
9794
|
}
|
|
9795
9795
|
var shaderInfo = Shader._shaderLab.parseShader(nameOrShaderSource);
|
|
9796
9796
|
if (shaderMap[shaderInfo.name]) {
|
|
9797
|
-
|
|
9797
|
+
console.error('Shader named "' + shaderInfo.name + '" already exists.');
|
|
9798
|
+
return;
|
|
9798
9799
|
}
|
|
9799
9800
|
var subShaderList = shaderInfo.subShaders.map(function(subShaderInfo) {
|
|
9800
9801
|
var passList = subShaderInfo.passes.map(function(passInfo) {
|
|
@@ -9833,7 +9834,8 @@
|
|
|
9833
9834
|
return shader;
|
|
9834
9835
|
} else {
|
|
9835
9836
|
if (shaderMap[nameOrShaderSource]) {
|
|
9836
|
-
|
|
9837
|
+
console.error('Shader named "' + nameOrShaderSource + '" already exists.');
|
|
9838
|
+
return;
|
|
9837
9839
|
}
|
|
9838
9840
|
if (typeof vertexSourceOrShaderPassesOrSubShaders === "string") {
|
|
9839
9841
|
var shaderPass = new ShaderPass(vertexSourceOrShaderPassesOrSubShaders, fragmentSource);
|
|
@@ -24193,7 +24195,8 @@
|
|
|
24193
24195
|
/** @internal */ this._upList = new DisorderedArray();
|
|
24194
24196
|
/** @internal */ this._downList = new DisorderedArray();
|
|
24195
24197
|
this._nativeEvents = [];
|
|
24196
|
-
|
|
24198
|
+
// Temporary solution for mini program, window does not exist
|
|
24199
|
+
if (typeof Window !== "undefined" && _instanceof1$2(target, Window)) {
|
|
24197
24200
|
throw "Do not set window as target because window cannot listen to pointer leave event.";
|
|
24198
24201
|
}
|
|
24199
24202
|
this._engine = engine;
|
|
@@ -26801,9 +26804,10 @@
|
|
|
26801
26804
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
26802
26805
|
var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
|
|
26803
26806
|
var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
|
|
26804
|
-
var
|
|
26805
|
-
var
|
|
26806
|
-
var
|
|
26807
|
+
var maxLight = LightManager._maxLight;
|
|
26808
|
+
var spotLightCount = Math.min(spotLight.length, maxLight);
|
|
26809
|
+
var pointLightCount = Math.min(pointLight.length, maxLight);
|
|
26810
|
+
var directLightCount = Math.min(directLight.length, maxLight);
|
|
26807
26811
|
for(var i = 0; i < spotLightCount; i++){
|
|
26808
26812
|
spotLight.get(i)._appendData(i, spotData);
|
|
26809
26813
|
}
|
|
@@ -31851,20 +31855,19 @@
|
|
|
31851
31855
|
var relativePath = curve.relativePath;
|
|
31852
31856
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
31853
31857
|
if (targetEntity) {
|
|
31854
|
-
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners,
|
|
31855
|
-
var propertyPath = "" + curve.typeIndex + "." + curve.property;
|
|
31858
|
+
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
31856
31859
|
var component = curve.typeIndex > 0 ? targetEntity.getComponents(curve.type, AnimationCurveOwner._components)[curve.typeIndex] : targetEntity.getComponent(curve.type);
|
|
31857
31860
|
if (!component) {
|
|
31858
31861
|
continue;
|
|
31859
31862
|
}
|
|
31860
31863
|
var property = curve.property;
|
|
31861
|
-
var instanceId =
|
|
31864
|
+
var instanceId = component.instanceId;
|
|
31862
31865
|
// Get owner
|
|
31863
31866
|
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
31864
31867
|
var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity, component));
|
|
31865
31868
|
// Get layer owner
|
|
31866
31869
|
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
31867
|
-
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[
|
|
31870
|
+
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
31868
31871
|
if (mask && mask.pathMasks.length) {
|
|
31869
31872
|
var _mask_getPathMask;
|
|
31870
31873
|
var _mask_getPathMask_active;
|
|
@@ -40211,6 +40214,7 @@
|
|
|
40211
40214
|
this.resourceManager = resourceManager;
|
|
40212
40215
|
this.params = params;
|
|
40213
40216
|
this.accessorBufferCache = {};
|
|
40217
|
+
this.needAnimatorController = false;
|
|
40214
40218
|
this._resourceCache = new Map();
|
|
40215
40219
|
this._progress = {
|
|
40216
40220
|
taskDetail: {},
|
|
@@ -40238,16 +40242,15 @@
|
|
|
40238
40242
|
return Promise.resolve(null);
|
|
40239
40243
|
}
|
|
40240
40244
|
var cache = this._resourceCache;
|
|
40241
|
-
var
|
|
40242
|
-
var cacheKey = isOnlyOne || index === undefined ? "" + type : type + ":" + index;
|
|
40245
|
+
var cacheKey = index === undefined ? "" + type : type + ":" + index;
|
|
40243
40246
|
var resource = cache.get(cacheKey);
|
|
40244
40247
|
if (resource) {
|
|
40245
40248
|
return resource;
|
|
40246
40249
|
}
|
|
40247
|
-
|
|
40248
|
-
|
|
40249
|
-
|
|
40250
|
-
var glTFItems = this.glTF[
|
|
40250
|
+
var glTFSchemaKey = glTFSchemaMap[type];
|
|
40251
|
+
var isSubAsset = !!glTFResourceMap[type];
|
|
40252
|
+
if (glTFSchemaKey) {
|
|
40253
|
+
var glTFItems = this.glTF[glTFSchemaKey];
|
|
40251
40254
|
if (glTFItems && (index === undefined || glTFItems[index])) {
|
|
40252
40255
|
if (index === undefined) {
|
|
40253
40256
|
resource = type === 8 ? glTFItems.map(function(_, index) {
|
|
@@ -40257,11 +40260,14 @@
|
|
|
40257
40260
|
}));
|
|
40258
40261
|
} else {
|
|
40259
40262
|
resource = parser.parse(this, index);
|
|
40260
|
-
this._handleSubAsset(resource, type, index);
|
|
40263
|
+
isSubAsset && this._handleSubAsset(resource, type, index);
|
|
40261
40264
|
}
|
|
40262
40265
|
} else {
|
|
40263
40266
|
resource = Promise.resolve(null);
|
|
40264
40267
|
}
|
|
40268
|
+
} else {
|
|
40269
|
+
resource = parser.parse(this, index);
|
|
40270
|
+
isSubAsset && this._handleSubAsset(resource, type, index);
|
|
40265
40271
|
}
|
|
40266
40272
|
cache.set(cacheKey, resource);
|
|
40267
40273
|
return resource;
|
|
@@ -40270,6 +40276,7 @@
|
|
|
40270
40276
|
var _this = this;
|
|
40271
40277
|
var promise = this.get(0).then(function(json) {
|
|
40272
40278
|
_this.glTF = json;
|
|
40279
|
+
_this.needAnimatorController = !!(json.skins || json.animations);
|
|
40273
40280
|
return Promise.all([
|
|
40274
40281
|
_this.get(1),
|
|
40275
40282
|
_this.get(5),
|
|
@@ -40277,11 +40284,14 @@
|
|
|
40277
40284
|
_this.get(7),
|
|
40278
40285
|
_this.get(9),
|
|
40279
40286
|
_this.get(10),
|
|
40287
|
+
_this.get(11),
|
|
40280
40288
|
_this.get(2)
|
|
40281
40289
|
]).then(function() {
|
|
40282
40290
|
var glTFResource = _this.glTFResource;
|
|
40283
|
-
|
|
40284
|
-
|
|
40291
|
+
var animatorController = glTFResource.animatorController;
|
|
40292
|
+
if (animatorController) {
|
|
40293
|
+
var animator = glTFResource._defaultSceneRoot.addComponent(Animator);
|
|
40294
|
+
animator.animatorController = animatorController;
|
|
40285
40295
|
}
|
|
40286
40296
|
_this.resourceManager.addContentRestorer(_this.contentRestorer);
|
|
40287
40297
|
return glTFResource;
|
|
@@ -40300,40 +40310,21 @@
|
|
|
40300
40310
|
_this._setTaskCompleteProgress(++task.loaded, task.total);
|
|
40301
40311
|
});
|
|
40302
40312
|
};
|
|
40303
|
-
_proto._createAnimator = function _createAnimator(context, animations) {
|
|
40304
|
-
var defaultSceneRoot = context.glTFResource.defaultSceneRoot;
|
|
40305
|
-
var animator = defaultSceneRoot.addComponent(Animator);
|
|
40306
|
-
var animatorController = new AnimatorController();
|
|
40307
|
-
var layer = new AnimatorControllerLayer("layer");
|
|
40308
|
-
var animatorStateMachine = new AnimatorStateMachine();
|
|
40309
|
-
animatorController.addLayer(layer);
|
|
40310
|
-
animator.animatorController = animatorController;
|
|
40311
|
-
layer.stateMachine = animatorStateMachine;
|
|
40312
|
-
if (animations) {
|
|
40313
|
-
for(var i = 0; i < animations.length; i++){
|
|
40314
|
-
var animationClip = animations[i];
|
|
40315
|
-
var name = animationClip.name;
|
|
40316
|
-
var uniqueName = animatorStateMachine.makeUniqueStateName(name);
|
|
40317
|
-
if (uniqueName !== name) {
|
|
40318
|
-
console.warn("AnimatorState name is existed, name: " + name + " reset to " + uniqueName);
|
|
40319
|
-
}
|
|
40320
|
-
var animatorState = animatorStateMachine.addState(uniqueName);
|
|
40321
|
-
animatorState.clip = animationClip;
|
|
40322
|
-
}
|
|
40323
|
-
}
|
|
40324
|
-
};
|
|
40325
40313
|
_proto._handleSubAsset = function _handleSubAsset(resource, type, index) {
|
|
40326
40314
|
var _this = this;
|
|
40327
40315
|
var glTFResourceKey = glTFResourceMap[type];
|
|
40328
|
-
if (!glTFResourceKey) return;
|
|
40329
40316
|
if (type === 8) {
|
|
40330
40317
|
var _this_glTFResource, _glTFResourceKey;
|
|
40331
40318
|
((_this_glTFResource = this.glTFResource)[_glTFResourceKey = glTFResourceKey] || (_this_glTFResource[_glTFResourceKey] = []))[index] = resource;
|
|
40332
40319
|
} else {
|
|
40333
40320
|
var url = this.glTFResource.url;
|
|
40334
40321
|
resource.then(function(item) {
|
|
40335
|
-
|
|
40336
|
-
|
|
40322
|
+
if (index == undefined) {
|
|
40323
|
+
_this.glTFResource[glTFResourceKey] = item;
|
|
40324
|
+
} else {
|
|
40325
|
+
var _this_glTFResource, _glTFResourceKey;
|
|
40326
|
+
((_this_glTFResource = _this.glTFResource)[_glTFResourceKey = glTFResourceKey] || (_this_glTFResource[_glTFResourceKey] = []))[index] = item;
|
|
40327
|
+
}
|
|
40337
40328
|
if (type === 7) {
|
|
40338
40329
|
for(var i = 0, length = item.length; i < length; i++){
|
|
40339
40330
|
var mesh = item[i];
|
|
@@ -40381,11 +40372,12 @@
|
|
|
40381
40372
|
GLTFParserType[GLTFParserType["Entity"] = 8] = "Entity";
|
|
40382
40373
|
GLTFParserType[GLTFParserType["Skin"] = 9] = "Skin";
|
|
40383
40374
|
GLTFParserType[GLTFParserType["Animation"] = 10] = "Animation";
|
|
40375
|
+
GLTFParserType[GLTFParserType["AnimatorController"] = 11] = "AnimatorController";
|
|
40384
40376
|
})(exports.GLTFParserType || (exports.GLTFParserType = {}));
|
|
40385
40377
|
var _obj;
|
|
40386
40378
|
var glTFSchemaMap = (_obj = {}, _obj[2] = "scenes", _obj[3] = "buffers", _obj[5] = "textures", _obj[6] = "materials", _obj[7] = "meshes", _obj[8] = "nodes", _obj[9] = "skins", _obj[10] = "animations", _obj[4] = "bufferViews", _obj);
|
|
40387
40379
|
var _obj1;
|
|
40388
|
-
var glTFResourceMap = (_obj1 = {}, _obj1[2] = "_sceneRoots", _obj1[5] = "textures", _obj1[6] = "materials", _obj1[7] = "meshes", _obj1[8] = "entities", _obj1[9] = "skins", _obj1[10] = "animations", _obj1);
|
|
40380
|
+
var glTFResourceMap = (_obj1 = {}, _obj1[2] = "_sceneRoots", _obj1[5] = "textures", _obj1[6] = "materials", _obj1[7] = "meshes", _obj1[8] = "entities", _obj1[9] = "skins", _obj1[10] = "animations", _obj1[11] = "animatorController", _obj1);
|
|
40389
40381
|
function registerGLTFParser(pipeline) {
|
|
40390
40382
|
return function(Parser) {
|
|
40391
40383
|
var parser = new Parser();
|
|
@@ -43138,6 +43130,47 @@
|
|
|
43138
43130
|
exports.GLTFBufferViewParser = __decorate([
|
|
43139
43131
|
registerGLTFParser(exports.GLTFParserType.BufferView)
|
|
43140
43132
|
], exports.GLTFBufferViewParser);
|
|
43133
|
+
exports.GLTFAnimatorControllerParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
43134
|
+
var GLTFAnimatorControllerParser = function GLTFAnimatorControllerParser() {
|
|
43135
|
+
return GLTFParser1.apply(this, arguments);
|
|
43136
|
+
};
|
|
43137
|
+
_inherits(GLTFAnimatorControllerParser, GLTFParser1);
|
|
43138
|
+
var _proto = GLTFAnimatorControllerParser.prototype;
|
|
43139
|
+
_proto.parse = function parse(context) {
|
|
43140
|
+
var _this = this;
|
|
43141
|
+
if (!context.needAnimatorController) {
|
|
43142
|
+
return Promise.resolve(null);
|
|
43143
|
+
}
|
|
43144
|
+
return context.get(exports.GLTFParserType.Animation).then(function(animations) {
|
|
43145
|
+
var animatorController = _this._createAnimatorController(animations);
|
|
43146
|
+
return Promise.resolve(animatorController);
|
|
43147
|
+
});
|
|
43148
|
+
};
|
|
43149
|
+
_proto._createAnimatorController = function _createAnimatorController(animations) {
|
|
43150
|
+
var animatorController = new AnimatorController();
|
|
43151
|
+
var layer = new AnimatorControllerLayer("layer");
|
|
43152
|
+
var animatorStateMachine = new AnimatorStateMachine();
|
|
43153
|
+
animatorController.addLayer(layer);
|
|
43154
|
+
layer.stateMachine = animatorStateMachine;
|
|
43155
|
+
if (animations) {
|
|
43156
|
+
for(var i = 0; i < animations.length; i++){
|
|
43157
|
+
var animationClip = animations[i];
|
|
43158
|
+
var name = animationClip.name;
|
|
43159
|
+
var uniqueName = animatorStateMachine.makeUniqueStateName(name);
|
|
43160
|
+
if (uniqueName !== name) {
|
|
43161
|
+
console.warn("AnimatorState name is existed, name: " + name + " reset to " + uniqueName);
|
|
43162
|
+
}
|
|
43163
|
+
var animatorState = animatorStateMachine.addState(uniqueName);
|
|
43164
|
+
animatorState.clip = animationClip;
|
|
43165
|
+
}
|
|
43166
|
+
}
|
|
43167
|
+
return animatorController;
|
|
43168
|
+
};
|
|
43169
|
+
return GLTFAnimatorControllerParser;
|
|
43170
|
+
}(GLTFParser);
|
|
43171
|
+
exports.GLTFAnimatorControllerParser = __decorate([
|
|
43172
|
+
registerGLTFParser(exports.GLTFParserType.AnimatorController)
|
|
43173
|
+
], exports.GLTFAnimatorControllerParser);
|
|
43141
43174
|
// Source: https://github.com/zeux/meshoptimizer/blob/master/js/meshopt_decoder.js
|
|
43142
43175
|
var MeshoptDecoder = function() {
|
|
43143
43176
|
var unpack = function unpack(data) {
|
|
@@ -43543,15 +43576,20 @@
|
|
|
43543
43576
|
var dataRGBA = new Uint8Array(4 * width * height);
|
|
43544
43577
|
var offset = 0, pos = 0;
|
|
43545
43578
|
var ptrEnd = 4 * scanLineWidth;
|
|
43546
|
-
var rgbeStart = new Uint8Array(4);
|
|
43547
43579
|
var scanLineBuffer = new Uint8Array(ptrEnd);
|
|
43548
43580
|
var numScanLines = height; // read in each successive scanLine
|
|
43549
43581
|
while(numScanLines > 0 && pos < byteLength){
|
|
43550
|
-
|
|
43551
|
-
|
|
43552
|
-
|
|
43553
|
-
|
|
43554
|
-
if (
|
|
43582
|
+
var a = buffer[pos++];
|
|
43583
|
+
var b = buffer[pos++];
|
|
43584
|
+
var c = buffer[pos++];
|
|
43585
|
+
var d = buffer[pos++];
|
|
43586
|
+
if (a != 2 || b != 2 || c & 0x80 || width < 8 || width > 32767) {
|
|
43587
|
+
// this file is not run length encoded
|
|
43588
|
+
// read values sequentially
|
|
43589
|
+
return buffer;
|
|
43590
|
+
}
|
|
43591
|
+
if ((c << 8 | d) != scanLineWidth) {
|
|
43592
|
+
// eslint-disable-next-line no-throw-literal
|
|
43555
43593
|
throw "HDR Bad header format, wrong scan line width";
|
|
43556
43594
|
}
|
|
43557
43595
|
// read each of the four channels for the scanline into the buffer
|
|
@@ -44957,7 +44995,7 @@
|
|
|
44957
44995
|
], KHR_materials_anisotropy);
|
|
44958
44996
|
|
|
44959
44997
|
//@ts-ignore
|
|
44960
|
-
var version = "1.2.0-beta.
|
|
44998
|
+
var version = "1.2.0-beta.4";
|
|
44961
44999
|
console.log("Galacean engine version: " + version);
|
|
44962
45000
|
for(var key in CoreObjects){
|
|
44963
45001
|
Loader.registerClass(key, CoreObjects[key]);
|
|
@@ -45152,3 +45190,4 @@
|
|
|
45152
45190
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
45153
45191
|
|
|
45154
45192
|
}));
|
|
45193
|
+
//# sourceMappingURL=browser.js.map
|