@galacean/effects-threejs 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/README.md +20 -0
- package/dist/index.js +348 -301
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +348 -295
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin 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
|
'use strict';
|
|
@@ -4808,7 +4808,9 @@ __decorate([
|
|
|
4808
4808
|
// }
|
|
4809
4809
|
/**
|
|
4810
4810
|
* 在每次设置 enabled 为 true 时触发
|
|
4811
|
-
*/ _proto.onEnable = function onEnable() {
|
|
4811
|
+
*/ _proto.onEnable = function onEnable() {
|
|
4812
|
+
// OVERRIDE
|
|
4813
|
+
};
|
|
4812
4814
|
/**
|
|
4813
4815
|
* 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
|
|
4814
4816
|
*/ _proto.start = function start() {
|
|
@@ -7677,55 +7679,6 @@ function getPreMultiAlpha(blending) {
|
|
|
7677
7679
|
return 1;
|
|
7678
7680
|
}
|
|
7679
7681
|
}
|
|
7680
|
-
var _obj$7;
|
|
7681
|
-
var downgradeKeywords = (_obj$7 = {}, _obj$7[exports.ShaderType.vertex] = {
|
|
7682
|
-
in: "attribute",
|
|
7683
|
-
out: "varying"
|
|
7684
|
-
}, _obj$7[exports.ShaderType.fragment] = {
|
|
7685
|
-
in: "varying"
|
|
7686
|
-
}, _obj$7);
|
|
7687
|
-
/**
|
|
7688
|
-
* 生成 shader,检测到 WebGL1 上下文会降级
|
|
7689
|
-
* @param macros - 宏定义数组
|
|
7690
|
-
* @param shader - 原始 shader 文本
|
|
7691
|
-
* @param shaderType - shader 类型
|
|
7692
|
-
* @return 去除版本号的 shader 文本
|
|
7693
|
-
*/ function createShaderWithMacros(macros, shader, shaderType, level) {
|
|
7694
|
-
var ret = [];
|
|
7695
|
-
var header = "";
|
|
7696
|
-
// shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
|
|
7697
|
-
ret.push("#define GE_RUNTIME");
|
|
7698
|
-
if (macros) {
|
|
7699
|
-
macros.forEach(function(param) {
|
|
7700
|
-
var key = param[0], value = param[1];
|
|
7701
|
-
if (value === true) {
|
|
7702
|
-
ret.push("#define " + key);
|
|
7703
|
-
} else if (Number.isFinite(value)) {
|
|
7704
|
-
ret.push("#define " + key + " " + value);
|
|
7705
|
-
}
|
|
7706
|
-
});
|
|
7707
|
-
header = ret.length ? ret.join("\n") + "\n" : "";
|
|
7708
|
-
}
|
|
7709
|
-
var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
|
|
7710
|
-
var GL_TYPE = "WEBGL" + level;
|
|
7711
|
-
header = header + ("\n#ifndef " + GL_TYPE + "\n#define " + GL_TYPE + "\n#endif");
|
|
7712
|
-
var fullShader = header + "\n" + shader;
|
|
7713
|
-
// 判断shader是否带有版本头
|
|
7714
|
-
var match = fullShader.match(versionTag);
|
|
7715
|
-
var version = match ? match[0] : "";
|
|
7716
|
-
if (version && version.includes("300")) {
|
|
7717
|
-
var reg = new RegExp("" + version, "g");
|
|
7718
|
-
// 带版本头且level为1,降级
|
|
7719
|
-
if (level === 1) {
|
|
7720
|
-
fullShader = fullShader.replace(/\b(in|out)\b/g, function(str) {
|
|
7721
|
-
var _downgradeKeywords_shaderType_str;
|
|
7722
|
-
return (_downgradeKeywords_shaderType_str = downgradeKeywords[shaderType][str]) != null ? _downgradeKeywords_shaderType_str : str;
|
|
7723
|
-
});
|
|
7724
|
-
}
|
|
7725
|
-
fullShader = fullShader.replace(reg, "\n");
|
|
7726
|
-
}
|
|
7727
|
-
return fullShader;
|
|
7728
|
-
}
|
|
7729
7682
|
function setBlendMode(material, blendMode) {
|
|
7730
7683
|
switch(blendMode){
|
|
7731
7684
|
case undefined:
|
|
@@ -8428,7 +8381,7 @@ function _loadMipmapImage() {
|
|
|
8428
8381
|
return _loadMipmapImage.apply(this, arguments);
|
|
8429
8382
|
}
|
|
8430
8383
|
|
|
8431
|
-
var seed$
|
|
8384
|
+
var seed$9 = 1;
|
|
8432
8385
|
/**
|
|
8433
8386
|
* Texture 抽象类
|
|
8434
8387
|
*/ var Texture = /*#__PURE__*/ function(EffectsObject) {
|
|
@@ -8437,7 +8390,7 @@ var seed$a = 1;
|
|
|
8437
8390
|
var _this;
|
|
8438
8391
|
_this = EffectsObject.call(this, engine) || this;
|
|
8439
8392
|
_this.destroyed = false;
|
|
8440
|
-
_this.id = "Tex" + seed$
|
|
8393
|
+
_this.id = "Tex" + seed$9++;
|
|
8441
8394
|
return _this;
|
|
8442
8395
|
}
|
|
8443
8396
|
var _proto = Texture.prototype;
|
|
@@ -9065,7 +9018,7 @@ exports.MaterialRenderType = void 0;
|
|
|
9065
9018
|
/**
|
|
9066
9019
|
* 用于设置材质默认名称的自增序号
|
|
9067
9020
|
* @internal
|
|
9068
|
-
*/ var seed$
|
|
9021
|
+
*/ var seed$8 = 1;
|
|
9069
9022
|
/**
|
|
9070
9023
|
* Material 抽象类
|
|
9071
9024
|
*/ var Material = /*#__PURE__*/ function(EffectsObject) {
|
|
@@ -9078,14 +9031,14 @@ exports.MaterialRenderType = void 0;
|
|
|
9078
9031
|
_this.destroyed = false;
|
|
9079
9032
|
_this.initialized = false;
|
|
9080
9033
|
if (props) {
|
|
9081
|
-
var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$
|
|
9034
|
+
var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$8++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
|
|
9082
9035
|
_this.name = name;
|
|
9083
9036
|
_this.renderType = renderType; // TODO 没有地方用到
|
|
9084
9037
|
_this.shaderSource = shader;
|
|
9085
9038
|
_this.props = props;
|
|
9086
9039
|
_this.uniformSemantics = _extends({}, uniformSemantics); // TODO 废弃,待移除
|
|
9087
9040
|
} else {
|
|
9088
|
-
_this.name = "Material" + seed$
|
|
9041
|
+
_this.name = "Material" + seed$8++;
|
|
9089
9042
|
_this.renderType = 0;
|
|
9090
9043
|
}
|
|
9091
9044
|
return _this;
|
|
@@ -9410,29 +9363,6 @@ function vecFill(out, number) {
|
|
|
9410
9363
|
}
|
|
9411
9364
|
return out;
|
|
9412
9365
|
}
|
|
9413
|
-
function vecAssign(out, a, count, start) {
|
|
9414
|
-
if (start === void 0) start = 0;
|
|
9415
|
-
for(var i = 0; i < count; i++){
|
|
9416
|
-
out[i] = a[i + start];
|
|
9417
|
-
}
|
|
9418
|
-
return out;
|
|
9419
|
-
}
|
|
9420
|
-
function vecNormalize(out, a) {
|
|
9421
|
-
var _Math;
|
|
9422
|
-
if (arguments.length === 1) {
|
|
9423
|
-
a = out;
|
|
9424
|
-
out = [];
|
|
9425
|
-
}
|
|
9426
|
-
var ap = a;
|
|
9427
|
-
var sum = (_Math = Math).hypot.apply(_Math, [].concat(ap));
|
|
9428
|
-
if (sum === 0) {
|
|
9429
|
-
return vecAssign(out, ap, ap.length);
|
|
9430
|
-
}
|
|
9431
|
-
for(var i = 0; i < ap.length; i++){
|
|
9432
|
-
out[i] = ap[i] / sum;
|
|
9433
|
-
}
|
|
9434
|
-
return out;
|
|
9435
|
-
}
|
|
9436
9366
|
function vecMulCombine(out, a, b) {
|
|
9437
9367
|
if (a && b) {
|
|
9438
9368
|
for(var i = 0, len = a.length; i < len; i++){
|
|
@@ -9522,10 +9452,6 @@ function numberToFix(a, fixed) {
|
|
|
9522
9452
|
var base = Math.pow(10, fixed);
|
|
9523
9453
|
return Math.floor(a * base) / base;
|
|
9524
9454
|
}
|
|
9525
|
-
function pointOnLine(x1, y1, x2, y2, x3, y3) {
|
|
9526
|
-
var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1;
|
|
9527
|
-
return det1 > -0.001 && det1 < 0.001;
|
|
9528
|
-
}
|
|
9529
9455
|
|
|
9530
9456
|
function _is_native_reflect_construct() {
|
|
9531
9457
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
@@ -10968,21 +10894,16 @@ exports.Shader = __decorate([
|
|
|
10968
10894
|
|
|
10969
10895
|
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
10970
10896
|
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
10971
|
-
var COPY_VERTEX_SHADER = "\
|
|
10972
|
-
var COPY_FRAGMENT_SHADER = "precision mediump float;\
|
|
10897
|
+
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}";
|
|
10898
|
+
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";
|
|
10973
10899
|
function createCopyShader(level, writeDepth) {
|
|
10974
10900
|
var webgl2 = level === 2;
|
|
10975
|
-
var version = webgl2 ? "#version 300 es" : "";
|
|
10976
10901
|
return {
|
|
10977
10902
|
name: EFFECTS_COPY_MESH_NAME,
|
|
10978
|
-
vertex:
|
|
10979
|
-
fragment:
|
|
10903
|
+
vertex: COPY_VERTEX_SHADER,
|
|
10904
|
+
fragment: COPY_FRAGMENT_SHADER,
|
|
10980
10905
|
glslVersion: webgl2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1,
|
|
10981
10906
|
macros: [
|
|
10982
|
-
[
|
|
10983
|
-
"WEBGL2",
|
|
10984
|
-
!!webgl2
|
|
10985
|
-
],
|
|
10986
10907
|
[
|
|
10987
10908
|
"DEPTH_TEXTURE",
|
|
10988
10909
|
!!writeDepth
|
|
@@ -11150,7 +11071,7 @@ function generateEmptyTypedArray(type) {
|
|
|
11150
11071
|
return new Float32Array(0);
|
|
11151
11072
|
}
|
|
11152
11073
|
|
|
11153
|
-
var seed$
|
|
11074
|
+
var seed$7 = 1;
|
|
11154
11075
|
/**
|
|
11155
11076
|
* Mesh 抽象类
|
|
11156
11077
|
*/ var Mesh = /*#__PURE__*/ function(RendererComponent) {
|
|
@@ -11162,14 +11083,14 @@ var seed$8 = 1;
|
|
|
11162
11083
|
_this.visible = true;
|
|
11163
11084
|
if (props) {
|
|
11164
11085
|
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;
|
|
11165
|
-
_this.id = "Mesh" + seed$
|
|
11086
|
+
_this.id = "Mesh" + seed$7++;
|
|
11166
11087
|
_this.name = name;
|
|
11167
11088
|
_this.geometry = geometry;
|
|
11168
11089
|
_this.material = material;
|
|
11169
11090
|
_this.priority = priority;
|
|
11170
11091
|
_this.worldMatrix = worldMatrix;
|
|
11171
11092
|
} else {
|
|
11172
|
-
_this.id = "Mesh" + seed$
|
|
11093
|
+
_this.id = "Mesh" + seed$7++;
|
|
11173
11094
|
_this.name = "<unnamed>";
|
|
11174
11095
|
_this.worldMatrix = Matrix4.fromIdentity();
|
|
11175
11096
|
_this._priority = 0;
|
|
@@ -11374,7 +11295,7 @@ exports.RenderPassDestroyAttachmentType = void 0;
|
|
|
11374
11295
|
* 强制销毁
|
|
11375
11296
|
*/ RenderPassDestroyAttachmentType[RenderPassDestroyAttachmentType["destroy"] = 0] = "destroy";
|
|
11376
11297
|
})(exports.RenderPassDestroyAttachmentType || (exports.RenderPassDestroyAttachmentType = {}));
|
|
11377
|
-
var seed$
|
|
11298
|
+
var seed$6 = 1;
|
|
11378
11299
|
/**
|
|
11379
11300
|
* RenderPass 抽象类
|
|
11380
11301
|
*/ var RenderPass = /*#__PURE__*/ function() {
|
|
@@ -11384,7 +11305,7 @@ var seed$7 = 1;
|
|
|
11384
11305
|
*/ this.attachments = [];
|
|
11385
11306
|
this.destroyed = false;
|
|
11386
11307
|
this.initialized = false;
|
|
11387
|
-
var _options_name = options.name, name = _options_name === void 0 ? "RenderPass_" + seed$
|
|
11308
|
+
var _options_name = options.name, name = _options_name === void 0 ? "RenderPass_" + seed$6++ : _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 ? exports.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;
|
|
11388
11309
|
this.name = name;
|
|
11389
11310
|
this.renderer = renderer;
|
|
11390
11311
|
this.priority = priority;
|
|
@@ -11604,10 +11525,12 @@ var seed$7 = 1;
|
|
|
11604
11525
|
*/ _proto.getDepthAttachment = function getDepthAttachment() {
|
|
11605
11526
|
var framebuffer = this.framebuffer;
|
|
11606
11527
|
if (framebuffer) {
|
|
11528
|
+
var depthTexture = framebuffer.getDepthTexture();
|
|
11529
|
+
var texture = depthTexture ? this.getDepthTexture(depthTexture, framebuffer.externalStorage) : undefined;
|
|
11607
11530
|
return {
|
|
11608
11531
|
storageType: framebuffer.depthStencilStorageType,
|
|
11609
11532
|
storage: framebuffer.depthStorage,
|
|
11610
|
-
texture:
|
|
11533
|
+
texture: texture
|
|
11611
11534
|
};
|
|
11612
11535
|
}
|
|
11613
11536
|
};
|
|
@@ -11616,10 +11539,12 @@ var seed$7 = 1;
|
|
|
11616
11539
|
*/ _proto.getStencilAttachment = function getStencilAttachment() {
|
|
11617
11540
|
var framebuffer = this.framebuffer;
|
|
11618
11541
|
if (framebuffer) {
|
|
11542
|
+
var stencilTexture = framebuffer.getStencilTexture();
|
|
11543
|
+
var texture = stencilTexture ? this.getDepthTexture(stencilTexture, framebuffer.externalStorage) : undefined;
|
|
11619
11544
|
return {
|
|
11620
11545
|
storageType: framebuffer.depthStencilStorageType,
|
|
11621
11546
|
storage: framebuffer.stencilStorage,
|
|
11622
|
-
texture:
|
|
11547
|
+
texture: texture
|
|
11623
11548
|
};
|
|
11624
11549
|
}
|
|
11625
11550
|
};
|
|
@@ -11731,11 +11656,7 @@ var seed$7 = 1;
|
|
|
11731
11656
|
|
|
11732
11657
|
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;}";
|
|
11733
11658
|
|
|
11734
|
-
var
|
|
11735
|
-
|
|
11736
|
-
var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
|
|
11737
|
-
|
|
11738
|
-
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);}";
|
|
11659
|
+
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);}";
|
|
11739
11660
|
|
|
11740
11661
|
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.;}";
|
|
11741
11662
|
|
|
@@ -11743,13 +11664,13 @@ var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3
|
|
|
11743
11664
|
|
|
11744
11665
|
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;}";
|
|
11745
11666
|
|
|
11746
|
-
var particleFrag = "#version
|
|
11667
|
+
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";
|
|
11747
11668
|
|
|
11748
|
-
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}}";
|
|
11669
|
+
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}}";
|
|
11749
11670
|
|
|
11750
|
-
var trailVert = "#version
|
|
11671
|
+
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}";
|
|
11751
11672
|
|
|
11752
|
-
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\
|
|
11673
|
+
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.;}";
|
|
11753
11674
|
|
|
11754
11675
|
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";
|
|
11755
11676
|
|
|
@@ -11767,6 +11688,159 @@ var gaussianUpFrag = "precision highp float;varying vec2 uv;uniform sampler2D _M
|
|
|
11767
11688
|
|
|
11768
11689
|
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);}";
|
|
11769
11690
|
|
|
11691
|
+
var shaderLib = {};
|
|
11692
|
+
var ShaderFactory = /*#__PURE__*/ function() {
|
|
11693
|
+
function ShaderFactory() {}
|
|
11694
|
+
ShaderFactory.registerInclude = function registerInclude(includeName, includeSource) {
|
|
11695
|
+
if (shaderLib[includeName]) {
|
|
11696
|
+
logger.warn('The "' + includeName + '" shader include already exist.');
|
|
11697
|
+
}
|
|
11698
|
+
shaderLib[includeName] = includeSource;
|
|
11699
|
+
};
|
|
11700
|
+
ShaderFactory.unRegisterInclude = function unRegisterInclude(includeName) {
|
|
11701
|
+
delete shaderLib[includeName];
|
|
11702
|
+
};
|
|
11703
|
+
ShaderFactory.unRegisterAllIncludes = function unRegisterAllIncludes() {
|
|
11704
|
+
Object.keys(shaderLib).forEach(function(key) {
|
|
11705
|
+
ShaderFactory.unRegisterInclude(key);
|
|
11706
|
+
});
|
|
11707
|
+
};
|
|
11708
|
+
/**
|
|
11709
|
+
* 生成 shader,检测到 WebGL1 上下文会降级
|
|
11710
|
+
* @param macros - 宏定义数组
|
|
11711
|
+
* @param shader - 原始 shader 文本
|
|
11712
|
+
* @param shaderType - shader 类型
|
|
11713
|
+
* @return 去除版本号的 shader 文本
|
|
11714
|
+
*/ ShaderFactory.genFinalShaderCode = function genFinalShaderCode(options) {
|
|
11715
|
+
var level = options.level, shaderType = options.shaderType, shader = options.shader, macros = options.macros, removeVersion = options.removeVersion;
|
|
11716
|
+
var macroString = ShaderFactory.genMacroString(level, macros);
|
|
11717
|
+
var versionString = ShaderFactory.genShaderVersion(level);
|
|
11718
|
+
var source = ShaderFactory.parseIncludes(shader);
|
|
11719
|
+
var isVersion300 = ShaderFactory.isVersion300(source);
|
|
11720
|
+
source = ShaderFactory.removeWebGLVersion(source);
|
|
11721
|
+
if (level === 2 && !isVersion300) {
|
|
11722
|
+
source = ShaderFactory.convertTo300(source, shaderType === exports.ShaderType.fragment);
|
|
11723
|
+
}
|
|
11724
|
+
if (removeVersion) {
|
|
11725
|
+
return macroString + source;
|
|
11726
|
+
}
|
|
11727
|
+
return versionString + macroString + source;
|
|
11728
|
+
};
|
|
11729
|
+
/**
|
|
11730
|
+
* Convert lower GLSL version to GLSL 300 es.
|
|
11731
|
+
* @param source - code
|
|
11732
|
+
* @param isFragment - Whether it is a fragment shader.
|
|
11733
|
+
* */ ShaderFactory.convertTo300 = function convertTo300(source, isFragment) {
|
|
11734
|
+
source = source.replace(/\bvarying\b/g, isFragment ? "in" : "out");
|
|
11735
|
+
source = source.replace(/\btexture(2D|Cube)\b/g, "texture");
|
|
11736
|
+
// Remove extensions
|
|
11737
|
+
var regex = /#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;
|
|
11738
|
+
source = source.replace(regex, "");
|
|
11739
|
+
if (isFragment) {
|
|
11740
|
+
source = source.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
|
|
11741
|
+
source = source.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
|
|
11742
|
+
source = source.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
|
|
11743
|
+
if (!ShaderFactory.has300Output(source)) {
|
|
11744
|
+
var isMRT = /\bgl_FragData\[.+?\]/g.test(source);
|
|
11745
|
+
if (isMRT) {
|
|
11746
|
+
source = source.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
|
|
11747
|
+
var result = source.match(/\bgl_FragData\[.+?\]/g);
|
|
11748
|
+
if (result) {
|
|
11749
|
+
source = ShaderFactory.replaceMRTShader(source, result);
|
|
11750
|
+
}
|
|
11751
|
+
} else {
|
|
11752
|
+
source = source.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
|
|
11753
|
+
source = source.replace(/\bgl_FragColor\b/g, "glFragColor");
|
|
11754
|
+
}
|
|
11755
|
+
}
|
|
11756
|
+
} else {
|
|
11757
|
+
source = source.replace(/\battribute\b/g, "in");
|
|
11758
|
+
}
|
|
11759
|
+
return source;
|
|
11760
|
+
};
|
|
11761
|
+
ShaderFactory.parseIncludes = function parseIncludes(source, regex) {
|
|
11762
|
+
if (regex === void 0) regex = /#include <(.+)>/gm;
|
|
11763
|
+
var match;
|
|
11764
|
+
while((match = regex.exec(source)) !== null){
|
|
11765
|
+
var shaderName = match[1];
|
|
11766
|
+
var replace = shaderLib[shaderName];
|
|
11767
|
+
if (replace === undefined) {
|
|
11768
|
+
throw new Error("Can't find include shader name " + shaderName);
|
|
11769
|
+
}
|
|
11770
|
+
source = source.replace(match[0], replace);
|
|
11771
|
+
}
|
|
11772
|
+
return source;
|
|
11773
|
+
};
|
|
11774
|
+
ShaderFactory.genMacroString = function genMacroString(level, macros, addRuntimeMacro) {
|
|
11775
|
+
if (addRuntimeMacro === void 0) addRuntimeMacro = true;
|
|
11776
|
+
var macroList = [];
|
|
11777
|
+
var webGLVersion = "WEBGL" + level;
|
|
11778
|
+
macroList.push("#ifndef " + webGLVersion);
|
|
11779
|
+
macroList.push("#define " + webGLVersion);
|
|
11780
|
+
macroList.push("#endif");
|
|
11781
|
+
if (addRuntimeMacro) {
|
|
11782
|
+
macroList.push("#define GE_RUNTIME");
|
|
11783
|
+
}
|
|
11784
|
+
if (macros && macros.length) {
|
|
11785
|
+
macros.forEach(function(param) {
|
|
11786
|
+
var key = param[0], value = param[1];
|
|
11787
|
+
if (value === true) {
|
|
11788
|
+
macroList.push("#define " + key);
|
|
11789
|
+
} else if (Number.isFinite(value)) {
|
|
11790
|
+
macroList.push("#define " + key + " " + value);
|
|
11791
|
+
}
|
|
11792
|
+
});
|
|
11793
|
+
}
|
|
11794
|
+
if (macroList.length) {
|
|
11795
|
+
return macroList.join("\n") + "\n";
|
|
11796
|
+
}
|
|
11797
|
+
return "";
|
|
11798
|
+
};
|
|
11799
|
+
ShaderFactory.genShaderVersion = function genShaderVersion(level) {
|
|
11800
|
+
if (level === 1) {
|
|
11801
|
+
return "#version 100\n";
|
|
11802
|
+
}
|
|
11803
|
+
return "#version 300 es\n";
|
|
11804
|
+
};
|
|
11805
|
+
ShaderFactory.isVersion300 = function isVersion300(source) {
|
|
11806
|
+
var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
|
|
11807
|
+
var match = source.match(versionTag);
|
|
11808
|
+
var version = match ? match[0] : "";
|
|
11809
|
+
return version.includes("300");
|
|
11810
|
+
};
|
|
11811
|
+
ShaderFactory.removeWebGLVersion = function removeWebGLVersion(source) {
|
|
11812
|
+
var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
|
|
11813
|
+
var match = source.match(versionTag);
|
|
11814
|
+
if (match) {
|
|
11815
|
+
return source.replace(match[0], "");
|
|
11816
|
+
}
|
|
11817
|
+
return source;
|
|
11818
|
+
};
|
|
11819
|
+
ShaderFactory.has300Output = function has300Output(fragmentShader) {
|
|
11820
|
+
// [layout(location = 0)] out [highp] vec4 [color];
|
|
11821
|
+
var fragReg = /\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/;
|
|
11822
|
+
return fragReg.test(fragmentShader);
|
|
11823
|
+
};
|
|
11824
|
+
ShaderFactory.replaceMRTShader = function replaceMRTShader(source, result) {
|
|
11825
|
+
var mrtIndexSet = new Set();
|
|
11826
|
+
var declaration = "";
|
|
11827
|
+
for(var i = 0; i < result.length; i++){
|
|
11828
|
+
var res = result[i].match(/\bgl_FragData\[(.+?)\]/);
|
|
11829
|
+
if (res) {
|
|
11830
|
+
mrtIndexSet.add(res[1]);
|
|
11831
|
+
}
|
|
11832
|
+
}
|
|
11833
|
+
mrtIndexSet.forEach(function(index) {
|
|
11834
|
+
declaration += "layout(location=" + index + ") out vec4 fragOutColor" + index + ";\n";
|
|
11835
|
+
});
|
|
11836
|
+
declaration += "void main(";
|
|
11837
|
+
source = source.replace(/\bgl_FragData\[(.+?)\]/g, "fragOutColor$1");
|
|
11838
|
+
source = source.replace(/void\s+?main\s*\(/g, declaration);
|
|
11839
|
+
return source;
|
|
11840
|
+
};
|
|
11841
|
+
return ShaderFactory;
|
|
11842
|
+
}();
|
|
11843
|
+
|
|
11770
11844
|
// Bloom 阈值 Pass
|
|
11771
11845
|
var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
11772
11846
|
_inherits(BloomThresholdPass, RenderPass);
|
|
@@ -12064,7 +12138,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
12064
12138
|
}(RenderPass);
|
|
12065
12139
|
|
|
12066
12140
|
var RENDER_PASS_NAME_PREFIX = "_effects_default_";
|
|
12067
|
-
var seed$
|
|
12141
|
+
var seed$5 = 1;
|
|
12068
12142
|
/**
|
|
12069
12143
|
* RenderFrame 抽象类
|
|
12070
12144
|
*/ var RenderFrame = /*#__PURE__*/ function() {
|
|
@@ -12218,7 +12292,7 @@ var seed$6 = 1;
|
|
|
12218
12292
|
}
|
|
12219
12293
|
this.semantics = new SemanticMap(options.semantics);
|
|
12220
12294
|
this.clearAction = clearAction;
|
|
12221
|
-
this.name = "RenderFrame" + seed$
|
|
12295
|
+
this.name = "RenderFrame" + seed$5++;
|
|
12222
12296
|
var firstRP = renderPasses[0];
|
|
12223
12297
|
this.emptyTexture = generateWhiteTexture(engine);
|
|
12224
12298
|
this.transparentTexture = generateTransparentTexture(engine);
|
|
@@ -12527,6 +12601,9 @@ var seed$6 = 1;
|
|
|
12527
12601
|
_proto.addToRenderPass = function addToRenderPass(renderPass, mesh) {
|
|
12528
12602
|
var info = this.renderPassInfoMap.get(renderPass);
|
|
12529
12603
|
var priority = mesh.priority;
|
|
12604
|
+
if (!info) {
|
|
12605
|
+
return;
|
|
12606
|
+
}
|
|
12530
12607
|
if (renderPass.meshes.length === 0) {
|
|
12531
12608
|
info.listStart = info.listEnd = priority;
|
|
12532
12609
|
} else {
|
|
@@ -12701,6 +12778,8 @@ var seed$6 = 1;
|
|
|
12701
12778
|
* 创建拷贝 RenderPass 用到的 Mesh 对象
|
|
12702
12779
|
* @param semantics - RenderPass 渲染时 Framebuffer 的颜色和深度纹理、大小和是否混合
|
|
12703
12780
|
*/ _proto.createCopyMesh = function createCopyMesh(semantics) {
|
|
12781
|
+
var // FIXME: 如果不把shader添加进shaderLibrary,这里可以移到core中,有性能上的考虑
|
|
12782
|
+
_this_renderer_getShaderLibrary;
|
|
12704
12783
|
var name = EFFECTS_COPY_MESH_NAME;
|
|
12705
12784
|
var engine = this.renderer.engine;
|
|
12706
12785
|
var geometry = Geometry.create(engine, {
|
|
@@ -12725,8 +12804,7 @@ var seed$6 = 1;
|
|
|
12725
12804
|
drawCount: 4
|
|
12726
12805
|
});
|
|
12727
12806
|
var shader = createCopyShader(engine.gpuCapability.level, !!(semantics == null ? void 0 : semantics.depthTexture));
|
|
12728
|
-
|
|
12729
|
-
this.renderer.getShaderLibrary().addShader(shader);
|
|
12807
|
+
(_this_renderer_getShaderLibrary = this.renderer.getShaderLibrary()) == null ? void 0 : _this_renderer_getShaderLibrary.addShader(shader);
|
|
12730
12808
|
var material = Material.create(engine, {
|
|
12731
12809
|
uniformValues: {
|
|
12732
12810
|
// @ts-expect-error
|
|
@@ -12790,7 +12868,10 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
|
|
|
12790
12868
|
}
|
|
12791
12869
|
var _proto = FinalCopyRP.prototype;
|
|
12792
12870
|
_proto.configure = function configure(renderer) {
|
|
12793
|
-
|
|
12871
|
+
var framebuffer = renderer.getFramebuffer();
|
|
12872
|
+
if (framebuffer) {
|
|
12873
|
+
this.prePassTexture = framebuffer.getColorTextures()[0];
|
|
12874
|
+
}
|
|
12794
12875
|
renderer.setFramebuffer(null);
|
|
12795
12876
|
};
|
|
12796
12877
|
_proto.execute = function execute(renderer) {
|
|
@@ -13151,7 +13232,7 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
13151
13232
|
|
|
13152
13233
|
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";
|
|
13153
13234
|
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";
|
|
13154
|
-
var seed$
|
|
13235
|
+
var seed$4 = 1;
|
|
13155
13236
|
var InteractMesh = /*#__PURE__*/ function() {
|
|
13156
13237
|
function InteractMesh(props, rendererOptions, transform, engine) {
|
|
13157
13238
|
this.transform = transform;
|
|
@@ -13252,7 +13333,7 @@ var InteractMesh = /*#__PURE__*/ function() {
|
|
|
13252
13333
|
};
|
|
13253
13334
|
_proto.createMesh = function createMesh(geometry, material) {
|
|
13254
13335
|
return Mesh.create(this.engine, {
|
|
13255
|
-
name: "Interact_preview" + seed$
|
|
13336
|
+
name: "Interact_preview" + seed$4++,
|
|
13256
13337
|
priority: 0,
|
|
13257
13338
|
worldMatrix: Matrix4.fromIdentity(),
|
|
13258
13339
|
geometry: geometry,
|
|
@@ -13304,13 +13385,15 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13304
13385
|
if (type === InteractType.CLICK) {
|
|
13305
13386
|
this.clickable = true;
|
|
13306
13387
|
if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
13307
|
-
var rendererOptions =
|
|
13308
|
-
|
|
13388
|
+
var rendererOptions = composition == null ? void 0 : composition.getRendererOptions();
|
|
13389
|
+
if (rendererOptions !== undefined) {
|
|
13390
|
+
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
13391
|
+
}
|
|
13309
13392
|
}
|
|
13310
13393
|
}
|
|
13311
13394
|
if (options.type === InteractType.DRAG) {
|
|
13312
13395
|
if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
|
|
13313
|
-
composition.event && this.beginDragTarget(options, composition.event);
|
|
13396
|
+
(composition == null ? void 0 : composition.event) && this.beginDragTarget(options, composition.event);
|
|
13314
13397
|
}
|
|
13315
13398
|
}
|
|
13316
13399
|
if (this.previewContent) {
|
|
@@ -13581,11 +13664,11 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
13581
13664
|
var shaderLibrary = render.getShaderLibrary();
|
|
13582
13665
|
var _render_engine_gpuCapability = render.engine.gpuCapability, level = _render_engine_gpuCapability.level, detail = _render_engine_gpuCapability.detail;
|
|
13583
13666
|
var env = (options != null ? options : {}).env;
|
|
13584
|
-
if (!shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)]) {
|
|
13585
|
-
shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
|
|
13586
|
-
shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, exports.maxSpriteMeshItemCount, 1, env));
|
|
13667
|
+
if (!(shaderLibrary == null ? void 0 : shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)])) {
|
|
13668
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
|
|
13669
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, exports.maxSpriteMeshItemCount, 1, env));
|
|
13587
13670
|
if (detail.writableFragDepth) {
|
|
13588
|
-
shaderLibrary.addShader(createCopyShader(level, true));
|
|
13671
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(createCopyShader(level, true));
|
|
13589
13672
|
}
|
|
13590
13673
|
}
|
|
13591
13674
|
return Promise.resolve();
|
|
@@ -13917,7 +14000,7 @@ var tempColor = [
|
|
|
13917
14000
|
1,
|
|
13918
14001
|
1
|
|
13919
14002
|
];
|
|
13920
|
-
var seed$
|
|
14003
|
+
var seed$3 = 0;
|
|
13921
14004
|
var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
13922
14005
|
_inherits(SpriteColorPlayable, Playable);
|
|
13923
14006
|
function SpriteColorPlayable() {
|
|
@@ -13958,8 +14041,9 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
13958
14041
|
colorChanged = true;
|
|
13959
14042
|
}
|
|
13960
14043
|
if (colorChanged) {
|
|
14044
|
+
var _this_spriteMaterial_getVector4;
|
|
13961
14045
|
vecMulCombine(this.renderColor, colorInc, this.startColor);
|
|
13962
|
-
this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor);
|
|
14046
|
+
(_this_spriteMaterial_getVector4 = this.spriteMaterial.getVector4("_Color")) == null ? void 0 : _this_spriteMaterial_getVector4.setFromArray(this.renderColor);
|
|
13963
14047
|
}
|
|
13964
14048
|
};
|
|
13965
14049
|
_proto.create = function create(clipData) {
|
|
@@ -14025,7 +14109,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14025
14109
|
}
|
|
14026
14110
|
}
|
|
14027
14111
|
};
|
|
14028
|
-
_this.name = "MSprite" + seed$
|
|
14112
|
+
_this.name = "MSprite" + seed$3++;
|
|
14029
14113
|
_this.renderer = {
|
|
14030
14114
|
renderMode: RenderMode.BILLBOARD,
|
|
14031
14115
|
blending: BlendingMode.ALPHA,
|
|
@@ -14211,9 +14295,11 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14211
14295
|
var data = this.getItemInitData();
|
|
14212
14296
|
var renderer = this.renderer;
|
|
14213
14297
|
var texParams = this.material.getVector4("_TexParams");
|
|
14214
|
-
texParams
|
|
14215
|
-
|
|
14216
|
-
|
|
14298
|
+
if (texParams) {
|
|
14299
|
+
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
14300
|
+
texParams.y = +this.preMultiAlpha;
|
|
14301
|
+
texParams.z = renderer.renderMode;
|
|
14302
|
+
}
|
|
14217
14303
|
var attributes = {
|
|
14218
14304
|
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
14219
14305
|
index: new Uint16Array(data.index.length)
|
|
@@ -14506,7 +14592,7 @@ function setConfig(name, value) {
|
|
|
14506
14592
|
}
|
|
14507
14593
|
|
|
14508
14594
|
var tempQuat$1 = new Quaternion();
|
|
14509
|
-
var seed$
|
|
14595
|
+
var seed$2 = 1;
|
|
14510
14596
|
// TODO 继承 Component
|
|
14511
14597
|
var Transform = /*#__PURE__*/ function() {
|
|
14512
14598
|
function Transform(props, parent) {
|
|
@@ -14557,7 +14643,7 @@ var Transform = /*#__PURE__*/ function() {
|
|
|
14557
14643
|
quat: new Quaternion(0, 0, 0, 1),
|
|
14558
14644
|
scale: new Vector3(1, 1, 1)
|
|
14559
14645
|
};
|
|
14560
|
-
this.name = "transform_" + seed$
|
|
14646
|
+
this.name = "transform_" + seed$2++;
|
|
14561
14647
|
if (props) {
|
|
14562
14648
|
this.setTransform(props);
|
|
14563
14649
|
}
|
|
@@ -15862,8 +15948,8 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
15862
15948
|
}
|
|
15863
15949
|
|
|
15864
15950
|
var Burst = /*#__PURE__*/ function() {
|
|
15865
|
-
function Burst(
|
|
15866
|
-
var time =
|
|
15951
|
+
function Burst(options) {
|
|
15952
|
+
var time = options.time, interval = options.interval, count = options.count, cycles = options.cycles, probability = options.probability;
|
|
15867
15953
|
this.time = +time || 0;
|
|
15868
15954
|
this.interval = +interval || 1;
|
|
15869
15955
|
this.count = _instanceof1(count, ValueGetter) ? count : createValueGetter(count);
|
|
@@ -15891,7 +15977,14 @@ var Burst = /*#__PURE__*/ function() {
|
|
|
15891
15977
|
this.now = 0;
|
|
15892
15978
|
};
|
|
15893
15979
|
_proto.clone = function clone() {
|
|
15894
|
-
|
|
15980
|
+
var options = {
|
|
15981
|
+
time: this.time,
|
|
15982
|
+
interval: this.interval,
|
|
15983
|
+
count: this.count,
|
|
15984
|
+
cycles: this.cycles,
|
|
15985
|
+
probability: this.probability
|
|
15986
|
+
};
|
|
15987
|
+
return new Burst(options);
|
|
15895
15988
|
};
|
|
15896
15989
|
return Burst;
|
|
15897
15990
|
}();
|
|
@@ -16029,6 +16122,17 @@ var Link = /*#__PURE__*/ function() {
|
|
|
16029
16122
|
}while (node = node.pre);
|
|
16030
16123
|
}
|
|
16031
16124
|
};
|
|
16125
|
+
_proto.getNodeByIndex = function getNodeByIndex(index) {
|
|
16126
|
+
var i = 0, res = this.first;
|
|
16127
|
+
if (!res || index >= this.length || index < 0) {
|
|
16128
|
+
return null;
|
|
16129
|
+
}
|
|
16130
|
+
while(i < index){
|
|
16131
|
+
res = res.next;
|
|
16132
|
+
i++;
|
|
16133
|
+
}
|
|
16134
|
+
return res;
|
|
16135
|
+
};
|
|
16032
16136
|
return Link;
|
|
16033
16137
|
}();
|
|
16034
16138
|
|
|
@@ -16342,6 +16446,7 @@ var TrailMesh = /*#__PURE__*/ function() {
|
|
|
16342
16446
|
if (index >= 0 && index < pointCountPerTrail) {
|
|
16343
16447
|
var startIndex = (trail * pointCountPerTrail + index) * 24 + 8;
|
|
16344
16448
|
var data = this.geometry.getAttributeData("aColor");
|
|
16449
|
+
assertExist(data);
|
|
16345
16450
|
out.x = data[startIndex];
|
|
16346
16451
|
out.y = data[1 + startIndex];
|
|
16347
16452
|
out.z = data[2 + startIndex];
|
|
@@ -16349,14 +16454,14 @@ var TrailMesh = /*#__PURE__*/ function() {
|
|
|
16349
16454
|
}
|
|
16350
16455
|
};
|
|
16351
16456
|
_proto.clearAllTrails = function clearAllTrails() {
|
|
16352
|
-
var
|
|
16457
|
+
var indexData = this.geometry.getIndexData();
|
|
16458
|
+
assertExist(indexData);
|
|
16353
16459
|
this.trailCursors = new Uint16Array(this.trailCursors.length);
|
|
16354
|
-
|
|
16355
|
-
geo.setIndexData(new Uint16Array(geo.getIndexData().length));
|
|
16460
|
+
this.geometry.setIndexData(new Uint16Array(indexData.length));
|
|
16356
16461
|
};
|
|
16357
16462
|
_proto.minusTime = function minusTime(time) {
|
|
16358
|
-
// FIXME: 可选性
|
|
16359
16463
|
var data = this.geometry.getAttributeData("aTime");
|
|
16464
|
+
assertExist(data);
|
|
16360
16465
|
for(var i = 0; i < data.length; i++){
|
|
16361
16466
|
data[i] -= time;
|
|
16362
16467
|
}
|
|
@@ -16368,6 +16473,7 @@ var TrailMesh = /*#__PURE__*/ function() {
|
|
|
16368
16473
|
var pointCountPerTrail = this.pointCountPerTrail;
|
|
16369
16474
|
var indicesPerTrail = (pointCountPerTrail - 1) * 6;
|
|
16370
16475
|
var indices = this.geometry.getIndexData();
|
|
16476
|
+
assertExist(indices);
|
|
16371
16477
|
indices.set(new Uint16Array(indicesPerTrail), index * indicesPerTrail);
|
|
16372
16478
|
this.geometry.setIndexData(indices);
|
|
16373
16479
|
this.trailCursors[index] = 0;
|
|
@@ -16821,7 +16927,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16821
16927
|
break;
|
|
16822
16928
|
}
|
|
16823
16929
|
var burst = bursts[j];
|
|
16824
|
-
var opts =
|
|
16930
|
+
var opts = burst.getGeneratorOptions(timePassed, lifetime);
|
|
16825
16931
|
if (opts) {
|
|
16826
16932
|
var originVec = [
|
|
16827
16933
|
0,
|
|
@@ -16830,9 +16936,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16830
16936
|
];
|
|
16831
16937
|
var offsets = emission.burstOffsets[j];
|
|
16832
16938
|
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
16833
|
-
if (burst.once) {
|
|
16834
|
-
this.removeBurst(j);
|
|
16835
|
-
}
|
|
16836
16939
|
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
16837
16940
|
var _p_transform;
|
|
16838
16941
|
if (shouldSkipGenerate()) {
|
|
@@ -16865,10 +16968,8 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16865
16968
|
content[3].delay -= duration;
|
|
16866
16969
|
});
|
|
16867
16970
|
this.renderer.minusTimeForLoop(duration);
|
|
16868
|
-
this.onIterate(this);
|
|
16869
16971
|
} else {
|
|
16870
16972
|
this.ended = true;
|
|
16871
|
-
this.onEnd(this);
|
|
16872
16973
|
var endBehavior = this.item.endBehavior;
|
|
16873
16974
|
if (endBehavior === EndBehavior.freeze) {
|
|
16874
16975
|
this.frozen = true;
|
|
@@ -17016,7 +17117,21 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
17016
17117
|
time: startTime
|
|
17017
17118
|
});
|
|
17018
17119
|
};
|
|
17019
|
-
|
|
17120
|
+
/**
|
|
17121
|
+
* 通过索引获取指定index粒子当前时刻的位置
|
|
17122
|
+
* @params index - 粒子索引
|
|
17123
|
+
*/ _proto.getPointPositionByIndex = function getPointPositionByIndex(index) {
|
|
17124
|
+
var point = this.particleLink.getNodeByIndex(index);
|
|
17125
|
+
if (!point) {
|
|
17126
|
+
console.error("Get point error.");
|
|
17127
|
+
return null;
|
|
17128
|
+
} else {
|
|
17129
|
+
return this.getPointPosition(point.content[3]);
|
|
17130
|
+
}
|
|
17131
|
+
};
|
|
17132
|
+
/**
|
|
17133
|
+
* 通过粒子参数获取当前时刻粒子的位置
|
|
17134
|
+
*/ _proto.getPointPosition = function getPointPosition(point) {
|
|
17020
17135
|
var transform = point.transform, vel = point.vel, lifetime = point.lifetime, delay = point.delay, _point_gravity = point.gravity, gravity = _point_gravity === void 0 ? [] : _point_gravity;
|
|
17021
17136
|
var forceTarget = this.options.forceTarget;
|
|
17022
17137
|
var time = this.lastUpdate - delay;
|
|
@@ -17038,8 +17153,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
17038
17153
|
}
|
|
17039
17154
|
return ret;
|
|
17040
17155
|
};
|
|
17041
|
-
_proto.onEnd = function onEnd(particle) {};
|
|
17042
|
-
_proto.onIterate = function onIterate(particle) {};
|
|
17043
17156
|
_proto.initPoint = function initPoint(data) {
|
|
17044
17157
|
var options = this.options;
|
|
17045
17158
|
var lifetime = this.lifetime;
|
|
@@ -17463,9 +17576,10 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
17463
17576
|
// this.item = vfxItem;
|
|
17464
17577
|
var interaction = props.interaction;
|
|
17465
17578
|
if (interaction) {
|
|
17579
|
+
var _interaction_radius;
|
|
17466
17580
|
this.interaction = {
|
|
17467
17581
|
multiple: interaction.multiple,
|
|
17468
|
-
radius: interaction.radius,
|
|
17582
|
+
radius: (_interaction_radius = interaction.radius) != null ? _interaction_radius : 0.4,
|
|
17469
17583
|
behavior: interaction.behavior
|
|
17470
17584
|
};
|
|
17471
17585
|
}
|
|
@@ -17549,7 +17663,10 @@ function randomArrItem(arr, keepArr) {
|
|
|
17549
17663
|
*/ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
|
|
17550
17664
|
_inherits(ParticleBehaviourPlayable, Playable);
|
|
17551
17665
|
function ParticleBehaviourPlayable() {
|
|
17552
|
-
|
|
17666
|
+
var _this;
|
|
17667
|
+
_this = Playable.apply(this, arguments) || this;
|
|
17668
|
+
_this.lastTime = 0;
|
|
17669
|
+
return _this;
|
|
17553
17670
|
}
|
|
17554
17671
|
var _proto = ParticleBehaviourPlayable.prototype;
|
|
17555
17672
|
_proto.start = function start(context) {
|
|
@@ -17577,8 +17694,12 @@ function randomArrItem(arr, keepArr) {
|
|
|
17577
17694
|
if (this.time < particleSystem.item.duration && particleSystem.isFrozen()) {
|
|
17578
17695
|
particleSystem.reset();
|
|
17579
17696
|
}
|
|
17697
|
+
if (Math.abs(this.time - this.lastTime) < 0.001) {
|
|
17698
|
+
deltaTime = 0;
|
|
17699
|
+
}
|
|
17580
17700
|
particleSystem.onUpdate(deltaTime);
|
|
17581
17701
|
}
|
|
17702
|
+
this.lastTime = this.time;
|
|
17582
17703
|
};
|
|
17583
17704
|
return ParticleBehaviourPlayable;
|
|
17584
17705
|
}(Playable);
|
|
@@ -17991,6 +18112,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
17991
18112
|
_proto.getPointColor = function getPointColor(index) {
|
|
17992
18113
|
var data = this.geometry.getAttributeData("aRot");
|
|
17993
18114
|
var i = index * 32 + 4;
|
|
18115
|
+
assertExist(data);
|
|
17994
18116
|
return [
|
|
17995
18117
|
data[i],
|
|
17996
18118
|
data[i + 1],
|
|
@@ -17998,31 +18120,6 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
17998
18120
|
data[i + 3]
|
|
17999
18121
|
];
|
|
18000
18122
|
};
|
|
18001
|
-
/**
|
|
18002
|
-
* 待废弃
|
|
18003
|
-
* @deprecated - 使用 `particle-system.getPointPosition` 替代
|
|
18004
|
-
*/ _proto.getPointPosition = function getPointPosition(index) {
|
|
18005
|
-
var geo = this.geometry;
|
|
18006
|
-
var posIndex = index * 48;
|
|
18007
|
-
var posData = geo.getAttributeData("aPos");
|
|
18008
|
-
var offsetData = geo.getAttributeData("aOffset");
|
|
18009
|
-
var time = this.time - offsetData[index * 16 + 2];
|
|
18010
|
-
var pointDur = offsetData[index * 16 + 3];
|
|
18011
|
-
var mtl = this.mesh.material;
|
|
18012
|
-
var acc = mtl.getVector4("uAcceleration").toVector3();
|
|
18013
|
-
var pos = Vector3.fromArray(posData, posIndex);
|
|
18014
|
-
var vel = Vector3.fromArray(posData, posIndex + 3);
|
|
18015
|
-
var ret = calculateTranslation(new Vector3(), this, acc, time, pointDur, pos, vel);
|
|
18016
|
-
if (this.forceTarget) {
|
|
18017
|
-
var target = mtl.getVector3("uFinalTarget");
|
|
18018
|
-
var life = this.forceTarget.curve.getValue(time / pointDur);
|
|
18019
|
-
var dl = 1 - life;
|
|
18020
|
-
ret.x = ret.x * dl + target.x * life;
|
|
18021
|
-
ret.y = ret.y * dl + target.y * life;
|
|
18022
|
-
ret.z = ret.z * dl + target.z * life;
|
|
18023
|
-
}
|
|
18024
|
-
return ret;
|
|
18025
|
-
};
|
|
18026
18123
|
_proto.clearPoints = function clearPoints() {
|
|
18027
18124
|
this.resetGeometryData(this.geometry);
|
|
18028
18125
|
this.particleCount = 0;
|
|
@@ -18045,6 +18142,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18045
18142
|
};
|
|
18046
18143
|
_proto.minusTime = function minusTime(time) {
|
|
18047
18144
|
var data = this.geometry.getAttributeData("aOffset");
|
|
18145
|
+
assertExist(data);
|
|
18048
18146
|
for(var i = 0; i < data.length; i += 4){
|
|
18049
18147
|
data[i + 2] -= time;
|
|
18050
18148
|
}
|
|
@@ -18171,6 +18269,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18171
18269
|
var attrSize = geometry.getAttributeStride(name) / Float32Array.BYTES_PER_ELEMENT;
|
|
18172
18270
|
if (increaseBuffer) {
|
|
18173
18271
|
var baseData = geometry.getAttributeData(name);
|
|
18272
|
+
assertExist(baseData);
|
|
18174
18273
|
var geoData = enlargeBuffer(baseData, vertexCount * attrSize, maxCount * 4 * attrSize, inc);
|
|
18175
18274
|
geoData.set(data, data.length * index);
|
|
18176
18275
|
geometry.setAttributeData(name, geoData);
|
|
@@ -18540,12 +18639,8 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
18540
18639
|
// TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
|
|
18541
18640
|
if (item.content.trails) {
|
|
18542
18641
|
var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
|
|
18543
|
-
var _shader_macros;
|
|
18544
|
-
shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, exports.ShaderType.vertex, level);
|
|
18545
|
-
var _shader_macros1;
|
|
18546
|
-
shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, exports.ShaderType.fragment, level);
|
|
18547
18642
|
shader1.glslVersion = level === 2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1;
|
|
18548
|
-
shaderLibrary.addShader(shader1);
|
|
18643
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader1);
|
|
18549
18644
|
}
|
|
18550
18645
|
});
|
|
18551
18646
|
shaders.forEach(function(shader) {
|
|
@@ -18555,15 +18650,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
18555
18650
|
} else {
|
|
18556
18651
|
shader.glslVersion = exports.GLSLVersion.GLSL1;
|
|
18557
18652
|
}
|
|
18558
|
-
|
|
18559
|
-
shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, exports.ShaderType.vertex, level);
|
|
18560
|
-
var _shader_macros1;
|
|
18561
|
-
shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, exports.ShaderType.fragment, level);
|
|
18562
|
-
shaderLibrary.addShader(shader);
|
|
18653
|
+
shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader);
|
|
18563
18654
|
});
|
|
18564
18655
|
if (level === 2) {
|
|
18565
18656
|
items.forEach(function(item) {
|
|
18566
|
-
// @ts-expect-error
|
|
18567
18657
|
item.content.options.meshSlots = [
|
|
18568
18658
|
maxVertexCount,
|
|
18569
18659
|
maxFragmentCount
|
|
@@ -19377,9 +19467,6 @@ function compareTracks(a, b) {
|
|
|
19377
19467
|
_this.startTime = 0;
|
|
19378
19468
|
_this.items = [] // 场景的所有元素
|
|
19379
19469
|
;
|
|
19380
|
-
/**
|
|
19381
|
-
* 合成是否冻结标志位
|
|
19382
|
-
*/ _this.fezzed = false;
|
|
19383
19470
|
_this.reusable = false;
|
|
19384
19471
|
_this.sceneBindings = [];
|
|
19385
19472
|
_this.graph = new PlayableGraph();
|
|
@@ -19804,7 +19891,9 @@ var CanvasPool = /*#__PURE__*/ function() {
|
|
|
19804
19891
|
};
|
|
19805
19892
|
_proto.getCanvas = function getCanvas() {
|
|
19806
19893
|
if (this.elements.length !== 0) {
|
|
19807
|
-
|
|
19894
|
+
var canvas = this.elements.shift();
|
|
19895
|
+
assertExist(canvas);
|
|
19896
|
+
return canvas;
|
|
19808
19897
|
}
|
|
19809
19898
|
if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
|
|
19810
19899
|
return window._createOffscreenCanvas(10, 10);
|
|
@@ -19829,9 +19918,6 @@ var CanvasPool = /*#__PURE__*/ function() {
|
|
|
19829
19918
|
return CanvasPool;
|
|
19830
19919
|
}();
|
|
19831
19920
|
var canvasPool = new CanvasPool();
|
|
19832
|
-
function getDefaultTemplateCanvasPool() {
|
|
19833
|
-
return canvasPool;
|
|
19834
|
-
}
|
|
19835
19921
|
|
|
19836
19922
|
var DEFAULT_FONTS = [
|
|
19837
19923
|
"serif",
|
|
@@ -20253,7 +20339,6 @@ var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
20253
20339
|
return TextLoader;
|
|
20254
20340
|
}(AbstractPlugin);
|
|
20255
20341
|
|
|
20256
|
-
var seed$2 = 1;
|
|
20257
20342
|
exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
20258
20343
|
_inherits(EffectComponent, RendererComponent);
|
|
20259
20344
|
function EffectComponent(engine) {
|
|
@@ -20264,7 +20349,6 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20264
20349
|
*/ _this.worldMatrix = Matrix4.fromIdentity();
|
|
20265
20350
|
_this.triangles = [];
|
|
20266
20351
|
_this.destroyed = false;
|
|
20267
|
-
_this.visible = false;
|
|
20268
20352
|
// TODO 点击测试后续抽象一个 Collider 组件
|
|
20269
20353
|
_this.getHitTestParams = function(force) {
|
|
20270
20354
|
var area = _this.getBoundingBox();
|
|
@@ -20275,18 +20359,11 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20275
20359
|
};
|
|
20276
20360
|
}
|
|
20277
20361
|
};
|
|
20278
|
-
_this.
|
|
20279
|
-
_this.name = "<unnamed>";
|
|
20362
|
+
_this.name = "EffectComponent";
|
|
20280
20363
|
_this._priority = 0;
|
|
20281
20364
|
return _this;
|
|
20282
20365
|
}
|
|
20283
20366
|
var _proto = EffectComponent.prototype;
|
|
20284
|
-
/**
|
|
20285
|
-
* 设置当前 Mesh 的可见性。
|
|
20286
|
-
* @param visible - true:可见,false:不可见
|
|
20287
|
-
*/ _proto.setVisible = function setVisible(visible) {
|
|
20288
|
-
this.visible = visible;
|
|
20289
|
-
};
|
|
20290
20367
|
_proto.start = function start() {
|
|
20291
20368
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20292
20369
|
};
|
|
@@ -20297,16 +20374,6 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20297
20374
|
renderer.drawGeometry(this.geometry, this.material);
|
|
20298
20375
|
};
|
|
20299
20376
|
/**
|
|
20300
|
-
* 获取当前 Mesh 的可见性。
|
|
20301
|
-
*/ _proto.getVisible = function getVisible() {
|
|
20302
|
-
return this.visible;
|
|
20303
|
-
};
|
|
20304
|
-
/**
|
|
20305
|
-
* 获取当前 Mesh 的第一个 geometry。
|
|
20306
|
-
*/ _proto.firstGeometry = function firstGeometry() {
|
|
20307
|
-
return this.geometry;
|
|
20308
|
-
};
|
|
20309
|
-
/**
|
|
20310
20377
|
* 设置当前 Mesh 的材质
|
|
20311
20378
|
* @param material - 要设置的材质
|
|
20312
20379
|
* @param destroy - 可选的材质销毁选项
|
|
@@ -20353,27 +20420,11 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20353
20420
|
* @param options - 可选的销毁选项
|
|
20354
20421
|
*/ _proto.dispose = function dispose(options) {
|
|
20355
20422
|
if (this.destroyed) {
|
|
20356
|
-
//console.error('call mesh.destroy multiple times', this);
|
|
20357
20423
|
return;
|
|
20358
20424
|
}
|
|
20359
|
-
// if (options?.geometries !== DestroyOptions.keep) {
|
|
20360
|
-
// this.geometry.dispose();
|
|
20361
|
-
// }
|
|
20362
|
-
// const materialDestroyOption = options?.material;
|
|
20363
|
-
// if (materialDestroyOption !== DestroyOptions.keep) {
|
|
20364
|
-
// this.material.dispose(materialDestroyOption);
|
|
20365
|
-
// }
|
|
20366
20425
|
this.destroyed = true;
|
|
20367
20426
|
RendererComponent.prototype.dispose.call(this);
|
|
20368
20427
|
};
|
|
20369
|
-
_create_class(EffectComponent, [
|
|
20370
|
-
{
|
|
20371
|
-
key: "isDestroyed",
|
|
20372
|
-
get: function get() {
|
|
20373
|
-
return this.destroyed;
|
|
20374
|
-
}
|
|
20375
|
-
}
|
|
20376
|
-
]);
|
|
20377
20428
|
return EffectComponent;
|
|
20378
20429
|
}(RendererComponent);
|
|
20379
20430
|
__decorate([
|
|
@@ -20383,8 +20434,10 @@ exports.EffectComponent = __decorate([
|
|
|
20383
20434
|
effectsClass(DataType.EffectComponent)
|
|
20384
20435
|
], exports.EffectComponent);
|
|
20385
20436
|
function geometryToTriangles(geometry) {
|
|
20386
|
-
var
|
|
20387
|
-
var
|
|
20437
|
+
var _geometry_getIndexData;
|
|
20438
|
+
var indices = (_geometry_getIndexData = geometry.getIndexData()) != null ? _geometry_getIndexData : [];
|
|
20439
|
+
var _geometry_getAttributeData;
|
|
20440
|
+
var vertices = (_geometry_getAttributeData = geometry.getAttributeData("aPos")) != null ? _geometry_getAttributeData : [];
|
|
20388
20441
|
var res = [];
|
|
20389
20442
|
for(var i = 0; i < indices.length; i += 3){
|
|
20390
20443
|
var index0 = indices[i] * 3;
|
|
@@ -23109,6 +23162,7 @@ function getStandardJSON(json) {
|
|
|
23109
23162
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
23110
23163
|
return version30Migration(version21Migration(getStandardJSONFromV0(json)));
|
|
23111
23164
|
}
|
|
23165
|
+
reverseParticle = false;
|
|
23112
23166
|
var vs = standardVersion.exec(json.version) || [];
|
|
23113
23167
|
var mainVersion = Number(vs[1]);
|
|
23114
23168
|
var minorVersion = Number(vs[2]);
|
|
@@ -23855,7 +23909,6 @@ var seed$1 = 1;
|
|
|
23855
23909
|
return __generator(this, function(_state) {
|
|
23856
23910
|
switch(_state.label){
|
|
23857
23911
|
case 0:
|
|
23858
|
-
// TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
|
|
23859
23912
|
jsonScene = getStandardJSON(json);
|
|
23860
23913
|
_jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
23861
23914
|
pluginSystem = new PluginSystem(plugins);
|
|
@@ -24149,18 +24202,18 @@ var seed$1 = 1;
|
|
|
24149
24202
|
source: source
|
|
24150
24203
|
};
|
|
24151
24204
|
});
|
|
24152
|
-
jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(
|
|
24153
|
-
var e, source, image,
|
|
24205
|
+
jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(textureOptions, idx) {
|
|
24206
|
+
var e, source, image, texture;
|
|
24154
24207
|
return __generator(this, function(_state) {
|
|
24155
24208
|
switch(_state.label){
|
|
24156
24209
|
case 0:
|
|
24157
|
-
if (_instanceof1(
|
|
24210
|
+
if (_instanceof1(textureOptions, Texture)) {
|
|
24158
24211
|
return [
|
|
24159
24212
|
2,
|
|
24160
|
-
|
|
24213
|
+
textureOptions
|
|
24161
24214
|
];
|
|
24162
24215
|
}
|
|
24163
|
-
if (!("mipmaps" in
|
|
24216
|
+
if (!("mipmaps" in textureOptions)) return [
|
|
24164
24217
|
3,
|
|
24165
24218
|
4
|
|
24166
24219
|
];
|
|
@@ -24174,7 +24227,7 @@ var seed$1 = 1;
|
|
|
24174
24227
|
]);
|
|
24175
24228
|
return [
|
|
24176
24229
|
4,
|
|
24177
|
-
deserializeMipmapTexture(
|
|
24230
|
+
deserializeMipmapTexture(textureOptions, bins, engine, jsonScene.bins)
|
|
24178
24231
|
];
|
|
24179
24232
|
case 2:
|
|
24180
24233
|
return [
|
|
@@ -24185,12 +24238,11 @@ var seed$1 = 1;
|
|
|
24185
24238
|
e = _state.sent();
|
|
24186
24239
|
throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
|
|
24187
24240
|
case 4:
|
|
24188
|
-
source =
|
|
24241
|
+
source = textureOptions.source;
|
|
24189
24242
|
if (!isObject(source)) return [
|
|
24190
24243
|
3,
|
|
24191
24244
|
5
|
|
24192
24245
|
];
|
|
24193
|
-
//@ts-expect-error
|
|
24194
24246
|
image = engine.assetLoader.loadGUID(source.id).data;
|
|
24195
24247
|
return [
|
|
24196
24248
|
3,
|
|
@@ -24210,12 +24262,12 @@ var seed$1 = 1;
|
|
|
24210
24262
|
_state.label = 7;
|
|
24211
24263
|
case 7:
|
|
24212
24264
|
if (image) {
|
|
24213
|
-
|
|
24214
|
-
|
|
24215
|
-
|
|
24265
|
+
texture = createTextureOptionsBySource(image, _this.assets[idx]);
|
|
24266
|
+
texture.id = textureOptions.id;
|
|
24267
|
+
texture.dataType = DataType.Texture;
|
|
24216
24268
|
return [
|
|
24217
24269
|
2,
|
|
24218
|
-
|
|
24270
|
+
texture.sourceType === exports.TextureSourceType.compressed ? texture : _extends({}, texture, textureOptions)
|
|
24219
24271
|
];
|
|
24220
24272
|
}
|
|
24221
24273
|
throw new Error("Invalid texture source: " + source + ".");
|
|
@@ -25047,28 +25099,6 @@ var listOrder = 0;
|
|
|
25047
25099
|
}
|
|
25048
25100
|
};
|
|
25049
25101
|
/**
|
|
25050
|
-
* 是否合成需要重新播放
|
|
25051
|
-
* @returns 重新播放合成标志位
|
|
25052
|
-
*/ _proto.shouldRestart = function shouldRestart() {
|
|
25053
|
-
var _this_rootItem = this.rootItem, duration = _this_rootItem.duration, endBehavior = _this_rootItem.endBehavior;
|
|
25054
|
-
var time = this.rootComposition.time;
|
|
25055
|
-
return endBehavior === EndBehavior.restart && duration - time < 0.02;
|
|
25056
|
-
};
|
|
25057
|
-
/**
|
|
25058
|
-
* 是否合成需要销毁
|
|
25059
|
-
* @returns 销毁合成标志位
|
|
25060
|
-
*/ _proto.shouldDispose = function shouldDispose() {
|
|
25061
|
-
if (this.reusable) {
|
|
25062
|
-
return false;
|
|
25063
|
-
}
|
|
25064
|
-
var endBehavior = this.rootItem.endBehavior;
|
|
25065
|
-
if (this.rootItem.isEnded(this.time)) {
|
|
25066
|
-
this.rootItem.ended = true;
|
|
25067
|
-
}
|
|
25068
|
-
// TODO: 合成结束行为
|
|
25069
|
-
return this.rootItem.ended && endBehavior === EndBehavior.destroy;
|
|
25070
|
-
};
|
|
25071
|
-
/**
|
|
25072
25102
|
* 合成更新,针对所有 item 的更新
|
|
25073
25103
|
* @param deltaTime - 更新的时间步长
|
|
25074
25104
|
* @param skipRender - 是否需要渲染
|
|
@@ -25079,49 +25109,56 @@ var listOrder = 0;
|
|
|
25079
25109
|
var time = this.getUpdateTime(deltaTime * this.speed);
|
|
25080
25110
|
this.globalTime += time;
|
|
25081
25111
|
this.updateRootComposition();
|
|
25082
|
-
if (this.shouldRestart()) {
|
|
25083
|
-
this.emit("end", {
|
|
25084
|
-
composition: this
|
|
25085
|
-
});
|
|
25086
|
-
this.restart();
|
|
25087
|
-
// restart then tick to avoid flicker
|
|
25088
|
-
}
|
|
25089
25112
|
this.updateVideo();
|
|
25090
25113
|
// 更新 model-tree-plugin
|
|
25091
25114
|
this.updatePluginLoaders(deltaTime);
|
|
25115
|
+
// scene VFXItem components lifetime function.
|
|
25092
25116
|
this.callStart(this.rootItem);
|
|
25093
25117
|
this.callUpdate(this.rootItem, time);
|
|
25094
25118
|
this.callLateUpdate(this.rootItem, time);
|
|
25095
25119
|
this.updateCamera();
|
|
25120
|
+
this.prepareRender();
|
|
25096
25121
|
if (this.shouldDispose()) {
|
|
25097
|
-
this.emit("end", {
|
|
25098
|
-
composition: this
|
|
25099
|
-
});
|
|
25100
25122
|
this.dispose();
|
|
25101
|
-
} else {
|
|
25102
|
-
this.prepareRender();
|
|
25103
25123
|
}
|
|
25104
25124
|
};
|
|
25105
25125
|
_proto.toLocalTime = function toLocalTime(time) {
|
|
25106
25126
|
var localTime = time - this.rootItem.start;
|
|
25107
25127
|
var duration = this.rootItem.duration;
|
|
25108
25128
|
if (localTime - duration > 0.001) {
|
|
25109
|
-
if (this.rootItem.
|
|
25110
|
-
|
|
25111
|
-
|
|
25112
|
-
|
|
25113
|
-
|
|
25114
|
-
|
|
25115
|
-
|
|
25116
|
-
|
|
25117
|
-
|
|
25118
|
-
|
|
25129
|
+
if (!this.rootItem.ended) {
|
|
25130
|
+
this.rootItem.ended = true;
|
|
25131
|
+
this.emit("end", {
|
|
25132
|
+
composition: this
|
|
25133
|
+
});
|
|
25134
|
+
}
|
|
25135
|
+
switch(this.rootItem.endBehavior){
|
|
25136
|
+
case EndBehavior.restart:
|
|
25137
|
+
{
|
|
25138
|
+
localTime = localTime % duration;
|
|
25139
|
+
this.restart();
|
|
25140
|
+
break;
|
|
25141
|
+
}
|
|
25142
|
+
case EndBehavior.freeze:
|
|
25143
|
+
{
|
|
25144
|
+
localTime = Math.min(duration, localTime);
|
|
25145
|
+
break;
|
|
25146
|
+
}
|
|
25147
|
+
case EndBehavior.forward:
|
|
25148
|
+
{
|
|
25149
|
+
break;
|
|
25150
|
+
}
|
|
25151
|
+
case EndBehavior.destroy:
|
|
25152
|
+
{
|
|
25153
|
+
break;
|
|
25119
25154
|
}
|
|
25120
|
-
}
|
|
25121
25155
|
}
|
|
25122
25156
|
}
|
|
25123
25157
|
return localTime;
|
|
25124
25158
|
};
|
|
25159
|
+
_proto.shouldDispose = function shouldDispose() {
|
|
25160
|
+
return this.rootItem.ended && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
25161
|
+
};
|
|
25125
25162
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
25126
25163
|
var startTimeInMs = this.startTime * 1000;
|
|
25127
25164
|
var now = this.rootComposition.time * 1000;
|
|
@@ -25452,7 +25489,9 @@ var listOrder = 0;
|
|
|
25452
25489
|
(_this_rendererOptions = this.rendererOptions) == null ? void 0 : _this_rendererOptions.emptyTexture.dispose();
|
|
25453
25490
|
(_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
|
|
25454
25491
|
this.update = function() {
|
|
25455
|
-
|
|
25492
|
+
{
|
|
25493
|
+
logger.error("Update disposed composition: " + _this.name + ".");
|
|
25494
|
+
}
|
|
25456
25495
|
};
|
|
25457
25496
|
this.dispose = noop;
|
|
25458
25497
|
if (textures && this.keepResource) {
|
|
@@ -27615,7 +27654,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
27615
27654
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
27616
27655
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
27617
27656
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
27618
|
-
var version$1 = "2.0.0-alpha.
|
|
27657
|
+
var version$1 = "2.0.0-alpha.34";
|
|
27619
27658
|
logger.info("Core version: " + version$1 + ".");
|
|
27620
27659
|
|
|
27621
27660
|
var _obj;
|
|
@@ -27690,11 +27729,12 @@ var _obj3;
|
|
|
27690
27729
|
var shader = props == null ? void 0 : props.shader;
|
|
27691
27730
|
var level = engine.gpuCapability.level;
|
|
27692
27731
|
_this.shader = new exports.Shader(engine);
|
|
27732
|
+
var _shader_vertex, _shader_fragment;
|
|
27693
27733
|
_this.shader.shaderData = _extends({}, shader, {
|
|
27694
27734
|
id: generateGUID(),
|
|
27695
27735
|
dataType: DataType.Shader,
|
|
27696
|
-
vertex: (shader == null ? void 0 : shader.vertex)
|
|
27697
|
-
fragment: (shader == null ? void 0 : shader.fragment)
|
|
27736
|
+
vertex: (_shader_vertex = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex : "",
|
|
27737
|
+
fragment: (_shader_fragment = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment : ""
|
|
27698
27738
|
});
|
|
27699
27739
|
for(var i = 0; i < exports.maxSpriteMeshItemCount; i++){
|
|
27700
27740
|
_this.uniforms["uSampler" + i] = new THREE__namespace.Uniform(null);
|
|
@@ -27760,9 +27800,22 @@ var _obj3;
|
|
|
27760
27800
|
8,
|
|
27761
27801
|
1
|
|
27762
27802
|
]);
|
|
27803
|
+
var _shader_vertex1, _shader_fragment1;
|
|
27763
27804
|
_this.material = new THREE__namespace.RawShaderMaterial({
|
|
27764
|
-
vertexShader:
|
|
27765
|
-
|
|
27805
|
+
vertexShader: ShaderFactory.genFinalShaderCode({
|
|
27806
|
+
level: _this.engine.gpuCapability.level,
|
|
27807
|
+
shaderType: exports.ShaderType.vertex,
|
|
27808
|
+
shader: (_shader_vertex1 = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex1 : "",
|
|
27809
|
+
macros: shader == null ? void 0 : shader.macros,
|
|
27810
|
+
removeVersion: true
|
|
27811
|
+
}),
|
|
27812
|
+
fragmentShader: ShaderFactory.genFinalShaderCode({
|
|
27813
|
+
level: _this.engine.gpuCapability.level,
|
|
27814
|
+
shaderType: exports.ShaderType.fragment,
|
|
27815
|
+
shader: (_shader_fragment1 = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment1 : "",
|
|
27816
|
+
macros: shader == null ? void 0 : shader.macros,
|
|
27817
|
+
removeVersion: true
|
|
27818
|
+
}),
|
|
27766
27819
|
alphaToCoverage: false,
|
|
27767
27820
|
depthFunc: THREE__namespace.LessDepth,
|
|
27768
27821
|
polygonOffsetFactor: THREE__namespace.ZeroFactor,
|
|
@@ -29282,7 +29335,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
29282
29335
|
*/ Mesh.create = function(engine, props) {
|
|
29283
29336
|
return new ThreeMesh(engine, props);
|
|
29284
29337
|
};
|
|
29285
|
-
var version = "2.0.0-alpha.
|
|
29338
|
+
var version = "2.0.0-alpha.34";
|
|
29286
29339
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
29287
29340
|
|
|
29288
29341
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -29371,6 +29424,7 @@ exports.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0 = SEMANTIC_PRE_COLOR_ATTACHMENT_SIZ
|
|
|
29371
29424
|
exports.SPRITE_VERTEX_STRIDE = SPRITE_VERTEX_STRIDE;
|
|
29372
29425
|
exports.SemanticMap = SemanticMap;
|
|
29373
29426
|
exports.SerializationHelper = SerializationHelper;
|
|
29427
|
+
exports.ShaderFactory = ShaderFactory;
|
|
29374
29428
|
exports.ShaderVariant = ShaderVariant;
|
|
29375
29429
|
exports.SpriteColorPlayable = SpriteColorPlayable;
|
|
29376
29430
|
exports.SpriteLoader = SpriteLoader;
|
|
@@ -29409,12 +29463,9 @@ exports.colorGradingFrag = colorGradingFrag;
|
|
|
29409
29463
|
exports.colorStopsFromGradient = colorStopsFromGradient;
|
|
29410
29464
|
exports.colorToArr = colorToArr$1;
|
|
29411
29465
|
exports.combineImageTemplate = combineImageTemplate;
|
|
29412
|
-
exports.compatibleFrag = compatible_frag;
|
|
29413
|
-
exports.compatibleVert = compatible_vert;
|
|
29414
29466
|
exports.createCopyShader = createCopyShader;
|
|
29415
29467
|
exports.createGLContext = createGLContext;
|
|
29416
29468
|
exports.createKeyFrameMeta = createKeyFrameMeta;
|
|
29417
|
-
exports.createShaderWithMacros = createShaderWithMacros;
|
|
29418
29469
|
exports.createShape = createShape;
|
|
29419
29470
|
exports.createValueGetter = createValueGetter;
|
|
29420
29471
|
exports.decimalEqual = decimalEqual;
|
|
@@ -29440,7 +29491,6 @@ exports.generateWhiteTexture = generateWhiteTexture;
|
|
|
29440
29491
|
exports.getBackgroundImage = getBackgroundImage;
|
|
29441
29492
|
exports.getColorFromGradientStops = getColorFromGradientStops;
|
|
29442
29493
|
exports.getConfig = getConfig;
|
|
29443
|
-
exports.getDefaultTemplateCanvasPool = getDefaultTemplateCanvasPool;
|
|
29444
29494
|
exports.getDefaultTextureFactory = getDefaultTextureFactory;
|
|
29445
29495
|
exports.getGeometryByShape = getGeometryByShape;
|
|
29446
29496
|
exports.getGeometryTriangles = getGeometryTriangles;
|
|
@@ -29507,7 +29557,6 @@ exports.particleOriginTranslateMap = particleOriginTranslateMap$1;
|
|
|
29507
29557
|
exports.particleUniformTypeMap = particleUniformTypeMap;
|
|
29508
29558
|
exports.particleVert = particleVert;
|
|
29509
29559
|
exports.pluginLoaderMap = pluginLoaderMap;
|
|
29510
|
-
exports.pointOnLine = pointOnLine;
|
|
29511
29560
|
exports.randomInRange = randomInRange;
|
|
29512
29561
|
exports.registerPlugin = registerPlugin;
|
|
29513
29562
|
exports.removeItem = removeItem;
|
|
@@ -29537,10 +29586,8 @@ exports.unregisterPlugin = unregisterPlugin;
|
|
|
29537
29586
|
exports.valIfUndefined = valIfUndefined;
|
|
29538
29587
|
exports.value = value;
|
|
29539
29588
|
exports.valueDefine = valueDefine;
|
|
29540
|
-
exports.vecAssign = vecAssign;
|
|
29541
29589
|
exports.vecFill = vecFill;
|
|
29542
29590
|
exports.vecMulCombine = vecMulCombine;
|
|
29543
|
-
exports.vecNormalize = vecNormalize;
|
|
29544
29591
|
exports.version = version;
|
|
29545
29592
|
exports.vertexFormatType2GLType = vertexFormatType2GLType;
|
|
29546
29593
|
//# sourceMappingURL=index.js.map
|