@galacean/effects-core 2.3.0-alpha.0 → 2.3.0-alpha.1
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/components/base-render-component.d.ts +2 -0
- package/dist/components/shape-component.d.ts +88 -2
- package/dist/index.js +123 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +123 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -6,6 +6,7 @@ import type { GeometryDrawMode, Renderer } from '../render';
|
|
|
6
6
|
import { Geometry } from '../render';
|
|
7
7
|
import type { Engine } from '../engine';
|
|
8
8
|
import type { BoundingBoxTriangle, HitTestTriangleParams } from '../plugins';
|
|
9
|
+
import type { MaterialProps } from '../material';
|
|
9
10
|
import { Material } from '../material';
|
|
10
11
|
import type { GeometryFromShape } from '../shape';
|
|
11
12
|
/**
|
|
@@ -102,6 +103,7 @@ export declare class BaseRenderComponent extends RendererComponent {
|
|
|
102
103
|
atlasOffset: number[];
|
|
103
104
|
};
|
|
104
105
|
protected createGeometry(mode: GeometryDrawMode): Geometry;
|
|
106
|
+
protected getMaterialProps(renderInfo: ItemRenderInfo, count: number): MaterialProps;
|
|
105
107
|
protected createMaterial(renderInfo: ItemRenderInfo, count: number): Material;
|
|
106
108
|
getTextures(): Texture[];
|
|
107
109
|
/**
|
|
@@ -1,6 +1,91 @@
|
|
|
1
1
|
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { Engine } from '../engine';
|
|
3
3
|
import { MeshComponent } from './mesh-component';
|
|
4
|
+
interface ShapeAttribute {
|
|
5
|
+
/**
|
|
6
|
+
* 矢量图形类型
|
|
7
|
+
*/
|
|
8
|
+
type: spec.ShapePrimitiveType;
|
|
9
|
+
/**
|
|
10
|
+
* 填充属性
|
|
11
|
+
*/
|
|
12
|
+
fill?: spec.ShapeFillParam;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 椭圆组件参数
|
|
16
|
+
*/
|
|
17
|
+
export interface EllipseAttribute extends ShapeAttribute {
|
|
18
|
+
type: spec.ShapePrimitiveType.Ellipse;
|
|
19
|
+
/**
|
|
20
|
+
* x 轴半径
|
|
21
|
+
* -- TODO 后续完善类型
|
|
22
|
+
* -- TODO 可以看一下用xRadius/yRadius 还是 width/height
|
|
23
|
+
*/
|
|
24
|
+
xRadius: number;
|
|
25
|
+
/**
|
|
26
|
+
* y 轴半径
|
|
27
|
+
*/
|
|
28
|
+
yRadius: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 矩形参数
|
|
32
|
+
*/
|
|
33
|
+
export interface RectangleAttribute extends ShapeAttribute {
|
|
34
|
+
/**
|
|
35
|
+
* 宽度
|
|
36
|
+
*/
|
|
37
|
+
width: number;
|
|
38
|
+
/**
|
|
39
|
+
* 高度
|
|
40
|
+
*/
|
|
41
|
+
height: number;
|
|
42
|
+
/**
|
|
43
|
+
* 角点元素
|
|
44
|
+
*/
|
|
45
|
+
roundness: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 星形参数
|
|
49
|
+
*/
|
|
50
|
+
export interface StarAttribute extends ShapeAttribute {
|
|
51
|
+
/**
|
|
52
|
+
* 顶点数 - 内外顶点同数
|
|
53
|
+
*/
|
|
54
|
+
pointCount: number;
|
|
55
|
+
/**
|
|
56
|
+
* 内径
|
|
57
|
+
*/
|
|
58
|
+
innerRadius: number;
|
|
59
|
+
/**
|
|
60
|
+
* 外径
|
|
61
|
+
*/
|
|
62
|
+
outerRadius: number;
|
|
63
|
+
/**
|
|
64
|
+
* 内径点圆度
|
|
65
|
+
*/
|
|
66
|
+
innerRoundness: number;
|
|
67
|
+
/**
|
|
68
|
+
* 外径点圆度
|
|
69
|
+
*/
|
|
70
|
+
outerRoundness: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 多边形参数
|
|
74
|
+
*/
|
|
75
|
+
export interface PolygonAttribute extends ShapeAttribute {
|
|
76
|
+
/**
|
|
77
|
+
* 顶点数
|
|
78
|
+
*/
|
|
79
|
+
pointCount: number;
|
|
80
|
+
/**
|
|
81
|
+
* 外切圆半径
|
|
82
|
+
*/
|
|
83
|
+
radius: number;
|
|
84
|
+
/**
|
|
85
|
+
* 角点圆度
|
|
86
|
+
*/
|
|
87
|
+
roundness: number;
|
|
88
|
+
}
|
|
4
89
|
/**
|
|
5
90
|
* 图形组件
|
|
6
91
|
* @since 2.1.0
|
|
@@ -9,12 +94,12 @@ export declare class ShapeComponent extends MeshComponent {
|
|
|
9
94
|
isStroke: boolean;
|
|
10
95
|
private graphicsPath;
|
|
11
96
|
private curveValues;
|
|
12
|
-
private data;
|
|
13
97
|
private shapeDirty;
|
|
14
98
|
private strokeAttributes;
|
|
99
|
+
private shapeAttribute;
|
|
15
100
|
private vert;
|
|
16
101
|
private frag;
|
|
17
|
-
get
|
|
102
|
+
get shape(): ShapeAttribute;
|
|
18
103
|
/**
|
|
19
104
|
*
|
|
20
105
|
* @param engine
|
|
@@ -27,3 +112,4 @@ export declare class ShapeComponent extends MeshComponent {
|
|
|
27
112
|
private setFillColor;
|
|
28
113
|
fromData(data: spec.ShapeComponentData): void;
|
|
29
114
|
}
|
|
115
|
+
export {};
|
package/dist/index.js
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-alpha.
|
|
6
|
+
* Version: v2.3.0-alpha.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -10186,7 +10186,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10186
10186
|
|
|
10187
10187
|
var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
|
|
10188
10188
|
|
|
10189
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(_MainTex,vTexCoord.xy)
|
|
10189
|
+
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nvec2 uv_rgb=vec2(vTexCoord.x*0.5000,vTexCoord.y);vec2 uv_alpha=vec2(vTexCoord.x*0.5000+0.5000,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=texture2D(_MainTex,uv_alpha).r;vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(vParams.z==0.&&color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
|
|
10190
10190
|
|
|
10191
10191
|
var particleFrag = "#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n";
|
|
10192
10192
|
|
|
@@ -13568,11 +13568,14 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13568
13568
|
maxVertex: 4
|
|
13569
13569
|
});
|
|
13570
13570
|
};
|
|
13571
|
-
_proto.
|
|
13572
|
-
|
|
13573
|
-
var materialProps = {
|
|
13571
|
+
_proto.getMaterialProps = function getMaterialProps(renderInfo, count) {
|
|
13572
|
+
return {
|
|
13574
13573
|
shader: spriteMeshShaderFromRenderInfo(renderInfo, count, 1)
|
|
13575
13574
|
};
|
|
13575
|
+
};
|
|
13576
|
+
_proto.createMaterial = function createMaterial(renderInfo, count) {
|
|
13577
|
+
var side = renderInfo.side, occlusion = renderInfo.occlusion, blending = renderInfo.blending, maskMode = renderInfo.maskMode, mask = renderInfo.mask;
|
|
13578
|
+
var materialProps = this.getMaterialProps(renderInfo, count);
|
|
13576
13579
|
this.preMultiAlpha = getPreMultiAlpha(blending);
|
|
13577
13580
|
var material = Material.create(this.engine, materialProps);
|
|
13578
13581
|
var states = {
|
|
@@ -16441,6 +16444,13 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16441
16444
|
join: "miter",
|
|
16442
16445
|
miterLimit: 10
|
|
16443
16446
|
};
|
|
16447
|
+
_this.shapeAttribute = {
|
|
16448
|
+
type: ShapePrimitiveType.Custom,
|
|
16449
|
+
points: [],
|
|
16450
|
+
easingIns: [],
|
|
16451
|
+
easingOuts: [],
|
|
16452
|
+
shapes: []
|
|
16453
|
+
};
|
|
16444
16454
|
return _this;
|
|
16445
16455
|
}
|
|
16446
16456
|
var _proto = ShapeComponent.prototype;
|
|
@@ -16449,7 +16459,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16449
16459
|
};
|
|
16450
16460
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16451
16461
|
if (this.shapeDirty) {
|
|
16452
|
-
this.buildPath(this.
|
|
16462
|
+
this.buildPath(this.shapeAttribute);
|
|
16453
16463
|
this.buildGeometryFromPath(this.graphicsPath.shapePath);
|
|
16454
16464
|
this.shapeDirty = false;
|
|
16455
16465
|
}
|
|
@@ -16507,17 +16517,16 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16507
16517
|
this.geometry.setIndexData(indexArray);
|
|
16508
16518
|
this.geometry.setDrawCount(indices.length);
|
|
16509
16519
|
};
|
|
16510
|
-
_proto.buildPath = function buildPath(
|
|
16520
|
+
_proto.buildPath = function buildPath(shapeAttribute) {
|
|
16511
16521
|
this.graphicsPath.clear();
|
|
16512
|
-
|
|
16513
|
-
switch(shapeData.type){
|
|
16522
|
+
switch(shapeAttribute.type){
|
|
16514
16523
|
case ShapePrimitiveType.Custom:
|
|
16515
16524
|
{
|
|
16516
|
-
var
|
|
16517
|
-
var points =
|
|
16518
|
-
var easingIns =
|
|
16519
|
-
var easingOuts =
|
|
16520
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(
|
|
16525
|
+
var customShapeAtribute = this.shapeAttribute;
|
|
16526
|
+
var points = customShapeAtribute.points;
|
|
16527
|
+
var easingIns = customShapeAtribute.easingIns;
|
|
16528
|
+
var easingOuts = customShapeAtribute.easingOuts;
|
|
16529
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customShapeAtribute.shapes), _step; !(_step = _iterator()).done;){
|
|
16521
16530
|
var shape = _step.value;
|
|
16522
16531
|
this.curveValues = [];
|
|
16523
16532
|
this.setFillColor(shape.fill);
|
|
@@ -16550,28 +16559,28 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16550
16559
|
}
|
|
16551
16560
|
case ShapePrimitiveType.Ellipse:
|
|
16552
16561
|
{
|
|
16553
|
-
var ellipseData =
|
|
16562
|
+
var ellipseData = shapeAttribute;
|
|
16554
16563
|
this.graphicsPath.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
16555
16564
|
this.setFillColor(ellipseData.fill);
|
|
16556
16565
|
break;
|
|
16557
16566
|
}
|
|
16558
16567
|
case ShapePrimitiveType.Rectangle:
|
|
16559
16568
|
{
|
|
16560
|
-
var rectangleData =
|
|
16569
|
+
var rectangleData = shapeAttribute;
|
|
16561
16570
|
this.graphicsPath.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16562
16571
|
this.setFillColor(rectangleData.fill);
|
|
16563
16572
|
break;
|
|
16564
16573
|
}
|
|
16565
16574
|
case ShapePrimitiveType.Star:
|
|
16566
16575
|
{
|
|
16567
|
-
var starData =
|
|
16576
|
+
var starData = shapeAttribute;
|
|
16568
16577
|
this.graphicsPath.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16569
16578
|
this.setFillColor(starData.fill);
|
|
16570
16579
|
break;
|
|
16571
16580
|
}
|
|
16572
16581
|
case ShapePrimitiveType.Polygon:
|
|
16573
16582
|
{
|
|
16574
|
-
var polygonData =
|
|
16583
|
+
var polygonData = shapeAttribute;
|
|
16575
16584
|
this.graphicsPath.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16576
16585
|
this.setFillColor(polygonData.fill);
|
|
16577
16586
|
break;
|
|
@@ -16586,13 +16595,93 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16586
16595
|
};
|
|
16587
16596
|
_proto.fromData = function fromData(data) {
|
|
16588
16597
|
MeshComponent.prototype.fromData.call(this, data);
|
|
16589
|
-
this.data = data;
|
|
16590
16598
|
this.shapeDirty = true;
|
|
16591
16599
|
var strokeParam = data.stroke;
|
|
16592
16600
|
if (strokeParam) {
|
|
16593
16601
|
this.isStroke = true;
|
|
16594
16602
|
this.strokeAttributes.width = strokeParam.width;
|
|
16595
16603
|
}
|
|
16604
|
+
switch(data.type){
|
|
16605
|
+
case ShapePrimitiveType.Custom:
|
|
16606
|
+
{
|
|
16607
|
+
this.shapeAttribute = {
|
|
16608
|
+
type: ShapePrimitiveType.Custom,
|
|
16609
|
+
points: [],
|
|
16610
|
+
easingIns: [],
|
|
16611
|
+
easingOuts: [],
|
|
16612
|
+
shapes: []
|
|
16613
|
+
};
|
|
16614
|
+
var customShapeData = data;
|
|
16615
|
+
var customShapeAttribute = this.shapeAttribute;
|
|
16616
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customShapeData.points), _step; !(_step = _iterator()).done;){
|
|
16617
|
+
var point = _step.value;
|
|
16618
|
+
customShapeAttribute.points.push(new Vector2(point.x, point.y));
|
|
16619
|
+
}
|
|
16620
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeData.easingIns), _step1; !(_step1 = _iterator1()).done;){
|
|
16621
|
+
var easingIn = _step1.value;
|
|
16622
|
+
customShapeAttribute.easingIns.push(new Vector2(easingIn.x, easingIn.y));
|
|
16623
|
+
}
|
|
16624
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(customShapeData.easingOuts), _step2; !(_step2 = _iterator2()).done;){
|
|
16625
|
+
var easingOut = _step2.value;
|
|
16626
|
+
customShapeAttribute.easingOuts.push(new Vector2(easingOut.x, easingOut.y));
|
|
16627
|
+
}
|
|
16628
|
+
customShapeAttribute.shapes = customShapeData.shapes;
|
|
16629
|
+
break;
|
|
16630
|
+
}
|
|
16631
|
+
case ShapePrimitiveType.Ellipse:
|
|
16632
|
+
{
|
|
16633
|
+
var ellipseData = data;
|
|
16634
|
+
var ellipseAttribute = {
|
|
16635
|
+
type: ShapePrimitiveType.Ellipse,
|
|
16636
|
+
xRadius: ellipseData.xRadius,
|
|
16637
|
+
yRadius: ellipseData.yRadius,
|
|
16638
|
+
fill: ellipseData.fill
|
|
16639
|
+
};
|
|
16640
|
+
this.shapeAttribute = ellipseAttribute;
|
|
16641
|
+
break;
|
|
16642
|
+
}
|
|
16643
|
+
case ShapePrimitiveType.Rectangle:
|
|
16644
|
+
{
|
|
16645
|
+
var rectangleData = data;
|
|
16646
|
+
var rectangleAttribute = {
|
|
16647
|
+
type: ShapePrimitiveType.Rectangle,
|
|
16648
|
+
width: rectangleData.width,
|
|
16649
|
+
height: rectangleData.height,
|
|
16650
|
+
roundness: rectangleData.roundness,
|
|
16651
|
+
fill: rectangleData.fill
|
|
16652
|
+
};
|
|
16653
|
+
this.shapeAttribute = rectangleAttribute;
|
|
16654
|
+
break;
|
|
16655
|
+
}
|
|
16656
|
+
case ShapePrimitiveType.Star:
|
|
16657
|
+
{
|
|
16658
|
+
var starData = data;
|
|
16659
|
+
var starAttribute = {
|
|
16660
|
+
type: ShapePrimitiveType.Star,
|
|
16661
|
+
pointCount: starData.pointCount,
|
|
16662
|
+
innerRadius: starData.innerRadius,
|
|
16663
|
+
outerRadius: starData.outerRadius,
|
|
16664
|
+
innerRoundness: starData.innerRoundness,
|
|
16665
|
+
outerRoundness: starData.outerRoundness,
|
|
16666
|
+
fill: starData.fill
|
|
16667
|
+
};
|
|
16668
|
+
this.shapeAttribute = starAttribute;
|
|
16669
|
+
break;
|
|
16670
|
+
}
|
|
16671
|
+
case ShapePrimitiveType.Polygon:
|
|
16672
|
+
{
|
|
16673
|
+
var polygonData = data;
|
|
16674
|
+
var polygonAttribute = {
|
|
16675
|
+
type: ShapePrimitiveType.Polygon,
|
|
16676
|
+
pointCount: polygonData.pointCount,
|
|
16677
|
+
radius: polygonData.radius,
|
|
16678
|
+
roundness: polygonData.roundness,
|
|
16679
|
+
fill: polygonData.fill
|
|
16680
|
+
};
|
|
16681
|
+
this.shapeAttribute = polygonAttribute;
|
|
16682
|
+
break;
|
|
16683
|
+
}
|
|
16684
|
+
}
|
|
16596
16685
|
var material = this.material;
|
|
16597
16686
|
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16598
16687
|
material.stencilRef = data.renderer.mask !== undefined ? [
|
|
@@ -16604,10 +16693,10 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16604
16693
|
};
|
|
16605
16694
|
_create_class(ShapeComponent, [
|
|
16606
16695
|
{
|
|
16607
|
-
key: "
|
|
16696
|
+
key: "shape",
|
|
16608
16697
|
get: function get() {
|
|
16609
16698
|
this.shapeDirty = true;
|
|
16610
|
-
return this.
|
|
16699
|
+
return this.shapeAttribute;
|
|
16611
16700
|
}
|
|
16612
16701
|
}
|
|
16613
16702
|
]);
|
|
@@ -21012,19 +21101,17 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
21012
21101
|
rotation: rotation,
|
|
21013
21102
|
path: path
|
|
21014
21103
|
};
|
|
21015
|
-
var parentTransform = this.transform.parentTransform;
|
|
21016
21104
|
var selfPos = position.clone();
|
|
21017
21105
|
if (path) {
|
|
21018
21106
|
selfPos.add(path.getValue(0));
|
|
21019
21107
|
}
|
|
21020
21108
|
this.transform.setPosition(selfPos.x, selfPos.y, selfPos.z);
|
|
21021
|
-
if (this.options.particleFollowParent
|
|
21022
|
-
var worldMatrix =
|
|
21109
|
+
if (this.options.particleFollowParent) {
|
|
21110
|
+
var worldMatrix = this.transform.getWorldMatrix();
|
|
21023
21111
|
this.renderer.updateWorldMatrix(worldMatrix);
|
|
21024
21112
|
}
|
|
21025
21113
|
};
|
|
21026
21114
|
_proto.updateEmitterTransform = function updateEmitterTransform(time) {
|
|
21027
|
-
var parentTransform = this.transform.parentTransform;
|
|
21028
21115
|
var _this_basicTransform = this.basicTransform, path = _this_basicTransform.path, position = _this_basicTransform.position;
|
|
21029
21116
|
var selfPos = position.clone();
|
|
21030
21117
|
if (path) {
|
|
@@ -21032,8 +21119,8 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
21032
21119
|
selfPos.add(path.getValue(time / duration));
|
|
21033
21120
|
}
|
|
21034
21121
|
this.transform.setPosition(selfPos.x, selfPos.y, selfPos.z);
|
|
21035
|
-
if (this.options.particleFollowParent
|
|
21036
|
-
var worldMatrix =
|
|
21122
|
+
if (this.options.particleFollowParent) {
|
|
21123
|
+
var worldMatrix = this.transform.getWorldMatrix();
|
|
21037
21124
|
this.renderer.updateWorldMatrix(worldMatrix);
|
|
21038
21125
|
}
|
|
21039
21126
|
};
|
|
@@ -21421,7 +21508,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
21421
21508
|
var lifetime = this.lifetime;
|
|
21422
21509
|
var shape = this.shape;
|
|
21423
21510
|
var speed = options.startSpeed.getValue(lifetime);
|
|
21424
|
-
var matrix4 = options.particleFollowParent ?
|
|
21511
|
+
var matrix4 = options.particleFollowParent ? Matrix4.IDENTITY : this.transform.getWorldMatrix();
|
|
21425
21512
|
var pointPosition = data.position;
|
|
21426
21513
|
// 粒子的位置受发射器的位置影响,自身的旋转和缩放不受影响
|
|
21427
21514
|
var position = matrix4.transformPoint(pointPosition, new Vector3());
|
|
@@ -24243,7 +24330,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
24243
24330
|
this.timelinePlayable.setTime(time);
|
|
24244
24331
|
// The properties of the object may change dynamically,
|
|
24245
24332
|
// so reset the track binding to avoid invalidation of the previously obtained binding object.
|
|
24246
|
-
|
|
24333
|
+
this.resolveBindings();
|
|
24247
24334
|
this.timelinePlayable.evaluate();
|
|
24248
24335
|
this.graph.evaluate(dt);
|
|
24249
24336
|
};
|
|
@@ -24482,7 +24569,10 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable)
|
|
|
24482
24569
|
}
|
|
24483
24570
|
var _proto = Vector4PropertyMixerPlayable.prototype;
|
|
24484
24571
|
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
24485
|
-
this.propertyValue.
|
|
24572
|
+
this.propertyValue.x = 0;
|
|
24573
|
+
this.propertyValue.y = 0;
|
|
24574
|
+
this.propertyValue.z = 0;
|
|
24575
|
+
this.propertyValue.w = 0;
|
|
24486
24576
|
};
|
|
24487
24577
|
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
24488
24578
|
var result = this.propertyValue;
|
|
@@ -24500,7 +24590,8 @@ var Vector2PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable)
|
|
|
24500
24590
|
}
|
|
24501
24591
|
var _proto = Vector2PropertyMixerPlayable.prototype;
|
|
24502
24592
|
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
24503
|
-
this.propertyValue.
|
|
24593
|
+
this.propertyValue.x = 0;
|
|
24594
|
+
this.propertyValue.y = 0;
|
|
24504
24595
|
};
|
|
24505
24596
|
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
24506
24597
|
var result = this.propertyValue;
|
|
@@ -31987,7 +32078,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
31987
32078
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
31988
32079
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
31989
32080
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
31990
|
-
var version = "2.3.0-alpha.
|
|
32081
|
+
var version = "2.3.0-alpha.1";
|
|
31991
32082
|
logger.info("Core version: " + version + ".");
|
|
31992
32083
|
|
|
31993
32084
|
exports.AbstractPlugin = AbstractPlugin;
|