@realsee/five
Version:
Realsee Renderer SDK
597 lines (596 loc) • 36.2 kB
JavaScript
/**
* @license
* @realsee/five
* Generated: 10/8/2026
* Version: 6.9.2
* 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.
*/import * as e from "three";
//#region build/line/utils/LineSegmentsGeometry.js
var t = class extends e.InstancedBufferGeometry {
constructor() {
super(), this.type = "LineSegmentsGeometry", this.setIndex([
0,
2,
1,
2,
3,
1,
2,
4,
3,
4,
5,
3,
4,
6,
5,
6,
7,
5
]), this.setAttribute("position", new e.Float32BufferAttribute([
-1,
2,
0,
1,
2,
0,
-1,
1,
0,
1,
1,
0,
-1,
0,
0,
1,
0,
0,
-1,
-1,
0,
1,
-1,
0
], 3)), this.setAttribute("uv", new e.Float32BufferAttribute([
-1,
2,
1,
2,
-1,
1,
1,
1,
-1,
-1,
1,
-1,
-1,
-2,
1,
-2
], 2));
}
applyMatrix4(e) {
let t = this.attributes.instanceStart, n = this.attributes.instanceEnd;
return t !== void 0 && (t.applyMatrix4(e), n.applyMatrix4(e), t.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this;
}
setPositions(t) {
let n;
n = t instanceof Float32Array ? t : Array.isArray(t) ? new Float32Array(t) : new Float32Array();
let r = new e.InstancedInterleavedBuffer(n, 6, 1);
return this.setAttribute("instanceStart", new e.InterleavedBufferAttribute(r, 3, 0)), this.setAttribute("instanceEnd", new e.InterleavedBufferAttribute(r, 3, 3)), this.computeBoundingBox(), this.computeBoundingSphere(), this;
}
setColors(t) {
let n;
n = t instanceof Float32Array ? t : Array.isArray(t) ? new Float32Array(t) : new Float32Array();
let r = new e.InstancedInterleavedBuffer(n, 6, 1);
return this.setAttribute("instanceColorStart", new e.InterleavedBufferAttribute(r, 3, 0)), this.setAttribute("instanceColorEnd", new e.InterleavedBufferAttribute(r, 3, 3)), this;
}
fromWireframeGeometry(e) {
return this.setPositions(e.attributes.position.array), this;
}
fromEdgesGeometry(e) {
return this.setPositions(e.attributes.position.array), this;
}
fromMesh(t) {
return this.fromWireframeGeometry(new e.WireframeGeometry(t.geometry)), this;
}
fromLineSegments(t) {
var n = t.geometry;
if (n instanceof e.Geometry) {
let t = new e.BufferGeometry().fromGeometry(n);
this.setPositions(t.attributes.position.array);
} else n instanceof e.BufferGeometry && this.setPositions(n.attributes.position.array);
return this;
}
computeBoundingBox() {
this.boundingBox === null && (this.boundingBox = new e.Box3());
let t = this.attributes.instanceStart, n = this.attributes.instanceEnd;
if (t !== void 0 && n !== void 0) {
let r = new e.Box3();
this.boundingBox.setFromBufferAttribute(t), r.setFromBufferAttribute(n), this.boundingBox.union(r);
}
}
computeBoundingSphere() {
this.boundingSphere === null && (this.boundingSphere = new e.Sphere()), this.boundingBox === null && this.computeBoundingBox();
let t = this.attributes.instanceStart, n = this.attributes.instanceEnd;
if (t !== void 0 && n !== void 0) {
let r = this.boundingSphere.center;
this.boundingBox.getCenter(r);
let i = 0, a = new e.Vector3();
for (let e = 0, o = t.count; e < o; e++) a.fromBufferAttribute(t, e), i = Math.max(i, r.distanceToSquared(a)), a.fromBufferAttribute(n, e), i = Math.max(i, r.distanceToSquared(a));
this.boundingSphere.radius = Math.sqrt(i), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this);
}
}
toJSON() {}
};
Object.assign(t.prototype, { isLineSegmentsGeometry: !0 });
//#endregion
//#region build/line/utils/LineMaterial.js
var n = {
uniforms: e.UniformsUtils.merge([
e.UniformsLib.common,
e.UniformsLib.fog,
{
linewidth: { value: 1 },
resolution: { value: new e.Vector2(1, 1) },
dashScale: { value: 1 },
dashSize: { value: 1 },
gapSize: { value: 1 },
opacity: { value: 1 }
}
]),
vertexShader: "\n #include <common>\n #include <color_pars_vertex>\n #include <fog_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n\n uniform float linewidth;\n uniform vec2 resolution;\n\n attribute vec3 instanceStart;\n attribute vec3 instanceEnd;\n\n attribute vec3 instanceColorStart;\n attribute vec3 instanceColorEnd;\n\n varying vec2 vUv;\n\n #ifdef USE_DASH\n\n uniform float dashScale;\n attribute float instanceDistanceStart;\n attribute float instanceDistanceEnd;\n varying float vLineDistance;\n\n #endif\n\n void trimSegment( const in vec4 start, inout vec4 end ) {\n\n // trim end segment so it terminates between the camera plane and the near plane\n\n // conservative estimate of the near plane\n float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n float nearEstimate = - 0.5 * b / a;\n\n float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n end.xyz = mix( start.xyz, end.xyz, alpha );\n\n }\n\n void main() {\n\n #ifdef USE_COLOR\n\n vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n #endif\n\n #ifdef USE_DASH\n\n vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n #endif\n\n float aspect = resolution.x / resolution.y;\n\n vUv = uv;\n\n // camera space\n vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n // perhaps there is a more elegant solution -- WestLangley\n\n bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n if ( perspective ) {\n\n if ( start.z < 0.0 && end.z >= 0.0 ) {\n\n trimSegment( start, end );\n\n } else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n trimSegment( end, start );\n\n }\n\n }\n\n // clip space\n vec4 clipStart = projectionMatrix * start;\n vec4 clipEnd = projectionMatrix * end;\n\n // ndc space\n vec2 ndcStart = clipStart.xy / clipStart.w;\n vec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n // direction\n vec2 dir = ndcEnd - ndcStart;\n\n // account for clip-space aspect ratio\n dir.x *= aspect;\n dir = normalize( dir );\n\n // perpendicular to dir\n vec2 offset = vec2( dir.y, - dir.x );\n\n // undo aspect ratio adjustment\n dir.x /= aspect;\n offset.x /= aspect;\n\n // sign flip\n if ( position.x < 0.0 ) offset *= - 1.0;\n\n // endcaps\n if ( position.y < 0.0 ) {\n\n offset += - dir;\n\n } else if ( position.y > 1.0 ) {\n\n offset += dir;\n\n }\n\n // adjust for linewidth\n offset *= linewidth;\n\n // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n offset /= resolution.y;\n\n // select end\n vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n // back to clip space\n offset *= clip.w;\n\n clip.xy += offset;\n\n gl_Position = clip;\n\n vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n }\n ",
fragmentShader: "\n uniform vec3 diffuse;\n uniform float opacity;\n\n #ifdef USE_DASH\n\n uniform float dashSize;\n uniform float gapSize;\n\n #endif\n\n varying float vLineDistance;\n\n #include <common>\n #include <color_pars_fragment>\n #include <fog_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n\n varying vec2 vUv;\n\n void main() {\n\n #include <clipping_planes_fragment>\n\n #ifdef USE_DASH\n\n if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n #endif\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n\n if ( len2 > 1.0 ) discard;\n\n }\n\n vec4 diffuseColor = vec4( diffuse, opacity );\n\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n\n gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n #include <tonemapping_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n }\n "
}, r = class extends e.ShaderMaterial {
constructor(t) {
super({
uniforms: e.UniformsUtils.clone(n.uniforms),
vertexShader: n.vertexShader,
fragmentShader: n.fragmentShader,
clipping: !0
}), this.type = "LineMaterial", this.dashed = !1, Object.defineProperties(this, {
color: {
enumerable: !0,
get() {
return this.uniforms.diffuse.value;
},
set(e) {
this.uniforms.diffuse.value = e;
}
},
linewidth: {
enumerable: !0,
get() {
return this.uniforms.linewidth.value;
},
set(e) {
this.uniforms.linewidth.value = e;
}
},
dashScale: {
enumerable: !0,
get() {
return this.uniforms.dashScale.value;
},
set(e) {
this.uniforms.dashScale.value = e;
}
},
dashSize: {
enumerable: !0,
get() {
return this.uniforms.dashSize.value;
},
set(e) {
this.uniforms.dashSize.value = e;
}
},
gapSize: {
enumerable: !0,
get() {
return this.uniforms.gapSize.value;
},
set(e) {
this.uniforms.gapSize.value = e;
}
},
opacity: {
enumerable: !0,
get() {
return this.uniforms.opacity.value;
},
set(e) {
this.uniforms.opacity.value = e;
}
},
resolution: {
enumerable: !0,
get() {
return this.uniforms.resolution.value;
},
set(e) {
this.uniforms.resolution.value.copy(e);
}
}
}), this.setValues(t);
}
};
Object.assign(r.prototype, { isLineMaterial: !0 });
//#endregion
//#region build/line/utils/LineSegments2.js
var i = class extends e.Mesh {
constructor(e, n) {
super(), this.type = "LineSegments2", this.geometry = e === void 0 ? new t() : e, this.material = n === void 0 ? new r({ color: Math.random() * 16777215 }) : n;
}
computeLineDistances() {
let t = this.geometry, n = t.attributes.instanceStart, r = t.attributes.instanceEnd, i = new Float32Array(2 * n.count), a = new e.Vector3(), o = new e.Vector3();
for (var s = 0, c = 0, l = n.count; s < l; s++, c += 2) a.fromBufferAttribute(n, s), o.fromBufferAttribute(r, s), i[c] = c === 0 ? 0 : i[c - 1], i[c + 1] = i[c] + a.distanceTo(o);
let u = new e.InstancedInterleavedBuffer(i, 2, 1);
return t.setAttribute("instanceDistanceStart", new e.InterleavedBufferAttribute(u, 1, 0)), t.setAttribute("instanceDistanceEnd", new e.InterleavedBufferAttribute(u, 1, 1)), this;
}
raycast(t, n) {
t.camera === null && console.error("LineSegments2: \"Raycaster.camera\" needs to be set in order to raycast against LineSegments2.");
let r = t.ray, i = t.camera, a = i.projectionMatrix, o = this.geometry, s = this.material, c = s.resolution, l = s.linewidth, u = o.attributes.instanceStart, d = o.attributes.instanceEnd, f = new e.Vector4(), p = new e.Vector4(), m = new e.Vector4(), h = new e.Vector3(), g = new e.Matrix4(), _ = new e.Line3(), v = new e.Vector3();
r.at(1, m), m.w = 1, m.applyMatrix4(i.matrixWorldInverse), m.applyMatrix4(a), m.multiplyScalar(1 / m.w), m.x *= c.x / 2, m.y *= c.y / 2, m.z = 0, h.copy(m);
let y = this.matrixWorld;
g.multiplyMatrices(i.matrixWorldInverse, y);
for (var b = 0, x = u.count; b < x; b++) {
f.fromBufferAttribute(u, b), p.fromBufferAttribute(d, b), f.w = 1, p.w = 1, f.applyMatrix4(g), p.applyMatrix4(g), f.applyMatrix4(a), p.applyMatrix4(a), f.multiplyScalar(1 / f.w), p.multiplyScalar(1 / p.w);
var S = f.z < -1 && p.z < -1, C = f.z > 1 && p.z > 1;
if (S || C) continue;
f.x *= c.x / 2, f.y *= c.y / 2, p.x *= c.x / 2, p.y *= c.y / 2, _.start.copy(f), _.start.z = 0, _.end.copy(p), _.end.z = 0;
let t = _.closestPointToPointParameter(h, !0);
_.at(t, v);
let i = e.MathUtils.lerp(f.z, p.z, t), o = i >= -1 && i <= 1;
var w = h.distanceTo(v) < l * .5;
if (o && w) {
_.start.fromBufferAttribute(u, b), _.end.fromBufferAttribute(d, b), _.start.applyMatrix4(y), _.end.applyMatrix4(y);
var T = new e.Vector3(), E = new e.Vector3();
r.distanceSqToSegment(_.start, _.end, E, T), n.push({
point: E,
pointOnLine: T,
distance: r.origin.distanceTo(E),
object: this,
faceIndex: b
});
}
}
}
};
Object.assign(i.prototype, { isLineSegments2: !0 });
//#endregion
//#region build/line/utils/Line2.js
var a = class extends i {
constructor(e, t) {
super(e, t), this.type = "Line2";
}
};
Object.assign(a.prototype, { isLine2: !0 });
//#endregion
//#region build/line/utils/LineGeometry.js
var o = class extends t {
constructor() {
super(), this.type = "LineGeometry";
}
setPositions(e) {
let t = e.length - 3, n = new Float32Array(2 * t);
for (let r = 0; r < t; r += 3) n[2 * r] = e[r], n[2 * r + 1] = e[r + 1], n[2 * r + 2] = e[r + 2], n[2 * r + 3] = e[r + 3], n[2 * r + 4] = e[r + 4], n[2 * r + 5] = e[r + 5];
return super.setPositions(n), this;
}
setColors(e) {
let t = e.length - 3, n = new Float32Array(2 * t);
for (let r = 0; r < t; r += 3) n[2 * r] = e[r], n[2 * r + 1] = e[r + 1], n[2 * r + 2] = e[r + 2], n[2 * r + 3] = e[r + 3], n[2 * r + 4] = e[r + 4], n[2 * r + 5] = e[r + 5];
return super.setColors(n), this;
}
fromLine(t) {
let n = t.geometry;
if (n instanceof e.Geometry) {
let t = new e.BufferGeometry().fromGeometry(n);
this.setPositions(t.attributes.position.array);
} else n instanceof e.BufferGeometry && this.setPositions(n.attributes.position.array);
return this;
}
copy() {
return this;
}
};
Object.assign(o.prototype, { isLineGeometry: !0 });
//#endregion
//#region build/line/index.js
var s = 14467195, c = 8, l = 2, u = 20, d = null, f = class extends e.Object3D {
static get version() {
return "6.9.2";
}
constructor(t = new e.Vector3(), n = new e.Vector3()) {
super(), this.type = "FiveLine", this.needsRender = !0;
let i = new o(), f = new r({
color: s,
linewidth: l,
dashScale: u,
dashed: !1
});
this.line = new a(i, f);
let p = new e.BufferGeometry(), m = new e.PointsMaterial({
color: s,
size: c,
map: d || (d = new e.TextureLoader().load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==")),
sizeAttenuation: !1,
transparent: !0
});
this.points = new e.Points(p, m), this.points.renderOrder = 11, this.points.frustumCulled = !1, this.setPoints(t, n), this.add(this.line, this.points);
}
setPoints(t, n) {
let r = [].concat(t.toArray(), n.toArray());
this.points.geometry.setAttribute("position", new e.BufferAttribute(new Float32Array(r), 3)), this.line.geometry.setPositions(r), this.line.computeLineDistances(), this.needsRender = !0;
}
getPoints() {
let t = this.points.geometry.attributes.position.array;
return [new e.Vector3(t[0], t[1], t[2]), new e.Vector3(t[3], t[4], t[5])];
}
setMaterial(e) {
let t = this.line.material;
for (let n in e) {
if (!e.hasOwnProperty(n)) continue;
let r = e[n];
n === "dashed" ? (t.dashed = r, r ? t.defines.USE_DASH = "" : delete t.defines.USE_DASH, t.needsUpdate = !0) : t[n] = e[n];
}
this.needsRender = !0;
}
setResolution(e, t) {
let n = this.line.material.resolution;
(n.x !== e || n.y !== t) && (n.set(e, t), this.needsRender = !0);
}
};
Object.assign(f.prototype, { isFiveLine: !0 });
//#endregion
export { f as Line, o as LineGeometry, r as LineMaterial, t as LineSegmentsGeometry, a as THREE_Line2, i as THREE_LineSegments2 };