u-space 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ declare class ArcgisTilesRenderer extends Globe {
14
14
  private _ellipsoidPosition;
15
15
  constructor(viewer: Viewer);
16
16
  render: () => void;
17
+ private applyGisOrigin;
17
18
  beforeRenderHandler: () => void;
18
19
  enable(): this;
19
20
  disable(): this;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("three/webgpu"),P=require("3d-tiles-renderer"),a=require("3d-tiles-renderer/plugins"),T=require("3d-tiles-renderer/src/three/plugins/fade/FadeMaterialManager.js"),v=require("3d-tiles-renderer/src/three/plugins/fade/wrapFadeMaterial.js"),n=require("three/tsl"),o=require("@takram/three-geospatial"),c=require("@takram/three-geospatial/webgpu"),h=Symbol("FADE_PARAMS"),p=c.FnLayout({name:"bayerDither2x2",type:"float",inputs:[{name:"v",type:"vec2"}]})(([t])=>(o.reinterpretType(t),t.y.mul(3).add(t.x.mul(2)).mod(4))),f=c.FnLayout({name:"bayerDither4x4",type:"float",inputs:[{name:"v",type:"vec2"}]})(([t])=>{o.reinterpretType(t);const e=t.mod(2),i=t.mod(4).mul(.5).floor();return p(e).mul(4).add(p(i))}),y=n.uniform(0).onObjectUpdate(({material:t})=>t!=null?t?.params?.fadeIn.value??0:0),R=n.uniform(0).onObjectUpdate(({material:t})=>t!=null?t?.params?.fadeOut.value??0:0),w=n.Fn(()=>{const i=f(n.screenCoordinate.xy.mod(4).floor()).add(.5).div(16);return n.If(i.greaterThanEqual(y),()=>{n.Discard()}),n.If(i.lessThan(R),()=>{n.Discard()}),n.output})();function _(t){if(o.reinterpretType(t),t[h]!=null)return t[h];const e={fadeIn:{value:0},fadeOut:{value:0},fadeTexture:{value:null}};let i=0;return t.params=e,t.defines={get FEATURE_FADE(){return i},set FEATURE_FADE(s){s!==i&&(i=s,t.outputNode=s===1?w:null)}},e}class E extends T.FadeMaterialManager{prepareMaterial(e){const i=this._fadeParams;if(i.has(e))return;let s;e instanceof r.NodeMaterial?s=_(e):s=v.wrapFadeMaterial(e,e.onBeforeCompile),i.set(e,s)}}class x extends a.TilesFadePlugin{constructor(...e){super(...e),this._fadeMaterialManager=new E}}function g(t,e){const i=t.material;if(Array.isArray(i))throw new Error("Multiple materials are not supported yet.");const s=new e;"map"in i&&i.map!=null&&"map"in s&&(o.reinterpretType(i.map),o.reinterpretType(s.map),i.map.flipY=!1,s.map=i.map.clone()),t.material=s,i.dispose()}class F{tiles;overrideMaterial;constructor(e=r.MeshBasicNodeMaterial){this.overrideMaterial=e}init(e){this.tiles=e,e.group.traverse(i=>{i instanceof r.Mesh&&g(i,this.overrideMaterial)}),e.addEventListener("load-model",this.handleLoadModel),e.addEventListener("dispose-model",this.handleDisposeModel)}handleLoadModel=({scene:e})=>{e.traverse(i=>{i instanceof r.Mesh&&g(i,this.overrideMaterial)})};handleDisposeModel=({scene:e})=>{e.traverse(i=>{i instanceof r.Mesh&&i.material.dispose()})};dispose(){this.tiles?.removeEventListener("load-model",this.handleLoadModel),this.tiles?.removeEventListener("dispose-model",this.handleDisposeModel)}}class m{tiles;tileCompressionPlugin;updateOnChangePlugin;reorientationPlugin;xyzTilesPlugin;tilesFadePlugin;tileMaterialReplacementPlugin;constructor(){this.tiles=this._initTilesRenderer(),this.tileCompressionPlugin=this._initTileCompressionPlugin(),this.updateOnChangePlugin=this._initUpdateOnChangePlugin(),this.reorientationPlugin=this._initReorientationPlugin(),this.xyzTilesPlugin=this._initXYZTilesPlugin(),this.tilesFadePlugin=this._initTilesFadePlugin(),this.tileMaterialReplacementPlugin=this._initTileMaterialReplacementPlugin()}_initTilesRenderer(){const e=new P.TilesRenderer;return e.maxDepth=20,e.errorTarget=1,e}_initTileCompressionPlugin(){const e=new a.TileCompressionPlugin;return this.tiles.registerPlugin(e),e}_initUpdateOnChangePlugin(){const e=new a.UpdateOnChangePlugin;return this.tiles.registerPlugin(e),e}_initReorientationPlugin(){const e=new a.ReorientationPlugin;return this.tiles.registerPlugin(e),e}_initXYZTilesPlugin(){const e=new a.XYZTilesPlugin({center:!0,shape:"ellipsoid",url:"https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"});return this.tiles.registerPlugin(e),e}_initTilesFadePlugin(){const e=new x;return this.tiles.registerPlugin(e),e}_initTileMaterialReplacementPlugin(){const e=new F(r.MeshBasicNodeMaterial);return this.tiles.registerPlugin(e),e}}class b extends m{viewer;loedTilesSets=new Set;gisOrigin=null;_worldToEllipsoidMatrix=new r.Matrix4;_ellipsoidPosition=new r.Vector3;constructor(e){super(),this.viewer=e,this.tiles.addEventListener("needs-render",this.render),this.tiles.addEventListener("needs-update",this.render)}render=()=>{this.viewer.render()};beforeRenderHandler=()=>{this.viewer.camera.updateMatrixWorld(),this.tiles.setCamera(this.viewer.camera),this.tiles.setResolutionFromRenderer(this.viewer.camera,this.viewer.renderer),this.tiles.update()};enable(){return this.viewer.scene.add(this.tiles.group),this.viewer.addEventListener("beforeRender",this.beforeRenderHandler),this}disable(){return this.viewer.scene.remove(this.tiles.group),this.viewer.removeEventListener("beforeRender",this.beforeRenderHandler),this}invalidate(e,i,s){const l=()=>{const u=r.MathUtils.degToRad(i),M=r.MathUtils.degToRad(e);this.reorientationPlugin.transformLatLonHeightToOrigin(u,M,s),this.gisOrigin={lon:e,lat:i,height:s},this.render(),d()},d=()=>{this.tiles.removeEventListener("load-root-tileset",l),this.loedTilesSets.delete(l)};return this.tiles.addEventListener("load-root-tileset",l),this.loedTilesSets.add(l),this.tiles.root&&l(),d}lonLatHeightToPosition(e,i,s=0,l=new r.Vector3){const d=r.MathUtils.degToRad(i),u=r.MathUtils.degToRad(e);return this.tiles.ellipsoid.getCartographicToPosition(d,u,s,l),this.tiles.group.updateWorldMatrix(!0,!1),l.applyMatrix4(this.tiles.group.matrixWorld)}positionToLonLatHeight(e,i={lon:0,lat:0,height:0}){return this.tiles.group.updateWorldMatrix(!0,!1),this._worldToEllipsoidMatrix.copy(this.tiles.group.matrixWorld).invert(),this._ellipsoidPosition.copy(e).applyMatrix4(this._worldToEllipsoidMatrix),this.tiles.ellipsoid.getPositionToCartographic(this._ellipsoidPosition,i),i.lon=r.MathUtils.radToDeg(i.lon),i.lat=r.MathUtils.radToDeg(i.lat),i}dispose(){this.disable(),this.loedTilesSets.forEach(e=>this.tiles.removeEventListener("load-root-tileset",e)),this.loedTilesSets.clear(),this.tiles.removeEventListener("needs-render",this.render),this.tiles.removeEventListener("needs-update",this.render),this.tiles.dispose()}}exports.ArcgisTilesRenderer=b;exports.Globe=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("three/webgpu"),M=require("3d-tiles-renderer"),o=require("3d-tiles-renderer/plugins"),P=require("3d-tiles-renderer/src/three/plugins/fade/FadeMaterialManager.js"),T=require("3d-tiles-renderer/src/three/plugins/fade/wrapFadeMaterial.js"),l=require("three/tsl"),d=require("@takram/three-geospatial"),g=require("@takram/three-geospatial/webgpu"),u=Symbol("FADE_PARAMS"),h=g.FnLayout({name:"bayerDither2x2",type:"float",inputs:[{name:"v",type:"vec2"}]})(([t])=>(d.reinterpretType(t),t.y.mul(3).add(t.x.mul(2)).mod(4))),v=g.FnLayout({name:"bayerDither4x4",type:"float",inputs:[{name:"v",type:"vec2"}]})(([t])=>{d.reinterpretType(t);const e=t.mod(2),i=t.mod(4).mul(.5).floor();return h(e).mul(4).add(h(i))}),f=l.uniform(0).onObjectUpdate(({material:t})=>t!=null?t?.params?.fadeIn.value??0:0),y=l.uniform(0).onObjectUpdate(({material:t})=>t!=null?t?.params?.fadeOut.value??0:0),R=l.Fn(()=>{const i=v(l.screenCoordinate.xy.mod(4).floor()).add(.5).div(16);return l.If(i.greaterThanEqual(f),()=>{l.Discard()}),l.If(i.lessThan(y),()=>{l.Discard()}),l.output})();function w(t){if(d.reinterpretType(t),t[u]!=null)return t[u];const e={fadeIn:{value:0},fadeOut:{value:0},fadeTexture:{value:null}};let i=0;return t.params=e,t.defines={get FEATURE_FADE(){return i},set FEATURE_FADE(s){s!==i&&(i=s,t.outputNode=s===1?R:null)}},e}class _ extends P.FadeMaterialManager{prepareMaterial(e){const i=this._fadeParams;if(i.has(e))return;let s;e instanceof r.NodeMaterial?s=w(e):s=T.wrapFadeMaterial(e,e.onBeforeCompile),i.set(e,s)}}class E extends o.TilesFadePlugin{constructor(...e){super(...e),this._fadeMaterialManager=new _}}function p(t,e){const i=t.material;if(Array.isArray(i))throw new Error("Multiple materials are not supported yet.");const s=new e;"map"in i&&i.map!=null&&"map"in s&&(d.reinterpretType(i.map),d.reinterpretType(s.map),i.map.flipY=!1,s.map=i.map.clone()),t.material=s,i.dispose()}class x{tiles;overrideMaterial;constructor(e=r.MeshBasicNodeMaterial){this.overrideMaterial=e}init(e){this.tiles=e,e.group.traverse(i=>{i instanceof r.Mesh&&p(i,this.overrideMaterial)}),e.addEventListener("load-model",this.handleLoadModel),e.addEventListener("dispose-model",this.handleDisposeModel)}handleLoadModel=({scene:e})=>{e.traverse(i=>{i instanceof r.Mesh&&p(i,this.overrideMaterial)})};handleDisposeModel=({scene:e})=>{e.traverse(i=>{i instanceof r.Mesh&&i.material.dispose()})};dispose(){this.tiles?.removeEventListener("load-model",this.handleLoadModel),this.tiles?.removeEventListener("dispose-model",this.handleDisposeModel)}}class c{tiles;tileCompressionPlugin;updateOnChangePlugin;reorientationPlugin;xyzTilesPlugin;tilesFadePlugin;tileMaterialReplacementPlugin;constructor(){this.tiles=this._initTilesRenderer(),this.tileCompressionPlugin=this._initTileCompressionPlugin(),this.updateOnChangePlugin=this._initUpdateOnChangePlugin(),this.reorientationPlugin=this._initReorientationPlugin(),this.xyzTilesPlugin=this._initXYZTilesPlugin(),this.tilesFadePlugin=this._initTilesFadePlugin(),this.tileMaterialReplacementPlugin=this._initTileMaterialReplacementPlugin()}_initTilesRenderer(){const e=new M.TilesRenderer;return e.maxDepth=20,e.errorTarget=1,e}_initTileCompressionPlugin(){const e=new o.TileCompressionPlugin;return this.tiles.registerPlugin(e),e}_initUpdateOnChangePlugin(){const e=new o.UpdateOnChangePlugin;return this.tiles.registerPlugin(e),e}_initReorientationPlugin(){const e=new o.ReorientationPlugin;return this.tiles.registerPlugin(e),e}_initXYZTilesPlugin(){const e=new o.XYZTilesPlugin({center:!0,shape:"ellipsoid",url:"https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"});return this.tiles.registerPlugin(e),e}_initTilesFadePlugin(){const e=new E;return this.tiles.registerPlugin(e),e}_initTileMaterialReplacementPlugin(){const e=new x(r.MeshBasicNodeMaterial);return this.tiles.registerPlugin(e),e}}class F extends c{viewer;loedTilesSets=new Set;gisOrigin=null;_worldToEllipsoidMatrix=new r.Matrix4;_ellipsoidPosition=new r.Vector3;constructor(e){super(),this.viewer=e,this.tiles.addEventListener("needs-render",this.render),this.tiles.addEventListener("needs-update",this.render)}render=()=>{this.viewer.render()};applyGisOrigin(e,i,s){const n=r.MathUtils.degToRad(i),a=r.MathUtils.degToRad(e);this.reorientationPlugin.transformLatLonHeightToOrigin(n,a,s),this.gisOrigin={lon:e,lat:i,height:s},this.render()}beforeRenderHandler=()=>{this.viewer.camera.updateMatrixWorld(),this.tiles.setCamera(this.viewer.camera),this.tiles.setResolutionFromRenderer(this.viewer.camera,this.viewer.renderer),this.tiles.update()};enable(){return this.viewer.scene.add(this.tiles.group),this.viewer.addEventListener("beforeRender",this.beforeRenderHandler),this}disable(){return this.viewer.scene.remove(this.tiles.group),this.viewer.removeEventListener("beforeRender",this.beforeRenderHandler),this}invalidate(e,i,s){const n=()=>{this.applyGisOrigin(e,i,s),a()},a=()=>{this.tiles.removeEventListener("load-root-tileset",n),this.loedTilesSets.delete(n)};return this.tiles.root||(this.tiles.addEventListener("load-root-tileset",n),this.loedTilesSets.add(n)),this.applyGisOrigin(e,i,s),a}lonLatHeightToPosition(e,i,s=0,n=new r.Vector3){const a=r.MathUtils.degToRad(i),m=r.MathUtils.degToRad(e);return this.tiles.ellipsoid.getCartographicToPosition(a,m,s,n),this.tiles.group.updateWorldMatrix(!0,!1),n.applyMatrix4(this.tiles.group.matrixWorld)}positionToLonLatHeight(e,i={lon:0,lat:0,height:0}){return this.tiles.group.updateWorldMatrix(!0,!1),this._worldToEllipsoidMatrix.copy(this.tiles.group.matrixWorld).invert(),this._ellipsoidPosition.copy(e).applyMatrix4(this._worldToEllipsoidMatrix),this.tiles.ellipsoid.getPositionToCartographic(this._ellipsoidPosition,i),i.lon=r.MathUtils.radToDeg(i.lon),i.lat=r.MathUtils.radToDeg(i.lat),i}dispose(){this.disable(),this.loedTilesSets.forEach(e=>this.tiles.removeEventListener("load-root-tileset",e)),this.loedTilesSets.clear(),this.tiles.removeEventListener("needs-render",this.render),this.tiles.removeEventListener("needs-update",this.render),this.tiles.dispose()}}exports.ArcgisTilesRenderer=F;exports.Globe=c;
@@ -1,38 +1,38 @@
1
- import { NodeMaterial as M, MeshBasicNodeMaterial as P, Mesh as d, Matrix4 as R, Vector3 as u, MathUtils as n } from "three/webgpu";
2
- import { TilesRenderer as w } from "3d-tiles-renderer";
3
- import { TilesFadePlugin as E, TileCompressionPlugin as y, UpdateOnChangePlugin as _, ReorientationPlugin as x, XYZTilesPlugin as F } from "3d-tiles-renderer/plugins";
4
- import { FadeMaterialManager as L } from "3d-tiles-renderer/src/three/plugins/fade/FadeMaterialManager.js";
5
- import { wrapFadeMaterial as b } from "3d-tiles-renderer/src/three/plugins/fade/wrapFadeMaterial.js";
6
- import { uniform as f, Fn as C, screenCoordinate as D, If as h, Discard as p, output as A } from "three/tsl";
7
- import { reinterpretType as l } from "@takram/three-geospatial";
8
- import { FnLayout as T } from "@takram/three-geospatial/webgpu";
9
- const g = /* @__PURE__ */ Symbol("FADE_PARAMS"), c = T({
1
+ import { NodeMaterial as v, MeshBasicNodeMaterial as m, Mesh as o, Matrix4 as M, Vector3 as d, MathUtils as l } from "three/webgpu";
2
+ import { TilesRenderer as R } from "3d-tiles-renderer";
3
+ import { TilesFadePlugin as y, TileCompressionPlugin as w, UpdateOnChangePlugin as E, ReorientationPlugin as _, XYZTilesPlugin as x } from "3d-tiles-renderer/plugins";
4
+ import { FadeMaterialManager as F } from "3d-tiles-renderer/src/three/plugins/fade/FadeMaterialManager.js";
5
+ import { wrapFadeMaterial as L } from "3d-tiles-renderer/src/three/plugins/fade/wrapFadeMaterial.js";
6
+ import { uniform as P, Fn as b, screenCoordinate as C, If as u, Discard as h, output as O } from "three/tsl";
7
+ import { reinterpretType as a } from "@takram/three-geospatial";
8
+ import { FnLayout as f } from "@takram/three-geospatial/webgpu";
9
+ const p = /* @__PURE__ */ Symbol("FADE_PARAMS"), g = f({
10
10
  name: "bayerDither2x2",
11
11
  type: "float",
12
12
  inputs: [{ name: "v", type: "vec2" }]
13
- })(([t]) => (l(t), t.y.mul(3).add(t.x.mul(2)).mod(4))), O = T({
13
+ })(([t]) => (a(t), t.y.mul(3).add(t.x.mul(2)).mod(4))), D = f({
14
14
  name: "bayerDither4x4",
15
15
  type: "float",
16
16
  inputs: [{ name: "v", type: "vec2" }]
17
17
  })(([t]) => {
18
- l(t);
18
+ a(t);
19
19
  const e = t.mod(2), i = t.mod(4).mul(0.5).floor();
20
- return c(e).mul(4).add(c(i));
21
- }), S = f(0).onObjectUpdate(
20
+ return g(e).mul(4).add(g(i));
21
+ }), A = P(0).onObjectUpdate(
22
22
  ({ material: t }) => t != null ? t?.params?.fadeIn.value ?? 0 : 0
23
- ), U = f(0).onObjectUpdate(
23
+ ), S = P(0).onObjectUpdate(
24
24
  ({ material: t }) => t != null ? t?.params?.fadeOut.value ?? 0 : 0
25
- ), H = C(() => {
26
- const i = O(D.xy.mod(4).floor()).add(0.5).div(16);
27
- return h(i.greaterThanEqual(S), () => {
28
- p();
29
- }), h(i.lessThan(U), () => {
30
- p();
31
- }), A;
25
+ ), U = b(() => {
26
+ const i = D(C.xy.mod(4).floor()).add(0.5).div(16);
27
+ return u(i.greaterThanEqual(A), () => {
28
+ h();
29
+ }), u(i.lessThan(S), () => {
30
+ h();
31
+ }), O;
32
32
  })();
33
- function W(t) {
34
- if (l(t), t[g] != null)
35
- return t[g];
33
+ function H(t) {
34
+ if (a(t), t[p] != null)
35
+ return t[p];
36
36
  const e = {
37
37
  fadeIn: { value: 0 },
38
38
  fadeOut: { value: 0 },
@@ -44,53 +44,53 @@ function W(t) {
44
44
  return i;
45
45
  },
46
46
  set FEATURE_FADE(s) {
47
- s !== i && (i = s, t.outputNode = s === 1 ? H : null);
47
+ s !== i && (i = s, t.outputNode = s === 1 ? U : null);
48
48
  }
49
49
  }, e;
50
50
  }
51
- class I extends L {
51
+ class W extends F {
52
52
  // HACK: Override "wrapFadeMaterial" to support NodeMaterial:
53
53
  prepareMaterial(e) {
54
54
  const i = this._fadeParams;
55
55
  if (i.has(e))
56
56
  return;
57
57
  let s;
58
- e instanceof M ? s = W(e) : s = b(e, e.onBeforeCompile), i.set(e, s);
58
+ e instanceof v ? s = H(e) : s = L(e, e.onBeforeCompile), i.set(e, s);
59
59
  }
60
60
  }
61
- class N extends E {
61
+ class I extends y {
62
62
  constructor(...e) {
63
- super(...e), this._fadeMaterialManager = new I();
63
+ super(...e), this._fadeMaterialManager = new W();
64
64
  }
65
65
  }
66
- function m(t, e) {
66
+ function c(t, e) {
67
67
  const i = t.material;
68
68
  if (Array.isArray(i))
69
69
  throw new Error("Multiple materials are not supported yet.");
70
70
  const s = new e();
71
- "map" in i && i.map != null && "map" in s && (l(i.map), l(s.map), i.map.flipY = !1, s.map = i.map.clone()), t.material = s, i.dispose();
71
+ "map" in i && i.map != null && "map" in s && (a(i.map), a(s.map), i.map.flipY = !1, s.map = i.map.clone()), t.material = s, i.dispose();
72
72
  }
73
- class z {
73
+ class N {
74
74
  tiles;
75
75
  overrideMaterial;
76
- constructor(e = P) {
76
+ constructor(e = m) {
77
77
  this.overrideMaterial = e;
78
78
  }
79
79
  // Plugin method
80
80
  init(e) {
81
81
  this.tiles = e, e.group.traverse((i) => {
82
- i instanceof d && m(i, this.overrideMaterial);
82
+ i instanceof o && c(i, this.overrideMaterial);
83
83
  }), e.addEventListener("load-model", this.handleLoadModel), e.addEventListener("dispose-model", this.handleDisposeModel);
84
84
  }
85
85
  handleLoadModel = ({ scene: e }) => {
86
86
  e.traverse((i) => {
87
- i instanceof d && m(i, this.overrideMaterial);
87
+ i instanceof o && c(i, this.overrideMaterial);
88
88
  });
89
89
  };
90
90
  // eslint-disable-next-line @typescript-eslint/class-methods-use-this
91
91
  handleDisposeModel = ({ scene: e }) => {
92
92
  e.traverse((i) => {
93
- i instanceof d && i.material.dispose();
93
+ i instanceof o && i.material.dispose();
94
94
  });
95
95
  };
96
96
  // Plugin method
@@ -98,7 +98,7 @@ class z {
98
98
  this.tiles?.removeEventListener("load-model", this.handleLoadModel), this.tiles?.removeEventListener("dispose-model", this.handleDisposeModel);
99
99
  }
100
100
  }
101
- class B {
101
+ class z {
102
102
  tiles;
103
103
  tileCompressionPlugin;
104
104
  updateOnChangePlugin;
@@ -110,23 +110,23 @@ class B {
110
110
  this.tiles = this._initTilesRenderer(), this.tileCompressionPlugin = this._initTileCompressionPlugin(), this.updateOnChangePlugin = this._initUpdateOnChangePlugin(), this.reorientationPlugin = this._initReorientationPlugin(), this.xyzTilesPlugin = this._initXYZTilesPlugin(), this.tilesFadePlugin = this._initTilesFadePlugin(), this.tileMaterialReplacementPlugin = this._initTileMaterialReplacementPlugin();
111
111
  }
112
112
  _initTilesRenderer() {
113
- const e = new w();
113
+ const e = new R();
114
114
  return e.maxDepth = 20, e.errorTarget = 1, e;
115
115
  }
116
116
  _initTileCompressionPlugin() {
117
- const e = new y();
117
+ const e = new w();
118
118
  return this.tiles.registerPlugin(e), e;
119
119
  }
120
120
  _initUpdateOnChangePlugin() {
121
- const e = new _();
121
+ const e = new E();
122
122
  return this.tiles.registerPlugin(e), e;
123
123
  }
124
124
  _initReorientationPlugin() {
125
- const e = new x();
125
+ const e = new _();
126
126
  return this.tiles.registerPlugin(e), e;
127
127
  }
128
128
  _initXYZTilesPlugin() {
129
- const e = new F({
129
+ const e = new x({
130
130
  center: !0,
131
131
  shape: "ellipsoid",
132
132
  url: "https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
@@ -134,26 +134,30 @@ class B {
134
134
  return this.tiles.registerPlugin(e), e;
135
135
  }
136
136
  _initTilesFadePlugin() {
137
- const e = new N();
137
+ const e = new I();
138
138
  return this.tiles.registerPlugin(e), e;
139
139
  }
140
140
  _initTileMaterialReplacementPlugin() {
141
- const e = new z(P);
141
+ const e = new N(m);
142
142
  return this.tiles.registerPlugin(e), e;
143
143
  }
144
144
  }
145
- class J extends B {
145
+ class k extends z {
146
146
  viewer;
147
147
  loedTilesSets = /* @__PURE__ */ new Set();
148
148
  gisOrigin = null;
149
- _worldToEllipsoidMatrix = new R();
150
- _ellipsoidPosition = new u();
149
+ _worldToEllipsoidMatrix = new M();
150
+ _ellipsoidPosition = new d();
151
151
  constructor(e) {
152
152
  super(), this.viewer = e, this.tiles.addEventListener("needs-render", this.render), this.tiles.addEventListener("needs-update", this.render);
153
153
  }
154
154
  render = () => {
155
155
  this.viewer.render();
156
156
  };
157
+ applyGisOrigin(e, i, s) {
158
+ const r = l.degToRad(i), n = l.degToRad(e);
159
+ this.reorientationPlugin.transformLatLonHeightToOrigin(r, n, s), this.gisOrigin = { lon: e, lat: i, height: s }, this.render();
160
+ }
157
161
  beforeRenderHandler = () => {
158
162
  this.viewer.camera.updateMatrixWorld(), this.tiles.setCamera(this.viewer.camera), this.tiles.setResolutionFromRenderer(this.viewer.camera, this.viewer.renderer), this.tiles.update();
159
163
  };
@@ -165,25 +169,24 @@ class J extends B {
165
169
  }
166
170
  invalidate(e, i, s) {
167
171
  const r = () => {
168
- const o = n.degToRad(i), v = n.degToRad(e);
169
- this.reorientationPlugin.transformLatLonHeightToOrigin(o, v, s), this.gisOrigin = { lon: e, lat: i, height: s }, this.render(), a();
170
- }, a = () => {
172
+ this.applyGisOrigin(e, i, s), n();
173
+ }, n = () => {
171
174
  this.tiles.removeEventListener("load-root-tileset", r), this.loedTilesSets.delete(r);
172
175
  };
173
- return this.tiles.addEventListener("load-root-tileset", r), this.loedTilesSets.add(r), this.tiles.root && r(), a;
176
+ return this.tiles.root || (this.tiles.addEventListener("load-root-tileset", r), this.loedTilesSets.add(r)), this.applyGisOrigin(e, i, s), n;
174
177
  }
175
- lonLatHeightToPosition(e, i, s = 0, r = new u()) {
176
- const a = n.degToRad(i), o = n.degToRad(e);
177
- return this.tiles.ellipsoid.getCartographicToPosition(a, o, s, r), this.tiles.group.updateWorldMatrix(!0, !1), r.applyMatrix4(this.tiles.group.matrixWorld);
178
+ lonLatHeightToPosition(e, i, s = 0, r = new d()) {
179
+ const n = l.degToRad(i), T = l.degToRad(e);
180
+ return this.tiles.ellipsoid.getCartographicToPosition(n, T, s, r), this.tiles.group.updateWorldMatrix(!0, !1), r.applyMatrix4(this.tiles.group.matrixWorld);
178
181
  }
179
182
  positionToLonLatHeight(e, i = { lon: 0, lat: 0, height: 0 }) {
180
- return this.tiles.group.updateWorldMatrix(!0, !1), this._worldToEllipsoidMatrix.copy(this.tiles.group.matrixWorld).invert(), this._ellipsoidPosition.copy(e).applyMatrix4(this._worldToEllipsoidMatrix), this.tiles.ellipsoid.getPositionToCartographic(this._ellipsoidPosition, i), i.lon = n.radToDeg(i.lon), i.lat = n.radToDeg(i.lat), i;
183
+ return this.tiles.group.updateWorldMatrix(!0, !1), this._worldToEllipsoidMatrix.copy(this.tiles.group.matrixWorld).invert(), this._ellipsoidPosition.copy(e).applyMatrix4(this._worldToEllipsoidMatrix), this.tiles.ellipsoid.getPositionToCartographic(this._ellipsoidPosition, i), i.lon = l.radToDeg(i.lon), i.lat = l.radToDeg(i.lat), i;
181
184
  }
182
185
  dispose() {
183
186
  this.disable(), this.loedTilesSets.forEach((e) => this.tiles.removeEventListener("load-root-tileset", e)), this.loedTilesSets.clear(), this.tiles.removeEventListener("needs-render", this.render), this.tiles.removeEventListener("needs-update", this.render), this.tiles.dispose();
184
187
  }
185
188
  }
186
189
  export {
187
- J as ArcgisTilesRenderer,
188
- B as Globe
190
+ k as ArcgisTilesRenderer,
191
+ z as Globe
189
192
  };