@galacean/effects-core 2.3.0-beta.1 → 2.3.0-beta.3
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/camera.d.ts +0 -1
- package/dist/index.js +31 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.3.0-beta.
|
|
6
|
+
* Version: v2.3.0-beta.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -16828,7 +16828,10 @@ var CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
16828
16828
|
camera.far = this.options.far;
|
|
16829
16829
|
camera.fov = this.options.fov;
|
|
16830
16830
|
camera.clipMode = this.options.clipMode;
|
|
16831
|
-
camera.
|
|
16831
|
+
camera.transform.parentTransform = this.transform.parentTransform;
|
|
16832
|
+
camera.position = this.transform.position;
|
|
16833
|
+
// TODO 修正 GE 四元数旋转共轭问题
|
|
16834
|
+
camera.setQuat(this.transform.getQuaternion().clone().conjugate());
|
|
16832
16835
|
}
|
|
16833
16836
|
};
|
|
16834
16837
|
_proto.fromData = function fromData(data) {
|
|
@@ -25514,9 +25517,12 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25514
25517
|
this.textStyle = new TextStyle(options);
|
|
25515
25518
|
this.textLayout = new TextLayout(options);
|
|
25516
25519
|
this.text = options.text.toString();
|
|
25520
|
+
this.lineCount = this.getLineCount(options.text, true);
|
|
25517
25521
|
};
|
|
25518
|
-
_proto.getLineCount = function getLineCount(text,
|
|
25522
|
+
_proto.getLineCount = function getLineCount(text, init) {
|
|
25523
|
+
var context = this.context;
|
|
25519
25524
|
var _this_textLayout = this.textLayout, letterSpace = _this_textLayout.letterSpace, overflow = _this_textLayout.overflow;
|
|
25525
|
+
var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
|
|
25520
25526
|
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
25521
25527
|
var lineCount = 1;
|
|
25522
25528
|
var x = 0;
|
|
@@ -25524,7 +25530,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25524
25530
|
var _context_measureText;
|
|
25525
25531
|
var str = text[i];
|
|
25526
25532
|
var _context_measureText_width;
|
|
25527
|
-
var textMetrics = (_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0;
|
|
25533
|
+
var textMetrics = ((_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0) * fontScale;
|
|
25528
25534
|
// 和浏览器行为保持一致
|
|
25529
25535
|
x += letterSpace;
|
|
25530
25536
|
// 处理文本结束行为
|
|
@@ -25594,6 +25600,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25594
25600
|
return;
|
|
25595
25601
|
}
|
|
25596
25602
|
this.text = value.toString();
|
|
25603
|
+
this.lineCount = this.getLineCount(value, false);
|
|
25597
25604
|
this.isDirty = true;
|
|
25598
25605
|
};
|
|
25599
25606
|
/**
|
|
@@ -25754,35 +25761,32 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25754
25761
|
var layout = this.textLayout;
|
|
25755
25762
|
var fontScale = style.fontScale;
|
|
25756
25763
|
var width = (layout.width + style.fontOffset) * fontScale;
|
|
25764
|
+
var finalHeight = layout.lineHeight * this.lineCount;
|
|
25757
25765
|
var fontSize = style.fontSize * fontScale;
|
|
25758
25766
|
var lineHeight = layout.lineHeight * fontScale;
|
|
25759
25767
|
style.fontDesc = this.getFontDesc(fontSize);
|
|
25760
25768
|
this.char = (this.text || "").split("");
|
|
25761
25769
|
this.canvas.width = width;
|
|
25762
|
-
var height = this.canvas.height;
|
|
25763
|
-
context.font = style.fontDesc;
|
|
25764
|
-
this.lineCount = this.getLineCount(this.text, context);
|
|
25765
|
-
var finalHeight = layout.lineHeight * this.lineCount;
|
|
25766
25770
|
if (layout.autoWidth) {
|
|
25767
25771
|
this.canvas.height = finalHeight * fontScale;
|
|
25768
25772
|
this.item.transform.size.set(1, finalHeight / layout.height);
|
|
25769
25773
|
} else {
|
|
25770
25774
|
this.canvas.height = layout.height * fontScale;
|
|
25771
25775
|
}
|
|
25776
|
+
var height = this.canvas.height;
|
|
25777
|
+
// fix bug 1/255
|
|
25778
|
+
context.fillStyle = "rgba(255, 255, 255, 0.0039)";
|
|
25779
|
+
if (!flipY) {
|
|
25780
|
+
context.translate(0, height);
|
|
25781
|
+
context.scale(1, -1);
|
|
25782
|
+
}
|
|
25772
25783
|
// canvas size 变化后重新刷新 context
|
|
25773
25784
|
if (this.maxLineWidth > width && layout.overflow === TextOverflow.display) {
|
|
25774
25785
|
context.font = this.getFontDesc(fontSize * width / this.maxLineWidth);
|
|
25775
25786
|
} else {
|
|
25776
25787
|
context.font = style.fontDesc;
|
|
25777
25788
|
}
|
|
25778
|
-
// fix bug 1/255
|
|
25779
|
-
context.fillStyle = "rgba(255, 255, 255, 0.0039)";
|
|
25780
25789
|
context.clearRect(0, 0, width, height);
|
|
25781
|
-
if (!flipY) {
|
|
25782
|
-
context.translate(0, height);
|
|
25783
|
-
context.scale(1, -1);
|
|
25784
|
-
}
|
|
25785
|
-
context.fillRect(0, 0, width, height);
|
|
25786
25790
|
if (style.hasShadow) {
|
|
25787
25791
|
this.setupShadow();
|
|
25788
25792
|
}
|
|
@@ -25854,9 +25858,9 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25854
25858
|
this.material.setTexture("_MainTex", texture);
|
|
25855
25859
|
this.isDirty = false;
|
|
25856
25860
|
};
|
|
25857
|
-
_proto.getFontDesc = function getFontDesc(
|
|
25858
|
-
var _this_textStyle = this.textStyle, fontFamily = _this_textStyle.fontFamily, textWeight = _this_textStyle.textWeight, fontStyle = _this_textStyle.fontStyle;
|
|
25859
|
-
var fontDesc = "" + fontSize.toString() + "px ";
|
|
25861
|
+
_proto.getFontDesc = function getFontDesc(size) {
|
|
25862
|
+
var _this_textStyle = this.textStyle, fontSize = _this_textStyle.fontSize, fontScale = _this_textStyle.fontScale, fontFamily = _this_textStyle.fontFamily, textWeight = _this_textStyle.textWeight, fontStyle = _this_textStyle.fontStyle;
|
|
25863
|
+
var fontDesc = "" + (size || fontSize * fontScale).toString() + "px ";
|
|
25860
25864
|
if (!DEFAULT_FONTS.includes(fontFamily)) {
|
|
25861
25865
|
fontDesc += '"' + fontFamily + '"';
|
|
25862
25866
|
} else {
|
|
@@ -28791,12 +28795,14 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
28791
28795
|
function Camera(name, options) {
|
|
28792
28796
|
if (options === void 0) options = {};
|
|
28793
28797
|
this.name = name;
|
|
28798
|
+
this./**
|
|
28799
|
+
* @internal
|
|
28800
|
+
*/ transform = new Transform();
|
|
28794
28801
|
this.viewportMatrix = Matrix4.fromIdentity();
|
|
28795
28802
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
28796
28803
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
28797
28804
|
this.viewProjectionMatrix = Matrix4.fromIdentity();
|
|
28798
28805
|
this.inverseViewMatrix = Matrix4.fromIdentity();
|
|
28799
|
-
this.transform = new Transform();
|
|
28800
28806
|
this.dirty = true;
|
|
28801
28807
|
var _options_near = options.near, near = _options_near === void 0 ? 0.1 : _options_near, _options_far = options.far, far = _options_far === void 0 ? 20 : _options_far, _options_fov = options.fov, fov = _options_fov === void 0 ? 60 : _options_fov, _options_aspect = options.aspect, aspect = _options_aspect === void 0 ? 1 : _options_aspect, _options_clipMode = options.clipMode, clipMode = _options_clipMode === void 0 ? CameraClipMode.portrait : _options_clipMode, _options_position = options.position, position = _options_position === void 0 ? [
|
|
28802
28808
|
0,
|
|
@@ -28910,7 +28916,10 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
28910
28916
|
* 设置相机的旋转四元数
|
|
28911
28917
|
* @param value - 旋转四元数
|
|
28912
28918
|
*/ _proto.setQuat = function setQuat(value) {
|
|
28913
|
-
this.transform.
|
|
28919
|
+
if (!this.transform.getQuaternion().equals(value)) {
|
|
28920
|
+
this.transform.setQuaternion(value.x, value.y, value.z, value.w);
|
|
28921
|
+
this.dirty = true;
|
|
28922
|
+
}
|
|
28914
28923
|
};
|
|
28915
28924
|
/**
|
|
28916
28925
|
* 获取相机旋转对应的四元数
|
|
@@ -28948,7 +28957,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
28948
28957
|
var _this_options = this.options, fov = _this_options.fov, aspect = _this_options.aspect, near = _this_options.near, far = _this_options.far, clipMode = _this_options.clipMode;
|
|
28949
28958
|
this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
|
|
28950
28959
|
this.projectionMatrix.premultiply(this.viewportMatrix);
|
|
28951
|
-
this.inverseViewMatrix.compose(this.position, this.getQuat()
|
|
28960
|
+
this.inverseViewMatrix.compose(this.position, this.getQuat(), tmpScale);
|
|
28952
28961
|
var _this_transform_getParentMatrix;
|
|
28953
28962
|
this.inverseViewMatrix.premultiply((_this_transform_getParentMatrix = this.transform.getParentMatrix()) != null ? _this_transform_getParentMatrix : Matrix4.IDENTITY);
|
|
28954
28963
|
this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
|
|
@@ -32066,7 +32075,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
|
|
|
32066
32075
|
registerPlugin("particle", ParticleLoader, VFXItem);
|
|
32067
32076
|
registerPlugin("cal", CalculateLoader, VFXItem);
|
|
32068
32077
|
registerPlugin("interact", InteractLoader, VFXItem);
|
|
32069
|
-
var version = "2.3.0-beta.
|
|
32078
|
+
var version = "2.3.0-beta.3";
|
|
32070
32079
|
logger.info("Core version: " + version + ".");
|
|
32071
32080
|
|
|
32072
32081
|
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|