@galacean/engine 1.3.2 → 1.3.5
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 +115 -73
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +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/.DS_Store +0 -0
- package/dist/browser.js.map.zip +0 -0
- package/dist/browser.min.js.map.zip +0 -0
package/dist/browser.js
CHANGED
|
@@ -15967,9 +15967,12 @@
|
|
|
15967
15967
|
// Safari gets data confusion through getImageData when the canvas width is not an integer.
|
|
15968
15968
|
// The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
|
|
15969
15969
|
// @todo: Text layout may vary from standard and not support emoji.
|
|
15970
|
-
var
|
|
15970
|
+
var _context_measureText = context.measureText(measureString), actualBoundingBoxLeft = _context_measureText.actualBoundingBoxLeft, actualBoundingBoxRight = _context_measureText.actualBoundingBoxRight, actualWidth = _context_measureText.width;
|
|
15971
15971
|
// In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
|
|
15972
|
-
|
|
15972
|
+
// TODO: With testing, actualBoundingBoxLeft + actualBoundingBoxRight is the actual rendering width
|
|
15973
|
+
// but the space rules between characters are unclear. Using actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft) is the closest to the native effect.
|
|
15974
|
+
var width = Math.max(1, Math.round(Math.max(actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft), actualWidth)));
|
|
15975
|
+
// Make sure enough width.
|
|
15973
15976
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
15974
15977
|
var height = baseline * TextUtils._heightMultiplier;
|
|
15975
15978
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
@@ -15983,7 +15986,11 @@
|
|
|
15983
15986
|
context.clearRect(0, 0, width, height);
|
|
15984
15987
|
context.textBaseline = "middle";
|
|
15985
15988
|
context.fillStyle = "#fff";
|
|
15986
|
-
|
|
15989
|
+
if (actualBoundingBoxLeft > 0) {
|
|
15990
|
+
context.fillText(measureString, actualBoundingBoxLeft, baseline);
|
|
15991
|
+
} else {
|
|
15992
|
+
context.fillText(measureString, 0, baseline);
|
|
15993
|
+
}
|
|
15987
15994
|
var colorData = context.getImageData(0, 0, width, height).data;
|
|
15988
15995
|
var len = colorData.length;
|
|
15989
15996
|
var top = -1;
|
|
@@ -16027,9 +16034,9 @@
|
|
|
16027
16034
|
y: 0,
|
|
16028
16035
|
w: width,
|
|
16029
16036
|
h: size,
|
|
16030
|
-
offsetX: 0,
|
|
16037
|
+
offsetX: actualBoundingBoxLeft > 0 ? actualBoundingBoxLeft : 0,
|
|
16031
16038
|
offsetY: (ascent - descent) * 0.5,
|
|
16032
|
-
xAdvance:
|
|
16039
|
+
xAdvance: Math.round(actualWidth),
|
|
16033
16040
|
uvs: [
|
|
16034
16041
|
new Vector2(),
|
|
16035
16042
|
new Vector2(),
|
|
@@ -16594,7 +16601,7 @@
|
|
|
16594
16601
|
j === firstRow && (minX = Math.min(minX, left));
|
|
16595
16602
|
maxX = Math.max(maxX, right);
|
|
16596
16603
|
}
|
|
16597
|
-
startX += charInfo.xAdvance;
|
|
16604
|
+
startX += charInfo.xAdvance + charInfo.offsetX;
|
|
16598
16605
|
}
|
|
16599
16606
|
}
|
|
16600
16607
|
startY -= lineHeight;
|
|
@@ -17411,8 +17418,6 @@
|
|
|
17411
17418
|
_this = ReferResource1.call(this, engine) || this;
|
|
17412
17419
|
/** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
|
|
17413
17420
|
;
|
|
17414
|
-
/** @internal */ _this._priority = 0 // todo: temporary resolution of submesh rendering order issue.
|
|
17415
|
-
;
|
|
17416
17421
|
_this._shaderData = new ShaderData(ShaderDataGroup.Material);
|
|
17417
17422
|
_this.shader = shader;
|
|
17418
17423
|
return _this;
|
|
@@ -22571,6 +22576,17 @@
|
|
|
22571
22576
|
this._setInActiveInHierarchy(this._activeChangedComponents, activeChangeFlag);
|
|
22572
22577
|
this._setActiveComponents(false, activeChangeFlag);
|
|
22573
22578
|
};
|
|
22579
|
+
/**
|
|
22580
|
+
* @internal
|
|
22581
|
+
*/ _proto._setTransformDirty = function _setTransformDirty() {
|
|
22582
|
+
if (this.transform) {
|
|
22583
|
+
this.transform._parentChange();
|
|
22584
|
+
} else {
|
|
22585
|
+
for(var i = 0, len = this._children.length; i < len; i++){
|
|
22586
|
+
this._children[i]._setTransformDirty();
|
|
22587
|
+
}
|
|
22588
|
+
}
|
|
22589
|
+
};
|
|
22574
22590
|
_proto._addToChildrenList = function _addToChildrenList(index, child) {
|
|
22575
22591
|
var children = this._children;
|
|
22576
22592
|
var childCount = children.length;
|
|
@@ -22680,15 +22696,6 @@
|
|
|
22680
22696
|
child.isActive && child._setInActiveInHierarchy(activeChangedComponents, activeChangeFlag);
|
|
22681
22697
|
}
|
|
22682
22698
|
};
|
|
22683
|
-
_proto._setTransformDirty = function _setTransformDirty() {
|
|
22684
|
-
if (this.transform) {
|
|
22685
|
-
this.transform._parentChange();
|
|
22686
|
-
} else {
|
|
22687
|
-
for(var i = 0, len = this._children.length; i < len; i++){
|
|
22688
|
-
this._children[i]._setTransformDirty();
|
|
22689
|
-
}
|
|
22690
|
-
}
|
|
22691
|
-
};
|
|
22692
22699
|
_proto._setSiblingIndex = function _setSiblingIndex(sibling, target) {
|
|
22693
22700
|
target = Math.min(target, sibling.length - 1);
|
|
22694
22701
|
if (target < 0) {
|
|
@@ -23617,12 +23624,12 @@
|
|
|
23617
23624
|
/**
|
|
23618
23625
|
* @internal
|
|
23619
23626
|
*/ var PrimitiveChunkManager = /*#__PURE__*/ function() {
|
|
23620
|
-
function PrimitiveChunkManager(engine, maxVertexCount) {
|
|
23621
|
-
if (maxVertexCount === void 0) maxVertexCount =
|
|
23627
|
+
var PrimitiveChunkManager = function PrimitiveChunkManager(engine, maxVertexCount) {
|
|
23628
|
+
if (maxVertexCount === void 0) maxVertexCount = 4096;
|
|
23622
23629
|
this.engine = engine;
|
|
23623
23630
|
this.maxVertexCount = maxVertexCount;
|
|
23624
23631
|
this.primitiveChunks = new Array();
|
|
23625
|
-
}
|
|
23632
|
+
};
|
|
23626
23633
|
var _proto = PrimitiveChunkManager.prototype;
|
|
23627
23634
|
_proto.allocateSubChunk = function allocateSubChunk(vertexCount) {
|
|
23628
23635
|
var _primitiveChunks, _length;
|
|
@@ -23659,9 +23666,6 @@
|
|
|
23659
23666
|
};
|
|
23660
23667
|
return PrimitiveChunkManager;
|
|
23661
23668
|
}();
|
|
23662
|
-
(function() {
|
|
23663
|
-
/** The maximum number of vertex. */ PrimitiveChunkManager.MAX_VERTEX_COUNT = 4096;
|
|
23664
|
-
})();
|
|
23665
23669
|
/**
|
|
23666
23670
|
* @internal
|
|
23667
23671
|
*/ var BatcherManager = /*#__PURE__*/ function() {
|
|
@@ -30295,6 +30299,7 @@
|
|
|
30295
30299
|
if (!isRoot) {
|
|
30296
30300
|
entity._isRoot = true;
|
|
30297
30301
|
entity._removeFromParent();
|
|
30302
|
+
entity._setTransformDirty();
|
|
30298
30303
|
}
|
|
30299
30304
|
// Add or remove from scene's rootEntities
|
|
30300
30305
|
var oldScene = entity._scene;
|
|
@@ -45946,57 +45951,18 @@
|
|
|
45946
45951
|
], exports.GLTFSkinParser);
|
|
45947
45952
|
var _GLTFTextureParser;
|
|
45948
45953
|
exports.GLTFTextureParser = (_GLTFTextureParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
45949
|
-
var
|
|
45954
|
+
var GLTFTextureParser1 = function GLTFTextureParser1() {
|
|
45950
45955
|
return GLTFParser1.apply(this, arguments);
|
|
45951
45956
|
};
|
|
45952
|
-
_inherits(
|
|
45953
|
-
var _proto =
|
|
45954
|
-
_proto.parse = function parse(context,
|
|
45955
|
-
var textureInfo = context.glTF.textures[
|
|
45956
|
-
var glTFResource = context.glTFResource
|
|
45957
|
-
var
|
|
45958
|
-
var
|
|
45959
|
-
var _glTF_images_source = glTF.images[source], uri = _glTF_images_source.uri, bufferViewIndex = _glTF_images_source.bufferView, mimeType = _glTF_images_source.mimeType, imageName = _glTF_images_source.name;
|
|
45960
|
-
var texture = GLTFParser.executeExtensionsCreateAndParse(extensions, context, textureInfo);
|
|
45957
|
+
_inherits(GLTFTextureParser1, GLTFParser1);
|
|
45958
|
+
var _proto = GLTFTextureParser1.prototype;
|
|
45959
|
+
_proto.parse = function parse(context, textureIndex) {
|
|
45960
|
+
var textureInfo = context.glTF.textures[textureIndex];
|
|
45961
|
+
var glTFResource = context.glTFResource;
|
|
45962
|
+
var sampler = textureInfo.sampler, tmp = textureInfo.source, imageIndex = tmp === void 0 ? 0 : tmp, textureName = textureInfo.name, extensions = textureInfo.extensions;
|
|
45963
|
+
var texture = GLTFParser.executeExtensionsCreateAndParse(extensions, context, textureInfo, textureIndex);
|
|
45961
45964
|
if (!texture) {
|
|
45962
|
-
|
|
45963
|
-
var samplerInfo = sampler !== undefined && GLTFUtils.getSamplerInfo(glTF.samplers[sampler]);
|
|
45964
|
-
if (uri) {
|
|
45965
|
-
var _samplerInfo;
|
|
45966
|
-
// TODO: deleted in 2.0
|
|
45967
|
-
var extIndex = uri.lastIndexOf(".");
|
|
45968
|
-
var ext = uri.substring(extIndex + 1);
|
|
45969
|
-
var type = ext.startsWith("ktx") ? exports.AssetType.KTX : exports.AssetType.Texture2D;
|
|
45970
|
-
texture = engine.resourceManager.load({
|
|
45971
|
-
url: Utils.resolveAbsoluteUrl(url, uri),
|
|
45972
|
-
type: type,
|
|
45973
|
-
params: {
|
|
45974
|
-
mipmap: (_samplerInfo = samplerInfo) == null ? void 0 : _samplerInfo.mipmap
|
|
45975
|
-
}
|
|
45976
|
-
}).onProgress(undefined, context._onTaskDetail).then(function(texture) {
|
|
45977
|
-
texture.name = textureName || imageName || texture.name || "texture_" + index;
|
|
45978
|
-
useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
|
|
45979
|
-
return texture;
|
|
45980
|
-
});
|
|
45981
|
-
context._addTaskCompletePromise(texture);
|
|
45982
|
-
} else {
|
|
45983
|
-
var bufferView = glTF.bufferViews[bufferViewIndex];
|
|
45984
|
-
texture = context.get(exports.GLTFParserType.Buffer).then(function(buffers) {
|
|
45985
|
-
var buffer = buffers[bufferView.buffer];
|
|
45986
|
-
var imageBuffer = new Uint8Array(buffer, bufferView.byteOffset, bufferView.byteLength);
|
|
45987
|
-
return GLTFUtils.loadImageBuffer(imageBuffer, mimeType).then(function(image) {
|
|
45988
|
-
var _samplerInfo;
|
|
45989
|
-
var texture = new Texture2D(engine, image.width, image.height, undefined, (_samplerInfo = samplerInfo) == null ? void 0 : _samplerInfo.mipmap);
|
|
45990
|
-
texture.setImageSource(image);
|
|
45991
|
-
texture.generateMipmaps();
|
|
45992
|
-
texture.name = textureName || imageName || "texture_" + index;
|
|
45993
|
-
useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
|
|
45994
|
-
var bufferTextureRestoreInfo = new BufferTextureRestoreInfo(texture, bufferView, mimeType);
|
|
45995
|
-
context.contentRestorer.bufferTextures.push(bufferTextureRestoreInfo);
|
|
45996
|
-
return texture;
|
|
45997
|
-
});
|
|
45998
|
-
});
|
|
45999
|
-
}
|
|
45965
|
+
texture = exports.GLTFTextureParser._parseTexture(context, imageIndex, textureIndex, sampler, textureName);
|
|
46000
45966
|
}
|
|
46001
45967
|
return Promise.resolve(texture).then(function(texture) {
|
|
46002
45968
|
GLTFParser.executeExtensionsAdditiveAndParse(extensions, context, texture, textureInfo);
|
|
@@ -46005,7 +45971,51 @@
|
|
|
46005
45971
|
return texture;
|
|
46006
45972
|
});
|
|
46007
45973
|
};
|
|
46008
|
-
|
|
45974
|
+
/** @internal */ GLTFTextureParser1._parseTexture = function _parseTexture(context, imageIndex, textureIndex, sampler, textureName) {
|
|
45975
|
+
var glTFResource = context.glTFResource, glTF = context.glTF;
|
|
45976
|
+
var engine = glTFResource.engine, url = glTFResource.url;
|
|
45977
|
+
var _glTF_images_imageIndex = glTF.images[imageIndex], uri = _glTF_images_imageIndex.uri, bufferViewIndex = _glTF_images_imageIndex.bufferView, mimeType = _glTF_images_imageIndex.mimeType, imageName = _glTF_images_imageIndex.name;
|
|
45978
|
+
var useSampler = sampler !== undefined;
|
|
45979
|
+
var samplerInfo = useSampler && GLTFUtils.getSamplerInfo(glTF.samplers[sampler]);
|
|
45980
|
+
var texture;
|
|
45981
|
+
if (uri) {
|
|
45982
|
+
var _samplerInfo;
|
|
45983
|
+
var extIndex = uri.lastIndexOf(".");
|
|
45984
|
+
var ext = uri.substring(extIndex + 1);
|
|
45985
|
+
var type = ext.startsWith("ktx") ? exports.AssetType.KTX : exports.AssetType.Texture2D;
|
|
45986
|
+
texture = engine.resourceManager.load({
|
|
45987
|
+
url: Utils.resolveAbsoluteUrl(url, uri),
|
|
45988
|
+
type: type,
|
|
45989
|
+
params: {
|
|
45990
|
+
mipmap: (_samplerInfo = samplerInfo) == null ? void 0 : _samplerInfo.mipmap
|
|
45991
|
+
}
|
|
45992
|
+
}).onProgress(undefined, context._onTaskDetail).then(function(texture) {
|
|
45993
|
+
texture.name = textureName || imageName || texture.name || "texture_" + textureIndex;
|
|
45994
|
+
useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
|
|
45995
|
+
return texture;
|
|
45996
|
+
});
|
|
45997
|
+
context._addTaskCompletePromise(texture);
|
|
45998
|
+
} else {
|
|
45999
|
+
var bufferView = glTF.bufferViews[bufferViewIndex];
|
|
46000
|
+
texture = context.get(exports.GLTFParserType.Buffer).then(function(buffers) {
|
|
46001
|
+
var buffer = buffers[bufferView.buffer];
|
|
46002
|
+
var imageBuffer = new Uint8Array(buffer, bufferView.byteOffset, bufferView.byteLength);
|
|
46003
|
+
return GLTFUtils.loadImageBuffer(imageBuffer, mimeType).then(function(image) {
|
|
46004
|
+
var _samplerInfo;
|
|
46005
|
+
var texture = new Texture2D(engine, image.width, image.height, undefined, (_samplerInfo = samplerInfo) == null ? void 0 : _samplerInfo.mipmap);
|
|
46006
|
+
texture.setImageSource(image);
|
|
46007
|
+
texture.generateMipmaps();
|
|
46008
|
+
texture.name = textureName || imageName || "texture_" + textureIndex;
|
|
46009
|
+
useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
|
|
46010
|
+
var bufferTextureRestoreInfo = new BufferTextureRestoreInfo(texture, bufferView, mimeType);
|
|
46011
|
+
context.contentRestorer.bufferTextures.push(bufferTextureRestoreInfo);
|
|
46012
|
+
return texture;
|
|
46013
|
+
});
|
|
46014
|
+
});
|
|
46015
|
+
}
|
|
46016
|
+
return texture;
|
|
46017
|
+
};
|
|
46018
|
+
return GLTFTextureParser1;
|
|
46009
46019
|
}(GLTFParser), function() {
|
|
46010
46020
|
var _obj;
|
|
46011
46021
|
/** @internal */ _GLTFTextureParser._wrapMap = (_obj = {}, _obj[TextureWrapMode.CLAMP_TO_EDGE] = exports.TextureWrapMode.Clamp, _obj[TextureWrapMode.MIRRORED_REPEAT] = exports.TextureWrapMode.Mirror, _obj[TextureWrapMode.REPEAT] = exports.TextureWrapMode.Repeat, _obj);
|
|
@@ -48028,9 +48038,41 @@
|
|
|
48028
48038
|
KHR_materials_anisotropy = __decorate([
|
|
48029
48039
|
registerGLTFExtension("KHR_materials_anisotropy", exports.GLTFExtensionMode.AdditiveParse)
|
|
48030
48040
|
], KHR_materials_anisotropy);
|
|
48041
|
+
var EXT_texture_webp = /*#__PURE__*/ function(GLTFExtensionParser1) {
|
|
48042
|
+
var EXT_texture_webp = function EXT_texture_webp() {
|
|
48043
|
+
var _this;
|
|
48044
|
+
_this = GLTFExtensionParser1.call(this) || this;
|
|
48045
|
+
_this._supportWebP = false;
|
|
48046
|
+
var testCanvas = document.createElement("canvas");
|
|
48047
|
+
testCanvas.width = testCanvas.height = 1;
|
|
48048
|
+
_this._supportWebP = testCanvas.toDataURL("image/webp").indexOf("data:image/webp") == 0;
|
|
48049
|
+
return _this;
|
|
48050
|
+
};
|
|
48051
|
+
_inherits(EXT_texture_webp, GLTFExtensionParser1);
|
|
48052
|
+
var _proto = EXT_texture_webp.prototype;
|
|
48053
|
+
_proto.createAndParse = function createAndParse(context, schema, textureInfo, textureIndex) {
|
|
48054
|
+
var _this = this;
|
|
48055
|
+
return _async_to_generator(function() {
|
|
48056
|
+
var webPIndex, sampler, tmp, fallbackIndex, textureName, texture;
|
|
48057
|
+
return __generator(this, function(_state) {
|
|
48058
|
+
webPIndex = schema.source;
|
|
48059
|
+
sampler = textureInfo.sampler, tmp = textureInfo.source, fallbackIndex = tmp === void 0 ? 0 : tmp, textureName = textureInfo.name;
|
|
48060
|
+
texture = exports.GLTFTextureParser._parseTexture(context, _this._supportWebP ? webPIndex : fallbackIndex, textureIndex, sampler, textureName);
|
|
48061
|
+
return [
|
|
48062
|
+
2,
|
|
48063
|
+
texture
|
|
48064
|
+
];
|
|
48065
|
+
});
|
|
48066
|
+
})();
|
|
48067
|
+
};
|
|
48068
|
+
return EXT_texture_webp;
|
|
48069
|
+
}(GLTFExtensionParser);
|
|
48070
|
+
EXT_texture_webp = __decorate([
|
|
48071
|
+
registerGLTFExtension("EXT_texture_webp", exports.GLTFExtensionMode.CreateAndParse)
|
|
48072
|
+
], EXT_texture_webp);
|
|
48031
48073
|
|
|
48032
48074
|
//@ts-ignore
|
|
48033
|
-
var version = "1.3.
|
|
48075
|
+
var version = "1.3.5";
|
|
48034
48076
|
console.log("Galacean engine version: " + version);
|
|
48035
48077
|
for(var key in CoreObjects){
|
|
48036
48078
|
Loader.registerClass(key, CoreObjects[key]);
|