UNPKG

@realsee/five

Version:

Realsee Renderer SDK

646 lines (577 loc) • 46.7 kB
/** * @license * @realsee/five * Generated: 10/28/2026 * Version: 6.9.3 * Terms: * Realsee SDK License Agreement * Update: July 28, 2021 * THIS LICENSE AGREEMENT BETWEEN YOU AND 【BEIKE REALSEE TECHNOLOGY (HK) * LIMITED】(“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN * RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee * Software Development Kit(s) for the software and related explanatory materials * (the "SDK") and includes any upgrades, modified versions, updates, additions, * and copies of the SDK licensed to You by Realsee. * BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE * THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE * AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO * THE TERMS AND CONDITIONS STATED BELOW. * This Agreement applies to Your use of the SDK in the country in which You * legally install it (“Territory”) and is subject to the laws of such Territory * and further subject to Section 12 below. Different terms, conditions, and * limitations may apply to the use of the SDK in any additional countries. * 1. DEFINITIONS. * “Agreement” means this Realsee SDK License Agreement. * “Developer”, “You” and “Your” means the person(s) or entity acquiring or using * the SDK or otherwise exercising rights under the terms of this Agreement. * “Documentation” means the technical or other specifications or documentation * that Realsee may provide to You for use in connection with the SDK. * “Integrated Product” means any software, website, or on-line service developed * by You based on or using the SDK (collectively, the “Integrated Product”). * “Intellectual Property” means any patents, patent rights, trademarks, service * marks, registered and unregistered designs, applications for any of the * foregoing, copyright, and any other similar protected rights in any country and * to the extent recognised by any relevant jurisdiction as intellectual property, * trade secrets, know-how and confidential information. Realsee reserves all * rights not expressly granted to You. * “Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated * and validly existing under the laws of Hong Kong]. * “SDK” means the Realsee-proprietary Software Development Kits (SDK) provided * hereunder, includes all development tools (including any compiler and debugger), * application programming interfaces (“APIs”), libraries, binary utilities, header * files, Documentation, content, data, code samples, and other materials provided * to You in connection with this Agreement, whether delivered through a download, * or any other media or form, and is licensed, not sold, to You by Realsee for use * only under the terms of this Agreement. The terms of this Agreement will govern * any updates provided by Realsee that replace and/or supplement the original SDK * delivered to You, unless such update is accompanied by a separate license, in * which case the terms of such license will govern. * 2. LICENSED USES AND RESTRICTIONS. * 2.1 Subject to the restrictions contained in this Section 2, Realsee grants to * You during the term, a limited, non-exclusive, revocable, non-sublicensable, * non-transferable license to install and use the SDK within the Territory only * for the purpose of internal development. * 2.2 Restrictions. You acknowledge and agree that, You shall not, and shall * ensure that Your affiliates, employees, agents, representatives, officers, * representatives, and subcontractors do not (directly or indirectly): * 2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source * code of, those components of the SDK provided in object code form, or any part * thereof; * 2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights * notice on any part of the SDK; * 2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website * or server for use by any third party except You, redistribute, or sublicense the * SDK (or any part thereof), or operate the SDK (or any part thereof) in the * capacity of a service bureau or other hosted services provider, in whole or in * part, nor may You enable others to do so; * 2.2.4 or alter, modify, customize or improve the SDK, or any part thereof; * 2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner * that is inconsistent with the terms of this Agreement, or to engage in any * illegal activity; * 2.2.6 use the SDK (or any part thereof) in any manner that may damage the * operation of Realsee’s products or services; or * 2.2.7 use the SDK or any information contained therein or otherwise provided by * Realsee for the purpose of developing, or having developed, any product * competitive with any Realsee product or service, as determined by Realsee in its * sole discretion; * 2.2.8 include any portion of the SDK in Your Developer products. * 2.3 Realsee has the right to impose reasonable conditions such as a reasonable * fee for use of the SDK in Integrated Product in the future. * 2.4 You may make a limited number of copies of the SDK to be used by Your * employees or consultants as provided herein, and not for general business * purposes, and such employees or consultants shall be subject to the obligations * and restrictions in this Agreement. * 2.5 All licenses not expressly granted in this Agreement are reserved and no * other licenses, immunity, or rights, express or implied, are granted by Realsee, * by implication, estoppel, or otherwise. * 3. CONFIDENTIALITY. * The SDK and all source code, Documentation, specifications, engineering details, * and related information pertaining to the SDK, whether in oral, written, * graphic, or electronic form, are and shall remain the confidential and * proprietary information of Realsee or its licensors (collectively, the * “Confidential Information”). You shall (i) disclose Confidential Information to * only those directors and employees (collectively, “Affiliates”) whose duties * justify their need to know such information and who have been clearly informed * of their obligation to maintain the confidential, proprietary, and/or trade * secret status of such Confidential Information; and (ii) use Confidential * Information solely in accordance with the license granted hereunder. In any * event, You and Your Affiliates shall treat Confidential Information as strictly * confidential and shall use the same care to prevent disclosure of such * information as You use with respect to Your own similar confidential and/or * proprietary information, which shall not be less than the care a reasonable * person would use under similar circumstances. All Confidential Information, and * any copies thereof, shall be returned promptly to Realsee upon request. You * shall ensure that Your Affiliates comply with the provisions of this Section 3, * and You shall be liable for any breach of this Section 3 resulting from the act * or omission of any of Your Affiliates. You shall not disclose Confidential * Information to any third party, including, without limitation, any of Your * subcontractors. * 4. PROPRIETARY RIGHTS. * 4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of * all right, title, and interest in, to, and under the SDK, including, without * limitation, all patents, copyrights, trade secrets, trademarks and other * intellectual property and other proprietary rights therein, and reserve all * rights not expressly granted to You. * 4.2 The items contained in the SDK are the intellectual property of Realsee and * its licensors and are protected by PRC copyright and patent law, international * treaty provisions and applicable laws of the country in which it is being used. * You agree to protect all copyright and other ownership interests of Realsee * and/or its licensors in all items in the SDK supplied under this License * Agreement. You agree that all copies of the items in the SDK, reproduced for any * reason by You, contain the same copyright notices, and other proprietary notices * as appropriate, as appear on or in the original items delivered by Realsee in * the SDK. Realsee and/or its licensors retain title and ownership of the items in * the SDK, the media on which it is loaded, and all subsequent copies, regardless * of the form or media in or on which the original and other copies may exist. * Except as stated above, this Agreement does not grant You any rights to patents, * copyrights, trade secrets, trademarks or any other rights in respect to the * items in the SDK. * 5. TERM AND TERMINATION. * 5.1 This Agreement is effective until terminated. Realsee has the right to * terminate this Agreement immediately, without judicial intervention, if You fail * to comply with any term herein. Upon any such termination You must remove all * full and partial copies of the items in the SDK from Your computer and * discontinue the use of the items in the SDK. * 5.2 Realsee may at any time, terminate the Agreement with You if: (A) You have * breached any provision of the Agreement; or (B) Realsee is required to do so by * law; or (C) Realsee decides to no longer provide the SDK or certain parts of the * SDK to users in the country in which You are resident or from which You use the * service, or the provision of the SDK or certain SDK services to You by Realsee * is, in Realsee's sole discretion, no longer legally or commercially viable. * 5.3 When the Agreement comes to an end, all of the legal rights, obligations and * liabilities that You and Realsee have benefited from, been subject to (or which * have accrued over time whilst the Agreement has been in force) or which are * expressed to continue indefinitely, shall be unaffected by this cessation, and * the provisions of Section 3, 4, 6, 7 and 8 shall continue to apply to such * rights, obligations and liabilities indefinitely. * 6. DISCLAIMER OF WARRANTY. * YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE * LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE * ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS * WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE * MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK, * WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY * PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR * RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING * OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT * CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL * WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED * CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK * OR ANY SERVICES RELATED TO THE SDK. * REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE * AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS * THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY. * 7. LIMITATION OF LIABILITY. * TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS * LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR * CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, * LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR * INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME, * OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF * PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER * COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY * TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY * SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART * THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT, * OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH * DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES * EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN * IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS * CONTAINED IN SECTIONS 6 AND THIS SECTION 7 ARE A FUNDAMENTAL PART OF THE BASIS * OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT * OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS. * 8. INDEMNIFICATION. * To the extent permitted by applicable law, You agree to indemnify, defend and * hold harmless Realsee, its affiliates and each of their directors, officers, * employees, independent contractors, and agents (each a “Realsee Indemnified * Party”) from any and all claims, losses, liabilities, damages, expenses, and * costs (including without limitation attorneys’ fees and court costs) incurred by * a Realsee Indemnified Party as a result of: (i) Your non-compliance with any * terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or * (iii) Your use of any Integrated Product, including any claim that Integrated * Product infringes the copyright, trademark, trade secret or other intellectual * property right of a third party. * 9. ACKNOWLEDGEMENTS. * Portions of the SDK may utilize or include third party software and other * copyrighted material. Acknowledgments, licensing terms, and disclaimers for such * material are contained in Documentation for the SDK or may otherwise accompany * such material, and Your use of such materials governed by their respective * terms. In the event of conflict between the terms of this Agreement and an * applicable open source or third party agreement, the open source or third party * agreement will control solely with respect to the open source software or third * party software. Moreover, You shall not subject any items (including not limited * to source code, object code, and any software) included in the SDK to any open * source license. * 10. NON-BLOCKING OF REALSEE DEVELOPMENT. * You acknowledge that Realsee is currently developing or may develop technologies * and products in the future that have or may have design and/or functionality * similar to Integrated Product that You may develop based on Your license herein. * Nothing in this Agreement shall impair, limit or curtail Realsee's right to * continue with its development, maintenance and/or distribution of Realsee's * technology or products. * 11. GENERAL. * 11.1 Export Control. You may not use or otherwise export or re-export the SDK * (or any part thereof) except as authorized by United States law and the laws of * the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In * particular, but without limitation, the SDK may not be exported or re-exported * (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury * Department's list of Specially Designated Nationals or the U.S. Department of * Commerce Denied Person's List or Entity List. By using the SDK (or any part * thereof), You represent and warrant that You are not located in any such country * or on any such list. * 11.2 Governing Law. This Agreement and the rights of the parties hereunder shall * be governed by and construed in accordance with the laws of People’s Republic of * China (for purpose of this Agreement, excluding Hong Kong, Taiwan, and Macau), * without reference to its conflict of laws principles. Any dispute, controversy * or claim arising from or in connection with this Agreement, or the breach, * termination or invalidity thereof, shall be submitted to China International * Economic and Trade Arbitration Commission (“CIETAC”) for arbitration in Beijing * which shall be conducted in accordance with the CIETAC's arbitration rules in * effect at the time of applying for arbitration. The arbitral award is final and * binding upon both parties. * 11.3 Severability. If any provision of this Agreement is held by a court of * competent jurisdiction to be unenforceable for any reason, the remaining * provisions hereof will be unaffected and remain in full force and effect. * 11.4. Modifications. Realsee reserves the right, from time to time, with or * without notice to You, to make revisions to this Agreement in our sole and * absolute discretion. The most current version of this Agreement will supersede * all previous versions and shall be made available on the website where the SDK * is made available, or by such other means as Realsee may determine in its * discretion. Any modified versions of this Agreement hereto shall take effect * from the time that it is made available. You shall be responsible for regularly * checking for notice of any such modifications. You agree that Your continued use * of the SDK constitutes Your agreement to the modified Agreement. * 11.5 Relationship of the Parties. This Agreement will not be construed as * creating an agency, partnership, joint venture, fiduciary duty, or any other * form of legal association between You and Realsee, and You will not represent to * the contrary, whether expressly, by implication, appearance, or otherwise. * 11.6 Entire Agreement; Governing Language. This Agreement constitutes the entire * agreement between You and Realsee with respect to the use of the SDK licensed * hereunder and supersedes all prior understandings regarding such subject matter. * No amendment to or modification of this Agreement will be binding unless in * writing and signed by Realsee. You and Realsee hereto confirm that this * Agreement and all related documents shall be drafted in English. */(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`three`)):typeof define==`function`&&define.amd?define([`exports`,`three`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.FiveSDK_VFX={},e.THREE))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t,1);var l=` uniform vec3 uColor1; uniform vec3 uColor2; uniform float uOpacity; varying vec3 vPosition; varying float vNoise; void main() { float alpha = 1.0; float gradient = mix(0.0, 1.0, -vPosition.y + 1.75); if(vNoise > 0.3 * gradient) { alpha = 0.0; } float mask = mix(0.3, 1.0, -vPosition.y + 0.5); alpha = clamp(alpha * (mask * 10.0), 0.0, 1.0); vec3 color = mix(uColor1, uColor2, -vPosition.y + 0.5); color.g = color.g * (1.0 + gradient * vNoise); gl_FragColor = vec4(color, alpha * uOpacity); } `,u=` // Simplex 4D Noise // by Ian McEwan, Ashima Arts // vec4 permute(vec4 x) { return mod((x * 34.0 + 1.0) * x, 289.0); } float permute(float x) { return floor( mod((x * 34.0 + 1.0) * x, 289.0) ); } vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; } float taylorInvSqrt(float r) { return 1.79284291400159 - 0.85373472095314 * r; } vec4 grad4(float j, vec4 ip) { const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0); vec4 p,s; p.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0; p.w = 1.5 - dot(abs(p.xyz), ones.xyz); s = vec4(lessThan(p, vec4(0.0))); p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www; return p; } float simplexNoise(vec4 v) { const vec2 C = vec2( 0.138196601125010504, // (5 - sqrt(5))/20 G4 0.309016994374947451); // (sqrt(5) - 1)/4 F4 // First corner vec4 i = floor(v + dot(v, C.yyyy) ); vec4 x0 = v - i + dot(i, C.xxxx); // Other corners // Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI) vec4 i0; vec3 isX = step( x0.yzw, x0.xxx ); vec3 isYZ = step( x0.zww, x0.yyz ); // i0.x = dot( isX, vec3( 1.0 ) ); i0.x = isX.x + isX.y + isX.z; i0.yzw = 1.0 - isX; // i0.y += dot( isYZ.xy, vec2( 1.0 ) ); i0.y += isYZ.x + isYZ.y; i0.zw += 1.0 - isYZ.xy; i0.z += isYZ.z; i0.w += 1.0 - isYZ.z; // i0 now contains the unique values 0,1,2,3 in each channel vec4 i3 = clamp( i0, 0.0, 1.0 ); vec4 i2 = clamp( i0-1.0, 0.0, 1.0 ); vec4 i1 = clamp( i0-2.0, 0.0, 1.0 ); // x0 = x0 - 0.0 + 0.0 * C vec4 x1 = x0 - i1 + 1.0 * C.xxxx; vec4 x2 = x0 - i2 + 2.0 * C.xxxx; vec4 x3 = x0 - i3 + 3.0 * C.xxxx; vec4 x4 = x0 - 1.0 + 4.0 * C.xxxx; // Permutations i = mod(i, 289.0); float j0 = permute( permute( permute( permute(i.w) + i.z) + i.y) + i.x); vec4 j1 = permute( permute( permute( permute ( i.w + vec4(i1.w, i2.w, i3.w, 1.0 )) + i.z + vec4(i1.z, i2.z, i3.z, 1.0 )) + i.y + vec4(i1.y, i2.y, i3.y, 1.0 )) + i.x + vec4(i1.x, i2.x, i3.x, 1.0 )); // Gradients // ( 7*7*6 points uniformly over a cube, mapped onto a 4-octahedron.) // 7*7*6 = 294, which is close to the ring size 17*17 = 289. vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ; vec4 p0 = grad4(j0, ip); vec4 p1 = grad4(j1.x, ip); vec4 p2 = grad4(j1.y, ip); vec4 p3 = grad4(j1.z, ip); vec4 p4 = grad4(j1.w, ip); // Normalise gradients vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w; p4 *= taylorInvSqrt(dot(p4,p4)); // Mix contributions from the five corners vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0); vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.0); m0 = m0 * m0; m1 = m1 * m1; return 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 ))) + dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ; } `,d=` float scale(float value, float fromMin, float fromMax, float toMin, float toMax) { return toMin + (value - fromMin) * (toMax - toMin) / (fromMax - fromMin); } `,f=` uniform float uTime; uniform float uNoise; uniform float uSpeed; varying vec3 vPosition; varying float vNoise; ${u} ${d} float fbm(vec4 x) { float v = 0.0; float a = 0.5; vec4 shift = vec4(100.0); #pragma unroll_loop_start for ( int i = 0; i < FRAGMENTATION_DEGREE; i ++ ) { v += a * simplexNoise(x); x = x * 2.0 + shift; a *= 0.5; } #pragma unroll_loop_end return v; } void main() { vPosition = position; vNoise = fbm(vec4((position / uNoise) - vec3(0.0, uTime * uSpeed, 0.0), 0.0)); vNoise = scale(vNoise, -1.0, 1.0, 0.0, 1.0); gl_Position = projectionMatrix * modelViewMatrix * vec4(vPosition, 1.0); } `,p=new t.SphereBufferGeometry(1,300,300),m=[];for(let e=0;e<2;e++)m.push(new t.Vector2(Math.sin(e)/2+1,e*2-.8));var h=new t.LatheBufferGeometry(m,300),g=class extends t.Group{constructor(e){super(),this.needsRender=!0;let n;if(e instanceof t.BufferGeometry)n=e;else switch(e){case`ring`:n=h;break;default:n=p;break}this.uniforms={uTime:{value:0},uColor1:{value:new t.Color(`rgb(255, 177, 20)`)},uColor2:{value:new t.Color(`rgb(255, 0, 0)`)},uNoise:{value:1.2},uSpeed:{value:1},uOpacity:{value:1}},this.defines={FRAGMENTATION_DEGREE:2};let r=new t.Mesh(n,new t.ShaderMaterial({uniforms:this.uniforms,defines:this.defines,vertexShader:f,fragmentShader:l,transparent:!0,depthWrite:!1,side:t.BackSide})),i=new t.Mesh(n,new t.ShaderMaterial({uniforms:this.uniforms,defines:this.defines,vertexShader:f,fragmentShader:l,transparent:!0,depthWrite:!1,side:t.FrontSide}));r.scale.setScalar(.1),i.scale.setScalar(.1),this.add(r),this.add(i)}setTime(e){this.startTime===void 0&&(this.startTime=e),this.uniforms.uTime.value=(e-this.startTime)/1e3,this.needsRender=!0}set color1(e){this.uniforms.uColor1.value=e,this.needsRender=!0}get color1(){return this.uniforms.uColor1.value}set color2(e){this.uniforms.uColor2.value=e,this.needsRender=!0}get color2(){return this.uniforms.uColor2.value}set speed(e){this.uniforms.uSpeed.value=e}get speed(){return this.uniforms.uSpeed.value}set noise(e){this.uniforms.uSpeed.value=e,this.needsRender=!0}get noise(){return this.uniforms.uSpeed.value}set opacity(e){this.uniforms.uOpacity.value=e,this.needsRender=!0}get opacity(){return this.uniforms.opacity.value}set fragmentationDegree(e){this.defines.FRAGMENTATION_DEGREE=e,this.traverse(e=>{e instanceof t.Mesh&&e.material instanceof t.ShaderMaterial&&(e.material.needsUpdate=!0)}),this.needsRender=!0}get fragmentationDegree(){return this.defines.FRAGMENTATION_DEGREE}},_=` uniform vec3 uLightColor; uniform vec3 uSpotPosition; uniform float uAttenuation; uniform float uAnglePower; varying vec3 vNormal; varying vec3 vWorldPosition; varying float vNoise; void main() { float intensity; intensity = distance(vWorldPosition, uSpotPosition) / uAttenuation; intensity = 1.0 - clamp(intensity, 0.1, 1.0); vec3 normal = vec3(vNormal.x, vNormal.y, abs(vNormal.z)); float angleIntensity = pow( dot(normal, vec3(0.0, 0.0, 1.0)), uAnglePower * vNoise ); intensity = intensity * angleIntensity * vNoise; gl_FragColor = vec4( uLightColor, intensity ); } `,v=` uniform float uTime; varying vec3 vNormal; varying vec3 vWorldPosition; varying float vNoise; ${u} ${d} void main(){ vNormal = normalize( normalMatrix * normal ); vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); vWorldPosition = worldPosition.xyz; vNoise = simplexNoise(vec4(position - vec3(0.0, uTime * 0.4, 0.0), 0)); vNoise = scale(vNoise, -1.0, 1.0, 0.5, 1.0); gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); } `,y=class extends t.Group{constructor(e=1,n=.1,r=.2){super(),this.needsRender=!0,this.uniforms={uTime:{value:0},uAttenuation:{value:e*.9},uAnglePower:{value:2},uSpotPosition:{value:this.position},uLightColor:{value:new t.Color(16777215)}};let i=new t.CylinderBufferGeometry(n,r,e,64,20,!0);i.applyMatrix4(new t.Matrix4().makeTranslation(0,-e/2,0)),i.applyMatrix4(new t.Matrix4().makeRotationX(-Math.PI/2));let a=new t.Mesh(i,new t.ShaderMaterial({uniforms:this.uniforms,vertexShader:v,fragmentShader:_,transparent:!0,side:t.FrontSide,depthWrite:!1}));this.add(a)}setTime(e){this.startTime===void 0&&(this.startTime=e),this.uniforms.uTime.value=(e-this.startTime)/1e3,this.needsRender=!0}set attenuation(e){this.uniforms.uAttenuation.value=e,this.needsRender=!0}get attenuation(){return this.uniforms.uAttenuation.value}set anglePower(e){this.uniforms.uAnglePower.value=e,this.needsRender=!0}get anglePower(){return this.uniforms.uAnglePower.value}set color(e){this.uniforms.uLightColor.value=e,this.needsRender=!0}get color(){return this.uniforms.uLightColor.value}},b=` uniform vec3 uColor; uniform float uOpacity; varying vec3 vPosition; varying float vNoise; void main() { float gradient = mix(0.0, 1.0, 1.0 + vPosition.y); gl_FragColor = vec4(uColor, vNoise * gradient * uOpacity); } `,x=` uniform float uTime; uniform float uSpeed; uniform float uScale; uniform float uExpand; varying float vNoise; varying vec3 vPosition; ${u} ${d} void main(){ vPosition = position; vNoise = simplexNoise(vec4(position.x * uScale, position.y + uTime * uSpeed, 0.0, 0.0)); vNoise = scale(vNoise, 0.0, 1.0, 0.5, 1.0); vec4 transformed = vec4( position, 1.0 ); transformed.x = transformed.x * scale(abs(transformed.y), 0.0, 1.0, 1.0, uExpand); gl_Position = projectionMatrix * modelViewMatrix * transformed; } `,S=new t.PlaneBufferGeometry(1,1,200,200);S.translate(0,-.5,0);var C=class extends t.Group{constructor(){super(),this.needsRender=!0;let e=this.outer=new t.Mesh(S,new t.ShaderMaterial({uniforms:{uTime:{value:0},uSpeed:{value:.75},uScale:{value:2},uExpand:{value:1.2},uColor:{value:new t.Color(.5,.5,.9)},uOpacity:{value:1}},vertexShader:x,fragmentShader:b,transparent:!0,side:t.DoubleSide,depthWrite:!1})),n=this.inner=new t.Mesh(S,new t.ShaderMaterial({uniforms:{uTime:{value:0},uSpeed:{value:2},uScale:{value:20},uExpand:{value:1.2},uColor:{value:new t.Color(1,1,1)},uOpacity:{value:.1}},vertexShader:x,fragmentShader:b,transparent:!0,side:t.DoubleSide,depthWrite:!1}));e.rotateX(-Math.PI/2),n.rotateX(-Math.PI/2),this.add(e),this.add(n)}setTime(e){this.startTime===void 0&&(this.startTime=e);let t=(e-this.startTime)/1e3;this.inner.material.uniforms.uTime.value=t,this.outer.material.uniforms.uTime.value=t,this.needsRender=!0}get expand(){return this.outer.material.uniforms.uExpand.value}set expand(e){this.outer.material.uniforms.uExpand.value=e,this.inner.material.uniforms.uExpand.value=e,this.needsRender=!0}get speed(){return this.inner.material.uniforms.speed.value}set speed(e){this.inner.material.uniforms.speed.value=e,this.needsRender=!0}get color(){return this.outer.material.uniforms.color.value}set color(e){this.outer.material.uniforms.color.value=e,this.needsRender=!0}get flowColor(){return this.inner.material.uniforms.color.value}set flowColor(e){this.inner.material.uniforms.color.value=e,this.needsRender=!0}};function w(e,t){return e+t*(Math.random()-.5)}function T(e,n){let r=new t.Vector3(Math.random()-.5,Math.random()-.5,Math.random()-.5);return new t.Vector3().addVectors(e,new t.Vector3().multiplyVectors(n,r))}function E(e,t,n){return e*n+t*n*n/2}function D(e,n,r){return new t.Vector3(E(e.x,n.x,r),E(e.y,n.y,r),E(e.z,n.z,r))}function O(e,t){let n=e.times.length,r=0;for(;r<n&&t>e.times[r];)r++;if(r==0)return e.values[0];if(r==n)return e.values[n-1];let i=(t-e.times[r-1])/(e.times[r]-e.times[r-1]),a=e.values[r-1],o=e.values[r];return typeof e.values[0]==`number`?a+i*(o-a):a.clone().lerp(o,i)}var k=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){this.birthTime=e,this.deathAge=t,this.position=n.clone(),this.velocity=r.clone(),this.acceleration=i.clone(),this.angle=a,this.angleVelocity=o,this.angleAcceleration=s,this.color=c,this.colorTween=l,this.size=u,this.sizeTween=d,this.opacity=f,this.opacityTween=p}getAlive(e){return this.deathAge>e-this.birthTime}getState(e){let n=this.getAlive(e),r=Math.min(this.deathAge,e-this.birthTime),i=D(this.velocity,this.acceleration,r).add(this.position),a=E(this.angleVelocity,this.angleAcceleration,r)+this.angle,o=(this.sizeTween?O(this.sizeTween,r):0)+this.size,s=(this.colorTween?O(this.colorTween,r):new t.Vector3).add(this.color);return{alive:n,age:r,position:i,angle:a,size:o,color:new t.Color().setHSL(s.x,s.y,s.z),opacity:(this.opacityTween?O(this.opacityTween,r):0)+this.opacity}}},A=` attribute vec3 color; attribute float opacity; attribute float size; attribute float alive; // float used as boolean (0 = false, 1 = true) varying vec4 vColor; #if defined(USE_MAP) attribute float angle; varying float vAngle; #endif void main() { if (alive > 0.5) { vColor = vec4(color, opacity); } else { vColor = vec4(0.0, 0.0, 0.0, 0.0); } #if defined(USE_MAP) vAngle = angle; #endif vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); gl_PointSize = size * ( 300.0 / length( mvPosition.xyz ) ); gl_Position = projectionMatrix * mvPosition; } `,j=` varying vec4 vColor; #if defined(USE_MAP) uniform sampler2D map; varying float vAngle; #endif void main() { gl_FragColor = vColor; #if defined(USE_MAP) float c = cos(vAngle); float s = sin(vAngle); // rotate UV coordinates to rotate texture vec2 rotatedUV = vec2( c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5, c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5 ); vec4 rotatedTexture = texture2D(map, rotatedUV); gl_FragColor = vColor * rotatedTexture; #endif } `,M=class extends t.Points{constructor(e){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,M,N,P,F,I,L,R,z,B,V;let H=new t.BufferGeometry;H.setAttribute(`position`,new t.BufferAttribute(new Float32Array,3)),H.setAttribute(`alive`,new t.BufferAttribute(new Float32Array,1)),H.setAttribute(`color`,new t.BufferAttribute(new Float32Array,3)),H.setAttribute(`opacity`,new t.BufferAttribute(new Float32Array,1)),H.setAttribute(`size`,new t.BufferAttribute(new Float32Array,1)),H.setAttribute(`angle`,new t.BufferAttribute(new Float32Array,1));let U=new t.ShaderMaterial({uniforms:{map:{value:(n=e.texture)==null?null:n}},defines:{USE_MAP:!!e.texture},vertexShader:A,fragmentShader:j,transparent:!0,blending:(r=e.blending)==null?t.NormalBlending:r,depthWrite:!1});super(H,U),this.instances=[],this.needsRender=!0,this.birthTime=Date.now()/1e3,this.disposed=!1,this.paused=!1,this.positionBase=(a=(i=e.positionBase)==null?void 0:i.clone())==null?new t.Vector3:a,this.positionStyle=(o=e.positionStyle)==null?`CUBE`:o,this.positionCubeSpread=(c=(s=e.positionCubeSpread)==null?void 0:s.clone())==null?new t.Vector3:c,this.positionSphereSpread=(l=e.positionSphereSpread)==null?0:l,this.velocityStyle=(u=e.velocityStyle)==null?`CUBE`:u,this.velocityCubeBase=(f=(d=e.velocityCubeBase)==null?void 0:d.clone())==null?new t.Vector3:f,this.velocityCubeSpread=(m=(p=e.velocityCubeSpread)==null?void 0:p.clone())==null?new t.Vector3:m,this.velocitySphereBase=(h=e.velocitySphereBase)==null?0:h,this.velocitySphereSpread=(g=e.velocitySphereSpread)==null?0:g,this.accelerationBase=(v=(_=e.accelerationBase)==null?void 0:_.clone())==null?new t.Vector3:v,this.accelerationSpread=(b=(y=e.accelerationSpread)==null?void 0:y.clone())==null?new t.Vector3:b,this.angleBase=(x=e.angleBase)==null?0:x,this.angleSpread=(S=e.angleSpread)==null?0:S,this.angleVelocityBase=(C=e.angleVelocityBase)==null?0:C,this.angleVelocitySpread=(w=e.angleVelocitySpread)==null?0:w,this.angleAccelerationBase=(T=e.angleAccelerationBase)==null?0:T,this.angleAccelerationSpread=(E=e.angleAccelerationSpread)==null?0:E,this.sizeBase=(D=e.sizeBase)==null?.1:D,this.sizeSpread=(O=e.sizeSpread)==null?0:O,this.sizeTween=(k=e.sizeTween)==null?null:k,this.colorBase=(N=(M=e.colorBase)==null?void 0:M.clone())==null?new t.Vector3:N,this.colorSpread=(F=(P=e.colorSpread)==null?void 0:P.clone())==null?new t.Vector3:F,this.colorTween=(I=e.colorTween)==null?null:I,this.opacityBase=((L=e.opacityBase)==null?e.opacityTween:L)?0:1,this.opacitySpread=(R=e.opacitySpread)==null?0:R,this.opacityTween=(z=e.opacityTween)==null?null:z,this.particlesPerSecond=(B=e.particlesPerSecond)==null?60:B,this.particleDeathAge=(V=e.particleDeathAge)==null?1:V}get texture(){return this.material.uniforms.map.value}set texture(e){this.material.uniforms.map.value=e,e===null?this.material.defines.USE_MAP!==!1&&(this.material.defines.USE_MAP=!1,this.material.needsUpdate=!0):this.material.defines.USE_MAP!==!0&&(this.material.defines.USE_MAP=!0,this.material.needsUpdate=!0)}get blending(){return this.material.blending}set blending(e){this.material.blending=e}createInstance(e){let n=this.positionBase.clone();switch(this.positionStyle){case`CUBE`:n=T(this.positionBase,this.positionCubeSpread);break;case`SPHERE`:{let e=2*Math.random()-1,r=Math.PI*2*Math.random(),i=Math.sqrt(1-e*e),a=new t.Vector3(i*Math.cos(r),i*Math.sin(r),e);n=new t.Vector3().addVectors(this.positionBase,a.multiplyScalar(this.positionSphereSpread));break}default:break}let r=new t.Vector3;switch(this.velocityStyle){case`CUBE`:r=T(this.velocityCubeBase,this.velocityCubeSpread);break;case`SPHERE`:{let e=new t.Vector3().subVectors(n,this.positionBase),i=w(this.velocitySphereBase,this.velocitySphereSpread);r=e.normalize().multiplyScalar(i);break}default:break}return new k(e,this.particleDeathAge,n,r,T(this.accelerationBase,this.accelerationSpread),w(this.angleBase,this.angleSpread),w(this.angleVelocityBase,this.angleVelocitySpread),w(this.angleAccelerationBase,this.angleAccelerationSpread),T(this.colorBase,this.colorSpread),this.colorTween,w(this.sizeBase,this.sizeSpread),this.sizeTween,w(this.opacityBase,this.opacitySpread),this.opacityTween)}pause(){this.paused!==!0&&(this.paused=!0,this.birthTime=Date.now()/1e3)}play(){this.paused!==!1&&(this.paused=!1,this.birthTime=Date.now()/1e3)}setTime(e){if(this.disposed)return;e/=1e3;let n=e-this.birthTime,r=Math.ceil(this.particlesPerSecond*this.particleDeathAge);if(this.geometry.attributes.position.count<r){let e=new Float32Array(r*3);e.set(this.geometry.attributes.position.array,0);let n=new t.BufferAttribute(e,3);n.needsUpdate=!0,this.geometry.setAttribute(`position`,n)}if(this.geometry.attributes.alive.count<r){let e=new Float32Array(r);e.set(this.geometry.attributes.alive.array,0);let n=new t.BufferAttribute(e,1);n.needsUpdate=!0,this.geometry.setAttribute(`alive`,n)}if(this.geometry.attributes.color.count<r){let e=new Float32Array(r*3);e.set(this.geometry.attributes.color.array,0);let n=new t.BufferAttribute(e,3);n.needsUpdate=!0,this.geometry.setAttribute(`color`,n)}if(this.geometry.attributes.opacity.count<r){let e=new Float32Array(r);e.set(this.geometry.attributes.opacity.array,0);let n=new t.BufferAttribute(e,1);n.needsUpdate=!0,this.geometry.setAttribute(`opacity`,n)}if(this.geometry.attributes.size.count<r){let e=new Float32Array(r);e.set(this.geometry.attributes.size.array,0);let n=new t.BufferAttribute(e,1);n.needsUpdate=!0,this.geometry.setAttribute(`size`,n)}if(this.geometry.attributes.angle.count<r){let e=new Float32Array(r);e.set(this.geometry.attributes.angle.array,0);let n=new t.BufferAttribute(e,1);n.needsUpdate=!0,this.geometry.setAttribute(`angle`,n)}this.instances.length<r&&(this.instances.length=r);for(let t=0;t<this.instances.length;t++){let i=this.instances[t];if(t<r&&this.paused===!1&&(i===void 0||i.getAlive(e)===!1)){let a=this.particleDeathAge/r*t;if(n>a){let r=e-(n-a)%this.particleDeathAge;this.instances[t]=i=this.createInstance(r)}}if(i){let{position:n,alive:r,color:a,opacity:o,size:s,angle:c}=i.getState(e);this.geometry.attributes.position.setXYZ(t,n.x,n.y,n.z),this.geometry.attributes.position.needsUpdate=!0,this.geometry.attributes.alive.setX(t,+!!r),this.geometry.attributes.alive.needsUpdate=!0,this.geometry.attributes.color.setXYZ(t,a.r,a.g,a.b),this.geometry.attributes.color.needsUpdate=!0,this.geometry.attributes.opacity.setX(t,o),this.geometry.attributes.opacity.needsUpdate=!0,this.geometry.attributes.size.setX(t,s),this.geometry.attributes.size.needsUpdate=!0,this.geometry.attributes.angle.setX(t,c),this.geometry.attributes.angle.needsUpdate=!0}}this.geometry.computeBoundingBox(),this.geometry.boundingSphere||(this.geometry.boundingSphere=new t.Sphere),this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere),this.needsRender=!0}dispose(){var e;this.disposed=!0,this.geometry.dispose(),(e=this.texture)==null||e.dispose(),this.material.dispose()}};function N(e,t){return e+t*(Math.random()-.5)}function P(e,n){let r=new t.Vector3(Math.random()-.5,Math.random()-.5,Math.random()-.5);return new t.Vector3().addVectors(e,new t.Vector3().multiplyVectors(n,r))}var F=` // 粒子初始属性 attribute vec3 initialVelocity; attribute vec3 acceleration; attribute float birthTime; attribute float lifeTime; attribute float initialSize; attribute float sizeGrowth; attribute vec3 initialColor; attribute float initialOpacity; attribute float initialAngle; attribute float angleVelocity; attribute float particleIndex; // 全局uniform参数 uniform float uTime; // 传递给fragment shader的变量 varying vec4 vColor; varying float vAngle; // 简单噪声函数 float random(vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123); } // HSL转RGB函数 vec3 hsl2rgb(vec3 c) { vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0), 6.0)-3.0)-1.0, 0.0, 1.0); return c.z + c.y * (rgb-0.5)*(1.0-abs(2.0*c.z-1.0)); } void main() { // 计算粒子的实际年龄,考虑循环重生 float totalCycleTime = lifeTime; float adjustedTime = uTime + birthTime; float cycleTime = mod(adjustedTime, totalCycleTime); float age = cycleTime; float normalizedAge = clamp(age / lifeTime, 0.0, 1.0); // 如果粒子年龄超过生命周期,让它重新开始 if (age > lifeTime) { age = 0.0; normalizedAge = 0.0; } // 计算当前位置(物理模拟) vec3 currentVelocity = initialVelocity + acceleration * age; vec3 currentPosition = position + currentVelocity * age; // 计算当前大小(随时间变化) float currentSize = initialSize + sizeGrowth * normalizedAge; // 计算当前角度 vAngle = initialAngle + angleVelocity * age; // 计算当前颜色和透明度(生命周期渐变) vec3 currentColor = initialColor; float currentOpacity = initialOpacity; // 生命周期透明度渐变(出生和死亡时渐变) if (normalizedAge < 0.1) { currentOpacity *= normalizedAge / 0.1; // 淡入 } else if (normalizedAge > 0.8) { currentOpacity *= (1.0 - normalizedAge) / 0.2; // 淡出 } // 将HSL颜色转换为RGB vec3 rgbColor = hsl2rgb(currentColor); vColor = vec4(rgbColor, currentOpacity); // 计算最终位置和大小 vec4 mvPosition = modelViewMatrix * vec4(currentPosition, 1.0); gl_PointSize = currentSize * (300.0 / length(mvPosition.xyz)); gl_Position = projectionMatrix * mvPosition; } `,I=` varying vec4 vColor; varying float vAngle; #if defined(USE_MAP) uniform sampler2D map; #endif void main() { // 如果粒子透明度为0,直接丢弃 if (vColor.a <= 0.0) { discard; } gl_FragColor = vColor; #if defined(USE_MAP) float c = cos(vAngle); float s = sin(vAngle); // 旋转UV坐标以旋转纹理 vec2 rotatedUV = vec2( c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5, c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5 ); vec4 textureColor = texture2D(map, rotatedUV); gl_FragColor = vColor * textureColor; #endif } `,L=class extends t.Points{constructor(e){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,L,R,z;let B=Math.ceil(((n=e.particlesPerSecond)==null?60:n)*((r=e.particleDeathAge)==null?1:r)),V=new t.BufferGeometry,H=new Float32Array(B*3),U=new Float32Array(B*3),W=new Float32Array(B*3),G=new Float32Array(B),K=new Float32Array(B),q=new Float32Array(B),J=new Float32Array(B),Y=new Float32Array(B*3),X=new Float32Array(B),Z=new Float32Array(B),Q=new Float32Array(B),$=new Float32Array(B);for(let n=0;n<B;n++){G[n]=((i=e.particleDeathAge)==null?1:i)/B*n,K[n]=(a=e.particleDeathAge)==null?1:a,$[n]=n;let r=(s=(o=e.positionBase)==null?void 0:o.clone())==null?new t.Vector3:s;switch((c=e.positionStyle)==null?`CUBE`:c){case`CUBE`:r=P((l=e.positionBase)==null?new t.Vector3:l,(u=e.positionCubeSpread)==null?new t.Vector3:u);break;case`SPHERE`:{let n=2*Math.random()-1,i=Math.PI*2*Math.random(),a=Math.sqrt(1-n*n),o=new t.Vector3(a*Math.cos(i),a*Math.sin(i),n);r=new t.Vector3().addVectors((d=e.positionBase)==null?new t.Vector3:d,o.multiplyScalar((f=e.positionSphereSpread)==null?0:f));break}}H[n*3]=r.x,H[n*3+1]=r.y,H[n*3+2]=r.z;let M=new t.Vector3;switch((p=e.velocityStyle)==null?`CUBE`:p){case`CUBE`:M=P((m=e.velocityCubeBase)==null?new t.Vector3:m,(h=e.velocityCubeSpread)==null?new t.Vector3:h);break;case`SPHERE`:{let n=new t.Vector3().subVectors(r,(g=e.positionBase)==null?new t.Vector3:g),i=N((_=e.velocitySphereBase)==null?0:_,(v=e.velocitySphereSpread)==null?0:v);M=n.normalize().multiplyScalar(i);break}}U[n*3]=M.x,U[n*3+1]=M.y,U[n*3+2]=M.z;let F=P((y=e.accelerationBase)==null?new t.Vector3:y,(b=e.accelerationSpread)==null?new t.Vector3:b);W[n*3]=F.x,W[n*3+1]=F.y,W[n*3+2]=F.z,q[n]=N((x=e.sizeBase)==null?.1:x,(S=e.sizeSpread)==null?0:S),J[n]=(C=e.sizeGrowth)==null?0:C;let I=P((w=e.colorBase)==null?new t.Vector3:w,(T=e.colorSpread)==null?new t.Vector3:T);Y[n*3]=I.x,Y[n*3+1]=I.y,Y[n*3+2]=I.z,X[n]=N((E=e.opacityBase)==null?1:E,(D=e.opacitySpread)==null?0:D),Z[n]=N((O=e.angleBase)==null?0:O,(k=e.angleSpread)==null?0:k),Q[n]=N((A=e.angleVelocityBase)==null?0:A,(j=e.angleVelocitySpread)==null?0:j)}V.setAttribute(`position`,new t.BufferAttribute(H,3)),V.setAttribute(`initialVelocity`,new t.BufferAttribute(U,3)),V.setAttribute(`acceleration`,new t.BufferAttribute(W,3)),V.setAttribute(`birthTime`,new t.BufferAttribute(G,1)),V.setAttribute(`lifeTime`,new t.BufferAttribute(K,1)),V.setAttribute(`initialSize`,new t.BufferAttribute(q,1)),V.setAttribute(`sizeGrowth`,new t.BufferAttribute(J,1)),V.setAttribute(`initialColor`,new t.BufferAttribute(Y,3)),V.setAttribute(`initialOpacity`,new t.BufferAttribute(X,1)),V.setAttribute(`initialAngle`,new t.BufferAttribute(Z,1)),V.setAttribute(`angleVelocity`,new t.BufferAttribute(Q,1)),V.setAttribute(`particleIndex`,new t.BufferAttribute($,1));let ee=new t.ShaderMaterial({uniforms:{map:{value:(M=e.texture)==null?null:M},uTime:{value:0}},defines:{USE_MAP:!!e.texture},vertexShader:F,fragmentShader:I,transparent:!0,blending:(L=e.blending)==null?t.NormalBlending:L,depthWrite:!1});super(V,ee),this.needsRender=!0,this.startTime=Date.now()/1e3,this.disposed=!1,this.paused=!1,this.particleCount=B,this.particlesPerSecond=(R=e.particlesPerSecond)==null?60:R,this.particleDeathAge=(z=e.particleDeathAge)==null?1:z}get texture(){return this.material.uniforms.map.value}set texture(e){this.material.uniforms.map.value=e,e===null?this.material.defines.USE_MAP!==!1&&(this.material.defines.USE_MAP=!1,this.material.needsUpdate=!0):this.material.defines.USE_MAP!==!0&&(this.material.defines.USE_MAP=!0,this.material.needsUpdate=!0)}get blending(){return this.material.blending}set blending(e){this.material.blending=e}pause(){this.paused!==!0&&(this.paused=!0,this.startTime=Date.now()/1e3)}play(){this.paused!==!1&&(this.paused=!1,this.startTime=Date.now()/1e3)}setTime(e){if(this.disposed||this.paused)return;let t=e/1e3-this.startTime;this.material.uniforms.uTime.value=t,this.needsRender=!0}dispose(){var e;this.disposed=!0,this.geometry.dispose(),(e=this.texture)==null||e.dispose(),this.material.dispose()}};e.Airflow=C,e.Flame=g,e.Particle=M,e.ParticleGPU=L,e.SpotLight=y});