123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481 |
- (window.webpackJsonpNVIV = window.webpackJsonpNVIV || []).push([[25], {
- 1906: function(t, e, n) {
- var i;
- window,
- t.exports = (i = n(4),
- function(t) {
- var e = {};
- function n(i) {
- if (e[i])
- return e[i].exports;
- var o = e[i] = {
- i: i,
- l: !1,
- exports: {}
- };
- return t[i].call(o.exports, o, o.exports, n),
- o.l = !0,
- o.exports
- }
- return n.m = t,
- n.c = e,
- n.d = function(t, e, i) {
- n.o(t, e) || Object.defineProperty(t, e, {
- enumerable: !0,
- get: i
- })
- }
- ,
- n.r = function(t) {
- "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
- value: "Module"
- }),
- Object.defineProperty(t, "__esModule", {
- value: !0
- })
- }
- ,
- n.t = function(t, e) {
- if (1 & e && (t = n(t)),
- 8 & e)
- return t;
- if (4 & e && "object" == typeof t && t && t.__esModule)
- return t;
- var i = Object.create(null);
- if (n.r(i),
- Object.defineProperty(i, "default", {
- enumerable: !0,
- value: t
- }),
- 2 & e && "string" != typeof t)
- for (var o in t)
- n.d(i, o, function(e) {
- return t[e]
- }
- .bind(null, o));
- return i
- }
- ,
- n.n = function(t) {
- var e = t && t.__esModule ? function() {
- return t.default
- }
- : function() {
- return t
- }
- ;
- return n.d(e, "a", e),
- e
- }
- ,
- n.o = function(t, e) {
- return Object.prototype.hasOwnProperty.call(t, e)
- }
- ,
- n.p = "",
- n(n.s = 8)
- }([function(t, e) {
- t.exports = i
- }
- , function(t, e, n) {
- "use strict";
- function i(t) {
- this.content = [],
- this.scoreFunction = t
- }
- Object.defineProperty(e, "__esModule", {
- value: !0
- }),
- e.BinaryHeap = i,
- i.prototype = {
- push: function(t) {
- this.content.push(t),
- this.bubbleUp(this.content.length - 1)
- },
- pop: function() {
- var t = this.content[0]
- , e = this.content.pop();
- return this.content.length > 0 && (this.content[0] = e,
- this.sinkDown(0)),
- t
- },
- remove: function(t) {
- for (var e = this.content.length, n = 0; n < e; n++)
- if (this.content[n] == t) {
- var i = this.content.pop();
- if (n == e - 1)
- break;
- this.content[n] = i,
- this.bubbleUp(n),
- this.sinkDown(n);
- break
- }
- },
- size: function() {
- return this.content.length
- },
- bubbleUp: function(t) {
- for (var e = this.content[t], n = this.scoreFunction(e); t > 0; ) {
- var i = Math.floor((t + 1) / 2) - 1
- , o = this.content[i];
- if (n >= this.scoreFunction(o))
- break;
- this.content[i] = e,
- this.content[t] = o,
- t = i
- }
- },
- sinkDown: function(t) {
- for (var e = this.content.length, n = this.content[t], i = this.scoreFunction(n); ; ) {
- var o = 2 * (t + 1)
- , r = o - 1
- , a = null;
- if (r < e) {
- var s = this.content[r]
- , u = this.scoreFunction(s);
- u < i && (a = r)
- }
- if (o < e) {
- var l = this.content[o];
- this.scoreFunction(l) < (null == a ? i : u) && (a = o)
- }
- if (null == a)
- break;
- this.content[t] = this.content[a],
- this.content[a] = n,
- t = a
- }
- }
- }
- }
- , function(t, e, n) {
- "use strict";
- n.r(e),
- e.default = "precision highp float;\nprecision highp int;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\n\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}"
- }
- , function(t, e, n) {
- "use strict";
- n.r(e),
- e.default = "precision highp float;\nprecision highp int;\n\nuniform mat4 projectionMatrix;\n\nuniform float screenWidth;\nuniform float screenHeight;\n\nuniform sampler2D map;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tfloat dx = 1.0 / screenWidth;\n\tfloat dy = 1.0 / screenHeight;\n\n\tvec3 color = vec3(0.0, 0.0, 0.0);\n\tcolor += texture2D(map, vUv + vec2(-dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, dy)).rgb;\n \n\tcolor = color / 9.0;\n\t\n\tgl_FragColor = vec4(color, 1.0);\n\t\n\t\n}"
- }
- , function(t, e, n) {
- "use strict";
- n.r(e),
- e.default = "precision highp float;\nprecision highp int;\n\n#define max_clip_boxes 30\n\nattribute vec3 position;\nattribute vec3 color;\nattribute vec3 normal;\nattribute float intensity;\nattribute float classification;\nattribute float returnNumber;\nattribute float numberOfReturns;\nattribute float pointSourceID;\nattribute vec4 indices;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\n\nuniform float pcIndex;\n\nuniform float screenWidth;\nuniform float screenHeight;\nuniform float fov;\nuniform float spacing;\n\n#if defined use_clip_box\n\tuniform mat4 clipBoxes[max_clip_boxes];\n#endif\n\nuniform float heightMin;\nuniform float heightMax;\nuniform float size; // pixel size factor\nuniform float minSize; // minimum pixel size\nuniform float maxSize; // maximum pixel size\nuniform float octreeSize;\nuniform vec3 bbSize;\nuniform vec3 uColor;\nuniform float opacity;\nuniform float clipBoxCount;\nuniform float level;\nuniform float vnStart;\nuniform bool isLeafNode;\n\nuniform float filterByNormalThreshold;\nuniform vec2 intensityRange;\nuniform float opacityAttenuation;\nuniform float intensityGamma;\nuniform float intensityContrast;\nuniform float intensityBrightness;\nuniform float rgbGamma;\nuniform float rgbContrast;\nuniform float rgbBrightness;\nuniform float transition;\nuniform float wRGB;\nuniform float wIntensity;\nuniform float wElevation;\nuniform float wClassification;\nuniform float wReturnNumber;\nuniform float wSourceID;\n\nuniform sampler2D visibleNodes;\nuniform sampler2D gradient;\nuniform sampler2D classificationLUT;\nuniform sampler2D depthMap;\n\n#ifdef highlight_point\n\tuniform vec3 highlightedPointCoordinate;\n\tuniform bool enablePointHighlighting;\n\tuniform float highlightedPointScale;\n#endif\n\nvarying vec3 vColor;\n\n#if !defined(color_type_point_index)\n\tvarying float vOpacity;\n#endif\n\n#if defined(weighted_splats)\n\tvarying float vLinearDepth;\n#endif\n\n#if !defined(paraboloid_point_shape) && defined(use_edl)\n\tvarying float vLogDepth;\n#endif\n\n#if defined(color_type_phong) && (MAX_POINT_LIGHTS > 0 || MAX_DIR_LIGHTS > 0) || defined(paraboloid_point_shape)\n\tvarying vec3 vViewPosition;\n#endif\n\n#if defined(weighted_splats) || defined(paraboloid_point_shape)\n\tvarying float vRadius;\n#endif\n\n#if defined(color_type_phong) && (MAX_POINT_LIGHTS > 0 || MAX_DIR_LIGHTS > 0)\n\tvarying vec3 vNormal;\n#endif\n\n#ifdef highlight_point\n\tvarying float vHighlight;\n#endif\n\n// ---------------------\n// OCTREE\n// ---------------------\n\n#if (defined(adaptive_point_size) || defined(color_type_lod)) && defined(tree_type_octree)\n\n/**\n * Rounds the specified number to the closest integer.\n */\nfloat round(float number){\n\treturn floor(number + 0.5);\n}\n\n/**\n * Gets the number of 1-bits up to inclusive index position.\n * \n * number is treated as if it were an integer in the range 0-255\n */\nint numberOfOnes(int number, int index) {\n\tint numOnes = 0;\n\tint tmp = 128;\n\tfor (int i = 7; i >= 0; i--) {\n\n\t\tif (number >= tmp) {\n\t\t\tnumber = number - tmp;\n\n\t\t\tif (i <= index) {\n\t\t\t\tnumOnes++;\n\t\t\t}\n\t\t}\n\n\t\ttmp = tmp / 2;\n\t}\n\n\treturn numOnes;\n}\n\n/**\n * Checks whether the bit at index is 1.0\n *\n * number is treated as if it were an integer in the range 0-255\n */\nbool isBitSet(int number, int index){\n\n\t// weird multi else if due to lack of proper array, int and bitwise support in WebGL 1.0\n\tint powi = 1;\n\tif (index == 0) {\n\t\tpowi = 1;\n\t} else if (index == 1) {\n\t\tpowi = 2;\n\t} else if (index == 2) {\n\t\tpowi = 4;\n\t} else if (index == 3) {\n\t\tpowi = 8;\n\t} else if (index == 4) {\n\t\tpowi = 16;\n\t} else if (index == 5) {\n\t\tpowi = 32;\n\t} else if (index == 6) {\n\t\tpowi = 64;\n\t} else if (index == 7) {\n\t\tpowi = 128;\n\t}\n\n\tint ndp = number / powi;\n\n\treturn mod(float(ndp), 2.0) != 0.0;\n}\n\n/**\n * Gets the the LOD at the point position.\n */\nfloat getLOD() {\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tint iOffset = int(vnStart);\n\tfloat depth = level;\n\n\tfor (float i = 0.0; i <= 30.0; i++) {\n\t\tfloat nodeSizeAtLevel = octreeSize / pow(2.0, i + level + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tint index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));\n\t\tint mask = int(round(value.r * 255.0));\n\n\t\tif (isBitSet(mask, index)) {\n\t\t\t// there are more visible child nodes at this position\n\t\t\tint advanceG = int(round(value.g * 255.0)) * 256;\n\t\t\tint advanceB = int(round(value.b * 255.0));\n\t\t\tint advanceChild = numberOfOnes(mask, index - 1);\n\t\t\tint advance = advanceG + advanceB + advanceChild;\n\n\t\t\tiOffset = iOffset + advance;\n\n\t\t\tdepth++;\n\t\t} else {\n\t\t\treturn value.a * 255.0; // no more visible child nodes at this position\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d; \n\t}\n\t\t\n\treturn depth;\n}\n\nfloat getPointSizeAttenuation() {\n\treturn 0.5 * pow(2.0, getLOD());\n}\n\n#endif\n\n// ---------------------\n// KD-TREE\n// ---------------------\n\n#if (defined(adaptive_point_size) || defined(color_type_lod)) && defined(tree_type_kdtree)\n\nfloat getLOD() {\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tfloat intOffset = 0.0;\n\tfloat depth = 0.0;\n\t\t\t\n\tvec3 size = bbSize;\t\n\tvec3 pos = position;\n\t\t\n\tfor (float i = 0.0; i <= 1000.0; i++) {\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(intOffset / 2048.0, 0.0));\n\t\t\n\t\tint children = int(value.r * 255.0);\n\t\tfloat next = value.g * 255.0;\n\t\tint split = int(value.b * 255.0);\n\t\t\n\t\tif (next == 0.0) {\n\t\t \treturn depth;\n\t\t}\n\t\t\n\t\tvec3 splitv = vec3(0.0, 0.0, 0.0);\n\t\tif (split == 1) {\n\t\t\tsplitv.x = 1.0;\n\t\t} else if (split == 2) {\n\t\t \tsplitv.y = 1.0;\n\t\t} else if (split == 4) {\n\t\t \tsplitv.z = 1.0;\n\t\t}\n\t\t\n\t\tintOffset = intOffset + next;\n\t\t\n\t\tfloat factor = length(pos * splitv / size);\n\t\tif (factor < 0.5) {\n\t\t \t// left\n\t\t\tif (children == 0 || children == 2) {\n\t\t\t\treturn depth;\n\t\t\t}\n\t\t} else {\n\t\t\t// right\n\t\t\tpos = pos - size * splitv * 0.5;\n\t\t\tif (children == 0 || children == 1) {\n\t\t\t\treturn depth;\n\t\t\t}\n\t\t\tif (children == 3) {\n\t\t\t\tintOffset = intOffset + 1.0;\n\t\t\t}\n\t\t}\n\t\tsize = size * ((1.0 - (splitv + 1.0) / 2.0) + 0.5);\n\t\t\n\t\tdepth++;\n\t}\n\t\t\n\t\t\n\treturn depth;\t\n}\n\nfloat getPointSizeAttenuation() {\n\treturn 0.5 * pow(1.3, getLOD());\n}\n\n#endif\n\n// formula adapted from: http://www.dfstudios.co.uk/articles/programming/image-programming-algorithms/image-processing-algorithms-part-5-contrast-adjustment/\nfloat getContrastFactor(float contrast) {\n\treturn (1.0158730158730156 * (contrast + 1.0)) / (1.0158730158730156 - contrast);\n}\n\nvec3 getRGB() {\n\t#if defined(use_rgb_gamma_contrast_brightness)\n\t vec3 rgb = color;\n\t\trgb = pow(rgb, vec3(rgbGamma));\n\t\trgb = rgb + rgbBrightness;\n\t\trgb = (rgb - 0.5) * getContrastFactor(rgbContrast) + 0.5;\n\t\trgb = clamp(rgb, 0.0, 1.0);\n\t\treturn rgb;\n\t#else\n\t\treturn color;\n\t#endif\n}\n\nfloat getIntensity() {\n\tfloat w = (intensity - intensityRange.x) / (intensityRange.y - intensityRange.x);\n\tw = pow(w, intensityGamma);\n\tw = w + intensityBrightness;\n\tw = (w - 0.5) * getContrastFactor(intensityContrast) + 0.5;\n\tw = clamp(w, 0.0, 1.0);\n\t\n\treturn w;\n}\n\nvec3 getElevation() {\n\tvec4 world = modelMatrix * vec4( position, 1.0 );\n\tfloat w = (world.z - heightMin) / (heightMax-heightMin);\n\tvec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t\n\treturn cElevation;\n}\n\nvec4 getClassification() {\n\tvec2 uv = vec2(classification / 255.0, 0.5);\n\tvec4 classColor = texture2D(classificationLUT, uv);\n\t\n\treturn classColor;\n}\n\nvec3 getReturnNumber() {\n\tif (numberOfReturns == 1.0) {\n\t\treturn vec3(1.0, 1.0, 0.0);\n\t} else {\n\t\tif (returnNumber == 1.0) {\n\t\t\treturn vec3(1.0, 0.0, 0.0);\n\t\t} else if (returnNumber == numberOfReturns) {\n\t\t\treturn vec3(0.0, 0.0, 1.0);\n\t\t} else {\n\t\t\treturn vec3(0.0, 1.0, 0.0);\n\t\t}\n\t}\n}\n\nvec3 getSourceID() {\n\tfloat w = mod(pointSourceID, 10.0) / 10.0;\n\treturn texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n}\n\nvec3 getCompositeColor() {\n\tvec3 c;\n\tfloat w;\n\n\tc += wRGB * getRGB();\n\tw += wRGB;\n\t\n\tc += wIntensity * getIntensity() * vec3(1.0, 1.0, 1.0);\n\tw += wIntensity;\n\t\n\tc += wElevation * getElevation();\n\tw += wElevation;\n\t\n\tc += wReturnNumber * getReturnNumber();\n\tw += wReturnNumber;\n\t\n\tc += wSourceID * getSourceID();\n\tw += wSourceID;\n\t\n\tvec4 cl = wClassification * getClassification();\n\tc += cl.a * cl.rgb;\n\tw += wClassification * cl.a;\n\n\tc = c / w;\n\t\n\tif (w == 0.0) {\n\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t}\n\t\n\treturn c;\n}\n\nvoid main() {\n\tvec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#if defined(color_type_phong) && (MAX_POINT_LIGHTS > 0 || MAX_DIR_LIGHTS > 0) || defined(paraboloid_point_shape)\n\t\tvViewPosition = mvPosition.xyz;\n\t#endif\n\n\t#if defined weighted_splats\n\t\tvLinearDepth = gl_Position.w;\n\t#endif\n\n\t#if defined(color_type_phong) && (MAX_POINT_LIGHTS > 0 || MAX_DIR_LIGHTS > 0)\n\t\tvNormal = normalize(normalMatrix * normal);\n\t#endif\n\n\t#if !defined(paraboloid_point_shape) && defined(use_edl)\n\t\tvLogDepth = log2(-mvPosition.z);\n\t#endif\n\n\t// ---------------------\n\t// POINT SIZE\n\t// ---------------------\n\n\tfloat pointSize = 1.0;\n\tfloat slope = tan(fov / 2.0);\n\tfloat projFactor = -0.5 * screenHeight / (slope * mvPosition.z);\n\n\t#if defined fixed_point_size\n\t\tpointSize = size;\n\t#elif defined attenuated_point_size\n\t\tpointSize = size * spacing * projFactor;\n\t#elif defined adaptive_point_size\n\t\tfloat worldSpaceSize = 2.0 * size * spacing / getPointSizeAttenuation();\n\t\tpointSize = worldSpaceSize * projFactor;\n\t#endif\n\n\tpointSize = max(minSize, pointSize);\n\tpointSize = min(maxSize, pointSize);\n\n\t#if defined(weighted_splats) || defined(paraboloid_point_shape)\n\t\tvRadius = pointSize / projFactor;\n\t#endif\n\n\tgl_PointSize = pointSize;\n\n\t// ---------------------\n\t// HIGHLIGHTING\n\t// ---------------------\n\n\t#ifdef highlight_point\n\t\tvec4 mPosition = modelMatrix * vec4(position, 1.0);\n\t\tif (enablePointHighlighting && abs(mPosition.x - highlightedPointCoordinate.x) < 0.0001 &&\n\t\t\tabs(mPosition.y - highlightedPointCoordinate.y) < 0.0001 &&\n\t\t\tabs(mPosition.z - highlightedPointCoordinate.z) < 0.0001) {\n\t\t\tvHighlight = 1.0;\n\t\t\tgl_PointSize = pointSize * highlightedPointScale;\n\t\t} else {\n\t\t\tvHighlight = 0.0;\n\t\t}\n\t#endif\n\n\t// ---------------------\n\t// OPACITY\n\t// ---------------------\n\n\t#ifndef color_type_point_index\n\t\t#ifdef attenuated_opacity\n\t\t\tvOpacity = opacity * exp(-length(-mvPosition.xyz) / opacityAttenuation);\n\t\t#else\n\t\t\tvOpacity = opacity;\n\t\t#endif\n\t#endif\n\n\t// ---------------------\n\t// FILTERING\n\t// ---------------------\n\n\t#ifdef use_filter_by_normal\n\t\tif(abs((modelViewMatrix * vec4(normal, 0.0)).z) > filterByNormalThreshold) {\n\t\t\t// Move point outside clip space space to discard it.\n\t\t\tgl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n\t\t}\n\t#endif\n\n\t// ---------------------\n\t// POINT COLOR\n\t// ---------------------\t\n\n\t#ifdef color_type_rgb\n\t\tvColor = getRGB();\n\t#elif defined color_type_height\n\t\tvColor = getElevation();\n\t#elif defined color_type_rgb_height\n\t\tvec3 cHeight = getElevation();\n\t\tvColor = (1.0 - transition) * getRGB() + transition * cHeight;\n\t#elif defined color_type_depth\n\t\tfloat linearDepth = -mvPosition.z ;\n\t\tfloat expDepth = (gl_Position.z / gl_Position.w) * 0.5 + 0.5;\n\t\tvColor = vec3(linearDepth, expDepth, 0.0);\n\t#elif defined color_type_intensity\n\t\tfloat w = getIntensity();\n\t\tvColor = vec3(w, w, w);\n\t#elif defined color_type_intensity_gradient\n\t\tfloat w = getIntensity();\n\t\tvColor = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n\t#elif defined color_type_color\n\t\tvColor = uColor;\n\t#elif defined color_type_lod\n\tfloat w = getLOD() / 10.0;\n\tvColor = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n\t#elif defined color_type_point_index\n\t\tvColor = indices.rgb;\n\t#elif defined color_type_classification\n\t vec4 cl = getClassification(); \n\t\tvColor = cl.rgb;\n\t#elif defined color_type_return_number\n\t\tvColor = getReturnNumber();\n\t#elif defined color_type_source\n\t\tvColor = getSourceID();\n\t#elif defined color_type_normal\n\t\tvColor = (modelMatrix * vec4(normal, 0.0)).xyz;\n\t#elif defined color_type_phong\n\t\tvColor = color;\n\t#elif defined color_type_composite\n\t\tvColor = getCompositeColor();\n\t#endif\n\t\n\t#if !defined color_type_composite && defined color_type_classification\n\t\tif (cl.a == 0.0) {\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\treturn;\n\t\t}\n\t#endif\n\n\t// ---------------------\n\t// CLIPPING\n\t// ---------------------\n\n\t#if defined use_clip_box\n\t\tbool insideAny = false;\n\t\tfor (int i = 0; i < max_clip_boxes; i++) {\n\t\t\tif (i == int(clipBoxCount)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\n\t\t\tvec4 clipPosition = clipBoxes[i] * modelMatrix * vec4(position, 1.0);\n\t\t\tbool inside = -0.5 <= clipPosition.x && clipPosition.x <= 0.5;\n\t\t\tinside = inside && -0.5 <= clipPosition.y && clipPosition.y <= 0.5;\n\t\t\tinside = inside && -0.5 <= clipPosition.z && clipPosition.z <= 0.5;\n\t\t\tinsideAny = insideAny || inside;\n\t\t}\n\n\t\tif (!insideAny) {\n\t\t\t#if defined clip_outside\n\t\t\t\tgl_Position = vec4(1000.0, 1000.0, 1000.0, 1.0);\n\t\t\t#elif defined clip_highlight_inside && !defined(color_type_depth)\n\t\t\t\tfloat c = (vColor.r + vColor.g + vColor.b) / 6.0;\n\t\t\t#endif\n\t\t} else {\n\t\t\t#if defined clip_highlight_inside\n\t\t\t\tvColor.r += 0.5;\n\t\t\t#endif\n\t\t}\n\t#endif\n}\n"
- }
- , function(t, e, n) {
- "use strict";
- n.r(e),
- e.default = "precision highp float;\nprecision highp int;\n\n#if defined paraboloid_point_shape\n\t#extension GL_EXT_frag_depth : enable\n#endif\n\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n\nuniform mat4 projectionMatrix;\nuniform float opacity;\n\nuniform float blendHardness;\nuniform float blendDepthSupplement;\nuniform float fov;\nuniform float spacing;\nuniform float pcIndex;\nuniform float screenWidth;\nuniform float screenHeight;\n\nuniform sampler2D depthMap;\n\n#ifdef highlight_point\n\tuniform vec4 highlightedPointColor;\n#endif\n\nvarying vec3 vColor;\n\n#if !defined(color_type_point_index)\n\tvarying float vOpacity;\n#endif\n\n#if defined(weighted_splats)\n\tvarying float vLinearDepth;\n#endif\n\n#if !defined(paraboloid_point_shape) && defined(use_edl)\n\tvarying float vLogDepth;\n#endif\n\n#if defined(color_type_phong) && (MAX_POINT_LIGHTS > 0 || MAX_DIR_LIGHTS > 0) || defined(paraboloid_point_shape)\n\tvarying vec3 vViewPosition;\n#endif\n\n#if defined(weighted_splats) || defined(paraboloid_point_shape)\n\tvarying float vRadius;\n#endif\n\n#if defined(color_type_phong) && (MAX_POINT_LIGHTS > 0 || MAX_DIR_LIGHTS > 0)\n\tvarying vec3 vNormal;\n#endif\n\n#ifdef highlight_point\n\tvarying float vHighlight;\n#endif\n\nfloat specularStrength = 1.0;\n\nvoid main() {\n\tvec3 color = vColor;\n\tfloat depth = gl_FragCoord.z;\n\n\t#if defined(circle_point_shape) || defined(paraboloid_point_shape) || defined (weighted_splats)\n\t\tfloat u = 2.0 * gl_PointCoord.x - 1.0;\n\t\tfloat v = 2.0 * gl_PointCoord.y - 1.0;\n\t#endif\n\t\n\t#if defined(circle_point_shape) || defined (weighted_splats)\n\t\tfloat cc = u*u + v*v;\n\t\tif(cc > 1.0){\n\t\t\tdiscard;\n\t\t}\n\t#endif\n\n\t#if defined weighted_splats\n\t\tvec2 uv = gl_FragCoord.xy / vec2(screenWidth, screenHeight);\n\t\tfloat sDepth = texture2D(depthMap, uv).r;\n\t\tif(vLinearDepth > sDepth + vRadius + blendDepthSupplement){\n\t\t\tdiscard;\n\t\t}\n\t#endif\n\t\t\n\t#if defined color_type_point_index\n\t\tgl_FragColor = vec4(color, pcIndex / 255.0);\n\t#else\n\t\tgl_FragColor = vec4(color, vOpacity);\n\t#endif\n\n\t#if defined(color_type_phong)\n\t\t#if MAX_POINT_LIGHTS > 0 || MAX_DIR_LIGHTS > 0\n\t\t\tvec3 normal = normalize( vNormal );\n\t\t\tnormal.z = abs(normal.z);\n\n\t\t\tvec3 viewPosition = normalize( vViewPosition );\n\t\t#endif\n\n\t\t// code taken from three.js phong light fragment shader\n\t\n\t\t#if MAX_POINT_LIGHTS > 0\n\n\t\t\tvec3 pointDiffuse = vec3( 0.0 );\n\t\t\tvec3 pointSpecular = vec3( 0.0 );\n\n\t\t\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\t\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\t\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\t\t\tfloat lDistance = 1.0;\n\t\t\t\tif ( pointLightDistance[ i ] > 0.0 )\n\t\t\t\t\tlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\n\n\t\t\t\tlVector = normalize( lVector );\n\n\t\t\t\t\t\t// diffuse\n\n\t\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t\t#else\n\n\t\t\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t\t#endif\n\n\t\t\t\tpointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\n\n\t\t\t\t// specular\n\n\t\t\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\t\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\t\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\t\t\tpointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n\t\t\t\tpointSpecular = vec3(0.0, 0.0, 0.0);\n\t\t\t}\n\t\t\n\t\t#endif\n\t\t\n\t\t#if MAX_DIR_LIGHTS > 0\n\n\t\t\tvec3 dirDiffuse = vec3( 0.0 );\n\t\t\tvec3 dirSpecular = vec3( 0.0 );\n\n\t\t\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\t\t\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n\t\t\t\tvec3 dirVector = normalize( lDirection.xyz );\n\n\t\t\t\t\t\t// diffuse\n\n\t\t\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t\t#else\n\n\t\t\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t\t#endif\n\n\t\t\t\tdirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t\t\t// specular\n\n\t\t\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\t\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\t\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\t\t\tdirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\t\t\t}\n\n\t\t#endif\n\t\t\n\t\tvec3 totalDiffuse = vec3( 0.0 );\n\t\tvec3 totalSpecular = vec3( 0.0 );\n\t\t\n\t\t#if MAX_POINT_LIGHTS > 0\n\n\t\t\ttotalDiffuse += pointDiffuse;\n\t\t\ttotalSpecular += pointSpecular;\n\n\t\t#endif\n\t\t\n\t\t#if MAX_DIR_LIGHTS > 0\n\n\t\t\ttotalDiffuse += dirDiffuse;\n\t\t\ttotalSpecular += dirSpecular;\n\n\t\t#endif\n\t\t\n\t\tgl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n\n\t#endif\n\t\n\t#if defined weighted_splats\n\t //float w = pow(1.0 - (u*u + v*v), blendHardness);\n\t\t\n\t\tfloat wx = 2.0 * length(2.0 * gl_PointCoord - 1.0);\n\t\tfloat w = exp(-wx * wx * 0.5);\n\t\t\n\t\t//float distance = length(2.0 * gl_PointCoord - 1.0);\n\t\t//float w = exp( -(distance * distance) / blendHardness);\n\t\t\n\t\tgl_FragColor.rgb = gl_FragColor.rgb * w;\n\t\tgl_FragColor.a = w;\n\t#endif\n\t\n\t#if defined paraboloid_point_shape\n\t\tfloat wi = 0.0 - ( u*u + v*v);\n\t\tvec4 pos = vec4(vViewPosition, 1.0);\n\t\tpos.z += wi * vRadius;\n\t\tfloat linearDepth = -pos.z;\n\t\tpos = projectionMatrix * pos;\n\t\tpos = pos / pos.w;\n\t\tfloat expDepth = pos.z;\n\t\tdepth = (pos.z + 1.0) / 2.0;\n\t\tgl_FragDepthEXT = depth;\n\t\t\n\t\t#if defined(color_type_depth)\n\t\t\tgl_FragColor.r = linearDepth;\n\t\t\tgl_FragColor.g = expDepth;\n\t\t#endif\n\t\t\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = log2(linearDepth);\n\t\t#endif\n\t\t\n\t#else\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = vLogDepth;\n\t\t#endif\n\t#endif\n\n\t#ifdef highlight_point\n\t\tif (vHighlight > 0.0) {\n\t\t\tgl_FragColor = highlightedPointColor;\n\t\t}\n\t#endif\n}\n"
- }
- , function(t, e, n) {
- t.exports = function() {
- return n(7)('!function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);onmessage=n.handleMessage},function(t,e,r){"use strict";var n;r.r(e),function(t){t[t.POSITION_CARTESIAN=0]="POSITION_CARTESIAN",t[t.COLOR_PACKED=1]="COLOR_PACKED",t[t.COLOR_FLOATS_1=2]="COLOR_FLOATS_1",t[t.COLOR_FLOATS_255=3]="COLOR_FLOATS_255",t[t.NORMAL_FLOATS=4]="NORMAL_FLOATS",t[t.FILLER=5]="FILLER",t[t.INTENSITY=6]="INTENSITY",t[t.CLASSIFICATION=7]="CLASSIFICATION",t[t.NORMAL_SPHEREMAPPED=8]="NORMAL_SPHEREMAPPED",t[t.NORMAL_OCT16=9]="NORMAL_OCT16",t[t.NORMAL=10]="NORMAL"}(n||(n={}));var i={ordinal:1,size:4},a={ordinal:2,size:1},o={ordinal:3,size:1},u={ordinal:5,size:2};function s(t,e,r){return{name:t,type:e,numElements:r,byteSize:r*e.size}}var f=s(n.COLOR_PACKED,a,4),A={POSITION_CARTESIAN:s(n.POSITION_CARTESIAN,i,3),RGBA_PACKED:f,COLOR_PACKED:f,RGB_PACKED:s(n.COLOR_PACKED,a,3),NORMAL_FLOATS:s(n.NORMAL_FLOATS,i,3),FILLER_1B:s(n.FILLER,o,1),INTENSITY:s(n.INTENSITY,u,1),CLASSIFICATION:s(n.CLASSIFICATION,o,1),NORMAL_SPHEREMAPPED:s(n.NORMAL_SPHEREMAPPED,o,2),NORMAL_OCT16:s(n.NORMAL_OCT16,o,2),NORMAL:s(n.NORMAL,i,3)};!function(){function t(t){void 0===t&&(t=[]),this.attributes=[],this.byteSize=0,this.size=0;for(var e=0;e<t.length;e++){var r=t[e],n=A[r];this.attributes.push(n),this.byteSize+=n.byteSize,this.size++}}t.prototype.add=function(t){this.attributes.push(t),this.byteSize+=t.byteSize,this.size++},t.prototype.hasColors=function(){return void 0!==this.attributes.find(O)},t.prototype.hasNormals=function(){return void 0!==this.attributes.find(b)}}();function O(t){return t.name===n.COLOR_PACKED}function b(t){var e=t.name;return e===n.NORMAL_SPHEREMAPPED||e===n.NORMAL_FLOATS||e===n.NORMAL||e===n.NORMAL_OCT16}var c=function(){function t(t){this.versionMinor=0,this.version=t;var e=-1===t.indexOf(".")?t.length:t.indexOf(".");this.versionMajor=parseInt(t.substr(0,e),10),this.versionMinor=parseInt(t.substr(e+1),10),isNaN(this.versionMinor)&&(this.versionMinor=0)}return t.prototype.newerThan=function(e){var r=new t(e);return this.versionMajor>r.versionMajor||this.versionMajor===r.versionMajor&&this.versionMinor>r.versionMinor},t.prototype.equalOrHigher=function(e){var r=new t(e);return this.versionMajor>r.versionMajor||this.versionMajor===r.versionMajor&&this.versionMinor>=r.versionMinor},t.prototype.upTo=function(t){return!this.newerThan(t)},t}(),h=function(){function t(t){this.tmp=new ArrayBuffer(4),this.tmpf=new Float32Array(this.tmp),this.tmpu8=new Uint8Array(this.tmp),this.u8=new Uint8Array(t)}return t.prototype.getUint32=function(t){return this.u8[t+3]<<24|this.u8[t+2]<<16|this.u8[t+1]<<8|this.u8[t]},t.prototype.getUint16=function(t){return this.u8[t+1]<<8|this.u8[t]},t.prototype.getFloat32=function(t){var e=this.tmpu8,r=this.u8,n=this.tmpf;return e[0]=r[t+0],e[1]=r[t+1],e[2]=r[t+2],e[3]=r[t+3],n[0]},t.prototype.getUint8=function(t){return this.u8[t]},t}();r.d(e,"handleMessage",(function(){return M}));var I=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1};function M(t){for(var e=t.data.buffer,r=t.data.pointAttributes,i={attributeBuffers:{},currentOffset:0,data:new h(e),mean:[0,0,0],nodeOffset:t.data.offset,numPoints:t.data.buffer.byteLength/r.byteSize,pointAttributes:r,scale:t.data.scale,tightBoxMax:[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],tightBoxMin:[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],transferables:[],version:new c(t.data.version)},a=0,o=i.pointAttributes.attributes;a<o.length;a++){var u=o[a];S(u,i),i.currentOffset+=u.byteSize}for(var s=new ArrayBuffer(4*i.numPoints),f=new Uint32Array(s),O=0;O<i.numPoints;O++)f[O]=O;i.attributeBuffers[n.CLASSIFICATION]||function(t){for(var e=new ArrayBuffer(4*t.numPoints),r=new Float32Array(e),i=0;i<t.numPoints;i++)r[i]=0;t.attributeBuffers[n.CLASSIFICATION]={buffer:e,attribute:A.CLASSIFICATION}}(i);var b={buffer:e,mean:i.mean,attributeBuffers:i.attributeBuffers,tightBoundingBox:{min:i.tightBoxMin,max:i.tightBoxMax},indices:s};postMessage(b,i.transferables)}function S(t,e){var r=function(t,e){switch(t.name){case n.POSITION_CARTESIAN:return function(t,e){for(var r=new ArrayBuffer(4*e.numPoints*3),n=new Float32Array(r),i=0;i<e.numPoints;i++){var a=void 0,o=void 0,u=void 0;e.version.newerThan("1.3")?(a=e.data.getUint32(e.currentOffset+i*e.pointAttributes.byteSize+0)*e.scale,o=e.data.getUint32(e.currentOffset+i*e.pointAttributes.byteSize+4)*e.scale,u=e.data.getUint32(e.currentOffset+i*e.pointAttributes.byteSize+8)*e.scale):(a=e.data.getFloat32(i*e.pointAttributes.byteSize+0)+e.nodeOffset[0],o=e.data.getFloat32(i*e.pointAttributes.byteSize+4)+e.nodeOffset[1],u=e.data.getFloat32(i*e.pointAttributes.byteSize+8)+e.nodeOffset[2]),n[3*i+0]=a,n[3*i+1]=o,n[3*i+2]=u,e.mean[0]+=a/e.numPoints,e.mean[1]+=o/e.numPoints,e.mean[2]+=u/e.numPoints,e.tightBoxMin[0]=Math.min(e.tightBoxMin[0],a),e.tightBoxMin[1]=Math.min(e.tightBoxMin[1],o),e.tightBoxMin[2]=Math.min(e.tightBoxMin[2],u),e.tightBoxMax[0]=Math.max(e.tightBoxMax[0],a),e.tightBoxMax[1]=Math.max(e.tightBoxMax[1],o),e.tightBoxMax[2]=Math.max(e.tightBoxMax[2],u)}return{buffer:r,attribute:t}}(t,e);case n.COLOR_PACKED:return function(t,e){for(var r=new ArrayBuffer(3*e.numPoints),n=new Uint8Array(r),i=0;i<e.numPoints;i++)n[3*i+0]=e.data.getUint8(e.currentOffset+i*e.pointAttributes.byteSize+0),n[3*i+1]=e.data.getUint8(e.currentOffset+i*e.pointAttributes.byteSize+1),n[3*i+2]=e.data.getUint8(e.currentOffset+i*e.pointAttributes.byteSize+2);return{buffer:r,attribute:t}}(t,e);case n.INTENSITY:return function(t,e){for(var r=new ArrayBuffer(4*e.numPoints),n=new Float32Array(r),i=0;i<e.numPoints;i++)n[i]=e.data.getUint16(e.currentOffset+i*e.pointAttributes.byteSize);return{buffer:r,attribute:t}}(t,e);case n.CLASSIFICATION:return function(t,e){for(var r=new ArrayBuffer(e.numPoints),n=new Uint8Array(r),i=0;i<e.numPoints;i++)n[i]=e.data.getUint8(e.currentOffset+i*e.pointAttributes.byteSize);return{buffer:r,attribute:t}}(t,e);case n.NORMAL_SPHEREMAPPED:return function(t,e){for(var r=new ArrayBuffer(4*e.numPoints*3),n=new Float32Array(r),i=0;i<e.numPoints;i++){var a=e.data.getUint8(e.currentOffset+i*e.pointAttributes.byteSize+0),o=e.data.getUint8(e.currentOffset+i*e.pointAttributes.byteSize+1),u=2*(a/255)-1,s=2*(o/255)-1,f=1,A=u*-u+s*-s+1*f;f=A,u*=Math.sqrt(A),s*=Math.sqrt(A),u*=2,s*=2,f=2*f-1,n[3*i+0]=u,n[3*i+1]=s,n[3*i+2]=f}return{buffer:r,attribute:t}}(t,e);case n.NORMAL_OCT16:return function(t,e){for(var r=new ArrayBuffer(4*e.numPoints*3),n=new Float32Array(r),i=0;i<e.numPoints;i++){var a=e.data.getUint8(e.currentOffset+i*e.pointAttributes.byteSize+0),o=e.data.getUint8(e.currentOffset+i*e.pointAttributes.byteSize+1),u=a/255*2-1,s=o/255*2-1,f=1-Math.abs(u)-Math.abs(s),A=0,O=0;f>=0?(A=u,O=s):(A=-(s/I(s)-1)/I(u),O=-(u/I(u)-1)/I(s));var b=Math.sqrt(A*A+O*O+f*f);A/=b,O/=b,f/=b,n[3*i+0]=A,n[3*i+1]=O,n[3*i+2]=f}return{buffer:r,attribute:t}}(t,e);case n.NORMAL:return function(t,e){for(var r=new ArrayBuffer(4*e.numPoints*3),n=new Float32Array(r),i=0;i<e.numPoints;i++){var a=e.data.getFloat32(e.currentOffset+i*e.pointAttributes.byteSize+0),o=e.data.getFloat32(e.currentOffset+i*e.pointAttributes.byteSize+4),u=e.data.getFloat32(e.currentOffset+i*e.pointAttributes.byteSize+8);n[3*i+0]=a,n[3*i+1]=o,n[3*i+2]=u}return{buffer:r,attribute:t}}(t,e);default:return}}(t,e);void 0!==r&&(e.attributeBuffers[r.attribute.name]=r,e.transferables.push(r.buffer))}}]);', null)
- }
- }
- , function(t, e, n) {
- "use strict";
- var i = window.URL || window.webkitURL;
- t.exports = function(t, e) {
- try {
- try {
- var n;
- try {
- (n = new (window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder)).append(t),
- n = n.getBlob()
- } catch (e) {
- n = new Blob([t])
- }
- return new Worker(i.createObjectURL(n))
- } catch (e) {
- return new Worker("data:application/javascript," + encodeURIComponent(t))
- }
- } catch (t) {
- if (!e)
- throw Error("Inline worker is not supported");
- return new Worker(e)
- }
- }
- }
- , function(t, e, n) {
- "use strict";
- n.r(e);
- var i, o, r, a, s, u, l, f = n(0), d = (i = function(t, e) {
- return (i = Object.setPrototypeOf || {
- __proto__: []
- }instanceof Array && function(t, e) {
- t.__proto__ = e
- }
- || function(t, e) {
- for (var n in e)
- e.hasOwnProperty(n) && (t[n] = e[n])
- }
- )(t, e)
- }
- ,
- function(t, e) {
- function n() {
- this.constructor = t
- }
- i(t, e),
- t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype,
- new n)
- }
- ), p = function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.vertexShader = n(2),
- e.fragmentShader = n(3),
- e.uniforms = {
- screenWidth: {
- type: "f",
- value: 0
- },
- screenHeight: {
- type: "f",
- value: 0
- },
- map: {
- type: "t",
- value: null
- }
- },
- e
- }
- return d(e, t),
- e
- }(f.ShaderMaterial);
- !function(t) {
- t[t.DISABLED = 0] = "DISABLED",
- t[t.CLIP_OUTSIDE = 1] = "CLIP_OUTSIDE",
- t[t.HIGHLIGHT_INSIDE = 2] = "HIGHLIGHT_INSIDE"
- }(o || (o = {})),
- function(t) {
- t[t.FIXED = 0] = "FIXED",
- t[t.ATTENUATED = 1] = "ATTENUATED",
- t[t.ADAPTIVE = 2] = "ADAPTIVE"
- }(r || (r = {})),
- function(t) {
- t[t.SQUARE = 0] = "SQUARE",
- t[t.CIRCLE = 1] = "CIRCLE",
- t[t.PARABOLOID = 2] = "PARABOLOID"
- }(a || (a = {})),
- function(t) {
- t[t.OCTREE = 0] = "OCTREE",
- t[t.KDTREE = 1] = "KDTREE"
- }(s || (s = {})),
- function(t) {
- t[t.FIXED = 0] = "FIXED",
- t[t.ATTENUATED = 1] = "ATTENUATED"
- }(u || (u = {})),
- function(t) {
- t[t.RGB = 0] = "RGB",
- t[t.COLOR = 1] = "COLOR",
- t[t.DEPTH = 2] = "DEPTH",
- t[t.HEIGHT = 3] = "HEIGHT",
- t[t.ELEVATION = 3] = "ELEVATION",
- t[t.INTENSITY = 4] = "INTENSITY",
- t[t.INTENSITY_GRADIENT = 5] = "INTENSITY_GRADIENT",
- t[t.LOD = 6] = "LOD",
- t[t.LEVEL_OF_DETAIL = 6] = "LEVEL_OF_DETAIL",
- t[t.POINT_INDEX = 7] = "POINT_INDEX",
- t[t.CLASSIFICATION = 8] = "CLASSIFICATION",
- t[t.RETURN_NUMBER = 9] = "RETURN_NUMBER",
- t[t.SOURCE = 10] = "SOURCE",
- t[t.NORMAL = 11] = "NORMAL",
- t[t.PHONG = 12] = "PHONG",
- t[t.RGB_HEIGHT = 13] = "RGB_HEIGHT",
- t[t.COMPOSITE = 50] = "COMPOSITE"
- }(l || (l = {}));
- var c = new f.Color(0,0,0)
- , h = new f.Vector4(1,0,0,1);
- function g(t) {
- return parseInt(t.charAt(t.length - 1), 10)
- }
- function v(t, e) {
- var n = t.name
- , i = e.name;
- return n.length !== i.length ? n.length - i.length : n < i ? -1 : n > i ? 1 : 0
- }
- var m = {
- 0: new f.Vector4(.5,.5,.5,1),
- 1: new f.Vector4(.5,.5,.5,1),
- 2: new f.Vector4(.63,.32,.18,1),
- 3: new f.Vector4(0,1,0,1),
- 4: new f.Vector4(0,.8,0,1),
- 5: new f.Vector4(0,.6,0,1),
- 6: new f.Vector4(1,.66,0,1),
- 7: new f.Vector4(1,0,1,1),
- 8: new f.Vector4(1,0,0,1),
- 9: new f.Vector4(0,0,1,1),
- 12: new f.Vector4(1,1,0,1),
- DEFAULT: new f.Vector4(.3,.6,.6,.5)
- }
- , y = [[0, new f.Color(0,0,0)], [1, new f.Color(1,1,1)]]
- , b = [[0, new f.Color(.077,.042,.206)], [.1, new f.Color(.225,.036,.388)], [.2, new f.Color(.373,.074,.432)], [.3, new f.Color(.522,.128,.42)], [.4, new f.Color(.665,.182,.37)], [.5, new f.Color(.797,.255,.287)], [.6, new f.Color(.902,.364,.184)], [.7, new f.Color(.969,.516,.063)], [.8, new f.Color(.988,.683,.072)], [.9, new f.Color(.961,.859,.298)], [1, new f.Color(.988,.998,.645)]]
- , _ = [[0, new f.Color(.241,.015,.61)], [.1, new f.Color(.387,.001,.654)], [.2, new f.Color(.524,.025,.653)], [.3, new f.Color(.651,.125,.596)], [.4, new f.Color(.752,.227,.513)], [.5, new f.Color(.837,.329,.431)], [.6, new f.Color(.907,.435,.353)], [.7, new f.Color(.963,.554,.272)], [.8, new f.Color(.992,.681,.195)], [.9, new f.Color(.987,.822,.144)], [1, new f.Color(.94,.975,.131)]]
- , x = [[0, new f.Color(.278,0,.714)], [1 / 6, new f.Color(0,0,1)], [2 / 6, new f.Color(0,1,1)], [.5, new f.Color(0,1,0)], [4 / 6, new f.Color(1,1,0)], [5 / 6, new f.Color(1,.64,0)], [1, new f.Color(1,0,0)]]
- , A = [[0, new f.Color(.3686,.3098,.6353)], [.1, new f.Color(.1961,.5333,.7412)], [.2, new f.Color(.4,.7608,.6471)], [.3, new f.Color(.6706,.8667,.6431)], [.4, new f.Color(.902,.9608,.5961)], [.5, new f.Color(1,1,.749)], [.6, new f.Color(.9961,.8784,.5451)], [.7, new f.Color(.9922,.6824,.3804)], [.8, new f.Color(.9569,.4275,.2627)], [.9, new f.Color(.8353,.2431,.3098)], [1, new f.Color(.6196,.0039,.2588)]]
- , w = [[0, new f.Color(.267,.005,.329)], [.1, new f.Color(.283,.141,.458)], [.2, new f.Color(.254,.265,.53)], [.3, new f.Color(.207,.372,.553)], [.4, new f.Color(.164,.471,.558)], [.5, new f.Color(.128,.567,.551)], [.6, new f.Color(.135,.659,.518)], [.7, new f.Color(.267,.749,.441)], [.8, new f.Color(.478,.821,.318)], [.9, new f.Color(.741,.873,.15)], [1, new f.Color(.993,.906,.144)]]
- , T = [[0, new f.Color(.1647,.2824,.3451)], [.1, new f.Color(.1338,.3555,.4227)], [.2, new f.Color(.061,.4319,.4864)], [.3, new f.Color(0,.5099,.5319)], [.4, new f.Color(0,.5881,.5569)], [.5, new f.Color(.137,.665,.5614)], [.6, new f.Color(.2906,.7395,.5477)], [.7, new f.Color(.4453,.8099,.5201)], [.8, new f.Color(.6102,.8748,.485)], [.9, new f.Color(.7883,.9323,.4514)], [1, new f.Color(.9804,.9804,.4314)]];
- function O(t, e, n) {
- for (var i = t * e, o = new Uint8Array(4 * i), r = Math.floor(255 * n.r), a = Math.floor(255 * n.g), s = Math.floor(255 * n.b), u = 0; u < i; u++)
- o[3 * u] = r,
- o[3 * u + 1] = a,
- o[3 * u + 2] = s;
- var l = new f.DataTexture(o,t,e,f.RGBAFormat);
- return l.needsUpdate = !0,
- l.magFilter = f.NearestFilter,
- l
- }
- function N(t) {
- var e = document.createElement("canvas");
- e.width = 64,
- e.height = 64;
- var n = e.getContext("2d");
- n.rect(0, 0, 64, 64);
- for (var i = n.createLinearGradient(0, 0, 64, 64), o = 0; o < t.length; o++) {
- var r = t[o];
- i.addColorStop(r[0], "#" + r[1].getHexString())
- }
- n.fillStyle = i,
- n.fill();
- var a = new f.CanvasTexture(e);
- return a.needsUpdate = !0,
- a.minFilter = f.LinearFilter,
- a
- }
- function P(t) {
- for (var e = new Uint8Array(262144), n = 0; n < 256; n++)
- for (var i = 0; i < 256; i++) {
- var o, r = n + 256 * i;
- o = t[n] ? t[n] : t[n % 32] ? t[n % 32] : t.DEFAULT,
- e[4 * r + 0] = 255 * o.x,
- e[4 * r + 1] = 255 * o.y,
- e[4 * r + 2] = 255 * o.z,
- e[4 * r + 3] = 255 * o.w
- }
- var a = new f.DataTexture(e,256,256,f.RGBAFormat);
- return a.magFilter = f.NearestFilter,
- a.needsUpdate = !0,
- a
- }
- var S, C, I, M, B, E, L, D = function() {
- var t = function(e, n) {
- return (t = Object.setPrototypeOf || {
- __proto__: []
- }instanceof Array && function(t, e) {
- t.__proto__ = e
- }
- || function(t, e) {
- for (var n in e)
- e.hasOwnProperty(n) && (t[n] = e[n])
- }
- )(e, n)
- };
- return function(e, n) {
- function i() {
- this.constructor = e
- }
- t(e, n),
- e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype,
- new i)
- }
- }(), R = function(t, e, n, i) {
- var o, r = arguments.length, a = r < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, n) : i;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate)
- a = Reflect.decorate(t, e, n, i);
- else
- for (var s = t.length - 1; s >= 0; s--)
- (o = t[s]) && (a = (r < 3 ? o(a) : r > 3 ? o(e, n, a) : o(e, n)) || a);
- return r > 3 && a && Object.defineProperty(e, n, a),
- a
- }, z = ((S = {})[s.OCTREE] = "tree_type_octree",
- S[s.KDTREE] = "tree_type_kdtree",
- S), F = ((C = {})[r.FIXED] = "fixed_point_size",
- C[r.ATTENUATED] = "attenuated_point_size",
- C[r.ADAPTIVE] = "adaptive_point_size",
- C), G = ((I = {})[u.ATTENUATED] = "attenuated_opacity",
- I[u.FIXED] = "fixed_opacity",
- I), U = ((M = {})[a.SQUARE] = "square_point_shape",
- M[a.CIRCLE] = "circle_point_shape",
- M[a.PARABOLOID] = "paraboloid_point_shape",
- M), H = ((B = {})[l.RGB] = "color_type_rgb",
- B[l.COLOR] = "color_type_color",
- B[l.DEPTH] = "color_type_depth",
- B[l.HEIGHT] = "color_type_height",
- B[l.INTENSITY] = "color_type_intensity",
- B[l.INTENSITY_GRADIENT] = "color_type_intensity_gradient",
- B[l.LOD] = "color_type_lod",
- B[l.POINT_INDEX] = "color_type_point_index",
- B[l.CLASSIFICATION] = "color_type_classification",
- B[l.RETURN_NUMBER] = "color_type_return_number",
- B[l.SOURCE] = "color_type_source",
- B[l.NORMAL] = "color_type_normal",
- B[l.PHONG] = "color_type_phong",
- B[l.RGB_HEIGHT] = "color_type_rgb_height",
- B[l.COMPOSITE] = "color_type_composite",
- B), V = ((E = {})[o.DISABLED] = "clip_disabled",
- E[o.CLIP_OUTSIDE] = "clip_outside",
- E[o.HIGHLIGHT_INSIDE] = "clip_highlight_inside",
- E), j = function(t) {
- function e(e) {
- void 0 === e && (e = {});
- var n = t.call(this) || this;
- n.lights = !1,
- n.fog = !1,
- n.numClipBoxes = 0,
- n.clipBoxes = [],
- n.visibleNodeTextureOffsets = new Map,
- n._gradient = A,
- n.gradientTexture = N(n._gradient),
- n._classification = m,
- n.classificationTexture = P(n._classification),
- n.uniforms = {
- bbSize: k("fv", [0, 0, 0]),
- blendDepthSupplement: k("f", 0),
- blendHardness: k("f", 2),
- classificationLUT: k("t", n.classificationTexture || new f.Texture),
- clipBoxCount: k("f", 0),
- clipBoxes: k("Matrix4fv", []),
- depthMap: k("t", null),
- diffuse: k("fv", [1, 1, 1]),
- fov: k("f", 1),
- gradient: k("t", n.gradientTexture || new f.Texture),
- heightMax: k("f", 1),
- heightMin: k("f", 0),
- intensityBrightness: k("f", 0),
- intensityContrast: k("f", 0),
- intensityGamma: k("f", 1),
- intensityRange: k("fv", [0, 65e3]),
- isLeafNode: k("b", 0),
- level: k("f", 0),
- maxSize: k("f", 50),
- minSize: k("f", 2),
- octreeSize: k("f", 0),
- opacity: k("f", 1),
- pcIndex: k("f", 0),
- rgbBrightness: k("f", 0),
- rgbContrast: k("f", 0),
- rgbGamma: k("f", 1),
- screenHeight: k("f", 1),
- screenWidth: k("f", 1),
- size: k("f", 1),
- spacing: k("f", 1),
- toModel: k("Matrix4f", []),
- transition: k("f", .5),
- uColor: k("c", new f.Color(16777215)),
- visibleNodes: k("t", n.visibleNodesTexture || new f.Texture),
- vnStart: k("f", 0),
- wClassification: k("f", 0),
- wElevation: k("f", 0),
- wIntensity: k("f", 0),
- wReturnNumber: k("f", 0),
- wRGB: k("f", 1),
- wSourceID: k("f", 0),
- opacityAttenuation: k("f", 1),
- filterByNormalThreshold: k("f", 0),
- highlightedPointCoordinate: k("fv", new f.Vector3),
- highlightedPointColor: k("fv", h.clone()),
- enablePointHighlighting: k("b", !0),
- highlightedPointScale: k("f", 2)
- },
- n.useClipBox = !1,
- n.weighted = !1,
- n.pointColorType = l.RGB,
- n.pointSizeType = r.ADAPTIVE,
- n.clipMode = o.DISABLED,
- n.useEDL = !1,
- n.shape = a.SQUARE,
- n.treeType = s.OCTREE,
- n.pointOpacityType = u.FIXED,
- n.useFilterByNormal = !1,
- n.highlightPoint = !1,
- n.attributes = {
- position: {
- type: "fv",
- value: []
- },
- color: {
- type: "fv",
- value: []
- },
- normal: {
- type: "fv",
- value: []
- },
- intensity: {
- type: "f",
- value: []
- },
- classification: {
- type: "f",
- value: []
- },
- returnNumber: {
- type: "f",
- value: []
- },
- numberOfReturns: {
- type: "f",
- value: []
- },
- pointSourceID: {
- type: "f",
- value: []
- },
- indices: {
- type: "fv",
- value: []
- }
- };
- var i = n.visibleNodesTexture = O(2048, 1, new f.Color(16777215));
- return i.minFilter = f.NearestFilter,
- i.magFilter = f.NearestFilter,
- n.setUniform("visibleNodes", i),
- n.treeType = W(e.treeType, s.OCTREE),
- n.size = W(e.size, 1),
- n.minSize = W(e.minSize, 2),
- n.maxSize = W(e.maxSize, 50),
- n.classification = m,
- n.defaultAttributeValues.normal = [0, 0, 0],
- n.defaultAttributeValues.classification = [0, 0, 0],
- n.defaultAttributeValues.indices = [0, 0, 0, 0],
- n.vertexColors = !0,
- n.updateShaderSource(),
- n
- }
- return D(e, t),
- e.prototype.dispose = function() {
- t.prototype.dispose.call(this),
- this.gradientTexture && (this.gradientTexture.dispose(),
- this.gradientTexture = void 0),
- this.visibleNodesTexture && (this.visibleNodesTexture.dispose(),
- this.visibleNodesTexture = void 0),
- this.clearVisibleNodeTextureOffsets(),
- this.classificationTexture && (this.classificationTexture.dispose(),
- this.classificationTexture = void 0),
- this.depthMap && (this.depthMap.dispose(),
- this.depthMap = void 0)
- }
- ,
- e.prototype.clearVisibleNodeTextureOffsets = function() {
- this.visibleNodeTextureOffsets.clear()
- }
- ,
- e.prototype.updateShaderSource = function() {
- this.vertexShader = this.applyDefines(n(4).default),
- this.fragmentShader = this.applyDefines(n(5).default),
- 1 === this.opacity ? (this.blending = f.NoBlending,
- this.transparent = !1,
- this.depthTest = !0,
- this.depthWrite = !0,
- this.depthFunc = f.LessEqualDepth) : this.opacity < 1 && !this.useEDL && (this.blending = f.AdditiveBlending,
- this.transparent = !0,
- this.depthTest = !1,
- this.depthWrite = !0),
- this.weighted && (this.blending = f.AdditiveBlending,
- this.transparent = !0,
- this.depthTest = !0,
- this.depthWrite = !1,
- this.depthFunc = f.LessEqualDepth),
- this.needsUpdate = !0
- }
- ,
- e.prototype.applyDefines = function(t) {
- var e = [];
- function n(t) {
- t && e.push("#define " + t)
- }
- return n(z[this.treeType]),
- n(F[this.pointSizeType]),
- n(U[this.shape]),
- n(H[this.pointColorType]),
- n(V[this.clipMode]),
- n(G[this.pointOpacityType]),
- 1 === this.rgbGamma && 0 === this.rgbBrightness && 0 === this.rgbContrast || n("use_rgb_gamma_contrast_brightness"),
- this.useFilterByNormal && n("use_filter_by_normal"),
- this.useEDL && n("use_edl"),
- this.weighted && n("weighted_splats"),
- this.numClipBoxes > 0 && n("use_clip_box"),
- this.highlightPoint && n("highlight_point"),
- n("MAX_POINT_LIGHTS 0"),
- n("MAX_DIR_LIGHTS 0"),
- e.push(t),
- e.join("\n")
- }
- ,
- e.prototype.setClipBoxes = function(t) {
- if (t) {
- this.clipBoxes = t;
- var e = this.numClipBoxes !== t.length && (0 === t.length || 0 === this.numClipBoxes);
- this.numClipBoxes = t.length,
- this.setUniform("clipBoxCount", this.numClipBoxes),
- e && this.updateShaderSource();
- for (var n = 16 * this.numClipBoxes, i = new Float32Array(n), o = 0; o < this.numClipBoxes; o++)
- i.set(t[o].inverse.elements, 16 * o);
- for (o = 0; o < n; o++)
- isNaN(i[o]) && (i[o] = 1 / 0);
- this.setUniform("clipBoxes", i)
- }
- }
- ,
- Object.defineProperty(e.prototype, "gradient", {
- get: function() {
- return this._gradient
- },
- set: function(t) {
- this._gradient !== t && (this._gradient = t,
- this.gradientTexture = N(this._gradient),
- this.setUniform("gradient", this.gradientTexture))
- },
- enumerable: !0,
- configurable: !0
- }),
- Object.defineProperty(e.prototype, "classification", {
- get: function() {
- return this._classification
- },
- set: function(t) {
- for (var e = {}, n = 0, i = Object.keys(t); n < i.length; n++)
- e[s = i[n]] = t[s].clone();
- var o = !1;
- if (void 0 === this._classification)
- o = !1;
- else {
- o = Object.keys(e).length === Object.keys(this._classification).length;
- for (var r = 0, a = Object.keys(e); r < a.length; r++) {
- var s = a[r];
- o = (o = o && void 0 !== this._classification[s]) && e[s].equals(this._classification[s])
- }
- }
- o || (this._classification = e,
- this.recomputeClassification())
- },
- enumerable: !0,
- configurable: !0
- }),
- e.prototype.recomputeClassification = function() {
- this.classificationTexture = P(this._classification),
- this.setUniform("classificationLUT", this.classificationTexture)
- }
- ,
- Object.defineProperty(e.prototype, "elevationRange", {
- get: function() {
- return [this.heightMin, this.heightMax]
- },
- set: function(t) {
- this.heightMin = t[0],
- this.heightMax = t[1]
- },
- enumerable: !0,
- configurable: !0
- }),
- e.prototype.getUniform = function(t) {
- return void 0 === this.uniforms ? void 0 : this.uniforms[t].value
- }
- ,
- e.prototype.setUniform = function(t, e) {
- if (void 0 !== this.uniforms) {
- var n = this.uniforms[t];
- "c" === n.type ? n.value.copy(e) : e !== n.value && (n.value = e)
- }
- }
- ,
- e.prototype.updateMaterial = function(t, n, i, o) {
- var a = o.getPixelRatio();
- "PerspectiveCamera" === i.type ? this.fov = i.fov * (Math.PI / 180) : this.fov = Math.PI / 2;
- var s = o.getRenderTarget();
- null !== s && s instanceof f.WebGLRenderTarget ? (this.screenWidth = s.width,
- this.screenHeight = s.height) : (this.screenWidth = o.domElement.clientWidth * a,
- this.screenHeight = o.domElement.clientHeight * a);
- var u = Math.max(t.scale.x, t.scale.y, t.scale.z);
- this.spacing = t.pcoGeometry.spacing * u,
- this.octreeSize = t.pcoGeometry.boundingBox.getSize(e.helperVec3).x,
- this.pointSizeType !== r.ADAPTIVE && this.pointColorType !== l.LOD || this.updateVisibilityTextureData(n)
- }
- ,
- e.prototype.updateVisibilityTextureData = function(t) {
- t.sort(v);
- var e = new Uint8Array(4 * t.length)
- , n = new Array(t.length).fill(1 / 0);
- this.visibleNodeTextureOffsets.clear();
- for (var i = 0; i < t.length; i++) {
- var o = t[i];
- if (this.visibleNodeTextureOffsets.set(o.name, i),
- i > 0) {
- var r = o.name.slice(0, -1)
- , a = this.visibleNodeTextureOffsets.get(r)
- , s = i - a;
- n[a] = Math.min(n[a], s);
- var u = 4 * a;
- e[u] = e[u] | 1 << o.index,
- e[u + 1] = n[a] >> 8,
- e[u + 2] = n[a] % 256
- }
- e[4 * i + 3] = o.name.length
- }
- var l = this.visibleNodesTexture;
- l && (l.image.data.set(e),
- l.needsUpdate = !0)
- }
- ,
- e.makeOnBeforeRender = function(t, e, n) {
- return function(i, o, r, a, s) {
- var u = s
- , l = u.uniforms;
- l.level.value = e.level,
- l.isLeafNode.value = e.isLeafNode;
- var f = u.visibleNodeTextureOffsets.get(e.name);
- void 0 !== f && (l.vnStart.value = f),
- l.pcIndex.value = void 0 !== n ? n : t.visibleNodes.indexOf(e),
- s.uniformsNeedUpdate = !0
- }
- }
- ,
- e.helperVec3 = new f.Vector3,
- R([Y("bbSize")], e.prototype, "bbSize", void 0),
- R([Y("depthMap")], e.prototype, "depthMap", void 0),
- R([Y("fov")], e.prototype, "fov", void 0),
- R([Y("heightMax")], e.prototype, "heightMax", void 0),
- R([Y("heightMin")], e.prototype, "heightMin", void 0),
- R([Y("intensityBrightness")], e.prototype, "intensityBrightness", void 0),
- R([Y("intensityContrast")], e.prototype, "intensityContrast", void 0),
- R([Y("intensityGamma")], e.prototype, "intensityGamma", void 0),
- R([Y("intensityRange")], e.prototype, "intensityRange", void 0),
- R([Y("maxSize")], e.prototype, "maxSize", void 0),
- R([Y("minSize")], e.prototype, "minSize", void 0),
- R([Y("octreeSize")], e.prototype, "octreeSize", void 0),
- R([Y("opacity", !0)], e.prototype, "opacity", void 0),
- R([Y("rgbBrightness", !0)], e.prototype, "rgbBrightness", void 0),
- R([Y("rgbContrast", !0)], e.prototype, "rgbContrast", void 0),
- R([Y("rgbGamma", !0)], e.prototype, "rgbGamma", void 0),
- R([Y("screenHeight")], e.prototype, "screenHeight", void 0),
- R([Y("screenWidth")], e.prototype, "screenWidth", void 0),
- R([Y("size")], e.prototype, "size", void 0),
- R([Y("spacing")], e.prototype, "spacing", void 0),
- R([Y("transition")], e.prototype, "transition", void 0),
- R([Y("uColor")], e.prototype, "color", void 0),
- R([Y("wClassification")], e.prototype, "weightClassification", void 0),
- R([Y("wElevation")], e.prototype, "weightElevation", void 0),
- R([Y("wIntensity")], e.prototype, "weightIntensity", void 0),
- R([Y("wReturnNumber")], e.prototype, "weightReturnNumber", void 0),
- R([Y("wRGB")], e.prototype, "weightRGB", void 0),
- R([Y("wSourceID")], e.prototype, "weightSourceID", void 0),
- R([Y("opacityAttenuation")], e.prototype, "opacityAttenuation", void 0),
- R([Y("filterByNormalThreshold")], e.prototype, "filterByNormalThreshold", void 0),
- R([Y("highlightedPointCoordinate")], e.prototype, "highlightedPointCoordinate", void 0),
- R([Y("highlightedPointColor")], e.prototype, "highlightedPointColor", void 0),
- R([Y("enablePointHighlighting")], e.prototype, "enablePointHighlighting", void 0),
- R([Y("highlightedPointScale")], e.prototype, "highlightedPointScale", void 0),
- R([X()], e.prototype, "useClipBox", void 0),
- R([X()], e.prototype, "weighted", void 0),
- R([X()], e.prototype, "pointColorType", void 0),
- R([X()], e.prototype, "pointSizeType", void 0),
- R([X()], e.prototype, "clipMode", void 0),
- R([X()], e.prototype, "useEDL", void 0),
- R([X()], e.prototype, "shape", void 0),
- R([X()], e.prototype, "treeType", void 0),
- R([X()], e.prototype, "pointOpacityType", void 0),
- R([X()], e.prototype, "useFilterByNormal", void 0),
- R([X()], e.prototype, "highlightPoint", void 0),
- e
- }(f.RawShaderMaterial);
- function k(t, e) {
- return {
- type: t,
- value: e
- }
- }
- function W(t, e) {
- return void 0 === t ? e : t
- }
- function Y(t, e) {
- return void 0 === e && (e = !1),
- function(n, i) {
- Object.defineProperty(n, i, {
- get: function() {
- return this.getUniform(t)
- },
- set: function(n) {
- n !== this.getUniform(t) && (this.setUniform(t, n),
- e && this.updateShaderSource())
- }
- })
- }
- }
- function X() {
- return function(t, e) {
- var n = "_" + e.toString();
- Object.defineProperty(t, e, {
- get: function() {
- return this[n]
- },
- set: function(t) {
- t !== this[n] && (this[n] = t,
- this.updateShaderSource())
- }
- })
- }
- }
- !function(t) {
- t[t.POSITION_CARTESIAN = 0] = "POSITION_CARTESIAN",
- t[t.COLOR_PACKED = 1] = "COLOR_PACKED",
- t[t.COLOR_FLOATS_1 = 2] = "COLOR_FLOATS_1",
- t[t.COLOR_FLOATS_255 = 3] = "COLOR_FLOATS_255",
- t[t.NORMAL_FLOATS = 4] = "NORMAL_FLOATS",
- t[t.FILLER = 5] = "FILLER",
- t[t.INTENSITY = 6] = "INTENSITY",
- t[t.CLASSIFICATION = 7] = "CLASSIFICATION",
- t[t.NORMAL_SPHEREMAPPED = 8] = "NORMAL_SPHEREMAPPED",
- t[t.NORMAL_OCT16 = 9] = "NORMAL_OCT16",
- t[t.NORMAL = 10] = "NORMAL"
- }(L || (L = {}));
- var K = {
- DATA_TYPE_DOUBLE: {
- ordinal: 0,
- size: 8
- },
- DATA_TYPE_FLOAT: {
- ordinal: 1,
- size: 4
- },
- DATA_TYPE_INT8: {
- ordinal: 2,
- size: 1
- },
- DATA_TYPE_UINT8: {
- ordinal: 3,
- size: 1
- },
- DATA_TYPE_INT16: {
- ordinal: 4,
- size: 2
- },
- DATA_TYPE_UINT16: {
- ordinal: 5,
- size: 2
- },
- DATA_TYPE_INT32: {
- ordinal: 6,
- size: 4
- },
- DATA_TYPE_UINT32: {
- ordinal: 7,
- size: 4
- },
- DATA_TYPE_INT64: {
- ordinal: 8,
- size: 8
- },
- DATA_TYPE_UINT64: {
- ordinal: 9,
- size: 8
- }
- };
- function q(t, e, n) {
- return {
- name: t,
- type: e,
- numElements: n,
- byteSize: n * e.size
- }
- }
- var Q = q(L.COLOR_PACKED, K.DATA_TYPE_INT8, 4)
- , J = {
- POSITION_CARTESIAN: q(L.POSITION_CARTESIAN, K.DATA_TYPE_FLOAT, 3),
- RGBA_PACKED: Q,
- COLOR_PACKED: Q,
- RGB_PACKED: q(L.COLOR_PACKED, K.DATA_TYPE_INT8, 3),
- NORMAL_FLOATS: q(L.NORMAL_FLOATS, K.DATA_TYPE_FLOAT, 3),
- FILLER_1B: q(L.FILLER, K.DATA_TYPE_UINT8, 1),
- INTENSITY: q(L.INTENSITY, K.DATA_TYPE_UINT16, 1),
- CLASSIFICATION: q(L.CLASSIFICATION, K.DATA_TYPE_UINT8, 1),
- NORMAL_SPHEREMAPPED: q(L.NORMAL_SPHEREMAPPED, K.DATA_TYPE_UINT8, 2),
- NORMAL_OCT16: q(L.NORMAL_OCT16, K.DATA_TYPE_UINT8, 2),
- NORMAL: q(L.NORMAL, K.DATA_TYPE_FLOAT, 3)
- }
- , Z = function() {
- function t(t) {
- void 0 === t && (t = []),
- this.attributes = [],
- this.byteSize = 0,
- this.size = 0;
- for (var e = 0; e < t.length; e++) {
- var n = t[e]
- , i = J[n];
- this.attributes.push(i),
- this.byteSize += i.byteSize,
- this.size++
- }
- }
- return t.prototype.add = function(t) {
- this.attributes.push(t),
- this.byteSize += t.byteSize,
- this.size++
- }
- ,
- t.prototype.hasColors = function() {
- return void 0 !== this.attributes.find($)
- }
- ,
- t.prototype.hasNormals = function() {
- return void 0 !== this.attributes.find(tt)
- }
- ,
- t
- }();
- function $(t) {
- return t.name === L.COLOR_PACKED
- }
- function tt(t) {
- var e = t.name;
- return e === L.NORMAL_SPHEREMAPPED || e === L.NORMAL_FLOATS || e === L.NORMAL || e === L.NORMAL_OCT16
- }
- function et(t, e) {
- return (new f.Box3).setFromPoints([new f.Vector3(t.min.x,t.min.y,t.min.z).applyMatrix4(e), new f.Vector3(t.min.x,t.min.y,t.min.z).applyMatrix4(e), new f.Vector3(t.max.x,t.min.y,t.min.z).applyMatrix4(e), new f.Vector3(t.min.x,t.max.y,t.min.z).applyMatrix4(e), new f.Vector3(t.min.x,t.min.y,t.max.z).applyMatrix4(e), new f.Vector3(t.min.x,t.max.y,t.max.z).applyMatrix4(e), new f.Vector3(t.max.x,t.max.y,t.min.z).applyMatrix4(e), new f.Vector3(t.max.x,t.min.y,t.max.z).applyMatrix4(e), new f.Vector3(t.max.x,t.max.y,t.max.z).applyMatrix4(e)])
- }
- function nt(t, e) {
- var n = t.min.clone()
- , i = t.max.clone()
- , o = (new f.Vector3).subVectors(i, n);
- return (1 & e) > 0 ? n.z += o.z / 2 : i.z -= o.z / 2,
- (2 & e) > 0 ? n.y += o.y / 2 : i.y -= o.y / 2,
- (4 & e) > 0 ? n.x += o.x / 2 : i.x -= o.x / 2,
- new f.Box3(n,i)
- }
- var it = function() {
- var t = function(e, n) {
- return (t = Object.setPrototypeOf || {
- __proto__: []
- }instanceof Array && function(t, e) {
- t.__proto__ = e
- }
- || function(t, e) {
- for (var n in e)
- e.hasOwnProperty(n) && (t[n] = e[n])
- }
- )(e, n)
- };
- return function(e, n) {
- function i() {
- this.constructor = e
- }
- t(e, n),
- e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype,
- new i)
- }
- }()
- , ot = function(t) {
- function e(n, i, o) {
- var r = t.call(this) || this;
- return r.id = e.idCount++,
- r.level = 0,
- r.spacing = 0,
- r.hasChildren = !1,
- r.children = [null, null, null, null, null, null, null, null],
- r.mean = new f.Vector3,
- r.numPoints = 0,
- r.loaded = !1,
- r.loading = !1,
- r.failed = !1,
- r.parent = null,
- r.oneTimeDisposeHandlers = [],
- r.isLeafNode = !0,
- r.isTreeNode = !1,
- r.isGeometryNode = !0,
- r.name = n,
- r.index = g(n),
- r.pcoGeometry = i,
- r.boundingBox = o,
- r.tightBoundingBox = o.clone(),
- r.boundingSphere = o.getBoundingSphere(new f.Sphere),
- r
- }
- return it(e, t),
- e.prototype.dispose = function() {
- this.geometry && this.parent && (this.geometry.dispose(),
- this.geometry = void 0,
- this.loaded = !1,
- this.oneTimeDisposeHandlers.forEach((function(t) {
- return t()
- }
- )),
- this.oneTimeDisposeHandlers = [])
- }
- ,
- e.prototype.getUrl = function() {
- var t = this.pcoGeometry
- , e = t.loader.version
- , n = [t.octreeDir];
- return t.loader && e.equalOrHigher("1.5") ? (n.push(this.getHierarchyBaseUrl()),
- n.push(this.name)) : (e.equalOrHigher("1.4") || e.upTo("1.3")) && n.push(this.name),
- n.join("/")
- }
- ,
- e.prototype.getHierarchyUrl = function() {
- let hrcUrl = this.pcoGeometry.octreeDir + "/" + this.getHierarchyBaseUrl() + "/" + this.name + ".hrc"
- return hrcUrl;
- }
- ,
- e.prototype.addChild = function(t) {
- this.children[t.index] = t,
- this.isLeafNode = !1,
- t.parent = this
- }
- ,
- e.prototype.traverse = function(t, e) {
- void 0 === e && (e = !0);
- for (var n, i = e ? [this] : []; void 0 !== (n = i.pop()); ) {
- t(n);
- for (var o = 0, r = n.children; o < r.length; o++) {
- var a = r[o];
- null !== a && i.push(a)
- }
- }
- }
- ,
- e.prototype.load = function() {
- var t = this;
- return this.canLoad() ? (this.loading = !0,
- this.pcoGeometry.numNodesLoading++,
- this.pcoGeometry.needsUpdate = !0,
- (this.pcoGeometry.loader.version.equalOrHigher("1.5") && this.level % this.pcoGeometry.hierarchyStepSize == 0 && this.hasChildren ? this.loadHierachyThenPoints() : this.loadPoints()).catch((function(e) {
- throw t.loading = !1,
- t.failed = !0,
- t.pcoGeometry.numNodesLoading--,
- e
- }
- ))) : Promise.resolve()
- }
- ,
- e.prototype.canLoad = function() {
- return !this.loading && !this.loaded && !this.pcoGeometry.disposed && !this.pcoGeometry.loader.disposed && this.pcoGeometry.numNodesLoading < this.pcoGeometry.maxNumNodesLoading
- }
- ,
- e.prototype.loadPoints = function() {
- return this.pcoGeometry.needsUpdate = !0,
- this.pcoGeometry.loader.load(this)
- }
- ,
- e.prototype.loadHierachyThenPoints = function() {
- var t = this;
- return this.level % this.pcoGeometry.hierarchyStepSize != 0 ? Promise.resolve() : Promise.resolve(this.pcoGeometry.loader.getUrl(this.getHierarchyUrl())).then((function(e) {
- return t.pcoGeometry.xhrRequest(e, {
- mode: "cors"
- })
- }
- )).then((function(t) {
- return t.arrayBuffer()
- }
- )).then((function(e) {
- return t.loadHierarchy(t, e)
- }
- ))
- }
- ,
- e.prototype.getHierarchyBaseUrl = function() {
- for (var t = this.pcoGeometry.hierarchyStepSize, e = this.name.substr(1), n = Math.floor(e.length / t), i = "r/", o = 0; o < n; o++)
- i += e.substr(o * t, t) + "/";
- return i.slice(0, -1)
- }
- ,
- e.prototype.loadHierarchy = function(t, e) {
- var n = this
- , i = new DataView(e)
- , o = this.getNodeData(t.name, 0, i);
- t.numPoints = o.numPoints;
- for (var r = [o], a = [], s = 5; r.length > 0; )
- for (var u = r.shift(), l = 1, f = 0; f < 8 && s + 1 < e.byteLength; f++) {
- if (0 != (u.children & l)) {
- var d = this.getNodeData(u.name + f, s, i);
- a.push(d),
- r.push(d),
- s += 5
- }
- l *= 2
- }
- t.pcoGeometry.needsUpdate = !0;
- var p = new Map;
- p.set(t.name, t),
- a.forEach((function(e) {
- return n.addNode(e, t.pcoGeometry, p)
- }
- )),
- t.loadPoints()
- }
- ,
- e.prototype.getNodeData = function(t, e, n) {
- return {
- children: n.getUint8(e),
- numPoints: n.getUint32(e + 1, !0),
- name: t
- }
- }
- ,
- e.prototype.addNode = function(t, n, i) {
- var o = t.name
- , r = t.numPoints
- , a = t.children
- , s = g(o)
- , u = o.substring(0, o.length - 1)
- , l = i.get(u)
- , f = o.length - 1
- , d = new e(o,n,nt(l.boundingBox, s));
- d.level = f,
- d.numPoints = r,
- d.hasChildren = a > 0,
- d.spacing = n.spacing / Math.pow(2, f),
- l.addChild(d),
- i.set(o, d)
- }
- ,
- e.idCount = 0,
- e
- }(f.EventDispatcher)
- , rt = function() {
- function t(t, e, n, i, o) {
- this.loader = t,
- this.boundingBox = e,
- this.tightBoundingBox = n,
- this.offset = i,
- this.xhrRequest = o,
- this.disposed = !1,
- this.needsUpdate = !0,
- this.octreeDir = "",
- this.hierarchyStepSize = -1,
- this.nodes = {},
- this.numNodesLoading = 0,
- this.maxNumNodesLoading = 3,
- this.spacing = 0,
- this.pointAttributes = new Z([]),
- this.projection = null,
- this.url = null
- }
- return t.prototype.dispose = function() {
- this.loader.dispose(),
- this.root.traverse((function(t) {
- return t.dispose()
- }
- )),
- this.disposed = !0
- }
- ,
- t.prototype.addNodeLoadedCallback = function(t) {
- this.loader.callbacks.push(t)
- }
- ,
- t.prototype.clearNodeLoadedCallbacks = function() {
- this.loader.callbacks = []
- }
- ,
- t
- }()
- , at = function() {
- var t = function(e, n) {
- return (t = Object.setPrototypeOf || {
- __proto__: []
- }instanceof Array && function(t, e) {
- t.__proto__ = e
- }
- || function(t, e) {
- for (var n in e)
- e.hasOwnProperty(n) && (t[n] = e[n])
- }
- )(e, n)
- };
- return function(e, n) {
- function i() {
- this.constructor = e
- }
- t(e, n),
- e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype,
- new i)
- }
- }()
- , st = function(t) {
- function e(e, n) {
- var i = t.call(this) || this;
- return i.pcIndex = void 0,
- i.boundingBoxNode = null,
- i.loaded = !0,
- i.isTreeNode = !0,
- i.isGeometryNode = !1,
- i.geometryNode = e,
- i.sceneNode = n,
- i.children = e.children.slice(),
- i
- }
- return at(e, t),
- e.prototype.dispose = function() {
- this.geometryNode.dispose()
- }
- ,
- e.prototype.disposeSceneNode = function() {
- var t = this.sceneNode;
- if (t.geometry instanceof f.BufferGeometry) {
- var e = t.geometry.attributes;
- for (var n in e)
- "position" === n && delete e[n].array,
- delete e[n];
- t.geometry.dispose(),
- t.geometry = void 0
- }
- }
- ,
- e.prototype.traverse = function(t, e) {
- this.geometryNode.traverse(t, e)
- }
- ,
- Object.defineProperty(e.prototype, "id", {
- get: function() {
- return this.geometryNode.id
- },
- enumerable: !0,
- configurable: !0
- }),
- Object.defineProperty(e.prototype, "name", {
- get: function() {
- return this.geometryNode.name
- },
- enumerable: !0,
- configurable: !0
- }),
- Object.defineProperty(e.prototype, "level", {
- get: function() {
- return this.geometryNode.level
- },
- enumerable: !0,
- configurable: !0
- }),
- Object.defineProperty(e.prototype, "isLeafNode", {
- get: function() {
- return this.geometryNode.isLeafNode
- },
- enumerable: !0,
- configurable: !0
- }),
- Object.defineProperty(e.prototype, "numPoints", {
- get: function() {
- return this.geometryNode.numPoints
- },
- enumerable: !0,
- configurable: !0
- }),
- Object.defineProperty(e.prototype, "index", {
- get: function() {
- return this.geometryNode.index
- },
- enumerable: !0,
- configurable: !0
- }),
- Object.defineProperty(e.prototype, "boundingSphere", {
- get: function() {
- return this.geometryNode.boundingSphere
- },
- enumerable: !0,
- configurable: !0
- }),
- Object.defineProperty(e.prototype, "boundingBox", {
- get: function() {
- return this.geometryNode.boundingBox
- },
- enumerable: !0,
- configurable: !0
- }),
- Object.defineProperty(e.prototype, "spacing", {
- get: function() {
- return this.geometryNode.spacing
- },
- enumerable: !0,
- configurable: !0
- }),
- e
- }(f.EventDispatcher);
- function ut(t, e, n) {
- return Math.min(Math.max(e, t), n)
- }
- var lt = function() {
- function t() {}
- return t.prototype.dispose = function() {
- this.pickState && (this.pickState.material.dispose(),
- this.pickState.renderTarget.dispose())
- }
- ,
- t.prototype.pick = function(e, n, i, o, r) {
- if (void 0 === r && (r = {}),
- 0 === o.length)
- return null;
- var a = this.pickState ? this.pickState : this.pickState = t.getPickState()
- , s = a.material
- , u = e.getPixelRatio()
- , l = Math.ceil(e.domElement.clientWidth * u)
- , f = Math.ceil(e.domElement.clientHeight * u);
- t.updatePickRenderTarget(this.pickState, l, f);
- var d = t.helperVec3;
- r.pixelPosition ? d.copy(r.pixelPosition) : (d.addVectors(n.position, i.direction).project(n),
- d.x = (d.x + 1) * l * .5,
- d.y = (d.y + 1) * f * .5);
- var p = Math.floor((r.pickWindowSize || 15) * u)
- , c = (p - 1) / 2
- , h = Math.floor(ut(d.x - c, 0, l))
- , g = Math.floor(ut(d.y - c, 0, f));
- t.prepareRender(e, h, g, p, s, a);
- var v = t.render(e, n, s, o, i, a, r);
- s.clearVisibleNodeTextureOffsets();
- var m = t.readPixels(e, h, g, p)
- , y = t.findHit(m, p);
- return t.getPickPoint(y, v)
- }
- ,
- t.prepareRender = function(t, e, n, i, o, r) {
- t.setScissor(e, n, i, i),
- t.setScissorTest(!0),
- t.state.buffers.depth.setTest(o.depthTest),
- t.state.buffers.depth.setMask(o.depthWrite),
- t.state.setBlending(f.NoBlending),
- t.setRenderTarget(r.renderTarget);
- var a = t.getClearColor()
- , s = t.getClearAlpha();
- t.setClearColor(c, 0),
- t.clear(!0, !0, !0),
- t.setClearColor(a, s)
- }
- ,
- t.render = function(e, n, i, o, r, a, s) {
- for (var u = [], l = function(o) {
- var l = t.nodesOnRay(o, r);
- if (!l.length)
- return "continue";
- t.updatePickMaterial(i, o.material, s),
- i.updateMaterial(o, l, n, e),
- s.onBeforePickRender && s.onBeforePickRender(i, a.renderTarget),
- a.scene.children = t.createTempNodes(o, l, i, u.length),
- e.render(a.scene, n),
- l.forEach((function(t) {
- return u.push({
- node: t,
- octree: o
- })
- }
- ))
- }, f = 0, d = o; f < d.length; f++)
- l(d[f]);
- return u
- }
- ,
- t.nodesOnRay = function(e, n) {
- for (var i = [], o = n.clone(), r = 0, a = e.visibleNodes; r < a.length; r++) {
- var s = a[r]
- , u = t.helperSphere.copy(s.boundingSphere).applyMatrix4(e.matrixWorld);
- o.intersectsSphere(u) && i.push(s)
- }
- return i
- }
- ,
- t.readPixels = function(t, e, n, i) {
- var o = new Uint8Array(4 * i * i);
- return t.readRenderTargetPixels(t.getRenderTarget(), e, n, i, i, o),
- t.setScissorTest(!1),
- t.setRenderTarget(null),
- o
- }
- ,
- t.createTempNodes = function(t, e, n, i) {
- for (var o = [], r = 0; r < e.length; r++) {
- var a = e[r]
- , s = a.sceneNode
- , u = new f.Points(s.geometry,n);
- u.matrix = s.matrix,
- u.matrixWorld = s.matrixWorld,
- u.matrixAutoUpdate = !1,
- u.frustumCulled = !1;
- var l = i + r + 1;
- l > 255 && console.error("More than 255 nodes for pick are not supported."),
- u.onBeforeRender = j.makeOnBeforeRender(t, a, l),
- o.push(u)
- }
- return o
- }
- ,
- t.updatePickMaterial = function(t, e, n) {
- t.pointSizeType = e.pointSizeType,
- t.shape = e.shape,
- t.size = e.size,
- t.minSize = e.minSize,
- t.maxSize = e.maxSize,
- t.classification = e.classification,
- t.useFilterByNormal = e.useFilterByNormal,
- t.filterByNormalThreshold = e.filterByNormalThreshold,
- n.pickOutsideClipRegion ? t.clipMode = o.DISABLED : (t.clipMode = e.clipMode,
- t.setClipBoxes(e.clipMode === o.CLIP_OUTSIDE ? e.clipBoxes : []))
- }
- ,
- t.updatePickRenderTarget = function(e, n, i) {
- e.renderTarget.width === n && e.renderTarget.height === i || (e.renderTarget.dispose(),
- e.renderTarget = t.makePickRenderTarget(),
- e.renderTarget.setSize(n, i))
- }
- ,
- t.makePickRenderTarget = function() {
- return new f.WebGLRenderTarget(1,1,{
- minFilter: f.LinearFilter,
- magFilter: f.NearestFilter,
- format: f.RGBAFormat
- })
- }
- ,
- t.findHit = function(t, e) {
- for (var n = new Uint32Array(t.buffer), i = Number.MAX_VALUE, o = null, r = 0; r < e; r++)
- for (var a = 0; a < e; a++) {
- var s = r + a * e
- , u = Math.pow(r - (e - 1) / 2, 2) + Math.pow(a - (e - 1) / 2, 2)
- , l = t[4 * s + 3];
- t[4 * s + 3] = 0;
- var f = n[s];
- l > 0 && u < i && (o = {
- pIndex: f,
- pcIndex: l - 1
- },
- i = u)
- }
- return o
- }
- ,
- t.getPickPoint = function(e, n) {
- if (!e)
- return null;
- var i = {}
- , o = n[e.pcIndex] && n[e.pcIndex].node.sceneNode;
- if (!o)
- return null;
- i.pointCloud = n[e.pcIndex].octree;
- var r = o.geometry.attributes;
- for (var a in r)
- if (r.hasOwnProperty(a)) {
- var s = r[a];
- if ("position" === a)
- t.addPositionToPickPoint(i, e, s, o);
- else if ("normal" === a)
- t.addNormalToPickPoint(i, e, s, o);
- else if ("indices" === a)
- ;
- else if (1 === s.itemSize)
- i[a] = s.array[e.pIndex];
- else {
- for (var u = [], l = 0; l < s.itemSize; l++)
- u.push(s.array[s.itemSize * e.pIndex + l]);
- i[a] = u
- }
- }
- return i
- }
- ,
- t.addPositionToPickPoint = function(t, e, n, i) {
- t.position = (new f.Vector3).fromBufferAttribute(n, e.pIndex).applyMatrix4(i.matrixWorld)
- }
- ,
- t.addNormalToPickPoint = function(t, e, n, i) {
- var o = (new f.Vector3).fromBufferAttribute(n, e.pIndex)
- , r = new f.Vector4(o.x,o.y,o.z,0).applyMatrix4(i.matrixWorld);
- o.set(r.x, r.y, r.z),
- t.normal = o
- }
- ,
- t.getPickState = function() {
- var e = new f.Scene;
- e.autoUpdate = !1;
- var n = new j;
- return n.pointColorType = l.POINT_INDEX,
- {
- renderTarget: t.makePickRenderTarget(),
- material: n,
- scene: e
- }
- }
- ,
- t.helperVec3 = new f.Vector3,
- t.helperSphere = new f.Sphere,
- t
- }()
- , ft = function() {
- var t = function(e, n) {
- return (t = Object.setPrototypeOf || {
- __proto__: []
- }instanceof Array && function(t, e) {
- t.__proto__ = e
- }
- || function(t, e) {
- for (var n in e)
- e.hasOwnProperty(n) && (t[n] = e[n])
- }
- )(e, n)
- };
- return function(e, n) {
- function i() {
- this.constructor = e
- }
- t(e, n),
- e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype,
- new i)
- }
- }()
- , dt = function(t) {
- function e() {
- var e = null !== t && t.apply(this, arguments) || this;
- return e.root = null,
- e
- }
- return ft(e, t),
- e.prototype.initialized = function() {
- return null !== this.root
- }
- ,
- e
- }(f.Object3D)
- , pt = function() {
- var t = function(e, n) {
- return (t = Object.setPrototypeOf || {
- __proto__: []
- }instanceof Array && function(t, e) {
- t.__proto__ = e
- }
- || function(t, e) {
- for (var n in e)
- e.hasOwnProperty(n) && (t[n] = e[n])
- }
- )(e, n)
- };
- return function(e, n) {
- function i() {
- this.constructor = e
- }
- t(e, n),
- e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype,
- new i)
- }
- }()
- , ct = function(t) {
- function e(e, n, i) {
- var o = t.call(this) || this;
- return o.disposed = !1,
- o.level = 0,
- o.maxLevel = 1 / 0,
- o.minNodePixelSize = 50,
- o.root = null,
- o.boundingBoxNodes = [],
- o.visibleNodes = [],
- o.visibleGeometry = [],
- o.numVisiblePoints = 0,
- o.showBoundingBox = !1,
- o.visibleBounds = new f.Box3,
- o.name = "",
- o.potree = e,
- o.root = n.root,
- o.pcoGeometry = n,
- o.boundingBox = n.boundingBox,
- o.boundingSphere = o.boundingBox.getBoundingSphere(new f.Sphere),
- o.position.copy(n.offset),
- o.updateMatrix(),
- o.material = i || new j,
- o.initMaterial(o.material),
- o
- }
- return pt(e, t),
- e.prototype.initMaterial = function(t) {
- this.updateMatrixWorld(!0);
- var e = et(this.pcoGeometry.tightBoundingBox || this.getBoundingBoxWorld(), this.matrixWorld)
- , n = e.min
- , i = e.max
- , o = i.z - n.z;
- t.heightMin = n.z - .2 * o,
- t.heightMax = i.z + .2 * o
- }
- ,
- e.prototype.dispose = function() {
- var t = this;
- this.root && this.root.dispose(),
- this.pcoGeometry.root.traverse((function(e) {
- return t.potree.lru.remove(e)
- }
- )),
- this.pcoGeometry.dispose(),
- this.material.dispose(),
- this.visibleNodes = [],
- this.visibleGeometry = [],
- this.picker && (this.picker.dispose(),
- this.picker = void 0),
- this.disposed = !0
- }
- ,
- Object.defineProperty(e.prototype, "pointSizeType", {
- get: function() {
- return this.material.pointSizeType
- },
- set: function(t) {
- this.material.pointSizeType = t
- },
- enumerable: !0,
- configurable: !0
- }),
- e.prototype.toTreeNode = function(t, e) {
- var n = new f.Points(t.geometry,this.material)
- , i = new st(t,n);
- return n.name = t.name,
- n.position.copy(t.boundingBox.min),
- n.frustumCulled = !1,
- n.onBeforeRender = j.makeOnBeforeRender(this, i),
- e ? (e.sceneNode.add(n),
- e.children[t.index] = i,
- t.oneTimeDisposeHandlers.push((function() {
- i.disposeSceneNode(),
- e.sceneNode.remove(i.sceneNode),
- e.children[t.index] = t
- }
- ))) : (this.root = i,
- this.add(n)),
- i
- }
- ,
- e.prototype.updateVisibleBounds = function() {
- var t = this.visibleBounds;
- t.min.set(1 / 0, 1 / 0, 1 / 0),
- t.max.set(-1 / 0, -1 / 0, -1 / 0);
- for (var e = 0, n = this.visibleNodes; e < n.length; e++) {
- var i = n[e];
- i.isLeafNode && (t.expandByPoint(i.boundingBox.min),
- t.expandByPoint(i.boundingBox.max))
- }
- }
- ,
- e.prototype.updateBoundingBoxes = function() {
- if (this.showBoundingBox && this.parent) {
- var t = this.parent.getObjectByName("bbroot");
- t || ((t = new f.Object3D).name = "bbroot",
- this.parent.add(t));
- for (var e = [], n = 0, i = this.visibleNodes; n < i.length; n++) {
- var o = i[n];
- void 0 !== o.boundingBoxNode && o.isLeafNode && e.push(o.boundingBoxNode)
- }
- t.children = e
- }
- }
- ,
- e.prototype.updateMatrixWorld = function(t) {
- !0 === this.matrixAutoUpdate && this.updateMatrix(),
- !0 !== this.matrixWorldNeedsUpdate && !0 !== t || (this.parent ? this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix) : this.matrixWorld.copy(this.matrix),
- this.matrixWorldNeedsUpdate = !1,
- t = !0)
- }
- ,
- e.prototype.hideDescendants = function(t) {
- var e = [];
- for (i(t); e.length > 0; ) {
- var n = e.shift();
- n.visible = !1,
- i(n)
- }
- function i(t) {
- for (var n = 0, i = t.children; n < i.length; n++) {
- var o = i[n];
- o.visible && e.push(o)
- }
- }
- }
- ,
- e.prototype.moveToOrigin = function() {
- this.position.set(0, 0, 0),
- this.position.set(0, 0, 0).sub(this.getBoundingBoxWorld().getCenter(new f.Vector3))
- }
- ,
- e.prototype.moveToGroundPlane = function() {
- this.position.y += -this.getBoundingBoxWorld().min.y
- }
- ,
- e.prototype.getBoundingBoxWorld = function() {
- return this.updateMatrixWorld(!0),
- et(this.boundingBox, this.matrixWorld)
- }
- ,
- e.prototype.getVisibleExtent = function() {
- return this.visibleBounds.applyMatrix4(this.matrixWorld)
- }
- ,
- e.prototype.pick = function(t, e, n, i) {
- return void 0 === i && (i = {}),
- this.picker = this.picker || new lt,
- this.picker.pick(t, e, n, [this], i)
- }
- ,
- Object.defineProperty(e.prototype, "progress", {
- get: function() {
- return 0 === this.visibleGeometry.length ? 0 : this.visibleNodes.length / this.visibleGeometry.length
- },
- enumerable: !0,
- configurable: !0
- }),
- e
- }(dt)
- , ht = document.createElement("canvas").getContext("webgl")
- , gt = {
- SHADER_INTERPOLATION: vt("EXT_frag_depth") && mt(8),
- SHADER_SPLATS: vt("EXT_frag_depth") && vt("OES_texture_float") && mt(8),
- SHADER_EDL: vt("OES_texture_float") && mt(8),
- precision: function() {
- if (null === ht)
- return "";
- var t = ht.getShaderPrecisionFormat(ht.VERTEX_SHADER, ht.HIGH_FLOAT)
- , e = ht.getShaderPrecisionFormat(ht.VERTEX_SHADER, ht.MEDIUM_FLOAT)
- , n = ht.getShaderPrecisionFormat(ht.FRAGMENT_SHADER, ht.HIGH_FLOAT)
- , i = ht.getShaderPrecisionFormat(ht.FRAGMENT_SHADER, ht.MEDIUM_FLOAT)
- , o = t && n && t.precision > 0 && n.precision > 0
- , r = e && i && e.precision > 0 && i.precision > 0;
- return o ? "highp" : r ? "mediump" : "lowp"
- }()
- };
- function vt(t) {
- return null !== ht && Boolean(ht.getExtension(t))
- }
- function mt(t) {
- return null !== ht && ht.getParameter(ht.MAX_VARYING_VECTORS) >= t
- }
- var yt = function() {
- function t(t) {
- this.versionMinor = 0,
- this.version = t;
- var e = -1 === t.indexOf(".") ? t.length : t.indexOf(".");
- this.versionMajor = parseInt(t.substr(0, e), 10),
- this.versionMinor = parseInt(t.substr(e + 1), 10),
- isNaN(this.versionMinor) && (this.versionMinor = 0)
- }
- return t.prototype.newerThan = function(e) {
- var n = new t(e);
- return this.versionMajor > n.versionMajor || this.versionMajor === n.versionMajor && this.versionMinor > n.versionMinor
- }
- ,
- t.prototype.equalOrHigher = function(e) {
- var n = new t(e);
- return this.versionMajor > n.versionMajor || this.versionMajor === n.versionMajor && this.versionMinor >= n.versionMinor
- }
- ,
- t.prototype.upTo = function(t) {
- return !this.newerThan(t)
- }
- ,
- t
- }()
- , bt = function() {
- function t(t) {
- var e = t.getUrl
- , n = void 0 === e ? function(t) {
- return Promise.resolve(t)
- }
- : e
- , i = t.version
- , o = t.boundingBox
- , r = t.scale
- , a = t.xhrRequest;
- this.disposed = !1,
- this.workers = [],
- this.version = "string" == typeof i ? new yt(i) : i,
- this.xhrRequest = a,
- this.getUrl = n,
- this.boundingBox = o,
- this.scale = r,
- this.callbacks = []
- }
- return t.prototype.dispose = function() {
- this.workers.forEach((function(t) {
- return t.terminate()
- }
- )),
- this.workers = [],
- this.disposed = !0
- }
- ,
- t.prototype.load = function(t) {
- var e = this;
- return t.loaded || this.disposed ? Promise.resolve() : Promise.resolve(this.getUrl(this.getNodeUrl(t))).then((function(t) {
- return e.xhrRequest(t, {
- mode: "cors"
- })
- }
- )).then((function(t) {
- return t.arrayBuffer()
- }
- )).then((function(n) {
- return new Promise((function(i) {
- return e.parse(t, n, i)
- }
- ))
- }
- ))
- }
- ,
- t.prototype.getNodeUrl = function(t) {
- var e = t.getUrl();
- return this.version.equalOrHigher("1.4") && (e += ".bin"),
- e
- }
- ,
- t.prototype.parse = function(t, e, n) {
- var i = this;
- if (this.disposed)
- n();
- else {
- var o = this.getWorker()
- , r = t.pcoGeometry.pointAttributes
- , a = e.byteLength / r.byteSize;
- this.version.upTo("1.5") && (t.numPoints = a),
- o.onmessage = function(e) {
- if (i.disposed)
- n();
- else {
- var r = e.data
- , s = t.geometry = t.geometry || new f.BufferGeometry;
- s.boundingBox = t.boundingBox,
- i.addBufferAttributes(s, r.attributeBuffers),
- i.addIndices(s, r.indices),
- i.addNormalAttribute(s, a),
- t.mean = (new f.Vector3).fromArray(r.mean),
- t.tightBoundingBox = i.getTightBoundingBox(r.tightBoundingBox),
- t.loaded = !0,
- t.loading = !1,
- t.failed = !1,
- t.pcoGeometry.numNodesLoading--,
- t.pcoGeometry.needsUpdate = !0,
- i.releaseWorker(o),
- i.callbacks.forEach((function(e) {
- return e(t)
- }
- )),
- n()
- }
- }
- ;
- var s = {
- buffer: e,
- pointAttributes: r,
- version: this.version.version,
- min: t.boundingBox.min.toArray(),
- offset: t.pcoGeometry.offset.toArray(),
- scale: this.scale,
- spacing: t.spacing,
- hasChildren: t.hasChildren
- };
- o.postMessage(s, [s.buffer])
- }
- }
- ,
- t.prototype.getWorker = function() {
- return this.workers.pop() || new (n(6))
- }
- ,
- t.prototype.releaseWorker = function(t) {
- this.workers.push(t)
- }
- ,
- t.prototype.getTightBoundingBox = function(t) {
- var e = t.min
- , n = t.max
- , i = new f.Box3((new f.Vector3).fromArray(e),(new f.Vector3).fromArray(n));
- return i.max.sub(i.min),
- i.min.set(0, 0, 0),
- i
- }
- ,
- t.prototype.addBufferAttributes = function(t, e) {
- var n = this;
- Object.keys(e).forEach((function(i) {
- var o = e[i].buffer;
- n.isAttribute(i, L.POSITION_CARTESIAN) ? t.setAttribute("position", new f.BufferAttribute(new Float32Array(o),3)) : n.isAttribute(i, L.COLOR_PACKED) ? t.setAttribute("color", new f.BufferAttribute(new Uint8Array(o),3,!0)) : n.isAttribute(i, L.INTENSITY) ? t.setAttribute("intensity", new f.BufferAttribute(new Float32Array(o),1)) : n.isAttribute(i, L.CLASSIFICATION) ? t.setAttribute("classification", new f.BufferAttribute(new Uint8Array(o),1)) : (n.isAttribute(i, L.NORMAL_SPHEREMAPPED) || n.isAttribute(i, L.NORMAL_OCT16) || n.isAttribute(i, L.NORMAL)) && t.setAttribute("normal", new f.BufferAttribute(new Float32Array(o),3))
- }
- ))
- }
- ,
- t.prototype.addIndices = function(t, e) {
- var n = new f.Uint8BufferAttribute(e,4);
- n.normalized = !0,
- t.setAttribute("indices", n)
- }
- ,
- t.prototype.addNormalAttribute = function(t, e) {
- if (!t.getAttribute("normal")) {
- var n = new Float32Array(3 * e);
- t.setAttribute("normal", new f.BufferAttribute(new Float32Array(n),3))
- }
- }
- ,
- t.prototype.isAttribute = function(t, e) {
- return parseInt(t, 10) === e
- }
- ,
- t
- }();
- function _t(t) {
- return null != t && t.isGeometryNode
- }
- function xt(t) {
- return null != t && t.isTreeNode
- }
- var At = n(1)
- , wt = function() {
- var t = function(e, n) {
- return (t = Object.setPrototypeOf || {
- __proto__: []
- }instanceof Array && function(t, e) {
- t.__proto__ = e
- }
- || function(t, e) {
- for (var n in e)
- e.hasOwnProperty(n) && (t[n] = e[n])
- }
- )(e, n)
- };
- return function(e, n) {
- function i() {
- this.constructor = e
- }
- t(e, n),
- e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype,
- new i)
- }
- }()
- , Tt = function(t) {
- function e(e, n) {
- void 0 === n && (n = new f.Color(16776960));
- var i = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7])
- , o = new Float32Array([e.min.x, e.min.y, e.min.z, e.max.x, e.min.y, e.min.z, e.max.x, e.min.y, e.max.z, e.min.x, e.min.y, e.max.z, e.min.x, e.max.y, e.min.z, e.max.x, e.max.y, e.min.z, e.max.x, e.max.y, e.max.z, e.min.x, e.max.y, e.max.z])
- , r = new f.BufferGeometry;
- r.setIndex(new f.BufferAttribute(i,1)),
- r.setAttribute("position", new f.BufferAttribute(o,3));
- var a = new f.LineBasicMaterial({
- color: n
- });
- return t.call(this, r, a) || this
- }
- return wt(e, t),
- e
- }(f.LineSegments)
- , Ot = function(t) {
- this.node = t,
- this.next = null,
- this.previous = null
- }
- , Nt = function() {
- function t(t) {
- void 0 === t && (t = 1e6),
- this.pointBudget = t,
- this.first = null,
- this.last = null,
- this.numPoints = 0,
- this.items = new Map
- }
- return Object.defineProperty(t.prototype, "size", {
- get: function() {
- return this.items.size
- },
- enumerable: !0,
- configurable: !0
- }),
- t.prototype.has = function(t) {
- return this.items.has(t.id)
- }
- ,
- t.prototype.touch = function(t) {
- if (t.loaded) {
- var e = this.items.get(t.id);
- e ? this.touchExisting(e) : this.addNew(t)
- }
- }
- ,
- t.prototype.addNew = function(t) {
- var e = new Ot(t);
- e.previous = this.last,
- this.last = e,
- e.previous && (e.previous.next = e),
- this.first || (this.first = e),
- this.items.set(t.id, e),
- this.numPoints += t.numPoints
- }
- ,
- t.prototype.touchExisting = function(t) {
- t.previous ? t.next && (t.previous.next = t.next,
- t.next.previous = t.previous,
- t.previous = this.last,
- t.next = null,
- this.last = t,
- t.previous && (t.previous.next = t)) : t.next && (this.first = t.next,
- this.first.previous = null,
- t.previous = this.last,
- t.next = null,
- this.last = t,
- t.previous && (t.previous.next = t))
- }
- ,
- t.prototype.remove = function(t) {
- var e = this.items.get(t.id);
- e && (1 === this.items.size ? (this.first = null,
- this.last = null) : (e.previous || (this.first = e.next,
- this.first.previous = null),
- e.next || (this.last = e.previous,
- this.last.next = null),
- e.previous && e.next && (e.previous.next = e.next,
- e.next.previous = e.previous)),
- this.items.delete(t.id),
- this.numPoints -= t.numPoints)
- }
- ,
- t.prototype.getLRUItem = function() {
- return this.first ? this.first.node : void 0
- }
- ,
- t.prototype.freeMemory = function() {
- if (!(this.items.size <= 1))
- for (; this.numPoints > 2 * this.pointBudget; ) {
- var t = this.getLRUItem();
- t && this.disposeSubtree(t)
- }
- }
- ,
- t.prototype.disposeSubtree = function(t) {
- var e = [t];
- t.traverse((function(t) {
- t.loaded && e.push(t)
- }
- ));
- for (var n = 0, i = e; n < i.length; n++) {
- var o = i[n];
- o.dispose(),
- this.remove(o)
- }
- }
- ,
- t
- }()
- , Pt = function(t, e, n, i) {
- this.pointCloudIndex = t,
- this.weight = e,
- this.node = n,
- this.parent = i
- }
- , St = function() {
- function t() {
- var t, e, n;
- this._pointBudget = 1e6,
- this._rendererSize = new f.Vector2,
- this.maxNumNodesLoading = 4,
- this.features = gt,
- this.lru = new Nt(this._pointBudget),
- this.updateVisibilityStructures = (t = new f.Matrix4,
- e = new f.Matrix4,
- n = new f.Matrix4,
- function(i, o) {
- for (var r = [], a = [], s = new At.BinaryHeap((function(t) {
- return 1 / t.weight
- }
- )), u = 0; u < i.length; u++) {
- var l = i[u];
- if (l.initialized()) {
- l.numVisiblePoints = 0,
- l.visibleNodes = [],
- l.visibleGeometry = [],
- o.updateMatrixWorld(!1);
- var d = o.matrixWorldInverse
- , p = l.matrixWorld;
- if (t.identity().multiply(o.projectionMatrix).multiply(d).multiply(p),
- r.push((new f.Frustum).setFromProjectionMatrix(t)),
- e.getInverse(p),
- n.identity().multiply(e).multiply(o.matrixWorld),
- a.push((new f.Vector3).setFromMatrixPosition(n)),
- l.visible && null !== l.root) {
- var c = Number.MAX_VALUE;
- s.push(new Pt(u,c,l.root))
- }
- xt(l.root) && l.hideDescendants(l.root.sceneNode);
- for (var h = 0, g = l.boundingBoxNodes; h < g.length; h++)
- g[h].visible = !1
- }
- }
- return {
- frustums: r,
- cameraPositions: a,
- priorityQueue: s
- }
- }
- )
- }
- return t.prototype.loadPointCloud = function(t, e, n) {
- var i = this;
- return void 0 === n && (n = function(t, e) {
- return fetch(t, e)
- }
- ),
- function(t, e, n) {
- return Promise.resolve(e(t)).then((function(t) {
- return n(t, {
- mode: "cors"
- }).then((function(t) {
- return t.json()
- }
- )).then(function(t, e, n) {
- return function(i) {
- var o = function(t) {
- var e = new f.Vector3(t.boundingBox.lx,t.boundingBox.ly,t.boundingBox.lz)
- , n = new f.Vector3(t.boundingBox.ux,t.boundingBox.uy,t.boundingBox.uz)
- , i = new f.Box3(e,n)
- , o = i.clone()
- , r = e.clone();
- if (t.tightBoundingBox) {
- var a = t.tightBoundingBox
- , s = a.lx
- , u = a.ly
- , l = a.lz
- , d = a.ux
- , p = a.uy
- , c = a.uz;
- o.min.set(s, u, l),
- o.max.set(d, p, c)
- }
- return i.min.sub(r),
- i.max.sub(r),
- o.min.sub(r),
- o.max.sub(r),
- {
- offset: r,
- boundingBox: i,
- tightBoundingBox: o
- }
- }(i)
- , r = o.offset
- , a = o.boundingBox
- , s = o.tightBoundingBox
- , u = new bt({
- getUrl: e,
- version: i.version,
- boundingBox: a,
- scale: i.scale,
- xhrRequest: n
- })
- , l = new rt(u,a,s,r,n);
- l.url = t,
- l.octreeDir = i.octreeDir,
- l.needsUpdate = !0,
- l.spacing = i.spacing,
- l.hierarchyStepSize = i.hierarchyStepSize;
- l.projection = i.projection,
- l.offset = r,
- l.pointAttributes = new Z(i.pointAttributes);
- var d = {}
- , p = new yt(i.version);
- return function(t, e, n, i) {
- var o = new ot("r",t,t.boundingBox);
- return o.hasChildren = !0,
- o.spacing = t.spacing,
- i.upTo("1.5") ? o.numPoints = e.hierarchy[0][1] : o.numPoints = 0,
- t.root = o,
- n.r = o,
- t.root.load()
- }(l, i, d, p).then((function() {
- return p.upTo("1.4") && function(t, e, n) {
- for (var i = 1; i < e.hierarchy.length; i++) {
- var o = e.hierarchy[i]
- , r = o[0]
- , a = o[1]
- , s = {
- index: g(c = r),
- parentName: c.substring(0, c.length - 1),
- level: c.length - 1
- }
- , u = s.index
- , l = s.level
- , f = n[s.parentName]
- , d = nt(f.boundingBox, u)
- , p = new ot(r,t,d);
- p.level = l,
- p.numPoints = a,
- p.spacing = t.spacing / Math.pow(2, p.level),
- n[r] = p,
- f.addChild(p)
- }
- var c
- }(l, i, d),
- l.nodes = d,
- l
- }
- ))
- }
- }(t, e, n))
- }
- ))
- }(t, e, n).then((function(t) {
- return new ct(i,t)
- }
- ))
- }
- ,
- t.prototype.updatePointClouds = function(t, e, n) {
- for (var i = this.updateVisibility(t, e, n), o = 0; o < t.length; o++) {
- var r = t[o];
- r.disposed || (r.material.updateMaterial(r, r.visibleNodes, e, n),
- r.updateVisibleBounds(),
- r.updateBoundingBoxes())
- }
- return this.lru.freeMemory(),
- i
- }
- ,
- t.pick = function(e, n, i, o, r) {
- return void 0 === r && (r = {}),
- t.picker = t.picker || new lt,
- t.picker.pick(n, i, o, e, r)
- }
- ,
- Object.defineProperty(t.prototype, "pointBudget", {
- get: function() {
- return this._pointBudget
- },
- set: function(t) {
- t !== this._pointBudget && (this._pointBudget = t,
- this.lru.pointBudget = t,
- this.lru.freeMemory())
- },
- enumerable: !0,
- configurable: !0
- }),
- t.prototype.updateVisibility = function(t, e, n) {
- for (var i, o = 0, r = [], a = [], s = this.updateVisibilityStructures(t, e), u = s.frustums, l = s.cameraPositions, f = s.priorityQueue, d = 0, p = !1, c = !1; void 0 !== (i = f.pop()); ) {
- var h = i.node;
- if (o + h.numPoints > this.pointBudget)
- break;
- var g = i.pointCloudIndex
- , v = t[g]
- , m = void 0 !== v.maxLevel ? v.maxLevel : 1 / 0;
- if (!(h.level > m || !u[g].intersectsBox(h.boundingBox) || this.shouldClip(v, h.boundingBox))) {
- o += h.numPoints,
- v.numVisiblePoints += h.numPoints;
- var y = i.parent;
- if (_t(h) && (!y || xt(y)))
- if (h.loaded && d < 2)
- h = v.toTreeNode(h, y),
- d++;
- else {
- if (h.failed) {
- c = !0;
- continue
- }
- h.loaded && d >= 2 && (p = !0),
- a.push(h),
- v.visibleGeometry.push(h)
- }
- xt(h) && (this.updateTreeNodeVisibility(v, h, r),
- v.visibleGeometry.push(h.geometryNode));
- var b = .5 * n.getSize(this._rendererSize).height * n.getPixelRatio();
- this.updateChildVisibility(i, f, v, h, l[g], e, b)
- }
- }
- for (var _ = Math.min(this.maxNumNodesLoading, a.length), x = [], A = 0; A < _; A++)
- x.push(a[A].load());
- return {
- visibleNodes: r,
- numVisiblePoints: o,
- exceededMaxLoadsToGPU: p,
- nodeLoadFailed: c,
- nodeLoadPromises: x
- }
- }
- ,
- t.prototype.updateTreeNodeVisibility = function(t, e, n) {
- this.lru.touch(e.geometryNode);
- var i = e.sceneNode;
- i.visible = !0,
- i.material = t.material,
- i.updateMatrix(),
- i.matrixWorld.multiplyMatrices(t.matrixWorld, i.matrix),
- n.push(e),
- t.visibleNodes.push(e),
- this.updateBoundingBoxVisibility(t, e)
- }
- ,
- t.prototype.updateChildVisibility = function(t, e, n, i, o, r, a) {
- for (var s = i.children, u = 0; u < s.length; u++) {
- var l = s[u];
- if (null !== l) {
- var f = l.boundingSphere
- , d = f.center.distanceTo(o)
- , p = f.radius
- , c = 0;
- if ("PerspectiveCamera" === r.type) {
- var h = r.fov * Math.PI / 180;
- c = a / (Math.tan(h / 2) * d)
- } else {
- var g = r;
- c = 2 * a / (g.top - g.bottom)
- }
- var v = p * c;
- if (!(v < n.minNodePixelSize)) {
- var m = d < p ? Number.MAX_VALUE : v + 1 / d;
- e.push(new Pt(t.pointCloudIndex,m,l,i))
- }
- }
- }
- }
- ,
- t.prototype.updateBoundingBoxVisibility = function(t, e) {
- if (t.showBoundingBox && !e.boundingBoxNode) {
- var n = new Tt(e.boundingBox);
- n.matrixAutoUpdate = !1,
- t.boundingBoxNodes.push(n),
- e.boundingBoxNode = n,
- e.boundingBoxNode.matrix.copy(t.matrixWorld)
- } else
- t.showBoundingBox && e.boundingBoxNode ? (e.boundingBoxNode.visible = !0,
- e.boundingBoxNode.matrix.copy(t.matrixWorld)) : !t.showBoundingBox && e.boundingBoxNode && (e.boundingBoxNode.visible = !1)
- }
- ,
- t.prototype.shouldClip = function(t, e) {
- var n = t.material;
- if (0 === n.numClipBoxes || n.clipMode !== o.CLIP_OUTSIDE)
- return !1;
- var i = e.clone();
- t.updateMatrixWorld(!0),
- i.applyMatrix4(t.matrixWorld);
- for (var r = n.clipBoxes, a = 0; a < r.length; a++) {
- var s = r[a].matrix
- , u = new f.Box3(new f.Vector3(-.5,-.5,-.5),new f.Vector3(.5,.5,.5)).applyMatrix4(s);
- if (i.intersectsBox(u))
- return !1
- }
- return !0
- }
- ,
- t
- }();
- n.d(e, "BlurMaterial", (function() {
- return p
- }
- )),
- n.d(e, "ClipMode", (function() {
- return o
- }
- )),
- n.d(e, "PointSizeType", (function() {
- return r
- }
- )),
- n.d(e, "PointShape", (function() {
- return a
- }
- )),
- n.d(e, "TreeType", (function() {
- return s
- }
- )),
- n.d(e, "PointOpacityType", (function() {
- return u
- }
- )),
- n.d(e, "PointColorType", (function() {
- return l
- }
- )),
- n.d(e, "PointCloudMaterial", (function() {
- return j
- }
- )),
- n.d(e, "generateDataTexture", (function() {
- return O
- }
- )),
- n.d(e, "generateGradientTexture", (function() {
- return N
- }
- )),
- n.d(e, "generateClassificationTexture", (function() {
- return P
- }
- )),
- n.d(e, "GRAYSCALE", (function() {
- return y
- }
- )),
- n.d(e, "INFERNO", (function() {
- return b
- }
- )),
- n.d(e, "PLASMA", (function() {
- return _
- }
- )),
- n.d(e, "RAINBOW", (function() {
- return x
- }
- )),
- n.d(e, "SPECTRAL", (function() {
- return A
- }
- )),
- n.d(e, "VIRIDIS", (function() {
- return w
- }
- )),
- n.d(e, "YELLOW_GREEN", (function() {
- return T
- }
- )),
- n.d(e, "PointAttributeName", (function() {
- return L
- }
- )),
- n.d(e, "POINT_ATTRIBUTE_TYPES", (function() {
- return K
- }
- )),
- n.d(e, "POINT_ATTRIBUTES", (function() {
- return J
- }
- )),
- n.d(e, "PointAttributes", (function() {
- return Z
- }
- )),
- n.d(e, "PointCloudOctreeGeometryNode", (function() {
- return ot
- }
- )),
- n.d(e, "PointCloudOctreeGeometry", (function() {
- return rt
- }
- )),
- n.d(e, "PointCloudOctreeNode", (function() {
- return st
- }
- )),
- n.d(e, "PointCloudOctreePicker", (function() {
- return lt
- }
- )),
- n.d(e, "PointCloudOctree", (function() {
- return ct
- }
- )),
- n.d(e, "PointCloudTree", (function() {
- return dt
- }
- )),
- n.d(e, "QueueItem", (function() {
- return Pt
- }
- )),
- n.d(e, "Potree", (function() {
- return St
- }
- )),
- n.d(e, "Version", (function() {
- return yt
- }
- ))
- }
- ]))
- }
- }]);
|