@galacean/effects-core 2.0.0-alpha.32 → 2.0.0-alpha.34
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/canvas-pool.d.ts +0 -1
- package/dist/comp-vfx-item.d.ts +0 -4
- package/dist/components/effect-component.d.ts +2 -22
- package/dist/composition.d.ts +1 -10
- package/dist/index.js +329 -296
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +329 -290
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +1 -5
- package/dist/material/utils.d.ts +0 -10
- package/dist/math/utils.d.ts +0 -3
- package/dist/plugins/particle/burst.d.ts +10 -3
- package/dist/plugins/particle/link.d.ts +1 -0
- package/dist/plugins/particle/particle-loader.d.ts +1 -1
- package/dist/plugins/particle/particle-mesh.d.ts +0 -5
- package/dist/plugins/particle/particle-system.d.ts +9 -3
- package/dist/plugins/particle/particle-vfx-item.d.ts +1 -0
- package/dist/render/create-copy-shader.d.ts +2 -2
- package/dist/render/mesh.d.ts +1 -1
- package/dist/shader/index.d.ts +1 -2
- package/dist/shader/shader-factory.d.ts +35 -0
- 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.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.34
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -4782,7 +4782,9 @@ __decorate([
|
|
|
4782
4782
|
// }
|
|
4783
4783
|
/**
|
|
4784
4784
|
* 在每次设置 enabled 为 true 时触发
|
|
4785
|
-
*/ _proto.onEnable = function onEnable() {
|
|
4785
|
+
*/ _proto.onEnable = function onEnable() {
|
|
4786
|
+
// OVERRIDE
|
|
4787
|
+
};
|
|
4786
4788
|
/**
|
|
4787
4789
|
* 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
|
|
4788
4790
|
*/ _proto.start = function start() {
|
|
@@ -7651,55 +7653,6 @@ function getPreMultiAlpha(blending) {
|
|
|
7651
7653
|
return 1;
|
|
7652
7654
|
}
|
|
7653
7655
|
}
|
|
7654
|
-
var _obj$6;
|
|
7655
|
-
var downgradeKeywords = (_obj$6 = {}, _obj$6[ShaderType.vertex] = {
|
|
7656
|
-
in: "attribute",
|
|
7657
|
-
out: "varying"
|
|
7658
|
-
}, _obj$6[ShaderType.fragment] = {
|
|
7659
|
-
in: "varying"
|
|
7660
|
-
}, _obj$6);
|
|
7661
|
-
/**
|
|
7662
|
-
* 生成 shader,检测到 WebGL1 上下文会降级
|
|
7663
|
-
* @param macros - 宏定义数组
|
|
7664
|
-
* @param shader - 原始 shader 文本
|
|
7665
|
-
* @param shaderType - shader 类型
|
|
7666
|
-
* @return 去除版本号的 shader 文本
|
|
7667
|
-
*/ function createShaderWithMacros(macros, shader, shaderType, level) {
|
|
7668
|
-
var ret = [];
|
|
7669
|
-
var header = "";
|
|
7670
|
-
// shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
|
|
7671
|
-
ret.push("#define GE_RUNTIME");
|
|
7672
|
-
if (macros) {
|
|
7673
|
-
macros.forEach(function(param) {
|
|
7674
|
-
var key = param[0], value = param[1];
|
|
7675
|
-
if (value === true) {
|
|
7676
|
-
ret.push("#define " + key);
|
|
7677
|
-
} else if (Number.isFinite(value)) {
|
|
7678
|
-
ret.push("#define " + key + " " + value);
|
|
7679
|
-
}
|
|
7680
|
-
});
|
|
7681
|
-
header = ret.length ? ret.join("\n") + "\n" : "";
|
|
7682
|
-
}
|
|
7683
|
-
var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
|
|
7684
|
-
var GL_TYPE = "WEBGL" + level;
|
|
7685
|
-
header = header + ("\n#ifndef " + GL_TYPE + "\n#define " + GL_TYPE + "\n#endif");
|
|
7686
|
-
var fullShader = header + "\n" + shader;
|
|
7687
|
-
// 判断shader是否带有版本头
|
|
7688
|
-
var match = fullShader.match(versionTag);
|
|
7689
|
-
var version = match ? match[0] : "";
|
|
7690
|
-
if (version && version.includes("300")) {
|
|
7691
|
-
var reg = new RegExp("" + version, "g");
|
|
7692
|
-
// 带版本头且level为1,降级
|
|
7693
|
-
if (level === 1) {
|
|
7694
|
-
fullShader = fullShader.replace(/\b(in|out)\b/g, function(str) {
|
|
7695
|
-
var _downgradeKeywords_shaderType_str;
|
|
7696
|
-
return (_downgradeKeywords_shaderType_str = downgradeKeywords[shaderType][str]) != null ? _downgradeKeywords_shaderType_str : str;
|
|
7697
|
-
});
|
|
7698
|
-
}
|
|
7699
|
-
fullShader = fullShader.replace(reg, "\n");
|
|
7700
|
-
}
|
|
7701
|
-
return fullShader;
|
|
7702
|
-
}
|
|
7703
7656
|
function setBlendMode(material, blendMode) {
|
|
7704
7657
|
switch(blendMode){
|
|
7705
7658
|
case undefined:
|
|
@@ -8402,7 +8355,7 @@ function _loadMipmapImage() {
|
|
|
8402
8355
|
return _loadMipmapImage.apply(this, arguments);
|
|
8403
8356
|
}
|
|
8404
8357
|
|
|
8405
|
-
var seed$
|
|
8358
|
+
var seed$8 = 1;
|
|
8406
8359
|
/**
|
|
8407
8360
|
* Texture 抽象类
|
|
8408
8361
|
*/ var Texture = /*#__PURE__*/ function(EffectsObject) {
|
|
@@ -8411,7 +8364,7 @@ var seed$9 = 1;
|
|
|
8411
8364
|
var _this;
|
|
8412
8365
|
_this = EffectsObject.call(this, engine) || this;
|
|
8413
8366
|
_this.destroyed = false;
|
|
8414
|
-
_this.id = "Tex" + seed$
|
|
8367
|
+
_this.id = "Tex" + seed$8++;
|
|
8415
8368
|
return _this;
|
|
8416
8369
|
}
|
|
8417
8370
|
var _proto = Texture.prototype;
|
|
@@ -9039,7 +8992,7 @@ var MaterialRenderType;
|
|
|
9039
8992
|
/**
|
|
9040
8993
|
* 用于设置材质默认名称的自增序号
|
|
9041
8994
|
* @internal
|
|
9042
|
-
*/ var seed$
|
|
8995
|
+
*/ var seed$7 = 1;
|
|
9043
8996
|
/**
|
|
9044
8997
|
* Material 抽象类
|
|
9045
8998
|
*/ var Material = /*#__PURE__*/ function(EffectsObject) {
|
|
@@ -9052,14 +9005,14 @@ var MaterialRenderType;
|
|
|
9052
9005
|
_this.destroyed = false;
|
|
9053
9006
|
_this.initialized = false;
|
|
9054
9007
|
if (props) {
|
|
9055
|
-
var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$
|
|
9008
|
+
var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$7++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
|
|
9056
9009
|
_this.name = name;
|
|
9057
9010
|
_this.renderType = renderType; // TODO 没有地方用到
|
|
9058
9011
|
_this.shaderSource = shader;
|
|
9059
9012
|
_this.props = props;
|
|
9060
9013
|
_this.uniformSemantics = _extends({}, uniformSemantics); // TODO 废弃,待移除
|
|
9061
9014
|
} else {
|
|
9062
|
-
_this.name = "Material" + seed$
|
|
9015
|
+
_this.name = "Material" + seed$7++;
|
|
9063
9016
|
_this.renderType = 0;
|
|
9064
9017
|
}
|
|
9065
9018
|
return _this;
|
|
@@ -9384,29 +9337,6 @@ function vecFill(out, number) {
|
|
|
9384
9337
|
}
|
|
9385
9338
|
return out;
|
|
9386
9339
|
}
|
|
9387
|
-
function vecAssign(out, a, count, start) {
|
|
9388
|
-
if (start === void 0) start = 0;
|
|
9389
|
-
for(var i = 0; i < count; i++){
|
|
9390
|
-
out[i] = a[i + start];
|
|
9391
|
-
}
|
|
9392
|
-
return out;
|
|
9393
|
-
}
|
|
9394
|
-
function vecNormalize(out, a) {
|
|
9395
|
-
var _Math;
|
|
9396
|
-
if (arguments.length === 1) {
|
|
9397
|
-
a = out;
|
|
9398
|
-
out = [];
|
|
9399
|
-
}
|
|
9400
|
-
var ap = a;
|
|
9401
|
-
var sum = (_Math = Math).hypot.apply(_Math, [].concat(ap));
|
|
9402
|
-
if (sum === 0) {
|
|
9403
|
-
return vecAssign(out, ap, ap.length);
|
|
9404
|
-
}
|
|
9405
|
-
for(var i = 0; i < ap.length; i++){
|
|
9406
|
-
out[i] = ap[i] / sum;
|
|
9407
|
-
}
|
|
9408
|
-
return out;
|
|
9409
|
-
}
|
|
9410
9340
|
function vecMulCombine(out, a, b) {
|
|
9411
9341
|
if (a && b) {
|
|
9412
9342
|
for(var i = 0, len = a.length; i < len; i++){
|
|
@@ -9496,10 +9426,6 @@ function numberToFix(a, fixed) {
|
|
|
9496
9426
|
var base = Math.pow(10, fixed);
|
|
9497
9427
|
return Math.floor(a * base) / base;
|
|
9498
9428
|
}
|
|
9499
|
-
function pointOnLine(x1, y1, x2, y2, x3, y3) {
|
|
9500
|
-
var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1;
|
|
9501
|
-
return det1 > -0.001 && det1 < 0.001;
|
|
9502
|
-
}
|
|
9503
9429
|
|
|
9504
9430
|
function _is_native_reflect_construct() {
|
|
9505
9431
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
@@ -10942,21 +10868,16 @@ Shader = __decorate([
|
|
|
10942
10868
|
|
|
10943
10869
|
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
10944
10870
|
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
10945
|
-
var COPY_VERTEX_SHADER = "\
|
|
10946
|
-
var COPY_FRAGMENT_SHADER = "precision mediump float;\
|
|
10871
|
+
var COPY_VERTEX_SHADER = "\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
|
|
10872
|
+
var COPY_FRAGMENT_SHADER = "precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";
|
|
10947
10873
|
function createCopyShader(level, writeDepth) {
|
|
10948
10874
|
var webgl2 = level === 2;
|
|
10949
|
-
var version = webgl2 ? "#version 300 es" : "";
|
|
10950
10875
|
return {
|
|
10951
10876
|
name: EFFECTS_COPY_MESH_NAME,
|
|
10952
|
-
vertex:
|
|
10953
|
-
fragment:
|
|
10877
|
+
vertex: COPY_VERTEX_SHADER,
|
|
10878
|
+
fragment: COPY_FRAGMENT_SHADER,
|
|
10954
10879
|
glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
|
|
10955
10880
|
macros: [
|
|
10956
|
-
[
|
|
10957
|
-
"WEBGL2",
|
|
10958
|
-
!!webgl2
|
|
10959
|
-
],
|
|
10960
10881
|
[
|
|
10961
10882
|
"DEPTH_TEXTURE",
|
|
10962
10883
|
!!writeDepth
|
|
@@ -11124,7 +11045,7 @@ function generateEmptyTypedArray(type) {
|
|
|
11124
11045
|
return new Float32Array(0);
|
|
11125
11046
|
}
|
|
11126
11047
|
|
|
11127
|
-
var seed$
|
|
11048
|
+
var seed$6 = 1;
|
|
11128
11049
|
/**
|
|
11129
11050
|
* Mesh 抽象类
|
|
11130
11051
|
*/ var Mesh = /*#__PURE__*/ function(RendererComponent) {
|
|
@@ -11136,14 +11057,14 @@ var seed$7 = 1;
|
|
|
11136
11057
|
_this.visible = true;
|
|
11137
11058
|
if (props) {
|
|
11138
11059
|
var material = props.material, geometry = props.geometry, _props_name = props.name, name = _props_name === void 0 ? "<unnamed>" : _props_name, _props_priority = props.priority, priority = _props_priority === void 0 ? 0 : _props_priority, _props_worldMatrix = props.worldMatrix, worldMatrix = _props_worldMatrix === void 0 ? Matrix4.fromIdentity() : _props_worldMatrix;
|
|
11139
|
-
_this.id = "Mesh" + seed$
|
|
11060
|
+
_this.id = "Mesh" + seed$6++;
|
|
11140
11061
|
_this.name = name;
|
|
11141
11062
|
_this.geometry = geometry;
|
|
11142
11063
|
_this.material = material;
|
|
11143
11064
|
_this.priority = priority;
|
|
11144
11065
|
_this.worldMatrix = worldMatrix;
|
|
11145
11066
|
} else {
|
|
11146
|
-
_this.id = "Mesh" + seed$
|
|
11067
|
+
_this.id = "Mesh" + seed$6++;
|
|
11147
11068
|
_this.name = "<unnamed>";
|
|
11148
11069
|
_this.worldMatrix = Matrix4.fromIdentity();
|
|
11149
11070
|
_this._priority = 0;
|
|
@@ -11348,7 +11269,7 @@ var RenderPassDestroyAttachmentType;
|
|
|
11348
11269
|
* 强制销毁
|
|
11349
11270
|
*/ RenderPassDestroyAttachmentType[RenderPassDestroyAttachmentType["destroy"] = 0] = "destroy";
|
|
11350
11271
|
})(RenderPassDestroyAttachmentType || (RenderPassDestroyAttachmentType = {}));
|
|
11351
|
-
var seed$
|
|
11272
|
+
var seed$5 = 1;
|
|
11352
11273
|
/**
|
|
11353
11274
|
* RenderPass 抽象类
|
|
11354
11275
|
*/ var RenderPass = /*#__PURE__*/ function() {
|
|
@@ -11358,7 +11279,7 @@ var seed$6 = 1;
|
|
|
11358
11279
|
*/ this.attachments = [];
|
|
11359
11280
|
this.destroyed = false;
|
|
11360
11281
|
this.initialized = false;
|
|
11361
|
-
var _options_name = options.name, name = _options_name === void 0 ? "RenderPass_" + seed$
|
|
11282
|
+
var _options_name = options.name, name = _options_name === void 0 ? "RenderPass_" + seed$5++ : _options_name, clearAction = options.clearAction, semantics = options.semantics, depthStencilAttachment = options.depthStencilAttachment, storeAction = options.storeAction, _options_priority = options.priority, priority = _options_priority === void 0 ? 0 : _options_priority, _options_meshOrder = options.meshOrder, meshOrder = _options_meshOrder === void 0 ? OrderType.ascending : _options_meshOrder, _options_meshes = options.meshes, meshes = _options_meshes === void 0 ? [] : _options_meshes, _options_delegate = options.delegate, delegate = _options_delegate === void 0 ? {} : _options_delegate;
|
|
11362
11283
|
this.name = name;
|
|
11363
11284
|
this.renderer = renderer;
|
|
11364
11285
|
this.priority = priority;
|
|
@@ -11578,10 +11499,12 @@ var seed$6 = 1;
|
|
|
11578
11499
|
*/ _proto.getDepthAttachment = function getDepthAttachment() {
|
|
11579
11500
|
var framebuffer = this.framebuffer;
|
|
11580
11501
|
if (framebuffer) {
|
|
11502
|
+
var depthTexture = framebuffer.getDepthTexture();
|
|
11503
|
+
var texture = depthTexture ? this.getDepthTexture(depthTexture, framebuffer.externalStorage) : undefined;
|
|
11581
11504
|
return {
|
|
11582
11505
|
storageType: framebuffer.depthStencilStorageType,
|
|
11583
11506
|
storage: framebuffer.depthStorage,
|
|
11584
|
-
texture:
|
|
11507
|
+
texture: texture
|
|
11585
11508
|
};
|
|
11586
11509
|
}
|
|
11587
11510
|
};
|
|
@@ -11590,10 +11513,12 @@ var seed$6 = 1;
|
|
|
11590
11513
|
*/ _proto.getStencilAttachment = function getStencilAttachment() {
|
|
11591
11514
|
var framebuffer = this.framebuffer;
|
|
11592
11515
|
if (framebuffer) {
|
|
11516
|
+
var stencilTexture = framebuffer.getStencilTexture();
|
|
11517
|
+
var texture = stencilTexture ? this.getDepthTexture(stencilTexture, framebuffer.externalStorage) : undefined;
|
|
11593
11518
|
return {
|
|
11594
11519
|
storageType: framebuffer.depthStencilStorageType,
|
|
11595
11520
|
storage: framebuffer.stencilStorage,
|
|
11596
|
-
texture:
|
|
11521
|
+
texture: texture
|
|
11597
11522
|
};
|
|
11598
11523
|
}
|
|
11599
11524
|
};
|
|
@@ -11705,11 +11630,7 @@ var seed$6 = 1;
|
|
|
11705
11630
|
|
|
11706
11631
|
var blend = "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;}";
|
|
11707
11632
|
|
|
11708
|
-
var
|
|
11709
|
-
|
|
11710
|
-
var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
|
|
11711
|
-
|
|
11712
|
-
var itemFrameFrag = "#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 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;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}";
|
|
11633
|
+
var itemFrameFrag = "#version 100\nprecision highp 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;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}";
|
|
11713
11634
|
|
|
11714
11635
|
var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}";
|
|
11715
11636
|
|
|
@@ -11717,13 +11638,13 @@ var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3
|
|
|
11717
11638
|
|
|
11718
11639
|
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;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(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
|
|
11719
11640
|
|
|
11720
|
-
var particleFrag = "#version
|
|
11641
|
+
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";
|
|
11721
11642
|
|
|
11722
|
-
var particleVert = "#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}";
|
|
11643
|
+
var particleVert = "#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec3 aVel;attribute vec3 aRot;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}";
|
|
11723
11644
|
|
|
11724
|
-
var trailVert = "#version
|
|
11645
|
+
var trailVert = "#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
|
|
11725
11646
|
|
|
11726
|
-
var value = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\
|
|
11647
|
+
var value = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}";
|
|
11727
11648
|
|
|
11728
11649
|
var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n";
|
|
11729
11650
|
|
|
@@ -11741,6 +11662,159 @@ var gaussianUpFrag = "precision highp float;varying vec2 uv;uniform sampler2D _M
|
|
|
11741
11662
|
|
|
11742
11663
|
var thresholdFrag = "precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}";
|
|
11743
11664
|
|
|
11665
|
+
var shaderLib = {};
|
|
11666
|
+
var ShaderFactory = /*#__PURE__*/ function() {
|
|
11667
|
+
function ShaderFactory() {}
|
|
11668
|
+
ShaderFactory.registerInclude = function registerInclude(includeName, includeSource) {
|
|
11669
|
+
if (shaderLib[includeName]) {
|
|
11670
|
+
logger.warn('The "' + includeName + '" shader include already exist.');
|
|
11671
|
+
}
|
|
11672
|
+
shaderLib[includeName] = includeSource;
|
|
11673
|
+
};
|
|
11674
|
+
ShaderFactory.unRegisterInclude = function unRegisterInclude(includeName) {
|
|
11675
|
+
delete shaderLib[includeName];
|
|
11676
|
+
};
|
|
11677
|
+
ShaderFactory.unRegisterAllIncludes = function unRegisterAllIncludes() {
|
|
11678
|
+
Object.keys(shaderLib).forEach(function(key) {
|
|
11679
|
+
ShaderFactory.unRegisterInclude(key);
|
|
11680
|
+
});
|
|
11681
|
+
};
|
|
11682
|
+
/**
|
|
11683
|
+
* 生成 shader,检测到 WebGL1 上下文会降级
|
|
11684
|
+
* @param macros - 宏定义数组
|
|
11685
|
+
* @param shader - 原始 shader 文本
|
|
11686
|
+
* @param shaderType - shader 类型
|
|
11687
|
+
* @return 去除版本号的 shader 文本
|
|
11688
|
+
*/ ShaderFactory.genFinalShaderCode = function genFinalShaderCode(options) {
|
|
11689
|
+
var level = options.level, shaderType = options.shaderType, shader = options.shader, macros = options.macros, removeVersion = options.removeVersion;
|
|
11690
|
+
var macroString = ShaderFactory.genMacroString(level, macros);
|
|
11691
|
+
var versionString = ShaderFactory.genShaderVersion(level);
|
|
11692
|
+
var source = ShaderFactory.parseIncludes(shader);
|
|
11693
|
+
var isVersion300 = ShaderFactory.isVersion300(source);
|
|
11694
|
+
source = ShaderFactory.removeWebGLVersion(source);
|
|
11695
|
+
if (level === 2 && !isVersion300) {
|
|
11696
|
+
source = ShaderFactory.convertTo300(source, shaderType === ShaderType.fragment);
|
|
11697
|
+
}
|
|
11698
|
+
if (removeVersion) {
|
|
11699
|
+
return macroString + source;
|
|
11700
|
+
}
|
|
11701
|
+
return versionString + macroString + source;
|
|
11702
|
+
};
|
|
11703
|
+
/**
|
|
11704
|
+
* Convert lower GLSL version to GLSL 300 es.
|
|
11705
|
+
* @param source - code
|
|
11706
|
+
* @param isFragment - Whether it is a fragment shader.
|
|
11707
|
+
* */ ShaderFactory.convertTo300 = function convertTo300(source, isFragment) {
|
|
11708
|
+
source = source.replace(/\bvarying\b/g, isFragment ? "in" : "out");
|
|
11709
|
+
source = source.replace(/\btexture(2D|Cube)\b/g, "texture");
|
|
11710
|
+
// Remove extensions
|
|
11711
|
+
var regex = /#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;
|
|
11712
|
+
source = source.replace(regex, "");
|
|
11713
|
+
if (isFragment) {
|
|
11714
|
+
source = source.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
|
|
11715
|
+
source = source.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
|
|
11716
|
+
source = source.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
|
|
11717
|
+
if (!ShaderFactory.has300Output(source)) {
|
|
11718
|
+
var isMRT = /\bgl_FragData\[.+?\]/g.test(source);
|
|
11719
|
+
if (isMRT) {
|
|
11720
|
+
source = source.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
|
|
11721
|
+
var result = source.match(/\bgl_FragData\[.+?\]/g);
|
|
11722
|
+
if (result) {
|
|
11723
|
+
source = ShaderFactory.replaceMRTShader(source, result);
|
|
11724
|
+
}
|
|
11725
|
+
} else {
|
|
11726
|
+
source = source.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
|
|
11727
|
+
source = source.replace(/\bgl_FragColor\b/g, "glFragColor");
|
|
11728
|
+
}
|
|
11729
|
+
}
|
|
11730
|
+
} else {
|
|
11731
|
+
source = source.replace(/\battribute\b/g, "in");
|
|
11732
|
+
}
|
|
11733
|
+
return source;
|
|
11734
|
+
};
|
|
11735
|
+
ShaderFactory.parseIncludes = function parseIncludes(source, regex) {
|
|
11736
|
+
if (regex === void 0) regex = /#include <(.+)>/gm;
|
|
11737
|
+
var match;
|
|
11738
|
+
while((match = regex.exec(source)) !== null){
|
|
11739
|
+
var shaderName = match[1];
|
|
11740
|
+
var replace = shaderLib[shaderName];
|
|
11741
|
+
if (replace === undefined) {
|
|
11742
|
+
throw new Error("Can't find include shader name " + shaderName);
|
|
11743
|
+
}
|
|
11744
|
+
source = source.replace(match[0], replace);
|
|
11745
|
+
}
|
|
11746
|
+
return source;
|
|
11747
|
+
};
|
|
11748
|
+
ShaderFactory.genMacroString = function genMacroString(level, macros, addRuntimeMacro) {
|
|
11749
|
+
if (addRuntimeMacro === void 0) addRuntimeMacro = true;
|
|
11750
|
+
var macroList = [];
|
|
11751
|
+
var webGLVersion = "WEBGL" + level;
|
|
11752
|
+
macroList.push("#ifndef " + webGLVersion);
|
|
11753
|
+
macroList.push("#define " + webGLVersion);
|
|
11754
|
+
macroList.push("#endif");
|
|
11755
|
+
if (addRuntimeMacro) {
|
|
11756
|
+
macroList.push("#define GE_RUNTIME");
|
|
11757
|
+
}
|
|
11758
|
+
if (macros && macros.length) {
|
|
11759
|
+
macros.forEach(function(param) {
|
|
11760
|
+
var key = param[0], value = param[1];
|
|
11761
|
+
if (value === true) {
|
|
11762
|
+
macroList.push("#define " + key);
|
|
11763
|
+
} else if (Number.isFinite(value)) {
|
|
11764
|
+
macroList.push("#define " + key + " " + value);
|
|
11765
|
+
}
|
|
11766
|
+
});
|
|
11767
|
+
}
|
|
11768
|
+
if (macroList.length) {
|
|
11769
|
+
return macroList.join("\n") + "\n";
|
|
11770
|
+
}
|
|
11771
|
+
return "";
|
|
11772
|
+
};
|
|
11773
|
+
ShaderFactory.genShaderVersion = function genShaderVersion(level) {
|
|
11774
|
+
if (level === 1) {
|
|
11775
|
+
return "#version 100\n";
|
|
11776
|
+
}
|
|
11777
|
+
return "#version 300 es\n";
|
|
11778
|
+
};
|
|
11779
|
+
ShaderFactory.isVersion300 = function isVersion300(source) {
|
|
11780
|
+
var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
|
|
11781
|
+
var match = source.match(versionTag);
|
|
11782
|
+
var version = match ? match[0] : "";
|
|
11783
|
+
return version.includes("300");
|
|
11784
|
+
};
|
|
11785
|
+
ShaderFactory.removeWebGLVersion = function removeWebGLVersion(source) {
|
|
11786
|
+
var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
|
|
11787
|
+
var match = source.match(versionTag);
|
|
11788
|
+
if (match) {
|
|
11789
|
+
return source.replace(match[0], "");
|
|
11790
|
+
}
|
|
11791
|
+
return source;
|
|
11792
|
+
};
|
|
11793
|
+
ShaderFactory.has300Output = function has300Output(fragmentShader) {
|
|
11794
|
+
// [layout(location = 0)] out [highp] vec4 [color];
|
|
11795
|
+
var fragReg = /\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/;
|
|
11796
|
+
return fragReg.test(fragmentShader);
|
|
11797
|
+
};
|
|
11798
|
+
ShaderFactory.replaceMRTShader = function replaceMRTShader(source, result) {
|
|
11799
|
+
var mrtIndexSet = new Set();
|
|
11800
|
+
var declaration = "";
|
|
11801
|
+
for(var i = 0; i < result.length; i++){
|
|
11802
|
+
var res = result[i].match(/\bgl_FragData\[(.+?)\]/);
|
|
11803
|
+
if (res) {
|
|
11804
|
+
mrtIndexSet.add(res[1]);
|
|
11805
|
+
}
|
|
11806
|
+
}
|
|
11807
|
+
mrtIndexSet.forEach(function(index) {
|
|
11808
|
+
declaration += "layout(location=" + index + ") out vec4 fragOutColor" + index + ";\n";
|
|
11809
|
+
});
|
|
11810
|
+
declaration += "void main(";
|
|
11811
|
+
source = source.replace(/\bgl_FragData\[(.+?)\]/g, "fragOutColor$1");
|
|
11812
|
+
source = source.replace(/void\s+?main\s*\(/g, declaration);
|
|
11813
|
+
return source;
|
|
11814
|
+
};
|
|
11815
|
+
return ShaderFactory;
|
|
11816
|
+
}();
|
|
11817
|
+
|
|
11744
11818
|
// Bloom 阈值 Pass
|
|
11745
11819
|
var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
11746
11820
|
_inherits(BloomThresholdPass, RenderPass);
|
|
@@ -12038,7 +12112,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
12038
12112
|
}(RenderPass);
|
|
12039
12113
|
|
|
12040
12114
|
var RENDER_PASS_NAME_PREFIX = "_effects_default_";
|
|
12041
|
-
var seed$
|
|
12115
|
+
var seed$4 = 1;
|
|
12042
12116
|
/**
|
|
12043
12117
|
* RenderFrame 抽象类
|
|
12044
12118
|
*/ var RenderFrame = /*#__PURE__*/ function() {
|
|
@@ -12192,7 +12266,7 @@ var seed$5 = 1;
|
|
|
12192
12266
|
}
|
|
12193
12267
|
this.semantics = new SemanticMap(options.semantics);
|
|
12194
12268
|
this.clearAction = clearAction;
|
|
12195
|
-
this.name = "RenderFrame" + seed$
|
|
12269
|
+
this.name = "RenderFrame" + seed$4++;
|
|
12196
12270
|
var firstRP = renderPasses[0];
|
|
12197
12271
|
this.emptyTexture = generateWhiteTexture(engine);
|
|
12198
12272
|
this.transparentTexture = generateTransparentTexture(engine);
|
|
@@ -12501,6 +12575,9 @@ var seed$5 = 1;
|
|
|
12501
12575
|
_proto.addToRenderPass = function addToRenderPass(renderPass, mesh) {
|
|
12502
12576
|
var info = this.renderPassInfoMap.get(renderPass);
|
|
12503
12577
|
var priority = mesh.priority;
|
|
12578
|
+
if (!info) {
|
|
12579
|
+
return;
|
|
12580
|
+
}
|
|
12504
12581
|
if (renderPass.meshes.length === 0) {
|
|
12505
12582
|
info.listStart = info.listEnd = priority;
|
|
12506
12583
|
} else {
|
|
@@ -12675,6 +12752,8 @@ var seed$5 = 1;
|
|
|
12675
12752
|
* 创建拷贝 RenderPass 用到的 Mesh 对象
|
|
12676
12753
|
* @param semantics - RenderPass 渲染时 Framebuffer 的颜色和深度纹理、大小和是否混合
|
|
12677
12754
|
*/ _proto.createCopyMesh = function createCopyMesh(semantics) {
|
|
12755
|
+
var // FIXME: 如果不把shader添加进shaderLibrary,这里可以移到core中,有性能上的考虑
|
|
12756
|
+
_this_renderer_getShaderLibrary;
|
|
12678
12757
|
var name = EFFECTS_COPY_MESH_NAME;
|
|
12679
12758
|
var engine = this.renderer.engine;
|
|
12680
12759
|
var geometry = Geometry.create(engine, {
|
|
@@ -12699,8 +12778,7 @@ var seed$5 = 1;
|
|
|
12699
12778
|
drawCount: 4
|
|
12700
12779
|
});
|
|
12701
12780
|
var shader = createCopyShader(engine.gpuCapability.level, !!(semantics == null ? void 0 : semantics.depthTexture));
|
|
12702
|
-
|
|
12703
|
-
this.renderer.getShaderLibrary().addShader(shader);
|
|
12781
|
+
(_this_renderer_getShaderLibrary = this.renderer.getShaderLibrary()) == null ? void 0 : _this_renderer_getShaderLibrary.addShader(shader);
|
|
12704
12782
|
var material = Material.create(engine, {
|
|
12705
12783
|
uniformValues: {
|
|
12706
12784
|
// @ts-expect-error
|
|
@@ -12764,7 +12842,10 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
|
|
|
12764
12842
|
}
|
|
12765
12843
|
var _proto = FinalCopyRP.prototype;
|
|
12766
12844
|
_proto.configure = function configure(renderer) {
|
|
12767
|
-
|
|
12845
|
+
var framebuffer = renderer.getFramebuffer();
|
|
12846
|
+
if (framebuffer) {
|
|
12847
|
+
this.prePassTexture = framebuffer.getColorTextures()[0];
|
|
12848
|
+
}
|
|
12768
12849
|
renderer.setFramebuffer(null);
|
|
12769
12850
|
};
|
|
12770
12851
|
_proto.execute = function execute(renderer) {
|
|
@@ -13125,7 +13206,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
13125
13206
|
|
|
13126
13207
|
var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n";
|
|
13127
13208
|
var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n";
|
|
13128
|
-
var seed$
|
|
13209
|
+
var seed$3 = 1;
|
|
13129
13210
|
var InteractMesh = /*#__PURE__*/ function() {
|
|
13130
13211
|
function InteractMesh(props, rendererOptions, transform, engine) {
|
|
13131
13212
|
this.transform = transform;
|
|
@@ -13226,7 +13307,7 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
13226
13307
|
};
|
|
13227
13308
|
_proto.createMesh = function createMesh(geometry, material) {
|
|
13228
13309
|
return Mesh.create(this.engine, {
|
|
13229
|
-
name: "Interact_preview" + seed$
|
|
13310
|
+
name: "Interact_preview" + seed$3++,
|
|
13230
13311
|
priority: 0,
|
|
13231
13312
|
worldMatrix: Matrix4.fromIdentity(),
|
|
13232
13313
|
geometry: geometry,
|
|
@@ -13278,13 +13359,15 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13278
13359
|
if (type === InteractType.CLICK) {
|
|
13279
13360
|
this.clickable = true;
|
|
13280
13361
|
if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
13281
|
-
var rendererOptions =
|
|
13282
|
-
|
|
13362
|
+
var rendererOptions = composition == null ? void 0 : composition.getRendererOptions();
|
|
13363
|
+
if (rendererOptions !== undefined) {
|
|
13364
|
+
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
13365
|
+
}
|
|
13283
13366
|
}
|
|
13284
13367
|
}
|
|
13285
13368
|
if (options.type === InteractType.DRAG) {
|
|
13286
13369
|
if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
|
|
13287
|
-
composition.event && this.beginDragTarget(options, composition.event);
|
|
13370
|
+
(composition == null ? void 0 : composition.event) && this.beginDragTarget(options, composition.event);
|
|
13288
13371
|
}
|
|
13289
13372
|
}
|
|
13290
13373
|
if (this.previewContent) {
|
|
@@ -13555,11 +13638,11 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
13555
13638
|
var shaderLibrary = render.getShaderLibrary();
|
|
13556
13639
|
var _render_engine_gpuCapability = render.engine.gpuCapability, level = _render_engine_gpuCapability.level, detail = _render_engine_gpuCapability.detail;
|
|
13557
13640
|
var env = (options != null ? options : {}).env;
|
|
13558
|
-
if (!shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)]) {
|
|
13559
|
-
shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
|
|
13560
|
-
shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, maxSpriteMeshItemCount, 1, env));
|
|
13641
|
+
if (!(shaderLibrary == null ? void 0 : shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)])) {
|
|
13642
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
|
|
13643
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, maxSpriteMeshItemCount, 1, env));
|
|
13561
13644
|
if (detail.writableFragDepth) {
|
|
13562
|
-
shaderLibrary.addShader(createCopyShader(level, true));
|
|
13645
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(createCopyShader(level, true));
|
|
13563
13646
|
}
|
|
13564
13647
|
}
|
|
13565
13648
|
return Promise.resolve();
|
|
@@ -13891,7 +13974,7 @@ var tempColor = [
|
|
|
13891
13974
|
1,
|
|
13892
13975
|
1
|
|
13893
13976
|
];
|
|
13894
|
-
var seed$
|
|
13977
|
+
var seed$2 = 0;
|
|
13895
13978
|
var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
13896
13979
|
_inherits(SpriteColorPlayable, Playable);
|
|
13897
13980
|
function SpriteColorPlayable() {
|
|
@@ -13932,8 +14015,9 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
13932
14015
|
colorChanged = true;
|
|
13933
14016
|
}
|
|
13934
14017
|
if (colorChanged) {
|
|
14018
|
+
var _this_spriteMaterial_getVector4;
|
|
13935
14019
|
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
13936
|
-
this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor);
|
|
14020
|
+
(_this_spriteMaterial_getVector4 = this.spriteMaterial.getVector4("_Color")) == null ? void 0 : _this_spriteMaterial_getVector4.setFromArray(this.renderColor);
|
|
13937
14021
|
}
|
|
13938
14022
|
};
|
|
13939
14023
|
_proto.create = function create(clipData) {
|
|
@@ -13999,7 +14083,7 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13999
14083
|
}
|
|
14000
14084
|
}
|
|
14001
14085
|
};
|
|
14002
|
-
_this.name = "MSprite" + seed$
|
|
14086
|
+
_this.name = "MSprite" + seed$2++;
|
|
14003
14087
|
_this.renderer = {
|
|
14004
14088
|
renderMode: RenderMode.BILLBOARD,
|
|
14005
14089
|
blending: BlendingMode.ALPHA,
|
|
@@ -14185,9 +14269,11 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14185
14269
|
var data = this.getItemInitData();
|
|
14186
14270
|
var renderer = this.renderer;
|
|
14187
14271
|
var texParams = this.material.getVector4("_TexParams");
|
|
14188
|
-
texParams
|
|
14189
|
-
|
|
14190
|
-
|
|
14272
|
+
if (texParams) {
|
|
14273
|
+
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
14274
|
+
texParams.y = +this.preMultiAlpha;
|
|
14275
|
+
texParams.z = renderer.renderMode;
|
|
14276
|
+
}
|
|
14191
14277
|
var attributes = {
|
|
14192
14278
|
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
14193
14279
|
index: new Uint16Array(data.index.length)
|
|
@@ -14480,7 +14566,7 @@ function setConfig(name, value) {
|
|
|
14480
14566
|
}
|
|
14481
14567
|
|
|
14482
14568
|
var tempQuat$1 = new Quaternion();
|
|
14483
|
-
var seed$
|
|
14569
|
+
var seed$1 = 1;
|
|
14484
14570
|
// TODO 继承 Component
|
|
14485
14571
|
var Transform = /*#__PURE__*/ function() {
|
|
14486
14572
|
function Transform(props, parent) {
|
|
@@ -14531,7 +14617,7 @@ var Transform = /*#__PURE__*/ function() {
|
|
|
14531
14617
|
quat: new Quaternion(0, 0, 0, 1),
|
|
14532
14618
|
scale: new Vector3(1, 1, 1)
|
|
14533
14619
|
};
|
|
14534
|
-
this.name = "transform_" + seed$
|
|
14620
|
+
this.name = "transform_" + seed$1++;
|
|
14535
14621
|
if (props) {
|
|
14536
14622
|
this.setTransform(props);
|
|
14537
14623
|
}
|
|
@@ -15836,8 +15922,8 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
15836
15922
|
}
|
|
15837
15923
|
|
|
15838
15924
|
var Burst = /*#__PURE__*/ function() {
|
|
15839
|
-
function Burst(
|
|
15840
|
-
var time =
|
|
15925
|
+
function Burst(options) {
|
|
15926
|
+
var time = options.time, interval = options.interval, count = options.count, cycles = options.cycles, probability = options.probability;
|
|
15841
15927
|
this.time = +time || 0;
|
|
15842
15928
|
this.interval = +interval || 1;
|
|
15843
15929
|
this.count = _instanceof1(count, ValueGetter) ? count : createValueGetter(count);
|
|
@@ -15865,7 +15951,14 @@ var Burst = /*#__PURE__*/ function() {
|
|
|
15865
15951
|
this.now = 0;
|
|
15866
15952
|
};
|
|
15867
15953
|
_proto.clone = function clone() {
|
|
15868
|
-
|
|
15954
|
+
var options = {
|
|
15955
|
+
time: this.time,
|
|
15956
|
+
interval: this.interval,
|
|
15957
|
+
count: this.count,
|
|
15958
|
+
cycles: this.cycles,
|
|
15959
|
+
probability: this.probability
|
|
15960
|
+
};
|
|
15961
|
+
return new Burst(options);
|
|
15869
15962
|
};
|
|
15870
15963
|
return Burst;
|
|
15871
15964
|
}();
|
|
@@ -16003,6 +16096,17 @@ var Link = /*#__PURE__*/ function() {
|
|
|
16003
16096
|
}while (node = node.pre);
|
|
16004
16097
|
}
|
|
16005
16098
|
};
|
|
16099
|
+
_proto.getNodeByIndex = function getNodeByIndex(index) {
|
|
16100
|
+
var i = 0, res = this.first;
|
|
16101
|
+
if (!res || index >= this.length || index < 0) {
|
|
16102
|
+
return null;
|
|
16103
|
+
}
|
|
16104
|
+
while(i < index){
|
|
16105
|
+
res = res.next;
|
|
16106
|
+
i++;
|
|
16107
|
+
}
|
|
16108
|
+
return res;
|
|
16109
|
+
};
|
|
16006
16110
|
return Link;
|
|
16007
16111
|
}();
|
|
16008
16112
|
|
|
@@ -16316,6 +16420,7 @@ var TrailMesh = /*#__PURE__*/ function() {
|
|
|
16316
16420
|
if (index >= 0 && index < pointCountPerTrail) {
|
|
16317
16421
|
var startIndex = (trail * pointCountPerTrail + index) * 24 + 8;
|
|
16318
16422
|
var data = this.geometry.getAttributeData("aColor");
|
|
16423
|
+
assertExist(data);
|
|
16319
16424
|
out.x = data[startIndex];
|
|
16320
16425
|
out.y = data[1 + startIndex];
|
|
16321
16426
|
out.z = data[2 + startIndex];
|
|
@@ -16323,14 +16428,14 @@ var TrailMesh = /*#__PURE__*/ function() {
|
|
|
16323
16428
|
}
|
|
16324
16429
|
};
|
|
16325
16430
|
_proto.clearAllTrails = function clearAllTrails() {
|
|
16326
|
-
var
|
|
16431
|
+
var indexData = this.geometry.getIndexData();
|
|
16432
|
+
assertExist(indexData);
|
|
16327
16433
|
this.trailCursors = new Uint16Array(this.trailCursors.length);
|
|
16328
|
-
|
|
16329
|
-
geo.setIndexData(new Uint16Array(geo.getIndexData().length));
|
|
16434
|
+
this.geometry.setIndexData(new Uint16Array(indexData.length));
|
|
16330
16435
|
};
|
|
16331
16436
|
_proto.minusTime = function minusTime(time) {
|
|
16332
|
-
// FIXME: 可选性
|
|
16333
16437
|
var data = this.geometry.getAttributeData("aTime");
|
|
16438
|
+
assertExist(data);
|
|
16334
16439
|
for(var i = 0; i < data.length; i++){
|
|
16335
16440
|
data[i] -= time;
|
|
16336
16441
|
}
|
|
@@ -16342,6 +16447,7 @@ var TrailMesh = /*#__PURE__*/ function() {
|
|
|
16342
16447
|
var pointCountPerTrail = this.pointCountPerTrail;
|
|
16343
16448
|
var indicesPerTrail = (pointCountPerTrail - 1) * 6;
|
|
16344
16449
|
var indices = this.geometry.getIndexData();
|
|
16450
|
+
assertExist(indices);
|
|
16345
16451
|
indices.set(new Uint16Array(indicesPerTrail), index * indicesPerTrail);
|
|
16346
16452
|
this.geometry.setIndexData(indices);
|
|
16347
16453
|
this.trailCursors[index] = 0;
|
|
@@ -16795,7 +16901,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16795
16901
|
break;
|
|
16796
16902
|
}
|
|
16797
16903
|
var burst = bursts[j];
|
|
16798
|
-
var opts =
|
|
16904
|
+
var opts = burst.getGeneratorOptions(timePassed, lifetime);
|
|
16799
16905
|
if (opts) {
|
|
16800
16906
|
var originVec = [
|
|
16801
16907
|
0,
|
|
@@ -16804,9 +16910,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16804
16910
|
];
|
|
16805
16911
|
var offsets = emission.burstOffsets[j];
|
|
16806
16912
|
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
16807
|
-
if (burst.once) {
|
|
16808
|
-
this.removeBurst(j);
|
|
16809
|
-
}
|
|
16810
16913
|
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
16811
16914
|
var _p_transform;
|
|
16812
16915
|
if (shouldSkipGenerate()) {
|
|
@@ -16839,10 +16942,8 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16839
16942
|
content[3].delay -= duration;
|
|
16840
16943
|
});
|
|
16841
16944
|
this.renderer.minusTimeForLoop(duration);
|
|
16842
|
-
this.onIterate(this);
|
|
16843
16945
|
} else {
|
|
16844
16946
|
this.ended = true;
|
|
16845
|
-
this.onEnd(this);
|
|
16846
16947
|
var endBehavior = this.item.endBehavior;
|
|
16847
16948
|
if (endBehavior === EndBehavior.freeze) {
|
|
16848
16949
|
this.frozen = true;
|
|
@@ -16990,7 +17091,21 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16990
17091
|
time: startTime
|
|
16991
17092
|
});
|
|
16992
17093
|
};
|
|
16993
|
-
|
|
17094
|
+
/**
|
|
17095
|
+
* 通过索引获取指定index粒子当前时刻的位置
|
|
17096
|
+
* @params index - 粒子索引
|
|
17097
|
+
*/ _proto.getPointPositionByIndex = function getPointPositionByIndex(index) {
|
|
17098
|
+
var point = this.particleLink.getNodeByIndex(index);
|
|
17099
|
+
if (!point) {
|
|
17100
|
+
console.error("Get point error.");
|
|
17101
|
+
return null;
|
|
17102
|
+
} else {
|
|
17103
|
+
return this.getPointPosition(point.content[3]);
|
|
17104
|
+
}
|
|
17105
|
+
};
|
|
17106
|
+
/**
|
|
17107
|
+
* 通过粒子参数获取当前时刻粒子的位置
|
|
17108
|
+
*/ _proto.getPointPosition = function getPointPosition(point) {
|
|
16994
17109
|
var transform = point.transform, vel = point.vel, lifetime = point.lifetime, delay = point.delay, _point_gravity = point.gravity, gravity = _point_gravity === void 0 ? [] : _point_gravity;
|
|
16995
17110
|
var forceTarget = this.options.forceTarget;
|
|
16996
17111
|
var time = this.lastUpdate - delay;
|
|
@@ -17012,8 +17127,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
17012
17127
|
}
|
|
17013
17128
|
return ret;
|
|
17014
17129
|
};
|
|
17015
|
-
_proto.onEnd = function onEnd(particle) {};
|
|
17016
|
-
_proto.onIterate = function onIterate(particle) {};
|
|
17017
17130
|
_proto.initPoint = function initPoint(data) {
|
|
17018
17131
|
var options = this.options;
|
|
17019
17132
|
var lifetime = this.lifetime;
|
|
@@ -17437,9 +17550,10 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
17437
17550
|
// this.item = vfxItem;
|
|
17438
17551
|
var interaction = props.interaction;
|
|
17439
17552
|
if (interaction) {
|
|
17553
|
+
var _interaction_radius;
|
|
17440
17554
|
this.interaction = {
|
|
17441
17555
|
multiple: interaction.multiple,
|
|
17442
|
-
radius: interaction.radius,
|
|
17556
|
+
radius: (_interaction_radius = interaction.radius) != null ? _interaction_radius : 0.4,
|
|
17443
17557
|
behavior: interaction.behavior
|
|
17444
17558
|
};
|
|
17445
17559
|
}
|
|
@@ -17523,7 +17637,10 @@ function randomArrItem(arr, keepArr) {
|
|
|
17523
17637
|
*/ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
|
|
17524
17638
|
_inherits(ParticleBehaviourPlayable, Playable);
|
|
17525
17639
|
function ParticleBehaviourPlayable() {
|
|
17526
|
-
|
|
17640
|
+
var _this;
|
|
17641
|
+
_this = Playable.apply(this, arguments) || this;
|
|
17642
|
+
_this.lastTime = 0;
|
|
17643
|
+
return _this;
|
|
17527
17644
|
}
|
|
17528
17645
|
var _proto = ParticleBehaviourPlayable.prototype;
|
|
17529
17646
|
_proto.start = function start(context) {
|
|
@@ -17551,8 +17668,12 @@ function randomArrItem(arr, keepArr) {
|
|
|
17551
17668
|
if (this.time < particleSystem.item.duration && particleSystem.isFrozen()) {
|
|
17552
17669
|
particleSystem.reset();
|
|
17553
17670
|
}
|
|
17671
|
+
if (Math.abs(this.time - this.lastTime) < 0.001) {
|
|
17672
|
+
deltaTime = 0;
|
|
17673
|
+
}
|
|
17554
17674
|
particleSystem.onUpdate(deltaTime);
|
|
17555
17675
|
}
|
|
17676
|
+
this.lastTime = this.time;
|
|
17556
17677
|
};
|
|
17557
17678
|
return ParticleBehaviourPlayable;
|
|
17558
17679
|
}(Playable);
|
|
@@ -17965,6 +18086,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
17965
18086
|
_proto.getPointColor = function getPointColor(index) {
|
|
17966
18087
|
var data = this.geometry.getAttributeData("aRot");
|
|
17967
18088
|
var i = index * 32 + 4;
|
|
18089
|
+
assertExist(data);
|
|
17968
18090
|
return [
|
|
17969
18091
|
data[i],
|
|
17970
18092
|
data[i + 1],
|
|
@@ -17972,31 +18094,6 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
17972
18094
|
data[i + 3]
|
|
17973
18095
|
];
|
|
17974
18096
|
};
|
|
17975
|
-
/**
|
|
17976
|
-
* 待废弃
|
|
17977
|
-
* @deprecated - 使用 `particle-system.getPointPosition` 替代
|
|
17978
|
-
*/ _proto.getPointPosition = function getPointPosition(index) {
|
|
17979
|
-
var geo = this.geometry;
|
|
17980
|
-
var posIndex = index * 48;
|
|
17981
|
-
var posData = geo.getAttributeData("aPos");
|
|
17982
|
-
var offsetData = geo.getAttributeData("aOffset");
|
|
17983
|
-
var time = this.time - offsetData[index * 16 + 2];
|
|
17984
|
-
var pointDur = offsetData[index * 16 + 3];
|
|
17985
|
-
var mtl = this.mesh.material;
|
|
17986
|
-
var acc = mtl.getVector4("uAcceleration").toVector3();
|
|
17987
|
-
var pos = Vector3.fromArray(posData, posIndex);
|
|
17988
|
-
var vel = Vector3.fromArray(posData, posIndex + 3);
|
|
17989
|
-
var ret = calculateTranslation(new Vector3(), this, acc, time, pointDur, pos, vel);
|
|
17990
|
-
if (this.forceTarget) {
|
|
17991
|
-
var target = mtl.getVector3("uFinalTarget");
|
|
17992
|
-
var life = this.forceTarget.curve.getValue(time / pointDur);
|
|
17993
|
-
var dl = 1 - life;
|
|
17994
|
-
ret.x = ret.x * dl + target.x * life;
|
|
17995
|
-
ret.y = ret.y * dl + target.y * life;
|
|
17996
|
-
ret.z = ret.z * dl + target.z * life;
|
|
17997
|
-
}
|
|
17998
|
-
return ret;
|
|
17999
|
-
};
|
|
18000
18097
|
_proto.clearPoints = function clearPoints() {
|
|
18001
18098
|
this.resetGeometryData(this.geometry);
|
|
18002
18099
|
this.particleCount = 0;
|
|
@@ -18019,6 +18116,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18019
18116
|
};
|
|
18020
18117
|
_proto.minusTime = function minusTime(time) {
|
|
18021
18118
|
var data = this.geometry.getAttributeData("aOffset");
|
|
18119
|
+
assertExist(data);
|
|
18022
18120
|
for(var i = 0; i < data.length; i += 4){
|
|
18023
18121
|
data[i + 2] -= time;
|
|
18024
18122
|
}
|
|
@@ -18145,6 +18243,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18145
18243
|
var attrSize = geometry.getAttributeStride(name) / Float32Array.BYTES_PER_ELEMENT;
|
|
18146
18244
|
if (increaseBuffer) {
|
|
18147
18245
|
var baseData = geometry.getAttributeData(name);
|
|
18246
|
+
assertExist(baseData);
|
|
18148
18247
|
var geoData = enlargeBuffer(baseData, vertexCount * attrSize, maxCount * 4 * attrSize, inc);
|
|
18149
18248
|
geoData.set(data, data.length * index);
|
|
18150
18249
|
geometry.setAttributeData(name, geoData);
|
|
@@ -18514,12 +18613,8 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
18514
18613
|
// TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
|
|
18515
18614
|
if (item.content.trails) {
|
|
18516
18615
|
var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
|
|
18517
|
-
var _shader_macros;
|
|
18518
|
-
shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, ShaderType.vertex, level);
|
|
18519
|
-
var _shader_macros1;
|
|
18520
|
-
shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, ShaderType.fragment, level);
|
|
18521
18616
|
shader1.glslVersion = level === 2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1;
|
|
18522
|
-
shaderLibrary.addShader(shader1);
|
|
18617
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader1);
|
|
18523
18618
|
}
|
|
18524
18619
|
});
|
|
18525
18620
|
shaders.forEach(function(shader) {
|
|
@@ -18529,15 +18624,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
18529
18624
|
} else {
|
|
18530
18625
|
shader.glslVersion = GLSLVersion.GLSL1;
|
|
18531
18626
|
}
|
|
18532
|
-
|
|
18533
|
-
shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, ShaderType.vertex, level);
|
|
18534
|
-
var _shader_macros1;
|
|
18535
|
-
shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, ShaderType.fragment, level);
|
|
18536
|
-
shaderLibrary.addShader(shader);
|
|
18627
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader);
|
|
18537
18628
|
});
|
|
18538
18629
|
if (level === 2) {
|
|
18539
18630
|
items.forEach(function(item) {
|
|
18540
|
-
// @ts-expect-error
|
|
18541
18631
|
item.content.options.meshSlots = [
|
|
18542
18632
|
maxVertexCount,
|
|
18543
18633
|
maxFragmentCount
|
|
@@ -19351,9 +19441,6 @@ function compareTracks(a, b) {
|
|
|
19351
19441
|
_this.startTime = 0;
|
|
19352
19442
|
_this.items = [] // 场景的所有元素
|
|
19353
19443
|
;
|
|
19354
|
-
/**
|
|
19355
|
-
* 合成是否冻结标志位
|
|
19356
|
-
*/ _this.fezzed = false;
|
|
19357
19444
|
_this.reusable = false;
|
|
19358
19445
|
_this.sceneBindings = [];
|
|
19359
19446
|
_this.graph = new PlayableGraph();
|
|
@@ -19778,7 +19865,9 @@ var CanvasPool = /*#__PURE__*/ function() {
|
|
|
19778
19865
|
};
|
|
19779
19866
|
_proto.getCanvas = function getCanvas() {
|
|
19780
19867
|
if (this.elements.length !== 0) {
|
|
19781
|
-
|
|
19868
|
+
var canvas = this.elements.shift();
|
|
19869
|
+
assertExist(canvas);
|
|
19870
|
+
return canvas;
|
|
19782
19871
|
}
|
|
19783
19872
|
if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
|
|
19784
19873
|
return window._createOffscreenCanvas(10, 10);
|
|
@@ -19803,9 +19892,6 @@ var CanvasPool = /*#__PURE__*/ function() {
|
|
|
19803
19892
|
return CanvasPool;
|
|
19804
19893
|
}();
|
|
19805
19894
|
var canvasPool = new CanvasPool();
|
|
19806
|
-
function getDefaultTemplateCanvasPool() {
|
|
19807
|
-
return canvasPool;
|
|
19808
|
-
}
|
|
19809
19895
|
|
|
19810
19896
|
var DEFAULT_FONTS = [
|
|
19811
19897
|
"serif",
|
|
@@ -20227,7 +20313,6 @@ var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
20227
20313
|
return TextLoader;
|
|
20228
20314
|
}(AbstractPlugin);
|
|
20229
20315
|
|
|
20230
|
-
var seed$1 = 1;
|
|
20231
20316
|
var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
20232
20317
|
_inherits(EffectComponent, RendererComponent);
|
|
20233
20318
|
function EffectComponent(engine) {
|
|
@@ -20238,7 +20323,6 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20238
20323
|
*/ _this.worldMatrix = Matrix4.fromIdentity();
|
|
20239
20324
|
_this.triangles = [];
|
|
20240
20325
|
_this.destroyed = false;
|
|
20241
|
-
_this.visible = false;
|
|
20242
20326
|
// TODO 点击测试后续抽象一个 Collider 组件
|
|
20243
20327
|
_this.getHitTestParams = function(force) {
|
|
20244
20328
|
var area = _this.getBoundingBox();
|
|
@@ -20249,18 +20333,11 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20249
20333
|
};
|
|
20250
20334
|
}
|
|
20251
20335
|
};
|
|
20252
|
-
_this.
|
|
20253
|
-
_this.name = "<unnamed>";
|
|
20336
|
+
_this.name = "EffectComponent";
|
|
20254
20337
|
_this._priority = 0;
|
|
20255
20338
|
return _this;
|
|
20256
20339
|
}
|
|
20257
20340
|
var _proto = EffectComponent.prototype;
|
|
20258
|
-
/**
|
|
20259
|
-
* 设置当前 Mesh 的可见性。
|
|
20260
|
-
* @param visible - true:可见,false:不可见
|
|
20261
|
-
*/ _proto.setVisible = function setVisible(visible) {
|
|
20262
|
-
this.visible = visible;
|
|
20263
|
-
};
|
|
20264
20341
|
_proto.start = function start() {
|
|
20265
20342
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20266
20343
|
};
|
|
@@ -20271,16 +20348,6 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20271
20348
|
renderer.drawGeometry(this.geometry, this.material);
|
|
20272
20349
|
};
|
|
20273
20350
|
/**
|
|
20274
|
-
* 获取当前 Mesh 的可见性。
|
|
20275
|
-
*/ _proto.getVisible = function getVisible() {
|
|
20276
|
-
return this.visible;
|
|
20277
|
-
};
|
|
20278
|
-
/**
|
|
20279
|
-
* 获取当前 Mesh 的第一个 geometry。
|
|
20280
|
-
*/ _proto.firstGeometry = function firstGeometry() {
|
|
20281
|
-
return this.geometry;
|
|
20282
|
-
};
|
|
20283
|
-
/**
|
|
20284
20351
|
* 设置当前 Mesh 的材质
|
|
20285
20352
|
* @param material - 要设置的材质
|
|
20286
20353
|
* @param destroy - 可选的材质销毁选项
|
|
@@ -20327,27 +20394,11 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20327
20394
|
* @param options - 可选的销毁选项
|
|
20328
20395
|
*/ _proto.dispose = function dispose(options) {
|
|
20329
20396
|
if (this.destroyed) {
|
|
20330
|
-
//console.error('call mesh.destroy multiple times', this);
|
|
20331
20397
|
return;
|
|
20332
20398
|
}
|
|
20333
|
-
// if (options?.geometries !== DestroyOptions.keep) {
|
|
20334
|
-
// this.geometry.dispose();
|
|
20335
|
-
// }
|
|
20336
|
-
// const materialDestroyOption = options?.material;
|
|
20337
|
-
// if (materialDestroyOption !== DestroyOptions.keep) {
|
|
20338
|
-
// this.material.dispose(materialDestroyOption);
|
|
20339
|
-
// }
|
|
20340
20399
|
this.destroyed = true;
|
|
20341
20400
|
RendererComponent.prototype.dispose.call(this);
|
|
20342
20401
|
};
|
|
20343
|
-
_create_class(EffectComponent, [
|
|
20344
|
-
{
|
|
20345
|
-
key: "isDestroyed",
|
|
20346
|
-
get: function get() {
|
|
20347
|
-
return this.destroyed;
|
|
20348
|
-
}
|
|
20349
|
-
}
|
|
20350
|
-
]);
|
|
20351
20402
|
return EffectComponent;
|
|
20352
20403
|
}(RendererComponent);
|
|
20353
20404
|
__decorate([
|
|
@@ -20357,8 +20408,10 @@ EffectComponent = __decorate([
|
|
|
20357
20408
|
effectsClass(DataType.EffectComponent)
|
|
20358
20409
|
], EffectComponent);
|
|
20359
20410
|
function geometryToTriangles(geometry) {
|
|
20360
|
-
var
|
|
20361
|
-
var
|
|
20411
|
+
var _geometry_getIndexData;
|
|
20412
|
+
var indices = (_geometry_getIndexData = geometry.getIndexData()) != null ? _geometry_getIndexData : [];
|
|
20413
|
+
var _geometry_getAttributeData;
|
|
20414
|
+
var vertices = (_geometry_getAttributeData = geometry.getAttributeData("aPos")) != null ? _geometry_getAttributeData : [];
|
|
20362
20415
|
var res = [];
|
|
20363
20416
|
for(var i = 0; i < indices.length; i += 3){
|
|
20364
20417
|
var index0 = indices[i] * 3;
|
|
@@ -23083,6 +23136,7 @@ function getStandardJSON(json) {
|
|
|
23083
23136
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
23084
23137
|
return version30Migration(version21Migration(getStandardJSONFromV0(json)));
|
|
23085
23138
|
}
|
|
23139
|
+
reverseParticle = false;
|
|
23086
23140
|
var vs = standardVersion.exec(json.version) || [];
|
|
23087
23141
|
var mainVersion = Number(vs[1]);
|
|
23088
23142
|
var minorVersion = Number(vs[2]);
|
|
@@ -23829,7 +23883,6 @@ var seed = 1;
|
|
|
23829
23883
|
return __generator(this, function(_state) {
|
|
23830
23884
|
switch(_state.label){
|
|
23831
23885
|
case 0:
|
|
23832
|
-
// TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
|
|
23833
23886
|
jsonScene = getStandardJSON(json);
|
|
23834
23887
|
_jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
23835
23888
|
pluginSystem = new PluginSystem(plugins);
|
|
@@ -24123,18 +24176,18 @@ var seed = 1;
|
|
|
24123
24176
|
source: source
|
|
24124
24177
|
};
|
|
24125
24178
|
});
|
|
24126
|
-
jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(
|
|
24127
|
-
var e, source, image,
|
|
24179
|
+
jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(textureOptions, idx) {
|
|
24180
|
+
var e, source, image, texture;
|
|
24128
24181
|
return __generator(this, function(_state) {
|
|
24129
24182
|
switch(_state.label){
|
|
24130
24183
|
case 0:
|
|
24131
|
-
if (_instanceof1(
|
|
24184
|
+
if (_instanceof1(textureOptions, Texture)) {
|
|
24132
24185
|
return [
|
|
24133
24186
|
2,
|
|
24134
|
-
|
|
24187
|
+
textureOptions
|
|
24135
24188
|
];
|
|
24136
24189
|
}
|
|
24137
|
-
if (!("mipmaps" in
|
|
24190
|
+
if (!("mipmaps" in textureOptions)) return [
|
|
24138
24191
|
3,
|
|
24139
24192
|
4
|
|
24140
24193
|
];
|
|
@@ -24148,7 +24201,7 @@ var seed = 1;
|
|
|
24148
24201
|
]);
|
|
24149
24202
|
return [
|
|
24150
24203
|
4,
|
|
24151
|
-
deserializeMipmapTexture(
|
|
24204
|
+
deserializeMipmapTexture(textureOptions, bins, engine, jsonScene.bins)
|
|
24152
24205
|
];
|
|
24153
24206
|
case 2:
|
|
24154
24207
|
return [
|
|
@@ -24159,12 +24212,11 @@ var seed = 1;
|
|
|
24159
24212
|
e = _state.sent();
|
|
24160
24213
|
throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
|
|
24161
24214
|
case 4:
|
|
24162
|
-
source =
|
|
24215
|
+
source = textureOptions.source;
|
|
24163
24216
|
if (!isObject(source)) return [
|
|
24164
24217
|
3,
|
|
24165
24218
|
5
|
|
24166
24219
|
];
|
|
24167
|
-
//@ts-expect-error
|
|
24168
24220
|
image = engine.assetLoader.loadGUID(source.id).data;
|
|
24169
24221
|
return [
|
|
24170
24222
|
3,
|
|
@@ -24184,12 +24236,12 @@ var seed = 1;
|
|
|
24184
24236
|
_state.label = 7;
|
|
24185
24237
|
case 7:
|
|
24186
24238
|
if (image) {
|
|
24187
|
-
|
|
24188
|
-
|
|
24189
|
-
|
|
24239
|
+
texture = createTextureOptionsBySource(image, _this.assets[idx]);
|
|
24240
|
+
texture.id = textureOptions.id;
|
|
24241
|
+
texture.dataType = DataType.Texture;
|
|
24190
24242
|
return [
|
|
24191
24243
|
2,
|
|
24192
|
-
|
|
24244
|
+
texture.sourceType === TextureSourceType.compressed ? texture : _extends({}, texture, textureOptions)
|
|
24193
24245
|
];
|
|
24194
24246
|
}
|
|
24195
24247
|
throw new Error("Invalid texture source: " + source + ".");
|
|
@@ -25021,28 +25073,6 @@ var listOrder = 0;
|
|
|
25021
25073
|
}
|
|
25022
25074
|
};
|
|
25023
25075
|
/**
|
|
25024
|
-
* 是否合成需要重新播放
|
|
25025
|
-
* @returns 重新播放合成标志位
|
|
25026
|
-
*/ _proto.shouldRestart = function shouldRestart() {
|
|
25027
|
-
var _this_rootItem = this.rootItem, duration = _this_rootItem.duration, endBehavior = _this_rootItem.endBehavior;
|
|
25028
|
-
var time = this.rootComposition.time;
|
|
25029
|
-
return endBehavior === EndBehavior.restart && duration - time < 0.02;
|
|
25030
|
-
};
|
|
25031
|
-
/**
|
|
25032
|
-
* 是否合成需要销毁
|
|
25033
|
-
* @returns 销毁合成标志位
|
|
25034
|
-
*/ _proto.shouldDispose = function shouldDispose() {
|
|
25035
|
-
if (this.reusable) {
|
|
25036
|
-
return false;
|
|
25037
|
-
}
|
|
25038
|
-
var endBehavior = this.rootItem.endBehavior;
|
|
25039
|
-
if (this.rootItem.isEnded(this.time)) {
|
|
25040
|
-
this.rootItem.ended = true;
|
|
25041
|
-
}
|
|
25042
|
-
// TODO: 合成结束行为
|
|
25043
|
-
return this.rootItem.ended && endBehavior === EndBehavior.destroy;
|
|
25044
|
-
};
|
|
25045
|
-
/**
|
|
25046
25076
|
* 合成更新,针对所有 item 的更新
|
|
25047
25077
|
* @param deltaTime - 更新的时间步长
|
|
25048
25078
|
* @param skipRender - 是否需要渲染
|
|
@@ -25053,49 +25083,56 @@ var listOrder = 0;
|
|
|
25053
25083
|
var time = this.getUpdateTime(deltaTime * this.speed);
|
|
25054
25084
|
this.globalTime += time;
|
|
25055
25085
|
this.updateRootComposition();
|
|
25056
|
-
if (this.shouldRestart()) {
|
|
25057
|
-
this.emit("end", {
|
|
25058
|
-
composition: this
|
|
25059
|
-
});
|
|
25060
|
-
this.restart();
|
|
25061
|
-
// restart then tick to avoid flicker
|
|
25062
|
-
}
|
|
25063
25086
|
this.updateVideo();
|
|
25064
25087
|
// 更新 model-tree-plugin
|
|
25065
25088
|
this.updatePluginLoaders(deltaTime);
|
|
25089
|
+
// scene VFXItem components lifetime function.
|
|
25066
25090
|
this.callStart(this.rootItem);
|
|
25067
25091
|
this.callUpdate(this.rootItem, time);
|
|
25068
25092
|
this.callLateUpdate(this.rootItem, time);
|
|
25069
25093
|
this.updateCamera();
|
|
25094
|
+
this.prepareRender();
|
|
25070
25095
|
if (this.shouldDispose()) {
|
|
25071
|
-
this.emit("end", {
|
|
25072
|
-
composition: this
|
|
25073
|
-
});
|
|
25074
25096
|
this.dispose();
|
|
25075
|
-
} else {
|
|
25076
|
-
this.prepareRender();
|
|
25077
25097
|
}
|
|
25078
25098
|
};
|
|
25079
25099
|
_proto.toLocalTime = function toLocalTime(time) {
|
|
25080
25100
|
var localTime = time - this.rootItem.start;
|
|
25081
25101
|
var duration = this.rootItem.duration;
|
|
25082
25102
|
if (localTime - duration > 0.001) {
|
|
25083
|
-
if (this.rootItem.
|
|
25084
|
-
|
|
25085
|
-
|
|
25086
|
-
|
|
25087
|
-
|
|
25088
|
-
|
|
25089
|
-
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
|
|
25103
|
+
if (!this.rootItem.ended) {
|
|
25104
|
+
this.rootItem.ended = true;
|
|
25105
|
+
this.emit("end", {
|
|
25106
|
+
composition: this
|
|
25107
|
+
});
|
|
25108
|
+
}
|
|
25109
|
+
switch(this.rootItem.endBehavior){
|
|
25110
|
+
case EndBehavior.restart:
|
|
25111
|
+
{
|
|
25112
|
+
localTime = localTime % duration;
|
|
25113
|
+
this.restart();
|
|
25114
|
+
break;
|
|
25115
|
+
}
|
|
25116
|
+
case EndBehavior.freeze:
|
|
25117
|
+
{
|
|
25118
|
+
localTime = Math.min(duration, localTime);
|
|
25119
|
+
break;
|
|
25120
|
+
}
|
|
25121
|
+
case EndBehavior.forward:
|
|
25122
|
+
{
|
|
25123
|
+
break;
|
|
25124
|
+
}
|
|
25125
|
+
case EndBehavior.destroy:
|
|
25126
|
+
{
|
|
25127
|
+
break;
|
|
25093
25128
|
}
|
|
25094
|
-
}
|
|
25095
25129
|
}
|
|
25096
25130
|
}
|
|
25097
25131
|
return localTime;
|
|
25098
25132
|
};
|
|
25133
|
+
_proto.shouldDispose = function shouldDispose() {
|
|
25134
|
+
return this.rootItem.ended && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
25135
|
+
};
|
|
25099
25136
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
25100
25137
|
var startTimeInMs = this.startTime * 1000;
|
|
25101
25138
|
var now = this.rootComposition.time * 1000;
|
|
@@ -25426,7 +25463,9 @@ var listOrder = 0;
|
|
|
25426
25463
|
(_this_rendererOptions = this.rendererOptions) == null ? void 0 : _this_rendererOptions.emptyTexture.dispose();
|
|
25427
25464
|
(_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
|
|
25428
25465
|
this.update = function() {
|
|
25429
|
-
|
|
25466
|
+
{
|
|
25467
|
+
logger.error("Update disposed composition: " + _this.name + ".");
|
|
25468
|
+
}
|
|
25430
25469
|
};
|
|
25431
25470
|
this.dispose = noop;
|
|
25432
25471
|
if (textures && this.keepResource) {
|
|
@@ -27589,8 +27628,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
27589
27628
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
27590
27629
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
27591
27630
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
27592
|
-
var version = "2.0.0-alpha.
|
|
27631
|
+
var version = "2.0.0-alpha.34";
|
|
27593
27632
|
logger.info("Core version: " + version + ".");
|
|
27594
27633
|
|
|
27595
|
-
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, 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, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, 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, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, 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, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate,
|
|
27634
|
+
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, 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, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, 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, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, SpriteColorPlayable, 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, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, 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, isSceneJSON, isSceneURL, isSceneWithOptions, 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, 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 };
|
|
27596
27635
|
//# sourceMappingURL=index.mjs.map
|