@galacean/engine-core 1.1.0-beta.24 → 1.1.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +101 -16
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +101 -16
- package/dist/module.js +101 -16
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/particle/modules/ParticleGradient.d.ts +38 -18
package/dist/miniprogram.js
CHANGED
|
@@ -5029,7 +5029,7 @@ var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"
|
|
|
5029
5029
|
|
|
5030
5030
|
var blendShape_input = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nuniform mediump sampler2DArray renderer_BlendShapeTexture;uniform ivec3 renderer_BlendShapeTextureInfo;uniform float renderer_BlendShapeWeights[RENDERER_BLENDSHAPE_COUNT];\n#else\nattribute vec3 POSITION_BS0;attribute vec3 POSITION_BS1;\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;uniform float renderer_BlendShapeWeights[2];\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;\n#ifdef RENDERER_BLENDSHAPE_HAS_NORMAL\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 NORMAL_BS2;attribute vec3 NORMAL_BS3;\n#endif\n#ifdef RENDERER_BLENDSHAPE_HAS_TANGENT\nattribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;attribute vec3 TANGENT_BS2;attribute vec3 TANGENT_BS3;\n#endif\nuniform float renderer_BlendShapeWeights[4];\n#else\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;attribute vec3 POSITION_BS4;attribute vec3 POSITION_BS5;attribute vec3 POSITION_BS6;attribute vec3 POSITION_BS7;uniform float renderer_BlendShapeWeights[8];\n#endif\n#endif\n#endif\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nvec3 getBlendShapeVertexElement(int blendShapeIndex,int vertexElementIndex){int y=vertexElementIndex/renderer_BlendShapeTextureInfo.y;int x=vertexElementIndex-y*renderer_BlendShapeTextureInfo.y;ivec3 uv=ivec3(x,y,blendShapeIndex);return texelFetch(renderer_BlendShapeTexture,uv,0).xyz;}\n#endif\n#endif\n"; // eslint-disable-line
|
|
5031
5031
|
|
|
5032
|
-
var blendShape_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nint vertexOffset=gl_VertexID*renderer_BlendShapeTextureInfo.x;for(int i=0;i<RENDERER_BLENDSHAPE_COUNT;i++){int vertexElementOffset=vertexOffset;float weight=renderer_BlendShapeWeights[i];position.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#ifndef MATERIAL_OMIT_NORMAL\n#if defined( RENDERER_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_NORMAL )\nvertexElementOffset+=1;normal+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvertexElementOffset+=1;tangent.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#endif\n}\n#else\nposition.xyz+=POSITION_BS0*renderer_BlendShapeWeights[0];position.xyz+=POSITION_BS1*renderer_BlendShapeWeights[1];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];\n#endif\n#endif\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_HAS_NORMAL )\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];normal+=NORMAL_BS2*renderer_BlendShapeWeights[2];normal+=NORMAL_BS3*renderer_BlendShapeWeights[3];\n#endif\n#if defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];tangent.xyz+=TANGENT_BS2*renderer_BlendShapeWeights[2];tangent.xyz+=TANGENT_BS3*renderer_BlendShapeWeights[3];\n#endif\n#endif\n#else\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];position.xyz+=POSITION_BS4*renderer_BlendShapeWeights[4];position.xyz+=POSITION_BS5*renderer_BlendShapeWeights[5];position.xyz+=POSITION_BS6*renderer_BlendShapeWeights[6];position.xyz+=POSITION_BS7*renderer_BlendShapeWeights[7];\n#endif\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
5032
|
+
var blendShape_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nint vertexOffset=gl_VertexID*renderer_BlendShapeTextureInfo.x;for(int i=0;i<RENDERER_BLENDSHAPE_COUNT;i++){int vertexElementOffset=vertexOffset;float weight=renderer_BlendShapeWeights[i];if(weight!=0.0){position.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#ifndef MATERIAL_OMIT_NORMAL\n#if defined( RENDERER_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_NORMAL )\nvertexElementOffset+=1;normal+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvertexElementOffset+=1;tangent.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#endif\n}}\n#else\nposition.xyz+=POSITION_BS0*renderer_BlendShapeWeights[0];position.xyz+=POSITION_BS1*renderer_BlendShapeWeights[1];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];\n#endif\n#endif\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_HAS_NORMAL )\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];normal+=NORMAL_BS2*renderer_BlendShapeWeights[2];normal+=NORMAL_BS3*renderer_BlendShapeWeights[3];\n#endif\n#if defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];tangent.xyz+=TANGENT_BS2*renderer_BlendShapeWeights[2];tangent.xyz+=TANGENT_BS3*renderer_BlendShapeWeights[3];\n#endif\n#endif\n#else\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];position.xyz+=POSITION_BS4*renderer_BlendShapeWeights[4];position.xyz+=POSITION_BS5*renderer_BlendShapeWeights[5];position.xyz+=POSITION_BS6*renderer_BlendShapeWeights[6];position.xyz+=POSITION_BS7*renderer_BlendShapeWeights[7];\n#endif\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
5033
5033
|
|
|
5034
5034
|
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
5035
5035
|
|
|
@@ -6697,6 +6697,9 @@ __decorate([
|
|
|
6697
6697
|
throw "ShaderLab has not been set up yet.";
|
|
6698
6698
|
}
|
|
6699
6699
|
var shaderInfo = Shader._shaderLab.parseShader(nameOrShaderSource);
|
|
6700
|
+
if (shaderMap[shaderInfo.name]) {
|
|
6701
|
+
throw 'Shader named "' + shaderInfo.name + '" already exists.';
|
|
6702
|
+
}
|
|
6700
6703
|
var subShaderList = shaderInfo.subShaders.map(function(subShaderInfo) {
|
|
6701
6704
|
var passList = subShaderInfo.passes.map(function(passInfo) {
|
|
6702
6705
|
if (typeof passInfo === "string") {
|
|
@@ -27685,15 +27688,17 @@ __decorate([
|
|
|
27685
27688
|
throw new Error("Gradient can only have 4 color keys");
|
|
27686
27689
|
}
|
|
27687
27690
|
var key = typeof timeOrKey === "number" ? new GradientColorKey(timeOrKey, color) : timeOrKey;
|
|
27691
|
+
key._onValueChanged = this._setColorTypeArrayDirty.bind(this);
|
|
27688
27692
|
this._addKey(colorKeys, key);
|
|
27689
27693
|
this._colorTypeArrayDirty = true;
|
|
27690
27694
|
};
|
|
27691
27695
|
_proto.addAlphaKey = function addAlphaKey(timeOrKey, alpha) {
|
|
27692
27696
|
var alphaKeys = this._alphaKeys;
|
|
27693
27697
|
if (alphaKeys.length === 4) {
|
|
27694
|
-
throw new Error("Gradient can only have 4
|
|
27698
|
+
throw new Error("Gradient can only have 4 alpha keys");
|
|
27695
27699
|
}
|
|
27696
27700
|
var key = typeof timeOrKey === "number" ? new GradientAlphaKey(timeOrKey, alpha) : timeOrKey;
|
|
27701
|
+
key._onValueChanged = this._setAlphaTypeArrayDirty.bind(this);
|
|
27697
27702
|
this._addKey(alphaKeys, key);
|
|
27698
27703
|
this._alphaTypeArrayDirty = true;
|
|
27699
27704
|
};
|
|
@@ -27701,6 +27706,7 @@ __decorate([
|
|
|
27701
27706
|
* Remove a color key from the gradient.
|
|
27702
27707
|
* @param index - The remove color key index
|
|
27703
27708
|
*/ _proto.removeColorKey = function removeColorKey(index) {
|
|
27709
|
+
this._colorKeys[index]._onValueChanged = null;
|
|
27704
27710
|
this._removeKey(this._colorKeys, index);
|
|
27705
27711
|
this._colorTypeArrayDirty = true;
|
|
27706
27712
|
};
|
|
@@ -27708,6 +27714,7 @@ __decorate([
|
|
|
27708
27714
|
* Remove an alpha key from the gradient.
|
|
27709
27715
|
* @param index - The remove alpha key index
|
|
27710
27716
|
*/ _proto.removeAlphaKey = function removeAlphaKey(index) {
|
|
27717
|
+
this._alphaKeys[index]._onValueChanged = null;
|
|
27711
27718
|
this._removeKey(this._alphaKeys, index);
|
|
27712
27719
|
this._alphaTypeArrayDirty = true;
|
|
27713
27720
|
};
|
|
@@ -27716,13 +27723,21 @@ __decorate([
|
|
|
27716
27723
|
* @param colorKeys - The color keys
|
|
27717
27724
|
* @param alphaKeys - The alpha keys
|
|
27718
27725
|
*/ _proto.setKeys = function setKeys(colorKeys, alphaKeys) {
|
|
27719
|
-
|
|
27720
|
-
|
|
27721
|
-
for(var i = 0, n =
|
|
27722
|
-
|
|
27726
|
+
var currentColorKeys = this._colorKeys;
|
|
27727
|
+
var currentAlphaKeys = this._alphaKeys;
|
|
27728
|
+
for(var i = 0, n = currentColorKeys.length; i < n; i++){
|
|
27729
|
+
currentColorKeys[i]._onValueChanged = null;
|
|
27730
|
+
}
|
|
27731
|
+
for(var i1 = 0, n1 = currentAlphaKeys.length; i1 < n1; i1++){
|
|
27732
|
+
currentAlphaKeys[i1]._onValueChanged = null;
|
|
27733
|
+
}
|
|
27734
|
+
currentColorKeys.length = 0;
|
|
27735
|
+
currentAlphaKeys.length = 0;
|
|
27736
|
+
for(var i2 = 0, n2 = colorKeys.length; i2 < n2; i2++){
|
|
27737
|
+
this._addKey(currentColorKeys, colorKeys[i2]);
|
|
27723
27738
|
}
|
|
27724
|
-
for(var
|
|
27725
|
-
this._addKey(
|
|
27739
|
+
for(var i3 = 0, n3 = alphaKeys.length; i3 < n3; i3++){
|
|
27740
|
+
this._addKey(currentAlphaKeys, alphaKeys[i3]);
|
|
27726
27741
|
}
|
|
27727
27742
|
this._alphaTypeArrayDirty = true;
|
|
27728
27743
|
this._colorTypeArrayDirty = true;
|
|
@@ -27783,6 +27798,12 @@ __decorate([
|
|
|
27783
27798
|
_proto._removeKey = function _removeKey(keys, index) {
|
|
27784
27799
|
keys.splice(index, 1);
|
|
27785
27800
|
};
|
|
27801
|
+
_proto._setColorTypeArrayDirty = function _setColorTypeArrayDirty() {
|
|
27802
|
+
this._colorTypeArrayDirty = true;
|
|
27803
|
+
};
|
|
27804
|
+
_proto._setAlphaTypeArrayDirty = function _setAlphaTypeArrayDirty() {
|
|
27805
|
+
this._alphaTypeArrayDirty = true;
|
|
27806
|
+
};
|
|
27786
27807
|
_create_class(ParticleGradient, [
|
|
27787
27808
|
{
|
|
27788
27809
|
key: "colorKeys",
|
|
@@ -27817,16 +27838,80 @@ __decorate([
|
|
|
27817
27838
|
], ParticleGradient.prototype, "_alphaTypeArray", void 0);
|
|
27818
27839
|
/**
|
|
27819
27840
|
* The color key of the particle gradient.
|
|
27820
|
-
*/ var GradientColorKey = function
|
|
27821
|
-
|
|
27822
|
-
|
|
27823
|
-
|
|
27841
|
+
*/ var GradientColorKey = /*#__PURE__*/ function() {
|
|
27842
|
+
function GradientColorKey(time, color) {
|
|
27843
|
+
/** @internal */ this._onValueChanged = null;
|
|
27844
|
+
this._color = new miniprogram.Color();
|
|
27845
|
+
this._time = time;
|
|
27846
|
+
color && this._color.copyFrom(color);
|
|
27847
|
+
// @ts-ignore
|
|
27848
|
+
this._color._onValueChanged = this._onValueChanged;
|
|
27849
|
+
}
|
|
27850
|
+
_create_class(GradientColorKey, [
|
|
27851
|
+
{
|
|
27852
|
+
key: "time",
|
|
27853
|
+
get: /**
|
|
27854
|
+
* The key time.
|
|
27855
|
+
*/ function get() {
|
|
27856
|
+
return this._time;
|
|
27857
|
+
},
|
|
27858
|
+
set: function set(value) {
|
|
27859
|
+
this._time = value;
|
|
27860
|
+
this._onValueChanged && this._onValueChanged();
|
|
27861
|
+
}
|
|
27862
|
+
},
|
|
27863
|
+
{
|
|
27864
|
+
key: "color",
|
|
27865
|
+
get: /**
|
|
27866
|
+
* The key color.
|
|
27867
|
+
*/ function get() {
|
|
27868
|
+
return this._color;
|
|
27869
|
+
},
|
|
27870
|
+
set: function set(value) {
|
|
27871
|
+
if (this._color !== value) {
|
|
27872
|
+
this._color.copyFrom(value);
|
|
27873
|
+
}
|
|
27874
|
+
}
|
|
27875
|
+
}
|
|
27876
|
+
]);
|
|
27877
|
+
return GradientColorKey;
|
|
27878
|
+
}();
|
|
27824
27879
|
/**
|
|
27825
27880
|
* The alpha key of the particle gradient.
|
|
27826
|
-
*/ var GradientAlphaKey = function
|
|
27827
|
-
|
|
27828
|
-
|
|
27829
|
-
|
|
27881
|
+
*/ var GradientAlphaKey = /*#__PURE__*/ function() {
|
|
27882
|
+
function GradientAlphaKey(time, alpha) {
|
|
27883
|
+
/** @internal */ this._onValueChanged = null;
|
|
27884
|
+
this._time = time;
|
|
27885
|
+
this._alpha = alpha;
|
|
27886
|
+
}
|
|
27887
|
+
_create_class(GradientAlphaKey, [
|
|
27888
|
+
{
|
|
27889
|
+
key: "time",
|
|
27890
|
+
get: /**
|
|
27891
|
+
* The key time.
|
|
27892
|
+
*/ function get() {
|
|
27893
|
+
return this._time;
|
|
27894
|
+
},
|
|
27895
|
+
set: function set(value) {
|
|
27896
|
+
this._time = value;
|
|
27897
|
+
this._onValueChanged && this._onValueChanged();
|
|
27898
|
+
}
|
|
27899
|
+
},
|
|
27900
|
+
{
|
|
27901
|
+
key: "alpha",
|
|
27902
|
+
get: /**
|
|
27903
|
+
* The key alpha.
|
|
27904
|
+
*/ function get() {
|
|
27905
|
+
return this._alpha;
|
|
27906
|
+
},
|
|
27907
|
+
set: function set(value) {
|
|
27908
|
+
this._alpha = value;
|
|
27909
|
+
this._onValueChanged && this._onValueChanged();
|
|
27910
|
+
}
|
|
27911
|
+
}
|
|
27912
|
+
]);
|
|
27913
|
+
return GradientAlphaKey;
|
|
27914
|
+
}();
|
|
27830
27915
|
|
|
27831
27916
|
/**
|
|
27832
27917
|
* Particle composite gradient.
|
package/dist/module.js
CHANGED
|
@@ -5024,7 +5024,7 @@ var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"
|
|
|
5024
5024
|
|
|
5025
5025
|
var blendShape_input = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nuniform mediump sampler2DArray renderer_BlendShapeTexture;uniform ivec3 renderer_BlendShapeTextureInfo;uniform float renderer_BlendShapeWeights[RENDERER_BLENDSHAPE_COUNT];\n#else\nattribute vec3 POSITION_BS0;attribute vec3 POSITION_BS1;\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;uniform float renderer_BlendShapeWeights[2];\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;\n#ifdef RENDERER_BLENDSHAPE_HAS_NORMAL\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 NORMAL_BS2;attribute vec3 NORMAL_BS3;\n#endif\n#ifdef RENDERER_BLENDSHAPE_HAS_TANGENT\nattribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;attribute vec3 TANGENT_BS2;attribute vec3 TANGENT_BS3;\n#endif\nuniform float renderer_BlendShapeWeights[4];\n#else\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;attribute vec3 POSITION_BS4;attribute vec3 POSITION_BS5;attribute vec3 POSITION_BS6;attribute vec3 POSITION_BS7;uniform float renderer_BlendShapeWeights[8];\n#endif\n#endif\n#endif\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nvec3 getBlendShapeVertexElement(int blendShapeIndex,int vertexElementIndex){int y=vertexElementIndex/renderer_BlendShapeTextureInfo.y;int x=vertexElementIndex-y*renderer_BlendShapeTextureInfo.y;ivec3 uv=ivec3(x,y,blendShapeIndex);return texelFetch(renderer_BlendShapeTexture,uv,0).xyz;}\n#endif\n#endif\n"; // eslint-disable-line
|
|
5026
5026
|
|
|
5027
|
-
var blendShape_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nint vertexOffset=gl_VertexID*renderer_BlendShapeTextureInfo.x;for(int i=0;i<RENDERER_BLENDSHAPE_COUNT;i++){int vertexElementOffset=vertexOffset;float weight=renderer_BlendShapeWeights[i];position.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#ifndef MATERIAL_OMIT_NORMAL\n#if defined( RENDERER_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_NORMAL )\nvertexElementOffset+=1;normal+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvertexElementOffset+=1;tangent.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#endif\n}\n#else\nposition.xyz+=POSITION_BS0*renderer_BlendShapeWeights[0];position.xyz+=POSITION_BS1*renderer_BlendShapeWeights[1];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];\n#endif\n#endif\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_HAS_NORMAL )\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];normal+=NORMAL_BS2*renderer_BlendShapeWeights[2];normal+=NORMAL_BS3*renderer_BlendShapeWeights[3];\n#endif\n#if defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];tangent.xyz+=TANGENT_BS2*renderer_BlendShapeWeights[2];tangent.xyz+=TANGENT_BS3*renderer_BlendShapeWeights[3];\n#endif\n#endif\n#else\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];position.xyz+=POSITION_BS4*renderer_BlendShapeWeights[4];position.xyz+=POSITION_BS5*renderer_BlendShapeWeights[5];position.xyz+=POSITION_BS6*renderer_BlendShapeWeights[6];position.xyz+=POSITION_BS7*renderer_BlendShapeWeights[7];\n#endif\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
5027
|
+
var blendShape_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nint vertexOffset=gl_VertexID*renderer_BlendShapeTextureInfo.x;for(int i=0;i<RENDERER_BLENDSHAPE_COUNT;i++){int vertexElementOffset=vertexOffset;float weight=renderer_BlendShapeWeights[i];if(weight!=0.0){position.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#ifndef MATERIAL_OMIT_NORMAL\n#if defined( RENDERER_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_NORMAL )\nvertexElementOffset+=1;normal+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvertexElementOffset+=1;tangent.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#endif\n}}\n#else\nposition.xyz+=POSITION_BS0*renderer_BlendShapeWeights[0];position.xyz+=POSITION_BS1*renderer_BlendShapeWeights[1];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];\n#endif\n#endif\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_HAS_NORMAL )\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];normal+=NORMAL_BS2*renderer_BlendShapeWeights[2];normal+=NORMAL_BS3*renderer_BlendShapeWeights[3];\n#endif\n#if defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];tangent.xyz+=TANGENT_BS2*renderer_BlendShapeWeights[2];tangent.xyz+=TANGENT_BS3*renderer_BlendShapeWeights[3];\n#endif\n#endif\n#else\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];position.xyz+=POSITION_BS4*renderer_BlendShapeWeights[4];position.xyz+=POSITION_BS5*renderer_BlendShapeWeights[5];position.xyz+=POSITION_BS6*renderer_BlendShapeWeights[6];position.xyz+=POSITION_BS7*renderer_BlendShapeWeights[7];\n#endif\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
5028
5028
|
|
|
5029
5029
|
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
5030
5030
|
|
|
@@ -6692,6 +6692,9 @@ __decorate([
|
|
|
6692
6692
|
throw "ShaderLab has not been set up yet.";
|
|
6693
6693
|
}
|
|
6694
6694
|
var shaderInfo = Shader._shaderLab.parseShader(nameOrShaderSource);
|
|
6695
|
+
if (shaderMap[shaderInfo.name]) {
|
|
6696
|
+
throw 'Shader named "' + shaderInfo.name + '" already exists.';
|
|
6697
|
+
}
|
|
6695
6698
|
var subShaderList = shaderInfo.subShaders.map(function(subShaderInfo) {
|
|
6696
6699
|
var passList = subShaderInfo.passes.map(function(passInfo) {
|
|
6697
6700
|
if (typeof passInfo === "string") {
|
|
@@ -27680,15 +27683,17 @@ __decorate([
|
|
|
27680
27683
|
throw new Error("Gradient can only have 4 color keys");
|
|
27681
27684
|
}
|
|
27682
27685
|
var key = typeof timeOrKey === "number" ? new GradientColorKey(timeOrKey, color) : timeOrKey;
|
|
27686
|
+
key._onValueChanged = this._setColorTypeArrayDirty.bind(this);
|
|
27683
27687
|
this._addKey(colorKeys, key);
|
|
27684
27688
|
this._colorTypeArrayDirty = true;
|
|
27685
27689
|
};
|
|
27686
27690
|
_proto.addAlphaKey = function addAlphaKey(timeOrKey, alpha) {
|
|
27687
27691
|
var alphaKeys = this._alphaKeys;
|
|
27688
27692
|
if (alphaKeys.length === 4) {
|
|
27689
|
-
throw new Error("Gradient can only have 4
|
|
27693
|
+
throw new Error("Gradient can only have 4 alpha keys");
|
|
27690
27694
|
}
|
|
27691
27695
|
var key = typeof timeOrKey === "number" ? new GradientAlphaKey(timeOrKey, alpha) : timeOrKey;
|
|
27696
|
+
key._onValueChanged = this._setAlphaTypeArrayDirty.bind(this);
|
|
27692
27697
|
this._addKey(alphaKeys, key);
|
|
27693
27698
|
this._alphaTypeArrayDirty = true;
|
|
27694
27699
|
};
|
|
@@ -27696,6 +27701,7 @@ __decorate([
|
|
|
27696
27701
|
* Remove a color key from the gradient.
|
|
27697
27702
|
* @param index - The remove color key index
|
|
27698
27703
|
*/ _proto.removeColorKey = function removeColorKey(index) {
|
|
27704
|
+
this._colorKeys[index]._onValueChanged = null;
|
|
27699
27705
|
this._removeKey(this._colorKeys, index);
|
|
27700
27706
|
this._colorTypeArrayDirty = true;
|
|
27701
27707
|
};
|
|
@@ -27703,6 +27709,7 @@ __decorate([
|
|
|
27703
27709
|
* Remove an alpha key from the gradient.
|
|
27704
27710
|
* @param index - The remove alpha key index
|
|
27705
27711
|
*/ _proto.removeAlphaKey = function removeAlphaKey(index) {
|
|
27712
|
+
this._alphaKeys[index]._onValueChanged = null;
|
|
27706
27713
|
this._removeKey(this._alphaKeys, index);
|
|
27707
27714
|
this._alphaTypeArrayDirty = true;
|
|
27708
27715
|
};
|
|
@@ -27711,13 +27718,21 @@ __decorate([
|
|
|
27711
27718
|
* @param colorKeys - The color keys
|
|
27712
27719
|
* @param alphaKeys - The alpha keys
|
|
27713
27720
|
*/ _proto.setKeys = function setKeys(colorKeys, alphaKeys) {
|
|
27714
|
-
|
|
27715
|
-
|
|
27716
|
-
for(var i = 0, n =
|
|
27717
|
-
|
|
27721
|
+
var currentColorKeys = this._colorKeys;
|
|
27722
|
+
var currentAlphaKeys = this._alphaKeys;
|
|
27723
|
+
for(var i = 0, n = currentColorKeys.length; i < n; i++){
|
|
27724
|
+
currentColorKeys[i]._onValueChanged = null;
|
|
27725
|
+
}
|
|
27726
|
+
for(var i1 = 0, n1 = currentAlphaKeys.length; i1 < n1; i1++){
|
|
27727
|
+
currentAlphaKeys[i1]._onValueChanged = null;
|
|
27728
|
+
}
|
|
27729
|
+
currentColorKeys.length = 0;
|
|
27730
|
+
currentAlphaKeys.length = 0;
|
|
27731
|
+
for(var i2 = 0, n2 = colorKeys.length; i2 < n2; i2++){
|
|
27732
|
+
this._addKey(currentColorKeys, colorKeys[i2]);
|
|
27718
27733
|
}
|
|
27719
|
-
for(var
|
|
27720
|
-
this._addKey(
|
|
27734
|
+
for(var i3 = 0, n3 = alphaKeys.length; i3 < n3; i3++){
|
|
27735
|
+
this._addKey(currentAlphaKeys, alphaKeys[i3]);
|
|
27721
27736
|
}
|
|
27722
27737
|
this._alphaTypeArrayDirty = true;
|
|
27723
27738
|
this._colorTypeArrayDirty = true;
|
|
@@ -27778,6 +27793,12 @@ __decorate([
|
|
|
27778
27793
|
_proto._removeKey = function _removeKey(keys, index) {
|
|
27779
27794
|
keys.splice(index, 1);
|
|
27780
27795
|
};
|
|
27796
|
+
_proto._setColorTypeArrayDirty = function _setColorTypeArrayDirty() {
|
|
27797
|
+
this._colorTypeArrayDirty = true;
|
|
27798
|
+
};
|
|
27799
|
+
_proto._setAlphaTypeArrayDirty = function _setAlphaTypeArrayDirty() {
|
|
27800
|
+
this._alphaTypeArrayDirty = true;
|
|
27801
|
+
};
|
|
27781
27802
|
_create_class(ParticleGradient, [
|
|
27782
27803
|
{
|
|
27783
27804
|
key: "colorKeys",
|
|
@@ -27812,16 +27833,80 @@ __decorate([
|
|
|
27812
27833
|
], ParticleGradient.prototype, "_alphaTypeArray", void 0);
|
|
27813
27834
|
/**
|
|
27814
27835
|
* The color key of the particle gradient.
|
|
27815
|
-
*/ var GradientColorKey = function
|
|
27816
|
-
|
|
27817
|
-
|
|
27818
|
-
|
|
27836
|
+
*/ var GradientColorKey = /*#__PURE__*/ function() {
|
|
27837
|
+
function GradientColorKey(time, color) {
|
|
27838
|
+
/** @internal */ this._onValueChanged = null;
|
|
27839
|
+
this._color = new Color$1();
|
|
27840
|
+
this._time = time;
|
|
27841
|
+
color && this._color.copyFrom(color);
|
|
27842
|
+
// @ts-ignore
|
|
27843
|
+
this._color._onValueChanged = this._onValueChanged;
|
|
27844
|
+
}
|
|
27845
|
+
_create_class(GradientColorKey, [
|
|
27846
|
+
{
|
|
27847
|
+
key: "time",
|
|
27848
|
+
get: /**
|
|
27849
|
+
* The key time.
|
|
27850
|
+
*/ function get() {
|
|
27851
|
+
return this._time;
|
|
27852
|
+
},
|
|
27853
|
+
set: function set(value) {
|
|
27854
|
+
this._time = value;
|
|
27855
|
+
this._onValueChanged && this._onValueChanged();
|
|
27856
|
+
}
|
|
27857
|
+
},
|
|
27858
|
+
{
|
|
27859
|
+
key: "color",
|
|
27860
|
+
get: /**
|
|
27861
|
+
* The key color.
|
|
27862
|
+
*/ function get() {
|
|
27863
|
+
return this._color;
|
|
27864
|
+
},
|
|
27865
|
+
set: function set(value) {
|
|
27866
|
+
if (this._color !== value) {
|
|
27867
|
+
this._color.copyFrom(value);
|
|
27868
|
+
}
|
|
27869
|
+
}
|
|
27870
|
+
}
|
|
27871
|
+
]);
|
|
27872
|
+
return GradientColorKey;
|
|
27873
|
+
}();
|
|
27819
27874
|
/**
|
|
27820
27875
|
* The alpha key of the particle gradient.
|
|
27821
|
-
*/ var GradientAlphaKey = function
|
|
27822
|
-
|
|
27823
|
-
|
|
27824
|
-
|
|
27876
|
+
*/ var GradientAlphaKey = /*#__PURE__*/ function() {
|
|
27877
|
+
function GradientAlphaKey(time, alpha) {
|
|
27878
|
+
/** @internal */ this._onValueChanged = null;
|
|
27879
|
+
this._time = time;
|
|
27880
|
+
this._alpha = alpha;
|
|
27881
|
+
}
|
|
27882
|
+
_create_class(GradientAlphaKey, [
|
|
27883
|
+
{
|
|
27884
|
+
key: "time",
|
|
27885
|
+
get: /**
|
|
27886
|
+
* The key time.
|
|
27887
|
+
*/ function get() {
|
|
27888
|
+
return this._time;
|
|
27889
|
+
},
|
|
27890
|
+
set: function set(value) {
|
|
27891
|
+
this._time = value;
|
|
27892
|
+
this._onValueChanged && this._onValueChanged();
|
|
27893
|
+
}
|
|
27894
|
+
},
|
|
27895
|
+
{
|
|
27896
|
+
key: "alpha",
|
|
27897
|
+
get: /**
|
|
27898
|
+
* The key alpha.
|
|
27899
|
+
*/ function get() {
|
|
27900
|
+
return this._alpha;
|
|
27901
|
+
},
|
|
27902
|
+
set: function set(value) {
|
|
27903
|
+
this._alpha = value;
|
|
27904
|
+
this._onValueChanged && this._onValueChanged();
|
|
27905
|
+
}
|
|
27906
|
+
}
|
|
27907
|
+
]);
|
|
27908
|
+
return GradientAlphaKey;
|
|
27909
|
+
}();
|
|
27825
27910
|
|
|
27826
27911
|
/**
|
|
27827
27912
|
* Particle composite gradient.
|