@galacean/engine-core 1.6.10 → 1.6.12
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 +195 -136
- package/dist/main.js.map +1 -1
- package/dist/module.js +195 -136
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/SystemInfo.d.ts +2 -1
- package/types/Utils.d.ts +1 -0
- package/types/mesh/MeshRenderer.d.ts +0 -1
- package/types/particle/ParticleRenderer.d.ts +3 -3
- package/types/particle/modules/EmissionModule.d.ts +5 -0
- package/types/particle/modules/RotationOverLifetimeModule.d.ts +1 -1
- package/types/particle/enums/attributes/MeshParticleVertexAttribute.d.ts +0 -5
package/dist/main.js
CHANGED
|
@@ -616,87 +616,6 @@ var Logger = {
|
|
|
616
616
|
}
|
|
617
617
|
};
|
|
618
618
|
|
|
619
|
-
/**
|
|
620
|
-
* Data type enumeration
|
|
621
|
-
*/ var DataType = /*#__PURE__*/ function(DataType) {
|
|
622
|
-
/** Float */ DataType[DataType["FLOAT"] = 5126] = "FLOAT";
|
|
623
|
-
/** Floating-point two-dimensional vector */ DataType[DataType["FLOAT_VEC2"] = 35664] = "FLOAT_VEC2";
|
|
624
|
-
/** Floating-point three-dimensional vector */ DataType[DataType["FLOAT_VEC3"] = 35665] = "FLOAT_VEC3";
|
|
625
|
-
/** Floating-point four-dimensional vector */ DataType[DataType["FLOAT_VEC4"] = 35666] = "FLOAT_VEC4";
|
|
626
|
-
/** Integer */ DataType[DataType["INT"] = 5124] = "INT";
|
|
627
|
-
/** Integer two-dimensional vector */ DataType[DataType["INT_VEC2"] = 35667] = "INT_VEC2";
|
|
628
|
-
/** Integer three-dimensional vector */ DataType[DataType["INT_VEC3"] = 35668] = "INT_VEC3";
|
|
629
|
-
/** Integer four-dimensional vector */ DataType[DataType["INT_VEC4"] = 35669] = "INT_VEC4";
|
|
630
|
-
/** Boolean */ DataType[DataType["BOOL"] = 35670] = "BOOL";
|
|
631
|
-
/** Boolean two-dimensional vector */ DataType[DataType["BOOL_VEC2"] = 35671] = "BOOL_VEC2";
|
|
632
|
-
/** Boolean three-dimensional vector */ DataType[DataType["BOOL_VEC3"] = 35672] = "BOOL_VEC3";
|
|
633
|
-
/** Boolean four-dimensional vector */ DataType[DataType["BOOL_VEC4"] = 35673] = "BOOL_VEC4";
|
|
634
|
-
/** Second-order matrix */ DataType[DataType["FLOAT_MAT2"] = 35674] = "FLOAT_MAT2";
|
|
635
|
-
/** Third-order matrix */ DataType[DataType["FLOAT_MAT3"] = 35675] = "FLOAT_MAT3";
|
|
636
|
-
/** Fourth-order matrix */ DataType[DataType["FLOAT_MAT4"] = 35676] = "FLOAT_MAT4";
|
|
637
|
-
/** Float array */ DataType[DataType["FLOAT_ARRAY"] = 35677] = "FLOAT_ARRAY";
|
|
638
|
-
/** Floating-point two-dimensional vector array */ DataType[DataType["FLOAT_VEC2_ARRAY"] = 100000] = "FLOAT_VEC2_ARRAY";
|
|
639
|
-
/** Floating-point three-dimensional vector array */ DataType[DataType["FLOAT_VEC3_ARRAY"] = 100001] = "FLOAT_VEC3_ARRAY";
|
|
640
|
-
/** Floating-point four-dimensional vector array */ DataType[DataType["FLOAT_VEC4_ARRAY"] = 100002] = "FLOAT_VEC4_ARRAY";
|
|
641
|
-
/** Integer array */ DataType[DataType["INT_ARRAY"] = 100003] = "INT_ARRAY";
|
|
642
|
-
/** Integer two-dimensional vector array */ DataType[DataType["INT_VEC2_ARRAY"] = 100004] = "INT_VEC2_ARRAY";
|
|
643
|
-
/** Integer three-dimensional vector array */ DataType[DataType["INT_VEC3_ARRAY"] = 100005] = "INT_VEC3_ARRAY";
|
|
644
|
-
/** Integer four-dimensional vector array */ DataType[DataType["INT_VEC4_ARRAY"] = 100006] = "INT_VEC4_ARRAY";
|
|
645
|
-
/** Second-order matrix array */ DataType[DataType["FLOAT_MAT2_ARRAY"] = 100007] = "FLOAT_MAT2_ARRAY";
|
|
646
|
-
/** Third-order matrix array */ DataType[DataType["FLOAT_MAT3_ARRAY"] = 100008] = "FLOAT_MAT3_ARRAY";
|
|
647
|
-
/** Fourth-order matrix array */ DataType[DataType["FLOAT_MAT4_ARRAY"] = 100009] = "FLOAT_MAT4_ARRAY";
|
|
648
|
-
/** 2D texture sampler array */ DataType[DataType["SAMPLER_2D_ARRAY"] = 100010] = "SAMPLER_2D_ARRAY";
|
|
649
|
-
/** Cube map texture sampler array */ DataType[DataType["SAMPLER_CUBE_ARRAY"] = 100011] = "SAMPLER_CUBE_ARRAY";
|
|
650
|
-
/** 2D sampler */ DataType[DataType["SAMPLER_2D"] = 35678] = "SAMPLER_2D";
|
|
651
|
-
/** Cube map Texture sampler */ DataType[DataType["SAMPLER_CUBE"] = 35680] = "SAMPLER_CUBE";
|
|
652
|
-
/** Byte */ DataType[DataType["BYTE"] = 5120] = "BYTE";
|
|
653
|
-
/** Unsigned byte */ DataType[DataType["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE";
|
|
654
|
-
/** Short */ DataType[DataType["SHORT"] = 5122] = "SHORT";
|
|
655
|
-
/** Unsigned short */ DataType[DataType["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT";
|
|
656
|
-
/** Unsigned int */ DataType[DataType["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT"; // gl.UNSIGNED_INT
|
|
657
|
-
return DataType;
|
|
658
|
-
}({});
|
|
659
|
-
/**
|
|
660
|
-
* GL Capabilities
|
|
661
|
-
* Some capabilities can be smoothed out by extension, and some capabilities must use WebGL 2.0.
|
|
662
|
-
* */ var GLCapabilityType = /*#__PURE__*/ function(GLCapabilityType) {
|
|
663
|
-
GLCapabilityType["shaderVertexID"] = "shaderVertexID";
|
|
664
|
-
GLCapabilityType["standardDerivatives"] = "OES_standard_derivatives";
|
|
665
|
-
GLCapabilityType["shaderTextureLod"] = "EXT_shader_texture_lod";
|
|
666
|
-
GLCapabilityType["elementIndexUint"] = "OES_element_index_uint";
|
|
667
|
-
GLCapabilityType["depthTexture"] = "WEBGL_depth_texture";
|
|
668
|
-
GLCapabilityType["drawBuffers"] = "WEBGL_draw_buffers";
|
|
669
|
-
GLCapabilityType["vertexArrayObject"] = "OES_vertex_array_object";
|
|
670
|
-
GLCapabilityType["instancedArrays"] = "ANGLE_instanced_arrays";
|
|
671
|
-
GLCapabilityType["multipleSample"] = "multipleSampleOnlySupportedInWebGL2";
|
|
672
|
-
GLCapabilityType["textureFloat"] = "OES_texture_float";
|
|
673
|
-
GLCapabilityType["textureFloatLinear"] = "OES_texture_float_linear";
|
|
674
|
-
GLCapabilityType["textureHalfFloat"] = "OES_texture_half_float";
|
|
675
|
-
GLCapabilityType["textureHalfFloatLinear"] = "OES_texture_half_float_linear";
|
|
676
|
-
GLCapabilityType["WEBGL_colorBufferFloat"] = "WEBGL_color_buffer_float";
|
|
677
|
-
GLCapabilityType["colorBufferFloat"] = "EXT_color_buffer_float";
|
|
678
|
-
GLCapabilityType["colorBufferHalfFloat"] = "EXT_color_buffer_half_float";
|
|
679
|
-
GLCapabilityType["textureFilterAnisotropic"] = "EXT_texture_filter_anisotropic";
|
|
680
|
-
GLCapabilityType["blendMinMax"] = "EXT_blend_minmax";
|
|
681
|
-
GLCapabilityType["fragDepth"] = "EXT_frag_depth";
|
|
682
|
-
GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
|
|
683
|
-
GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
|
|
684
|
-
GLCapabilityType["astc_hdr"] = "WEBGL_compressed_texture_astc_hdr";
|
|
685
|
-
GLCapabilityType["etc"] = "WEBGL_compressed_texture_etc";
|
|
686
|
-
GLCapabilityType["etc_webkit"] = "WEBKIT_WEBGL_compressed_texture_etc";
|
|
687
|
-
GLCapabilityType["etc1"] = "WEBGL_compressed_texture_etc1";
|
|
688
|
-
GLCapabilityType["etc1_webkit"] = "WEBKIT_WEBGL_compressed_texture_etc1";
|
|
689
|
-
GLCapabilityType["pvrtc"] = "WEBGL_compressed_texture_pvrtc";
|
|
690
|
-
GLCapabilityType["pvrtc_webkit"] = "WEBKIT_WEBGL_compressed_texture_pvrtc";
|
|
691
|
-
GLCapabilityType["s3tc"] = "WEBGL_compressed_texture_s3tc";
|
|
692
|
-
GLCapabilityType["s3tc_webkit"] = "WEBKIT_WEBGL_compressed_texture_s3tc";
|
|
693
|
-
GLCapabilityType["s3tc_srgb"] = "WEBGL_compressed_texture_s3tc_srgb";
|
|
694
|
-
GLCapabilityType["bptc"] = "EXT_texture_compression_bptc";
|
|
695
|
-
GLCapabilityType["WEBGL_lose_context"] = "WEBGL_lose_context";
|
|
696
|
-
GLCapabilityType["sRGB"] = "EXT_sRGB";
|
|
697
|
-
return GLCapabilityType;
|
|
698
|
-
}({});
|
|
699
|
-
|
|
700
619
|
var AssetPromise = /*#__PURE__*/ function() {
|
|
701
620
|
function AssetPromise(executor) {
|
|
702
621
|
var _this = this;
|
|
@@ -884,10 +803,99 @@ var AssetPromise = /*#__PURE__*/ function() {
|
|
|
884
803
|
return AssetPromise;
|
|
885
804
|
}();
|
|
886
805
|
|
|
806
|
+
/**
|
|
807
|
+
* Data type enumeration
|
|
808
|
+
*/ var DataType = /*#__PURE__*/ function(DataType) {
|
|
809
|
+
/** Float */ DataType[DataType["FLOAT"] = 5126] = "FLOAT";
|
|
810
|
+
/** Floating-point two-dimensional vector */ DataType[DataType["FLOAT_VEC2"] = 35664] = "FLOAT_VEC2";
|
|
811
|
+
/** Floating-point three-dimensional vector */ DataType[DataType["FLOAT_VEC3"] = 35665] = "FLOAT_VEC3";
|
|
812
|
+
/** Floating-point four-dimensional vector */ DataType[DataType["FLOAT_VEC4"] = 35666] = "FLOAT_VEC4";
|
|
813
|
+
/** Integer */ DataType[DataType["INT"] = 5124] = "INT";
|
|
814
|
+
/** Integer two-dimensional vector */ DataType[DataType["INT_VEC2"] = 35667] = "INT_VEC2";
|
|
815
|
+
/** Integer three-dimensional vector */ DataType[DataType["INT_VEC3"] = 35668] = "INT_VEC3";
|
|
816
|
+
/** Integer four-dimensional vector */ DataType[DataType["INT_VEC4"] = 35669] = "INT_VEC4";
|
|
817
|
+
/** Boolean */ DataType[DataType["BOOL"] = 35670] = "BOOL";
|
|
818
|
+
/** Boolean two-dimensional vector */ DataType[DataType["BOOL_VEC2"] = 35671] = "BOOL_VEC2";
|
|
819
|
+
/** Boolean three-dimensional vector */ DataType[DataType["BOOL_VEC3"] = 35672] = "BOOL_VEC3";
|
|
820
|
+
/** Boolean four-dimensional vector */ DataType[DataType["BOOL_VEC4"] = 35673] = "BOOL_VEC4";
|
|
821
|
+
/** Second-order matrix */ DataType[DataType["FLOAT_MAT2"] = 35674] = "FLOAT_MAT2";
|
|
822
|
+
/** Third-order matrix */ DataType[DataType["FLOAT_MAT3"] = 35675] = "FLOAT_MAT3";
|
|
823
|
+
/** Fourth-order matrix */ DataType[DataType["FLOAT_MAT4"] = 35676] = "FLOAT_MAT4";
|
|
824
|
+
/** Float array */ DataType[DataType["FLOAT_ARRAY"] = 35677] = "FLOAT_ARRAY";
|
|
825
|
+
/** Floating-point two-dimensional vector array */ DataType[DataType["FLOAT_VEC2_ARRAY"] = 100000] = "FLOAT_VEC2_ARRAY";
|
|
826
|
+
/** Floating-point three-dimensional vector array */ DataType[DataType["FLOAT_VEC3_ARRAY"] = 100001] = "FLOAT_VEC3_ARRAY";
|
|
827
|
+
/** Floating-point four-dimensional vector array */ DataType[DataType["FLOAT_VEC4_ARRAY"] = 100002] = "FLOAT_VEC4_ARRAY";
|
|
828
|
+
/** Integer array */ DataType[DataType["INT_ARRAY"] = 100003] = "INT_ARRAY";
|
|
829
|
+
/** Integer two-dimensional vector array */ DataType[DataType["INT_VEC2_ARRAY"] = 100004] = "INT_VEC2_ARRAY";
|
|
830
|
+
/** Integer three-dimensional vector array */ DataType[DataType["INT_VEC3_ARRAY"] = 100005] = "INT_VEC3_ARRAY";
|
|
831
|
+
/** Integer four-dimensional vector array */ DataType[DataType["INT_VEC4_ARRAY"] = 100006] = "INT_VEC4_ARRAY";
|
|
832
|
+
/** Second-order matrix array */ DataType[DataType["FLOAT_MAT2_ARRAY"] = 100007] = "FLOAT_MAT2_ARRAY";
|
|
833
|
+
/** Third-order matrix array */ DataType[DataType["FLOAT_MAT3_ARRAY"] = 100008] = "FLOAT_MAT3_ARRAY";
|
|
834
|
+
/** Fourth-order matrix array */ DataType[DataType["FLOAT_MAT4_ARRAY"] = 100009] = "FLOAT_MAT4_ARRAY";
|
|
835
|
+
/** 2D texture sampler array */ DataType[DataType["SAMPLER_2D_ARRAY"] = 100010] = "SAMPLER_2D_ARRAY";
|
|
836
|
+
/** Cube map texture sampler array */ DataType[DataType["SAMPLER_CUBE_ARRAY"] = 100011] = "SAMPLER_CUBE_ARRAY";
|
|
837
|
+
/** 2D sampler */ DataType[DataType["SAMPLER_2D"] = 35678] = "SAMPLER_2D";
|
|
838
|
+
/** Cube map Texture sampler */ DataType[DataType["SAMPLER_CUBE"] = 35680] = "SAMPLER_CUBE";
|
|
839
|
+
/** Byte */ DataType[DataType["BYTE"] = 5120] = "BYTE";
|
|
840
|
+
/** Unsigned byte */ DataType[DataType["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE";
|
|
841
|
+
/** Short */ DataType[DataType["SHORT"] = 5122] = "SHORT";
|
|
842
|
+
/** Unsigned short */ DataType[DataType["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT";
|
|
843
|
+
/** Unsigned int */ DataType[DataType["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT"; // gl.UNSIGNED_INT
|
|
844
|
+
return DataType;
|
|
845
|
+
}({});
|
|
846
|
+
/**
|
|
847
|
+
* GL Capabilities
|
|
848
|
+
* Some capabilities can be smoothed out by extension, and some capabilities must use WebGL 2.0.
|
|
849
|
+
* */ var GLCapabilityType = /*#__PURE__*/ function(GLCapabilityType) {
|
|
850
|
+
GLCapabilityType["shaderVertexID"] = "shaderVertexID";
|
|
851
|
+
GLCapabilityType["standardDerivatives"] = "OES_standard_derivatives";
|
|
852
|
+
GLCapabilityType["shaderTextureLod"] = "EXT_shader_texture_lod";
|
|
853
|
+
GLCapabilityType["elementIndexUint"] = "OES_element_index_uint";
|
|
854
|
+
GLCapabilityType["depthTexture"] = "WEBGL_depth_texture";
|
|
855
|
+
GLCapabilityType["drawBuffers"] = "WEBGL_draw_buffers";
|
|
856
|
+
GLCapabilityType["vertexArrayObject"] = "OES_vertex_array_object";
|
|
857
|
+
GLCapabilityType["instancedArrays"] = "ANGLE_instanced_arrays";
|
|
858
|
+
GLCapabilityType["multipleSample"] = "multipleSampleOnlySupportedInWebGL2";
|
|
859
|
+
GLCapabilityType["textureFloat"] = "OES_texture_float";
|
|
860
|
+
GLCapabilityType["textureFloatLinear"] = "OES_texture_float_linear";
|
|
861
|
+
GLCapabilityType["textureHalfFloat"] = "OES_texture_half_float";
|
|
862
|
+
GLCapabilityType["textureHalfFloatLinear"] = "OES_texture_half_float_linear";
|
|
863
|
+
GLCapabilityType["WEBGL_colorBufferFloat"] = "WEBGL_color_buffer_float";
|
|
864
|
+
GLCapabilityType["colorBufferFloat"] = "EXT_color_buffer_float";
|
|
865
|
+
GLCapabilityType["colorBufferHalfFloat"] = "EXT_color_buffer_half_float";
|
|
866
|
+
GLCapabilityType["textureFilterAnisotropic"] = "EXT_texture_filter_anisotropic";
|
|
867
|
+
GLCapabilityType["blendMinMax"] = "EXT_blend_minmax";
|
|
868
|
+
GLCapabilityType["fragDepth"] = "EXT_frag_depth";
|
|
869
|
+
GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
|
|
870
|
+
GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
|
|
871
|
+
GLCapabilityType["astc_hdr"] = "WEBGL_compressed_texture_astc_hdr";
|
|
872
|
+
GLCapabilityType["etc"] = "WEBGL_compressed_texture_etc";
|
|
873
|
+
GLCapabilityType["etc_webkit"] = "WEBKIT_WEBGL_compressed_texture_etc";
|
|
874
|
+
GLCapabilityType["etc1"] = "WEBGL_compressed_texture_etc1";
|
|
875
|
+
GLCapabilityType["etc1_webkit"] = "WEBKIT_WEBGL_compressed_texture_etc1";
|
|
876
|
+
GLCapabilityType["pvrtc"] = "WEBGL_compressed_texture_pvrtc";
|
|
877
|
+
GLCapabilityType["pvrtc_webkit"] = "WEBKIT_WEBGL_compressed_texture_pvrtc";
|
|
878
|
+
GLCapabilityType["s3tc"] = "WEBGL_compressed_texture_s3tc";
|
|
879
|
+
GLCapabilityType["s3tc_webkit"] = "WEBKIT_WEBGL_compressed_texture_s3tc";
|
|
880
|
+
GLCapabilityType["s3tc_srgb"] = "WEBGL_compressed_texture_s3tc_srgb";
|
|
881
|
+
GLCapabilityType["bptc"] = "EXT_texture_compression_bptc";
|
|
882
|
+
GLCapabilityType["WEBGL_lose_context"] = "WEBGL_lose_context";
|
|
883
|
+
GLCapabilityType["sRGB"] = "EXT_sRGB";
|
|
884
|
+
return GLCapabilityType;
|
|
885
|
+
}({});
|
|
886
|
+
|
|
887
887
|
/**
|
|
888
888
|
* Access operating system, platform and hardware information.
|
|
889
889
|
*/ var SystemInfo = /*#__PURE__*/ function() {
|
|
890
890
|
function SystemInfo() {}
|
|
891
|
+
SystemInfo._parseAppleMobileOSVersion = function _parseAppleMobileOSVersion(userAgent, osPrefix) {
|
|
892
|
+
// Since iOS 26, Safari freezes UA OS version at 18.6, so Version/xx is more reliable
|
|
893
|
+
// Use Version/ if available, otherwise fallback to OS version
|
|
894
|
+
var v = userAgent.match(/Version\/(\d+)(?:\.(\d+))?(?:\.(\d+))?/);
|
|
895
|
+
if (v) return osPrefix + " " + v[1] + "." + (v[2] || 0) + "." + (v[3] || 0);
|
|
896
|
+
v = userAgent.match(/OS (\d+)_(\d+)(?:_(\d+))?/);
|
|
897
|
+
return v ? osPrefix + " " + v[1] + "." + v[2] + "." + (v[3] || 0) : osPrefix;
|
|
898
|
+
};
|
|
891
899
|
/**
|
|
892
900
|
* @internal
|
|
893
901
|
*/ SystemInfo._initialize = function _initialize() {
|
|
@@ -909,12 +917,10 @@ var AssetPromise = /*#__PURE__*/ function() {
|
|
|
909
917
|
var v;
|
|
910
918
|
switch(SystemInfo.platform){
|
|
911
919
|
case Platform.IPhone:
|
|
912
|
-
|
|
913
|
-
this.operatingSystem = v ? "iPhone OS " + v[1] + "." + (v[2] || 0) + "." + (v[3] || 0) : "iPhone OS";
|
|
920
|
+
this.operatingSystem = this._parseAppleMobileOSVersion(userAgent, "iPhone OS");
|
|
914
921
|
break;
|
|
915
922
|
case Platform.IPad:
|
|
916
|
-
|
|
917
|
-
this.operatingSystem = v ? "iPad OS " + v[1] + "." + (v[2] || 0) + "." + (v[3] || 0) : "iPad OS";
|
|
923
|
+
this.operatingSystem = this._parseAppleMobileOSVersion(userAgent, "iPad OS");
|
|
918
924
|
break;
|
|
919
925
|
case Platform.Android:
|
|
920
926
|
v = userAgent.match(/Android (\d+).?(\d+)?.?(\d+)?/);
|
|
@@ -3012,12 +3018,13 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
3012
3018
|
if (Utils.isBase64Url(relativeUrl)) {
|
|
3013
3019
|
return relativeUrl;
|
|
3014
3020
|
}
|
|
3015
|
-
if (
|
|
3016
|
-
|
|
3017
|
-
baseUrl = fileSchema + baseUrl;
|
|
3018
|
-
return new URL(relativeUrl, baseUrl).href.substring(fileSchema.length);
|
|
3021
|
+
if (Utils.isAbsoluteUrl(baseUrl)) {
|
|
3022
|
+
return relativeUrl ? new URL(relativeUrl, baseUrl).href : baseUrl;
|
|
3019
3023
|
}
|
|
3020
|
-
|
|
3024
|
+
var head = "file://";
|
|
3025
|
+
var encodedBaseUrl = head + this._encodePathComponents(baseUrl);
|
|
3026
|
+
var encodedRelativeUrl = this._encodePathComponents(relativeUrl);
|
|
3027
|
+
return decodeURIComponent(new URL(encodedRelativeUrl, encodedBaseUrl).href.slice(head.length));
|
|
3021
3028
|
};
|
|
3022
3029
|
/**
|
|
3023
3030
|
* @internal
|
|
@@ -3176,6 +3183,9 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
3176
3183
|
a[j + 1] = element;
|
|
3177
3184
|
}
|
|
3178
3185
|
};
|
|
3186
|
+
Utils._encodePathComponents = function _encodePathComponents(path) {
|
|
3187
|
+
return path.split("/").map(encodeURIComponent).join("/");
|
|
3188
|
+
};
|
|
3179
3189
|
return Utils;
|
|
3180
3190
|
}();
|
|
3181
3191
|
var charCodeOfDot$1 = ".".charCodeAt(0);
|
|
@@ -4725,11 +4735,11 @@ var ShadowLib = {
|
|
|
4725
4735
|
ShadowVertex: ShadowVertex
|
|
4726
4736
|
};
|
|
4727
4737
|
|
|
4728
|
-
var particle_common = "\n\nvec3 rotationByEuler(in vec3 vector, in vec3 rot) {\n float halfRoll = rot.z * 0.5;\n float halfPitch = rot.x * 0.5;\n float halfYaw = rot.y * 0.5;\n\n float sinRoll = sin(halfRoll);\n float cosRoll = cos(halfRoll);\n float sinPitch = sin(halfPitch);\n float cosPitch = cos(halfPitch);\n float sinYaw = sin(halfYaw);\n float cosYaw = cos(halfYaw);\n\n float
|
|
4738
|
+
var particle_common = "vec3 rotationByQuaternions(in vec3 v, in vec4 q) {\n return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);\n}\n\nvec3 rotationByEuler(in vec3 vector, in vec3 rot) {\n float halfRoll = rot.z * 0.5;\n float halfPitch = rot.x * 0.5;\n float halfYaw = rot.y * 0.5;\n\n float sinRoll = sin(halfRoll);\n float cosRoll = cos(halfRoll);\n float sinPitch = sin(halfPitch);\n float cosPitch = cos(halfPitch);\n float sinYaw = sin(halfYaw);\n float cosYaw = cos(halfYaw);\n\n float cosYawPitch = cosYaw * cosPitch;\n float sinYawPitch = sinYaw * sinPitch;\n\n float quaX = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll);\n float quaY = (sinYaw * cosPitch * cosRoll) - (cosYaw * sinPitch * sinRoll);\n float quaZ = (cosYawPitch * sinRoll) - (sinYawPitch * cosRoll);\n float quaW = (cosYawPitch * cosRoll) + (sinYawPitch * sinRoll);\n\n return rotationByQuaternions(vector, vec4(quaX, quaY, quaZ, quaW));\n}\n\n// Assume axis is normalized\nvec3 rotationByAxis(in vec3 vector, in vec3 axis, in float angle) {\n float halfAngle = angle * 0.5;\n float s = sin(halfAngle);\n\n return rotationByQuaternions(vector, vec4(axis * s, cos(halfAngle)));\n}\n\n\nfloat evaluateParticleCurve(in vec2 keys[4], in float normalizedAge) {\n float value;\n for (int i = 1; i < 4; i++) {\n vec2 key = keys[i];\n float time = key.x;\n if (time >= normalizedAge) {\n vec2 lastKey = keys[i - 1];\n float lastTime = lastKey.x;\n float age = (normalizedAge - lastTime) / (time - lastTime);\n value = mix(lastKey.y, key.y, age);\n break;\n }\n }\n return value;\n}\n\nfloat evaluateParticleCurveCumulative(in vec2 keys[4], in float normalizedAge, out float currentValue){\n float cumulativeValue = 0.0;\n for (int i = 1; i < 4; i++){\n\t vec2 key = keys[i];\n\t float time = key.x;\n\t vec2 lastKey = keys[i - 1];\n\t float lastValue = lastKey.y;\n\n\t if (time >= normalizedAge){\n\t\t float lastTime = lastKey.x;\n float offsetTime = normalizedAge - lastTime;\n\t\t float age = offsetTime / (time - lastTime);\n currentValue = mix(lastValue, key.y, age);\n\t\t cumulativeValue += (lastValue + currentValue) * 0.5 * offsetTime;\n\t\t break;\n\t\t}\n\t else{\n\t\t cumulativeValue += (lastValue + key.y) * 0.5 * (time - lastKey.x);\n\t\t}\n\t}\n return cumulativeValue;\n}"; // eslint-disable-line
|
|
4729
4739
|
|
|
4730
4740
|
var velocity_over_lifetime_module = "#if defined(RENDERER_VOL_CONSTANT_MODE) || defined(RENDERER_VOL_CURVE_MODE)\n #define _VOL_MODULE_ENABLED\n#endif\n\n#ifdef _VOL_MODULE_ENABLED\n uniform int renderer_VOLSpace;\n\n #ifdef RENDERER_VOL_CONSTANT_MODE\n uniform vec3 renderer_VOLMaxConst;\n\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n uniform vec3 renderer_VOLMinConst;\n #endif\n #endif\n\n #ifdef RENDERER_VOL_CURVE_MODE\n uniform vec2 renderer_VOLMaxGradientX[4]; // x:time y:value\n uniform vec2 renderer_VOLMaxGradientY[4]; // x:time y:value\n uniform vec2 renderer_VOLMaxGradientZ[4]; // x:time y:value\n\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n uniform vec2 renderer_VOLMinGradientX[4]; // x:time y:value\n uniform vec2 renderer_VOLMinGradientY[4]; // x:time y:value\n uniform vec2 renderer_VOLMinGradientZ[4]; // x:time y:value\n #endif\n #endif\n\n\n vec3 computeVelocityPositionOffset(in float normalizedAge, in float age, out vec3 currentVelocity) {\n vec3 velocityPosition;\n\n #ifdef RENDERER_VOL_CONSTANT_MODE\n currentVelocity = renderer_VOLMaxConst;\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n currentVelocity = mix(renderer_VOLMinConst, currentVelocity, a_Random1.yzw);\n #endif\n\n velocityPosition = currentVelocity * age;\n #endif\n\n #ifdef RENDERER_VOL_CURVE_MODE\n velocityPosition = vec3(\n evaluateParticleCurveCumulative(renderer_VOLMaxGradientX, normalizedAge, currentVelocity.x),\n evaluateParticleCurveCumulative(renderer_VOLMaxGradientY, normalizedAge, currentVelocity.y),\n evaluateParticleCurveCumulative(renderer_VOLMaxGradientZ, normalizedAge, currentVelocity.z));\n\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n vec3 minCurrentVelocity;\n vec3 minVelocityPosition = vec3(\n evaluateParticleCurveCumulative(renderer_VOLMinGradientX, normalizedAge, minCurrentVelocity.x),\n evaluateParticleCurveCumulative(renderer_VOLMinGradientY, normalizedAge, minCurrentVelocity.y),\n evaluateParticleCurveCumulative(renderer_VOLMinGradientZ, normalizedAge, minCurrentVelocity.z));\n\n currentVelocity = mix(minCurrentVelocity, currentVelocity, a_Random1.yzw);\n velocityPosition = mix(minVelocityPosition, velocityPosition, a_Random1.yzw);\n #endif\n\n velocityPosition *= vec3(a_ShapePositionStartLifeTime.w);\n #endif\n return velocityPosition;\n }\n#endif\n"; // eslint-disable-line
|
|
4731
4741
|
|
|
4732
|
-
var rotation_over_lifetime_module = "#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #ifdef RENDERER_ROL_CURVE_MODE\n uniform vec2 renderer_ROLMaxCurveZ[4];\n // #ifdef RENDERER_ROL_IS_SEPARATE\n // uniform vec2 renderer_ROLMaxCurveX[4];\n // uniform vec2 renderer_ROLMaxCurveY[4];\n // #endif\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec2 renderer_ROLMinCurveZ[4];\n // #ifdef RENDERER_ROL_IS_SEPARATE\n // uniform vec2 renderer_ROLMinCurveX[4];\n // uniform vec2 renderer_ROLMinCurveY[4];\n // #endif\n #endif\n #else\n uniform vec3 renderer_ROLMaxConst;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec3 renderer_ROLMinConst;\n #endif\n #endif\n#endif\n\nfloat computeParticleRotationFloat(in float rotation, in float age, in float normalizedAge) {\n #if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifeRotation = evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue);\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue), lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * a_ShapePositionStartLifeTime.w;\n #else\n float lifeRotation = renderer_ROLMaxConst.z;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(renderer_ROLMinConst.z, lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * age;\n #endif\n #endif\n return rotation;\n}\n\n\n#if defined(RENDERER_MODE_MESH) && (defined(
|
|
4742
|
+
var rotation_over_lifetime_module = "#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #ifdef RENDERER_ROL_CURVE_MODE\n uniform vec2 renderer_ROLMaxCurveZ[4];\n // #ifdef RENDERER_ROL_IS_SEPARATE\n // uniform vec2 renderer_ROLMaxCurveX[4];\n // uniform vec2 renderer_ROLMaxCurveY[4];\n // #endif\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec2 renderer_ROLMinCurveZ[4];\n // #ifdef RENDERER_ROL_IS_SEPARATE\n // uniform vec2 renderer_ROLMinCurveX[4];\n // uniform vec2 renderer_ROLMinCurveY[4];\n // #endif\n #endif\n #else\n uniform vec3 renderer_ROLMaxConst;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec3 renderer_ROLMinConst;\n #endif\n #endif\n#endif\n\nfloat computeParticleRotationFloat(in float rotation, in float age, in float normalizedAge) {\n #if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifeRotation = evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue);\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue), lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * a_ShapePositionStartLifeTime.w;\n #else\n float lifeRotation = renderer_ROLMaxConst.z;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(renderer_ROLMinConst.z, lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * age;\n #endif\n #endif\n return rotation;\n}\n\n\n#if defined(RENDERER_MODE_MESH) && (defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE))\nvec3 computeParticleRotationVec3(in vec3 rotation, in float age, in float normalizedAge) {\n #ifdef RENDERER_ROL_IS_SEPARATE\n #ifdef RENDERER_ROL_CONSTANT_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n vec3 ageRot = mix(renderer_ROLMinConst, renderer_ROLMaxConst, a_Random0.w) * age;\n #else\n vec3 ageRot = renderer_ROLMaxConst * age;\n #endif\n rotation += ageRot;\n #endif\n #ifdef RENDERER_ROL_CURVE_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n rotation += vec3(\n mix(getTotalValueFromGradientFloat(renderer_ROLMinCurveX, normalizedAge),\n getTotalValueFromGradientFloat(renderer_ROLMaxCurveX, normalizedAge), a_Random0.w),\n mix(getTotalValueFromGradientFloat(renderer_ROLMinCurveY, normalizedAge),\n getTotalValueFromGradientFloat(renderer_ROLMaxCurveY, normalizedAge), a_Random0.w),\n mix(getTotalValueFromGradientFloat(renderer_ROLMinCurveZ, normalizedAge),\n getTotalValueFromGradientFloat(renderer_ROLMaxCurveZ, normalizedAge), a_Random0.w));\n #else\n rotation += vec3(getTotalValueFromGradientFloat(renderer_ROLMaxCurveX, normalizedAge),\n getTotalValueFromGradientFloat(renderer_ROLMaxCurveY, normalizedAge),\n getTotalValueFromGradientFloat(renderer_ROLMaxCurveZ, normalizedAge));\n #endif\n #endif\n #else\n #ifdef RENDERER_ROL_CONSTANT_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n float ageRot = mix(renderer_ROLMinConst.z, renderer_ROLMaxConst.z, a_Random0.w) * age;\n #else\n float ageRot = renderer_ROLMaxConst.z * age;\n #endif\n rotation += ageRot;\n #endif\n\n #ifdef RENDERER_ROL_CURVE_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n rotation += mix(\n getTotalValueFromGradientFloat(renderer_ROLMinCurveZ, normalizedAge),\n getTotalValueFromGradientFloat(renderer_ROLMaxCurveZ, normalizedAge),\n a_Random0.w);\n #else\n rotation += getTotalValueFromGradientFloat(renderer_ROLMaxCurveZ, normalizedAge);\n #endif\n #endif\n #endif\n return rotation;\n}\n#endif\n"; // eslint-disable-line
|
|
4733
4743
|
|
|
4734
4744
|
var size_over_lifetime_module = "#ifdef RENDERER_SOL_CURVE_MODE\n uniform vec2 renderer_SOLMaxCurveX[4]; // x:time y:value\n #ifdef RENDERER_SOL_IS_SEPARATE\n uniform vec2 renderer_SOLMaxCurveY[4]; // x:time y:value\n uniform vec2 renderer_SOLMaxCurveZ[4]; // x:time y:value\n #endif\n\n #ifdef RENDERER_SOL_IS_RANDOM_TWO\n uniform vec2 renderer_SOLMinCurveX[4]; // x:time y:value\n #ifdef RENDERER_SOL_IS_SEPARATE\n uniform vec2 renderer_SOLMinCurveY[4]; // x:time y:value\n uniform vec2 renderer_SOLMinCurveZ[4]; // x:time y:value\n #endif\n #endif\n#endif\n\nvec2 computeParticleSizeBillboard(in vec2 size, in float normalizedAge) {\n #ifdef RENDERER_SOL_CURVE_MODE\n float lifeSizeX = evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge);\n #ifdef RENDERER_SOL_IS_RANDOM_TWO\n lifeSizeX = mix(evaluateParticleCurve(renderer_SOLMinCurveX, normalizedAge), lifeSizeX, a_Random0.z);\n #endif\n\n #ifdef RENDERER_SOL_IS_SEPARATE\n float lifeSizeY = evaluateParticleCurve(renderer_SOLMaxCurveY, normalizedAge);\n #ifdef RENDERER_SOL_IS_RANDOM_TWO\n lifeSizeY = mix(evaluateParticleCurve(renderer_SOLMinCurveY, normalizedAge), lifeSizeY, a_Random0.z);\n #endif\n size *= vec2(lifeSizeX, lifeSizeY);\n #else\n size *= lifeSizeX;\n #endif\n #endif\n return size;\n}\n\n#ifdef RENDERER_MODE_MESH\n vec3 computeParticleSizeMesh(in vec3 size, in float normalizedAge) {\n #ifdef RENDERER_SOL_CURVE\n size *= evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge);\n #endif\n #ifdef RENDERER_SOL_RANDOM_CURVES\n size *= mix(evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge),\n evaluateParticleCurve(u_SOLSizeGradientMax, normalizedAge),\n a_Random0.z);\n #endif\n #ifdef RENDERER_SOL_CURVE_SEPARATE\n size *= vec3(evaluateParticleCurve(renderer_SOLMinCurveX, normalizedAge),\n evaluateParticleCurve(renderer_SOLMinCurveY, normalizedAge),\n evaluateParticleCurve(renderer_SOLMinCurveZ, normalizedAge));\n #endif\n #ifdef RENDERER_SOL_RANDOM_CURVES_SEPARATE\n size *= vec3(mix(evaluateParticleCurve(renderer_SOLMinCurveX, normalizedAge),\n evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge),\n a_Random0.z),\n mix(evaluateParticleCurve(renderer_SOLMinCurveY, normalizedAge),\n evaluateParticleCurve(renderer_SOLMaxCurveY, normalizedAge),\n a_Random0.z),\n mix(evaluateParticleCurve(renderer_SOLMinCurveZ, normalizedAge),\n evaluateParticleCurve(renderer_SOLMaxCurveZ, normalizedAge),\n a_Random0.z));\n #endif\n return size;\n }\n#endif"; // eslint-disable-line
|
|
4735
4745
|
|
|
@@ -4747,7 +4757,7 @@ var vertical_billboard = "#ifdef RENDERER_MODE_VERTICAL_BILLBOARD\n\tvec2 corner
|
|
|
4747
4757
|
|
|
4748
4758
|
var horizontal_billboard = "#ifdef RENDERER_MODE_HORIZONTAL_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy; // Billboard模式z轴无效\n\tconst vec3 cameraUpVector = vec3(0.0, 0.0, 1.0);\n\tconst vec3 sideVector = vec3(-1.0, 0.0, 0.0);\n\n\tfloat rot = computeParticleRotationFloat(a_StartRotation0.x, age, normalizedAge);\n\tfloat c = cos(rot);\n\tfloat s = sin(rot);\n\tmat2 rotation = mat2(c, -s, s, c);\n\tcorner = rotation * corner * cos(0.78539816339744830961566084581988); // TODO:临时缩小cos45,不确定U3D原因\n\tcorner *= computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n\tcenter += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * cameraUpVector);\n#endif"; // eslint-disable-line
|
|
4749
4759
|
|
|
4750
|
-
var particle_mesh = "#ifdef RENDERER_MODE_MESH\n
|
|
4760
|
+
var particle_mesh = "// Only support local alignment mode\n#ifdef RENDERER_MODE_MESH\n #if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #define RENDERER_ROL_ENABLED\n #endif\n\n\tvec3 size = computeParticleSizeMesh(a_StartSize, normalizedAge);\n\n bool is3DRotation = renderer_ThreeDStartRotation;\n #if defined(RENDERER_ROL_ENABLED) && defined(RENDERER_ROL_IS_SEPARATE)\n is3DRotation = true;\n #endif\n\n if (is3DRotation) {\n #ifdef RENDERER_ROL_ENABLED\n vec3 startRotation = renderer_ThreeDStartRotation ? a_StartRotation0 : vec3(0.0, 0.0, a_StartRotation0.x);\n vec3 rotation = computeParticleRotationVec3(startRotation, age, normalizedAge);\n #else\n vec3 rotation = a_StartRotation0;\n #endif\n // 3D Start Rotation is same in local and world simulation space\n center += rotationByQuaternions(renderer_SizeScale * rotationByEuler(POSITION * size, rotation), worldRotation);\n } else {\n #ifdef RENDERER_ROL_ENABLED\n float angle = computeParticleRotationFloat(a_StartRotation0.x, age, normalizedAge);\n #else\n float angle = a_StartRotation0.x;\n #endif\n #ifdef RENDERER_EMISSION_SHAPE\n // Axis is side vector of emit position look at zero\n vec3 axis = vec3(a_ShapePositionStartLifeTime.xy, 0.0);\n if (renderer_SimulationSpace == 1){\n axis = rotationByQuaternions(axis, worldRotation);\n }\n vec3 crossResult = cross(axis, vec3(0.0, 0.0, -1.0));\n float crossLen = length(crossResult);\n vec3 rotateAxis = crossLen > 0.0001 ? crossResult / crossLen : vec3(0.0, 1.0, 0.0);\n #else\n // Axis is negative z\n vec3 rotateAxis = vec3(0.0, 0.0, -1.0);\n #endif\n center += rotationByQuaternions(renderer_SizeScale *rotationByAxis(POSITION * size, rotateAxis, angle), worldRotation);\n }\n #ifdef RENDERER_ENABLE_VERTEXCOLOR\n\t\tv_MeshColor = COLOR_0;\n\t#endif\n#endif"; // eslint-disable-line
|
|
4751
4761
|
|
|
4752
4762
|
var ParticleShaderLib = {
|
|
4753
4763
|
particle_common: particle_common,
|
|
@@ -19133,11 +19143,11 @@ var BlendShapeFrameDirty = /*#__PURE__*/ function(BlendShapeFrameDirty) {
|
|
|
19133
19143
|
]);
|
|
19134
19144
|
return MeshRenderer;
|
|
19135
19145
|
}(exports.Renderer);
|
|
19146
|
+
/** @internal */ MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
19136
19147
|
MeshRenderer._uvMacro = ShaderMacro.getByName("RENDERER_HAS_UV");
|
|
19137
19148
|
MeshRenderer._uv1Macro = ShaderMacro.getByName("RENDERER_HAS_UV1");
|
|
19138
19149
|
MeshRenderer._normalMacro = ShaderMacro.getByName("RENDERER_HAS_NORMAL");
|
|
19139
19150
|
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
19140
|
-
MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
19141
19151
|
__decorate([
|
|
19142
19152
|
ignoreClone
|
|
19143
19153
|
], MeshRenderer.prototype, "_mesh", void 0);
|
|
@@ -25784,9 +25794,9 @@ var depthOnlyFs = "void main() {\n}"; // eslint-disable-line
|
|
|
25784
25794
|
|
|
25785
25795
|
var depthOnlyVs = "#define MATERIAL_OMIT_NORMAL\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\nuniform mat4 camera_VPMat;\n\n\nvoid main() {\n\n #include <begin_position_vert>\n #include <blendShape_vert>\n #include <skinning_vert>\n #include <position_vert>\n\n}\n"; // eslint-disable-line
|
|
25786
25796
|
|
|
25787
|
-
var particleFs = "#include <common>\n\nvarying vec4 v_Color;\nvarying vec2 v_TextureCoordinate;\nuniform sampler2D material_BaseTexture;\nuniform vec4 material_BaseColor;\n \nuniform mediump vec3 material_EmissiveColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\n uniform sampler2D material_EmissiveTexture;\n#endif\n\n#ifdef RENDERER_MODE_MESH\n\tvarying vec4 v_MeshColor;\n#endif\n\nvoid main() {\n\tvec4 color = material_BaseColor * v_Color;\n\n\t#
|
|
25797
|
+
var particleFs = "#include <common>\n\nvarying vec4 v_Color;\nvarying vec2 v_TextureCoordinate;\nuniform sampler2D material_BaseTexture;\nuniform vec4 material_BaseColor;\n \nuniform mediump vec3 material_EmissiveColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\n uniform sampler2D material_EmissiveTexture;\n#endif\n\n#ifdef RENDERER_MODE_MESH\n\tvarying vec4 v_MeshColor;\n#endif\n\nvoid main() {\n\tvec4 color = material_BaseColor * v_Color;\n\n\t#if defined(RENDERER_MODE_MESH) && defined(RENDERER_ENABLE_VERTEXCOLOR)\n\t\tcolor *= v_MeshColor;\n\t#endif\n\n\t#ifdef MATERIAL_HAS_BASETEXTURE\n\t\tcolor *= texture2DSRGB(material_BaseTexture, v_TextureCoordinate);\n\t#endif\n\t\n\t// Emissive\n\tvec3 emissiveRadiance = material_EmissiveColor;\n\t#ifdef MATERIAL_HAS_EMISSIVETEXTURE\n\t\temissiveRadiance *= texture2DSRGB(material_EmissiveTexture, v_TextureCoordinate).rgb;\n\t#endif\n\n\tcolor.rgb += emissiveRadiance;\n\n\tgl_FragColor = color;\n}"; // eslint-disable-line
|
|
25788
25798
|
|
|
25789
|
-
var particleVs = "#if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\n attribute vec4 a_CornerTextureCoordinate;\n#endif\n\n#ifdef RENDERER_MODE_MESH\n attribute vec3
|
|
25799
|
+
var particleVs = "#if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\n attribute vec4 a_CornerTextureCoordinate;\n#endif\n\n#ifdef RENDERER_MODE_MESH\n attribute vec3 POSITION;\n #ifdef RENDERER_ENABLE_VERTEXCOLOR\n attribute vec4 COLOR_0;\n #endif\n attribute vec2 TEXCOORD_0;\n varying vec4 v_MeshColor;\n#endif\n\nattribute vec4 a_ShapePositionStartLifeTime;\nattribute vec4 a_DirectionTime;\nattribute vec4 a_StartColor;\nattribute vec3 a_StartSize;\nattribute vec3 a_StartRotation0;\nattribute float a_StartSpeed;\n\n//#if defined(COLOR_OVER_LIFETIME) || defined(RENDERER_COL_RANDOM_GRADIENTS) || defined(RENDERER_SOL_RANDOM_CURVES) || defined(RENDERER_SOL_RANDOM_CURVES_SEPARATE) || defined(ROTATION_OVER_LIFE_TIME_RANDOM_CONSTANTS) || defined(ROTATION_OVER_LIFETIME_RANDOM_CURVES)\n attribute vec4 a_Random0;\n//#endif\n\n#if defined(RENDERER_TSA_FRAME_RANDOM_CURVES) || defined(RENDERER_VOL_IS_RANDOM_TWO)\n attribute vec4 a_Random1; // x:texture sheet animation random\n#endif\n\nattribute vec3 a_SimulationWorldPosition;\nattribute vec4 a_SimulationWorldRotation;\n\nvarying vec4 v_Color;\n#ifdef MATERIAL_HAS_BASETEXTURE\n attribute vec4 a_SimulationUV;\n varying vec2 v_TextureCoordinate;\n#endif\n\nuniform float renderer_CurrentTime;\nuniform vec3 renderer_Gravity;\nuniform vec2 u_DragConstant;\nuniform vec3 renderer_WorldPosition;\nuniform vec4 renderer_WorldRotation;\nuniform bool renderer_ThreeDStartRotation;\nuniform int renderer_ScalingMode;\nuniform vec3 renderer_PositionScale;\nuniform vec3 renderer_SizeScale;\nuniform vec3 renderer_PivotOffset;\n\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\n\n#ifdef RENDERER_MODE_STRETCHED_BILLBOARD\n uniform vec3 camera_Position;\n#endif\nuniform vec3 camera_Forward; // TODO:只有几种广告牌模式需要用\nuniform vec3 camera_Up;\n\nuniform float renderer_StretchedBillboardLengthScale;\nuniform float renderer_StretchedBillboardSpeedScale;\nuniform int renderer_SimulationSpace;\n\n#include <particle_common>\n#include <velocity_over_lifetime_module>\n#include <force_over_lifetime_module>\n#include <color_over_lifetime_module>\n#include <size_over_lifetime_module>\n#include <rotation_over_lifetime_module>\n#include <texture_sheet_animation_module>\n\nvec3 getStartPosition(vec3 startVelocity, float age, vec3 dragData) {\n vec3 startPosition;\n float lastTime = min(startVelocity.x / dragData.x, age); // todo 0/0\n startPosition = lastTime * (startVelocity - 0.5 * dragData * lastTime);\n return startPosition;\n}\n\nvec3 computeParticlePosition(in vec3 startVelocity, in float age, in float normalizedAge, vec3 gravityVelocity, vec4 worldRotation, vec3 dragData, inout vec3 localVelocity, inout vec3 worldVelocity) {\n vec3 startPosition = getStartPosition(startVelocity, age, dragData);\n\n vec3 finalPosition;\n vec3 localPositionOffset = startPosition;\n vec3 worldPositionOffset;\n\n #ifdef _VOL_MODULE_ENABLED\n vec3 lifeVelocity; \n vec3 velocityPositionOffset = computeVelocityPositionOffset(normalizedAge, age, lifeVelocity);\n if (renderer_VOLSpace == 0) {\n localVelocity += lifeVelocity;\n localPositionOffset += velocityPositionOffset;\n } else {\n worldVelocity += lifeVelocity;\n worldPositionOffset += velocityPositionOffset;\n }\n #endif\n\n #ifdef _FOL_MODULE_ENABLED\n vec3 forceVelocity;\n vec3 forcePositionOffset = computeForcePositionOffset(normalizedAge, age, forceVelocity);\n if (renderer_FOLSpace == 0) {\n localVelocity += forceVelocity;\n localPositionOffset += forcePositionOffset;\n } else {\n worldVelocity += forceVelocity;\n worldPositionOffset += forcePositionOffset;\n }\n #endif\n\n finalPosition = rotationByQuaternions(a_ShapePositionStartLifeTime.xyz + localPositionOffset, worldRotation) + worldPositionOffset;\n\n if (renderer_SimulationSpace == 0) {\n finalPosition = finalPosition + renderer_WorldPosition;\n } else if (renderer_SimulationSpace == 1) {\n\t finalPosition = finalPosition + a_SimulationWorldPosition;\n\t}\n\n finalPosition += 0.5 * gravityVelocity * age;\n\n return finalPosition;\n}\n\nvoid main() {\n float age = renderer_CurrentTime - a_DirectionTime.w;\n float normalizedAge = age / a_ShapePositionStartLifeTime.w;\n if (normalizedAge < 1.0) {\n vec3 startVelocity = a_DirectionTime.xyz * a_StartSpeed;\n vec3 gravityVelocity = renderer_Gravity * a_Random0.x * age;\n\n vec4 worldRotation;\n if (renderer_SimulationSpace == 0) {\n worldRotation = renderer_WorldRotation;\n } else {\n worldRotation = a_SimulationWorldRotation;\n }\n\n vec3 localVelocity = startVelocity;\n vec3 worldVelocity = gravityVelocity;\n\n //drag\n vec3 dragData = a_DirectionTime.xyz * mix(u_DragConstant.x, u_DragConstant.y, a_Random0.x);\n vec3 center = computeParticlePosition(startVelocity, age, normalizedAge, gravityVelocity, worldRotation, dragData, localVelocity, worldVelocity);\n\n #include <sphere_billboard>\n #include <stretched_billboard>\n #include <horizontal_billboard>\n #include <vertical_billboard>\n #include <particle_mesh>\n\n gl_Position = camera_ProjMat * camera_ViewMat * vec4(center, 1.0);\n v_Color = computeParticleColor(a_StartColor, normalizedAge);\n\n #ifdef MATERIAL_HAS_BASETEXTURE\n vec2 simulateUV;\n #if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\n simulateUV = a_CornerTextureCoordinate.zw * a_SimulationUV.xy + a_SimulationUV.zw;\n v_TextureCoordinate = computeParticleUV(simulateUV, normalizedAge);\n #endif\n #ifdef RENDERER_MODE_MESH\n simulateUV = a_SimulationUV.zw + TEXCOORD_0 * a_SimulationUV.xy;\n v_TextureCoordinate = computeParticleUV(simulateUV, normalizedAge);\n #endif\n #endif\n } else {\n\t gl_Position = vec4(2.0, 2.0, 2.0, 1.0); // Discard use out of X(-1,1),Y(-1,1),Z(0,1)\n }\n}"; // eslint-disable-line
|
|
25790
25800
|
|
|
25791
25801
|
var pbrSpecularFs = "#include <common>\n#include <camera_declare>\n\n#include <FogFragmentDeclaration>\n\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n\n#include <light_frag_define>\n\n\n#include <pbr_frag_define>\n#include <pbr_helper>\n\nvoid main() {\n #include <pbr_frag>\n #include <FogFragment>\n}\n"; // eslint-disable-line
|
|
25792
25802
|
|
|
@@ -32476,7 +32486,7 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
32476
32486
|
}
|
|
32477
32487
|
generator._primitive.instanceCount = aliveParticleCount;
|
|
32478
32488
|
var material = this.getMaterial();
|
|
32479
|
-
if (!material) {
|
|
32489
|
+
if (!material || this._renderMode === ParticleRenderMode.Mesh && !this._mesh) {
|
|
32480
32490
|
return;
|
|
32481
32491
|
}
|
|
32482
32492
|
if (material.destroyed || material.shader.destroyed) {
|
|
@@ -32536,7 +32546,6 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
32536
32546
|
var lastRenderMode = this._renderMode;
|
|
32537
32547
|
this._renderMode = value;
|
|
32538
32548
|
var renderModeMacro = null;
|
|
32539
|
-
var shaderData = this.shaderData;
|
|
32540
32549
|
switch(value){
|
|
32541
32550
|
case ParticleRenderMode.Billboard:
|
|
32542
32551
|
renderModeMacro = ParticleRenderer._billboardModeMacro;
|
|
@@ -32549,16 +32558,21 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
32549
32558
|
case ParticleRenderMode.VerticalBillboard:
|
|
32550
32559
|
throw "Not implemented";
|
|
32551
32560
|
case ParticleRenderMode.Mesh:
|
|
32552
|
-
|
|
32561
|
+
renderModeMacro = ParticleRenderer._meshModeMacro;
|
|
32562
|
+
break;
|
|
32553
32563
|
}
|
|
32554
32564
|
if (this._currentRenderModeMacro !== renderModeMacro) {
|
|
32565
|
+
var shaderData = this.shaderData;
|
|
32555
32566
|
this._currentRenderModeMacro && shaderData.disableMacro(this._currentRenderModeMacro);
|
|
32556
32567
|
renderModeMacro && shaderData.enableMacro(renderModeMacro);
|
|
32557
32568
|
this._currentRenderModeMacro = renderModeMacro;
|
|
32558
32569
|
}
|
|
32559
|
-
|
|
32560
|
-
|
|
32561
|
-
|
|
32570
|
+
var wasMeshMode = lastRenderMode === ParticleRenderMode.Mesh;
|
|
32571
|
+
var isMeshMode = value === ParticleRenderMode.Mesh;
|
|
32572
|
+
if (wasMeshMode !== isMeshMode) {
|
|
32573
|
+
if (!isMeshMode || this.mesh) {
|
|
32574
|
+
this.generator._reorganizeGeometryBuffers();
|
|
32575
|
+
}
|
|
32562
32576
|
}
|
|
32563
32577
|
}
|
|
32564
32578
|
}
|
|
@@ -32566,8 +32580,8 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
32566
32580
|
{
|
|
32567
32581
|
key: "mesh",
|
|
32568
32582
|
get: /**
|
|
32569
|
-
* The mesh
|
|
32570
|
-
* @remarks
|
|
32583
|
+
* The mesh shape for rendering each emitted particle.
|
|
32584
|
+
* @remarks Only effective when `renderMode` is `ParticleRenderMode.Mesh`.
|
|
32571
32585
|
*/ function get() {
|
|
32572
32586
|
return this._mesh;
|
|
32573
32587
|
},
|
|
@@ -32576,9 +32590,14 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
32576
32590
|
if (lastMesh !== value) {
|
|
32577
32591
|
this._mesh = value;
|
|
32578
32592
|
lastMesh && this._addResourceReferCount(lastMesh, -1);
|
|
32579
|
-
|
|
32580
|
-
|
|
32581
|
-
|
|
32593
|
+
if (value) {
|
|
32594
|
+
if (value.subMeshes.length !== 1) {
|
|
32595
|
+
Logger.error("Particle emit mesh must have only one sub mesh.");
|
|
32596
|
+
}
|
|
32597
|
+
this._addResourceReferCount(value, 1);
|
|
32598
|
+
if (this.renderMode === ParticleRenderMode.Mesh) {
|
|
32599
|
+
this.generator._reorganizeGeometryBuffers();
|
|
32600
|
+
}
|
|
32582
32601
|
}
|
|
32583
32602
|
}
|
|
32584
32603
|
}
|
|
@@ -32590,7 +32609,7 @@ ParticleRenderer._billboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_SPHE
|
|
|
32590
32609
|
ParticleRenderer._stretchedBillboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_STRETCHED_BILLBOARD");
|
|
32591
32610
|
ParticleRenderer._horizontalBillboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_HORIZONTAL_BILLBOARD");
|
|
32592
32611
|
ParticleRenderer._verticalBillboardModeMacro = ShaderMacro.getByName("RENDERER_MODE_VERTICAL_BILLBOARD");
|
|
32593
|
-
ParticleRenderer.
|
|
32612
|
+
ParticleRenderer._meshModeMacro = ShaderMacro.getByName("RENDERER_MODE_MESH");
|
|
32594
32613
|
ParticleRenderer._pivotOffsetProperty = ShaderProperty.getByName("renderer_PivotOffset");
|
|
32595
32614
|
ParticleRenderer._lengthScale = ShaderProperty.getByName("renderer_StretchedBillboardLengthScale");
|
|
32596
32615
|
ParticleRenderer._speedScale = ShaderProperty.getByName("renderer_StretchedBillboardSpeedScale");
|
|
@@ -33481,6 +33500,24 @@ __decorate([
|
|
|
33481
33500
|
this._currentBurstIndex = index;
|
|
33482
33501
|
};
|
|
33483
33502
|
_create_class(EmissionModule, [
|
|
33503
|
+
{
|
|
33504
|
+
key: "enabled",
|
|
33505
|
+
get: /**
|
|
33506
|
+
* @inheritdoc
|
|
33507
|
+
*/ function get() {
|
|
33508
|
+
return this._enabled;
|
|
33509
|
+
},
|
|
33510
|
+
set: function set(value) {
|
|
33511
|
+
if (value !== this._enabled) {
|
|
33512
|
+
this._enabled = value;
|
|
33513
|
+
if (value && this._shape) {
|
|
33514
|
+
this._generator._renderer.shaderData.enableMacro(EmissionModule._emissionShapeMacro);
|
|
33515
|
+
} else {
|
|
33516
|
+
this._generator._renderer.shaderData.disableMacro(EmissionModule._emissionShapeMacro);
|
|
33517
|
+
}
|
|
33518
|
+
}
|
|
33519
|
+
}
|
|
33520
|
+
},
|
|
33484
33521
|
{
|
|
33485
33522
|
key: "shape",
|
|
33486
33523
|
get: /**
|
|
@@ -33494,7 +33531,12 @@ __decorate([
|
|
|
33494
33531
|
this._shape = value;
|
|
33495
33532
|
var renderer = this._generator._renderer;
|
|
33496
33533
|
lastShape == null ? void 0 : lastShape._unRegisterOnValueChanged(renderer._onGeneratorParamsChanged);
|
|
33497
|
-
|
|
33534
|
+
if (value) {
|
|
33535
|
+
value._registerOnValueChanged(renderer._onGeneratorParamsChanged);
|
|
33536
|
+
this.enabled && renderer.shaderData.enableMacro(EmissionModule._emissionShapeMacro);
|
|
33537
|
+
} else {
|
|
33538
|
+
renderer.shaderData.disableMacro(EmissionModule._emissionShapeMacro);
|
|
33539
|
+
}
|
|
33498
33540
|
renderer._onGeneratorParamsChanged();
|
|
33499
33541
|
}
|
|
33500
33542
|
}
|
|
@@ -33510,6 +33552,7 @@ __decorate([
|
|
|
33510
33552
|
]);
|
|
33511
33553
|
return EmissionModule;
|
|
33512
33554
|
}(ParticleGeneratorModule);
|
|
33555
|
+
/** @internal */ EmissionModule._emissionShapeMacro = ShaderMacro.getByName("RENDERER_EMISSION_SHAPE");
|
|
33513
33556
|
__decorate([
|
|
33514
33557
|
deepClone
|
|
33515
33558
|
], EmissionModule.prototype, "rateOverTime", void 0);
|
|
@@ -34041,7 +34084,7 @@ __decorate([
|
|
|
34041
34084
|
* @internal
|
|
34042
34085
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
34043
34086
|
var enableSeparateMacro = null;
|
|
34044
|
-
var
|
|
34087
|
+
var modeMacro = null;
|
|
34045
34088
|
var isRandomTwoMacro = null;
|
|
34046
34089
|
if (this.enabled) {
|
|
34047
34090
|
var rotationX = this.rotationX;
|
|
@@ -34064,7 +34107,7 @@ __decorate([
|
|
|
34064
34107
|
}
|
|
34065
34108
|
isRandomTwoMacro = RotationOverLifetimeModule._isRandomTwoMacro;
|
|
34066
34109
|
}
|
|
34067
|
-
|
|
34110
|
+
modeMacro = RotationOverLifetimeModule._curveModeMacro;
|
|
34068
34111
|
} else {
|
|
34069
34112
|
var constantMax = this._rotationMaxConstant;
|
|
34070
34113
|
constantMax.set(engineMath.MathUtil.degreeToRadian(rotationX.constantMax), engineMath.MathUtil.degreeToRadian(rotationY.constantMax), engineMath.MathUtil.degreeToRadian(rotationZ.constantMax));
|
|
@@ -34075,14 +34118,14 @@ __decorate([
|
|
|
34075
34118
|
shaderData.setVector3(RotationOverLifetimeModule._minConstantProperty, constantMin);
|
|
34076
34119
|
isRandomTwoMacro = RotationOverLifetimeModule._isRandomTwoMacro;
|
|
34077
34120
|
}
|
|
34078
|
-
|
|
34121
|
+
modeMacro = RotationOverLifetimeModule._constantModeMacro;
|
|
34079
34122
|
}
|
|
34080
34123
|
if (separateAxes) {
|
|
34081
34124
|
enableSeparateMacro = RotationOverLifetimeModule._isSeparateMacro;
|
|
34082
34125
|
}
|
|
34083
34126
|
}
|
|
34084
34127
|
this._enableSeparateMacro = this._enableMacro(shaderData, this._enableSeparateMacro, enableSeparateMacro);
|
|
34085
|
-
this.
|
|
34128
|
+
this._modeMacro = this._enableMacro(shaderData, this._modeMacro, modeMacro);
|
|
34086
34129
|
this._isRandomTwoMacro = this._enableMacro(shaderData, this._isRandomTwoMacro, isRandomTwoMacro);
|
|
34087
34130
|
};
|
|
34088
34131
|
/**
|
|
@@ -34127,7 +34170,7 @@ __decorate([
|
|
|
34127
34170
|
], RotationOverLifetimeModule.prototype, "_enableSeparateMacro", void 0);
|
|
34128
34171
|
__decorate([
|
|
34129
34172
|
ignoreClone
|
|
34130
|
-
], RotationOverLifetimeModule.prototype, "
|
|
34173
|
+
], RotationOverLifetimeModule.prototype, "_modeMacro", void 0);
|
|
34131
34174
|
__decorate([
|
|
34132
34175
|
ignoreClone
|
|
34133
34176
|
], RotationOverLifetimeModule.prototype, "_isRandomTwoMacro", void 0);
|
|
@@ -34817,25 +34860,32 @@ __decorate([
|
|
|
34817
34860
|
/**
|
|
34818
34861
|
* @internal
|
|
34819
34862
|
*/ _proto._emit = function _emit(playTime, count) {
|
|
34820
|
-
|
|
34863
|
+
var emission = this.emission;
|
|
34864
|
+
if (emission.enabled) {
|
|
34865
|
+
var main = this.main;
|
|
34821
34866
|
// Wait the existing particles to be retired
|
|
34822
34867
|
var notRetireParticleCount = this._getNotRetiredParticleCount();
|
|
34823
|
-
if (notRetireParticleCount >=
|
|
34868
|
+
if (notRetireParticleCount >= main.maxParticles) {
|
|
34824
34869
|
return;
|
|
34825
34870
|
}
|
|
34826
34871
|
var position = ParticleGenerator._tempVector30;
|
|
34827
34872
|
var direction = ParticleGenerator._tempVector31;
|
|
34828
34873
|
var transform = this._renderer.entity.transform;
|
|
34829
|
-
var shape =
|
|
34874
|
+
var shape = emission.shape;
|
|
34875
|
+
var positionScale = main._getPositionScale();
|
|
34830
34876
|
for(var i = 0; i < count; i++){
|
|
34831
34877
|
if (shape == null ? void 0 : shape.enabled) {
|
|
34832
|
-
shape._generatePositionAndDirection(
|
|
34833
|
-
var positionScale = this.main._getPositionScale();
|
|
34878
|
+
shape._generatePositionAndDirection(emission._shapeRand, playTime, position, direction);
|
|
34834
34879
|
position.multiply(positionScale);
|
|
34835
34880
|
direction.normalize().multiply(positionScale);
|
|
34836
34881
|
} else {
|
|
34837
34882
|
position.set(0, 0, 0);
|
|
34838
34883
|
direction.set(0, 0, -1);
|
|
34884
|
+
// Speed is scaled by shape scale in world simulation space
|
|
34885
|
+
// So if no shape and in world simulation space, we shouldn't scale the speed
|
|
34886
|
+
if (main.simulationSpace === ParticleSimulationSpace.Local) {
|
|
34887
|
+
direction.multiply(positionScale);
|
|
34888
|
+
}
|
|
34839
34889
|
}
|
|
34840
34890
|
this._addNewParticle(position, direction, transform, playTime);
|
|
34841
34891
|
}
|
|
@@ -34902,17 +34952,12 @@ __decorate([
|
|
|
34902
34952
|
/**
|
|
34903
34953
|
* @internal
|
|
34904
34954
|
*/ _proto._reorganizeGeometryBuffers = function _reorganizeGeometryBuffers() {
|
|
34905
|
-
var renderer =
|
|
34906
|
-
var
|
|
34907
|
-
var primitive = this._primitive;
|
|
34908
|
-
var vertexBufferBindings = this._vertexBufferBindings;
|
|
34955
|
+
var _this = this, renderer = _this._renderer, primitive = _this._primitive, vertexBufferBindings = _this._vertexBufferBindings;
|
|
34956
|
+
var _renderer_engine = renderer.engine, particleUtils = _renderer_engine._particleBufferUtils;
|
|
34909
34957
|
primitive.clearVertexElements();
|
|
34910
34958
|
vertexBufferBindings.length = 0;
|
|
34911
34959
|
if (renderer.renderMode === ParticleRenderMode.Mesh) {
|
|
34912
34960
|
var mesh = renderer.mesh;
|
|
34913
|
-
if (!mesh) {
|
|
34914
|
-
return;
|
|
34915
|
-
}
|
|
34916
34961
|
var positionElement = mesh.getVertexElement(VertexAttribute.Position);
|
|
34917
34962
|
var colorElement = mesh.getVertexElement(VertexAttribute.Color);
|
|
34918
34963
|
var uvElement = mesh.getVertexElement(VertexAttribute.UV);
|
|
@@ -34926,28 +34971,38 @@ __decorate([
|
|
|
34926
34971
|
if (colorBufferBinding) {
|
|
34927
34972
|
var index1 = this._addVertexBufferBindingsFilterDuplicate(colorBufferBinding, vertexBufferBindings);
|
|
34928
34973
|
primitive.addVertexElement(new VertexElement(VertexAttribute.Color, colorElement.offset, colorElement.format, index1));
|
|
34974
|
+
renderer.shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
34975
|
+
} else {
|
|
34976
|
+
renderer.shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
34929
34977
|
}
|
|
34930
34978
|
if (uvBufferBinding) {
|
|
34931
34979
|
var index2 = this._addVertexBufferBindingsFilterDuplicate(uvBufferBinding, vertexBufferBindings);
|
|
34932
34980
|
primitive.addVertexElement(new VertexElement(VertexAttribute.UV, uvElement.offset, uvElement.format, index2));
|
|
34933
34981
|
}
|
|
34934
|
-
|
|
34935
|
-
var
|
|
34936
|
-
|
|
34937
|
-
|
|
34982
|
+
primitive.setIndexBufferBinding(mesh._primitive.indexBufferBinding);
|
|
34983
|
+
var subMesh = mesh.subMesh;
|
|
34984
|
+
var _this1 = this, subPrimitive = _this1._subPrimitive;
|
|
34985
|
+
subPrimitive.start = subMesh.start;
|
|
34986
|
+
subPrimitive.topology = subMesh.topology;
|
|
34987
|
+
subPrimitive.count = subMesh.count;
|
|
34938
34988
|
} else {
|
|
34989
|
+
renderer.shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
34939
34990
|
primitive.addVertexElement(particleUtils.billboardVertexElement);
|
|
34940
34991
|
vertexBufferBindings.push(particleUtils.billboardVertexBufferBinding);
|
|
34941
34992
|
primitive.setIndexBufferBinding(particleUtils.billboardIndexBufferBinding);
|
|
34942
34993
|
this._subPrimitive.count = ParticleBufferUtils.billboardIndexCount;
|
|
34943
34994
|
}
|
|
34944
|
-
primitive.setVertexBufferBindings(vertexBufferBindings);
|
|
34945
34995
|
var instanceVertexElements = particleUtils.instanceVertexElements;
|
|
34946
34996
|
var bindingIndex = vertexBufferBindings.length;
|
|
34947
34997
|
for(var i = 0, n = instanceVertexElements.length; i < n; i++){
|
|
34948
34998
|
var element = instanceVertexElements[i];
|
|
34949
34999
|
primitive.addVertexElement(new VertexElement(element.attribute, element.offset, element.format, bindingIndex, element.instanceStepRate));
|
|
34950
35000
|
}
|
|
35001
|
+
// If instance buffer already created
|
|
35002
|
+
if (this._instanceVertexBufferBinding) {
|
|
35003
|
+
vertexBufferBindings.push(this._instanceVertexBufferBinding);
|
|
35004
|
+
}
|
|
35005
|
+
primitive.setVertexBufferBindings(vertexBufferBindings);
|
|
34951
35006
|
};
|
|
34952
35007
|
/**
|
|
34953
35008
|
* @internal
|
|
@@ -35211,16 +35266,20 @@ __decorate([
|
|
|
35211
35266
|
}
|
|
35212
35267
|
// Start rotation
|
|
35213
35268
|
var startRotationRand = main._startRotationRand, flipRotation = main.flipRotation;
|
|
35214
|
-
var
|
|
35269
|
+
var isFlip = flipRotation > startRotationRand.random();
|
|
35270
|
+
// @todo:None-Mesh mode should inverse the rotation, maybe should unify it
|
|
35271
|
+
if (this._renderer.renderMode !== ParticleRenderMode.Mesh) {
|
|
35272
|
+
isFlip = !isFlip;
|
|
35273
|
+
}
|
|
35215
35274
|
var rotationZ = engineMath.MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
|
|
35216
35275
|
if (main.startRotation3D) {
|
|
35217
35276
|
var rotationX = engineMath.MathUtil.degreeToRadian(main.startRotationX.evaluate(undefined, startRotationRand.random()));
|
|
35218
35277
|
var rotationY = engineMath.MathUtil.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
|
|
35219
|
-
instanceVertices[offset + 15] =
|
|
35220
|
-
instanceVertices[offset + 16] =
|
|
35221
|
-
instanceVertices[offset + 17] =
|
|
35278
|
+
instanceVertices[offset + 15] = isFlip ? -rotationX : rotationX;
|
|
35279
|
+
instanceVertices[offset + 16] = isFlip ? -rotationY : rotationY;
|
|
35280
|
+
instanceVertices[offset + 17] = isFlip ? -rotationZ : rotationZ;
|
|
35222
35281
|
} else {
|
|
35223
|
-
instanceVertices[offset + 15] =
|
|
35282
|
+
instanceVertices[offset + 15] = isFlip ? -rotationZ : rotationZ;
|
|
35224
35283
|
}
|
|
35225
35284
|
// Start speed
|
|
35226
35285
|
instanceVertices[offset + 18] = startSpeed;
|