@sharadox/globe-web-library 0.0.0-stage → 0.1.0

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.
Files changed (115) hide show
  1. package/LICENCA.md +76 -0
  2. package/LICENSE.md +76 -0
  3. package/NOTICE.md +3 -0
  4. package/README.md +60 -2
  5. package/distribution/arc/index.d.ts +4 -0
  6. package/distribution/arc/index.d.ts.map +1 -0
  7. package/distribution/arc/index.js +29 -0
  8. package/distribution/arc/index.js.map +1 -0
  9. package/distribution/arc/type.d.ts +12 -0
  10. package/distribution/arc/type.d.ts.map +1 -0
  11. package/distribution/arc/type.js +2 -0
  12. package/distribution/arc/type.js.map +1 -0
  13. package/distribution/color/index.d.ts +9 -0
  14. package/distribution/color/index.d.ts.map +1 -0
  15. package/distribution/color/index.js +11 -0
  16. package/distribution/color/index.js.map +1 -0
  17. package/distribution/color/type.d.ts +20 -0
  18. package/distribution/color/type.d.ts.map +1 -0
  19. package/distribution/color/type.js +2 -0
  20. package/distribution/color/type.js.map +1 -0
  21. package/distribution/dots/index.d.ts +4 -0
  22. package/distribution/dots/index.d.ts.map +1 -0
  23. package/distribution/dots/index.js +38 -0
  24. package/distribution/dots/index.js.map +1 -0
  25. package/distribution/dots/type.d.ts +7 -0
  26. package/distribution/dots/type.d.ts.map +1 -0
  27. package/distribution/dots/type.js +2 -0
  28. package/distribution/dots/type.js.map +1 -0
  29. package/distribution/drag-controller/index.d.ts +11 -0
  30. package/distribution/drag-controller/index.d.ts.map +1 -0
  31. package/distribution/drag-controller/index.js +65 -0
  32. package/distribution/drag-controller/index.js.map +1 -0
  33. package/distribution/drag-controller/type.d.ts +26 -0
  34. package/distribution/drag-controller/type.d.ts.map +1 -0
  35. package/distribution/drag-controller/type.js +2 -0
  36. package/distribution/drag-controller/type.js.map +1 -0
  37. package/distribution/globe/index.d.ts +12 -0
  38. package/distribution/globe/index.d.ts.map +1 -0
  39. package/distribution/globe/index.js +38 -0
  40. package/distribution/globe/index.js.map +1 -0
  41. package/distribution/globe/index.module.css +37 -0
  42. package/distribution/globe/type.d.ts +16 -0
  43. package/distribution/globe/type.d.ts.map +1 -0
  44. package/distribution/globe/type.js +2 -0
  45. package/distribution/globe/type.js.map +1 -0
  46. package/distribution/globe-drag/index.d.ts +7 -0
  47. package/distribution/globe-drag/index.d.ts.map +1 -0
  48. package/distribution/globe-drag/index.js +49 -0
  49. package/distribution/globe-drag/index.js.map +1 -0
  50. package/distribution/hex-channel/index.d.ts +3 -0
  51. package/distribution/hex-channel/index.d.ts.map +1 -0
  52. package/distribution/hex-channel/index.js +8 -0
  53. package/distribution/hex-channel/index.js.map +1 -0
  54. package/distribution/land-point-generator/entry/index.d.ts +3 -0
  55. package/distribution/land-point-generator/entry/index.d.ts.map +1 -0
  56. package/distribution/land-point-generator/entry/index.js +13 -0
  57. package/distribution/land-point-generator/entry/index.js.map +1 -0
  58. package/distribution/land-point-generator/index.d.ts +10 -0
  59. package/distribution/land-point-generator/index.d.ts.map +1 -0
  60. package/distribution/land-point-generator/index.js +23 -0
  61. package/distribution/land-point-generator/index.js.map +1 -0
  62. package/distribution/land-points/index.d.ts +6 -0
  63. package/distribution/land-points/index.d.ts.map +1 -0
  64. package/distribution/land-points/index.js +20 -0
  65. package/distribution/land-points/index.js.map +1 -0
  66. package/distribution/latitude-longitude-to-vector/index.d.ts +7 -0
  67. package/distribution/latitude-longitude-to-vector/index.d.ts.map +1 -0
  68. package/distribution/latitude-longitude-to-vector/index.js +12 -0
  69. package/distribution/latitude-longitude-to-vector/index.js.map +1 -0
  70. package/distribution/marker/index.d.ts +4 -0
  71. package/distribution/marker/index.d.ts.map +1 -0
  72. package/distribution/marker/index.js +21 -0
  73. package/distribution/marker/index.js.map +1 -0
  74. package/distribution/marker/type.d.ts +9 -0
  75. package/distribution/marker/type.d.ts.map +1 -0
  76. package/distribution/marker/type.js +2 -0
  77. package/distribution/marker/type.js.map +1 -0
  78. package/distribution/place/type.d.ts +6 -0
  79. package/distribution/place/type.d.ts.map +1 -0
  80. package/distribution/place/type.js +2 -0
  81. package/distribution/place/type.js.map +1 -0
  82. package/distribution/shader/arc/index.d.ts +6 -0
  83. package/distribution/shader/arc/index.d.ts.map +1 -0
  84. package/distribution/shader/arc/index.js +24 -0
  85. package/distribution/shader/arc/index.js.map +1 -0
  86. package/distribution/shader/atmosphere/index.d.ts +6 -0
  87. package/distribution/shader/atmosphere/index.d.ts.map +1 -0
  88. package/distribution/shader/atmosphere/index.js +15 -0
  89. package/distribution/shader/atmosphere/index.js.map +1 -0
  90. package/distribution/shader/body/index.d.ts +6 -0
  91. package/distribution/shader/body/index.d.ts.map +1 -0
  92. package/distribution/shader/body/index.js +15 -0
  93. package/distribution/shader/body/index.js.map +1 -0
  94. package/distribution/shader/dot/index.d.ts +6 -0
  95. package/distribution/shader/dot/index.d.ts.map +1 -0
  96. package/distribution/shader/dot/index.js +29 -0
  97. package/distribution/shader/dot/index.js.map +1 -0
  98. package/distribution/shader/glow-vertex/index.d.ts +3 -0
  99. package/distribution/shader/glow-vertex/index.d.ts.map +1 -0
  100. package/distribution/shader/glow-vertex/index.js +9 -0
  101. package/distribution/shader/glow-vertex/index.js.map +1 -0
  102. package/distribution/web-gl-support/index.d.ts +3 -0
  103. package/distribution/web-gl-support/index.d.ts.map +1 -0
  104. package/distribution/web-gl-support/index.js +11 -0
  105. package/distribution/web-gl-support/index.js.map +1 -0
  106. package/distribution/world/index.d.ts +4 -0
  107. package/distribution/world/index.d.ts.map +1 -0
  108. package/distribution/world/index.js +38 -0
  109. package/distribution/world/index.js.map +1 -0
  110. package/distribution/world/type.d.ts +15 -0
  111. package/distribution/world/type.d.ts.map +1 -0
  112. package/distribution/world/type.js +2 -0
  113. package/distribution/world/type.js.map +1 -0
  114. package/llms.txt +10 -0
  115. package/package.json +103 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/globe/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAC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F,CACV,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAE,MAAM,CAAC,QAAQ,wBAAgB,CAChD,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ /* The globe fills its positioned parent. Colours follow the page through --globe-glow and --globe-surface. */
2
+ .globe {
3
+ --globe-glow: currentColor;
4
+ --globe-surface: Canvas;
5
+ position: absolute;
6
+ inset: 0;
7
+ }
8
+ .globe canvas {
9
+ display: block;
10
+ touch-action: pan-y;
11
+ }
12
+ .halo {
13
+ position: absolute;
14
+ inset: 14%;
15
+ border-radius: 50%;
16
+ background: radial-gradient(
17
+ closest-side,
18
+ color-mix(in srgb, var(--globe-glow) 14%, transparent),
19
+ color-mix(in srgb, var(--globe-glow) 4%, transparent) 60%,
20
+ transparent
21
+ );
22
+ filter: blur(30px);
23
+ pointer-events: none;
24
+ }
25
+ .fallback {
26
+ position: absolute;
27
+ inset: 18%;
28
+ border-radius: 50%;
29
+ background: radial-gradient(
30
+ circle at 35% 30%,
31
+ color-mix(in srgb, var(--globe-glow) 10%, var(--globe-surface)),
32
+ var(--globe-surface) 70%
33
+ );
34
+ box-shadow:
35
+ 0 0 120px 10px color-mix(in srgb, var(--globe-glow) 8%, transparent),
36
+ inset 0 0 40px color-mix(in srgb, var(--globe-glow) 8%, transparent);
37
+ }
@@ -0,0 +1,16 @@
1
+ import type { GlobePalette } from "@sharadox/globe-web-library/color/type";
2
+ import type { Place } from "@sharadox/globe-web-library/place/type";
3
+ export interface GlobeProperties {
4
+ /** Colours (hex) and whether the background is dark; pass new ones when the page's style changes. */
5
+ palette: GlobePalette;
6
+ /** Where arcs start and the globe first faces. */
7
+ home: Place;
8
+ /** Where arcs go. */
9
+ destinations?: readonly Place[];
10
+ /** The land dots file made by `globe-land-points`; "/globe/land.bin" by default. */
11
+ landPoints?: string;
12
+ /** Accessible name of the canvas; "Interactive globe" by default. */
13
+ label?: string;
14
+ className?: string;
15
+ }
16
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/globe/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,qGAAqG;IACrG,OAAO,EAAE,YAAY,CAAC;IACtB,kDAAkD;IAClD,IAAI,EAAE,KAAK,CAAC;IACZ,qBAAqB;IACrB,YAAY,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IAChC,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/globe/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { GlobeDragController, GlobeRotation } from "@sharadox/globe-web-library/drag-controller/type";
2
+ /**
3
+ * Connects the drag controller to an element's pointer events (with pointer capture and grab cursors). Attach the
4
+ * returned reference to the element that receives the pointer; step the controller every frame.
5
+ */
6
+ export declare function useGlobeDrag(initial: GlobeRotation, autoRotate: boolean): readonly [import("react").RefObject<HTMLDivElement | null>, GlobeDragController];
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/globe-drag/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AAE3G;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,oFAsCvE"}
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { createDragController } from "@sharadox/globe-web-library/drag-controller";
4
+ /**
5
+ * Connects the drag controller to an element's pointer events (with pointer capture and grab cursors). Attach the
6
+ * returned reference to the element that receives the pointer; step the controller every frame.
7
+ */
8
+ export function useGlobeDrag(initial, autoRotate) {
9
+ const target = useRef(null);
10
+ const [controller] = useState(() => createDragController(initial, autoRotate));
11
+ useEffect(() => {
12
+ const element = target.current;
13
+ if (!element)
14
+ return;
15
+ const sample = (event) => ({
16
+ clientX: event.clientX,
17
+ clientY: event.clientY,
18
+ bounds: element.getBoundingClientRect(),
19
+ });
20
+ const down = (event) => {
21
+ controller.down(event.clientX, event.clientY);
22
+ element.setPointerCapture(event.pointerId);
23
+ element.style.cursor = "grabbing";
24
+ };
25
+ const move = (event) => controller.move(sample(event));
26
+ const up = (event) => {
27
+ controller.up();
28
+ element.style.cursor = "grab";
29
+ if (element.hasPointerCapture(event.pointerId))
30
+ element.releasePointerCapture(event.pointerId);
31
+ };
32
+ element.style.cursor = "grab";
33
+ element.style.touchAction = "pan-y";
34
+ element.addEventListener("pointerdown", down);
35
+ element.addEventListener("pointermove", move);
36
+ element.addEventListener("pointerup", up);
37
+ element.addEventListener("pointercancel", up);
38
+ element.addEventListener("pointerleave", controller.leave);
39
+ return () => {
40
+ element.removeEventListener("pointerdown", down);
41
+ element.removeEventListener("pointermove", move);
42
+ element.removeEventListener("pointerup", up);
43
+ element.removeEventListener("pointercancel", up);
44
+ element.removeEventListener("pointerleave", controller.leave);
45
+ };
46
+ }, [controller]);
47
+ return [target, controller];
48
+ }
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/globe-drag/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,oBAAoB,EA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CAAC,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;QACpC,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC9C,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAC9C,OAAO,CAAC,gBAAgB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC1C,OAAO,CAAC,gBAAgB,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QAC3D,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YACjD,OAAO,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YACjD,OAAO,CAAC,mBAAmB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAC7C,OAAO,CAAC,mBAAmB,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;YACjD,OAAO,CAAC,mBAAmB,CAAC,cAAc,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,MAAM,EAAE,UAAiC,CAAU,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** "#rrggbb" (or "#rgb") as red, green and blue from 0 to 1, for shader colours. */
2
+ export declare function hexChannel(hex: string): [number, number, number];
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/hex-channel/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAKhE"}
@@ -0,0 +1,8 @@
1
+ /** "#rrggbb" (or "#rgb") as red, green and blue from 0 to 1, for shader colours. */
2
+ export function hexChannel(hex) {
3
+ const digits = hex.replace("#", "");
4
+ const full = digits.length === 3 ? [...digits].map((digit) => digit + digit).join("") : digits;
5
+ const value = Number.parseInt(full, 16);
6
+ return [((value >> 16) & 255) / 255, ((value >> 8) & 255) / 255, (value & 255) / 255];
7
+ }
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/hex-channel/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC/F,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACxC,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AACxF,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/land-point-generator/entry/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ // globe-land-points <output file>: writes the land dots for the globe (for example public/globe/land.bin).
3
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
+ import { createRequire } from "node:module";
5
+ import { dirname } from "node:path";
6
+ import { landPoints } from "@sharadox/globe-web-library/land-point-generator";
7
+ const output = process.argv[2] ?? "public/globe/land.bin";
8
+ const topology = JSON.parse(readFileSync(createRequire(import.meta.url).resolve("world-atlas/land-110m.json"), "utf8"));
9
+ const points = landPoints(topology);
10
+ mkdirSync(dirname(output), { recursive: true });
11
+ writeFileSync(output, Buffer.from(points.buffer));
12
+ console.log(`${points.length / 2} land dots written to ${output}`);
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/land-point-generator/entry/index.ts"],"names":[],"mappings":";AACA,2GAA2G;AAC3G,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAE9E,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,uBAAuB,CAAC;AAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC,CAC/E,CAAC;AACd,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;AACpC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAChD,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAClD,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Topology } from "topojson-specification";
2
+ /**
3
+ * Evenly spaced dots on land (a Fibonacci lattice over the sphere), as [latitude, longitude] pairs, from a
4
+ * world-atlas land topology. Antarctica is left out below `southernLimit` for a cleaner silhouette.
5
+ *
6
+ * @example
7
+ * landPoints(topology, 42000).length / 2; // ≈ number of dots
8
+ */
9
+ export declare function landPoints(topology: Topology, samples?: number, southernLimit?: number): Float32Array;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/land-point-generator/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,SAAQ,EAAE,aAAa,SAAM,GAAG,YAAY,CAWjG"}
@@ -0,0 +1,23 @@
1
+ import { geoContains } from "d3-geo";
2
+ import { feature } from "topojson-client";
3
+ /**
4
+ * Evenly spaced dots on land (a Fibonacci lattice over the sphere), as [latitude, longitude] pairs, from a
5
+ * world-atlas land topology. Antarctica is left out below `southernLimit` for a cleaner silhouette.
6
+ *
7
+ * @example
8
+ * landPoints(topology, 42000).length / 2; // ≈ number of dots
9
+ */
10
+ export function landPoints(topology, samples = 42000, southernLimit = -60) {
11
+ const land = feature(topology, topology.objects.land);
12
+ const golden = Math.PI * (3 - Math.sqrt(5));
13
+ const points = [];
14
+ for (let index = 0; index < samples; index++) {
15
+ const y = 1 - (index / (samples - 1)) * 2;
16
+ const latitude = (Math.asin(y) * 180) / Math.PI;
17
+ const longitude = (((((golden * index * 180) / Math.PI) % 360) + 540) % 360) - 180;
18
+ if (latitude >= southernLimit && geoContains(land, [longitude, latitude]))
19
+ points.push(latitude, longitude);
20
+ }
21
+ return new Float32Array(points);
22
+ }
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/land-point-generator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,QAAkB,EAAE,OAAO,GAAG,KAAK,EAAE,aAAa,GAAG,CAAC,EAAE;IACjF,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,IAA0B,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;QAC7C,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QACnF,IAAI,QAAQ,IAAI,aAAa,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC9G,CAAC;IACD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Loads precomputed land dots (Float32 latitude/longitude pairs, see the `globe-land-points` command) from a URL.
3
+ * `null` until loaded.
4
+ */
5
+ export declare function useLandPoints(url?: string): Float32Array<ArrayBufferLike> | null;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/land-points/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,SAAoB,wCAYpD"}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ /**
4
+ * Loads precomputed land dots (Float32 latitude/longitude pairs, see the `globe-land-points` command) from a URL.
5
+ * `null` until loaded.
6
+ */
7
+ export function useLandPoints(url = "/globe/land.bin") {
8
+ const [points, setPoints] = useState(null);
9
+ useEffect(() => {
10
+ let live = true;
11
+ fetch(url)
12
+ .then((response) => response.arrayBuffer())
13
+ .then((buffer) => live && setPoints(new Float32Array(buffer)));
14
+ return () => {
15
+ live = false;
16
+ };
17
+ }, [url]);
18
+ return points;
19
+ }
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/land-points/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAG,GAAG,iBAAiB;IACnD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAsB,IAAI,CAAC,CAAC;IAChE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,KAAK,CAAC,GAAG,CAAC;aACP,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;aAC1C,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACjE,OAAO,GAAG,EAAE;YACV,IAAI,GAAG,KAAK,CAAC;QACf,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACV,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Vector3 } from "three";
2
+ /**
3
+ * A point on a sphere of `radius`. Longitude 0 faces the camera (+z), so
4
+ * `rotation.y = -longitude` brings a longitude to the front and `rotation.x = latitude` centres a latitude.
5
+ */
6
+ export declare function latitudeLongitudeToVector(latitude: number, longitude: number, radius?: number): Vector3;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/latitude-longitude-to-vector/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,OAAO,CAQlG"}
@@ -0,0 +1,12 @@
1
+ import { Vector3 } from "three";
2
+ import { radians } from "@sharadox/web-library/math/radians";
3
+ /**
4
+ * A point on a sphere of `radius`. Longitude 0 faces the camera (+z), so
5
+ * `rotation.y = -longitude` brings a longitude to the front and `rotation.x = latitude` centres a latitude.
6
+ */
7
+ export function latitudeLongitudeToVector(latitude, longitude, radius = 1) {
8
+ const latitudeRadians = radians(latitude);
9
+ const longitudeRadians = radians(longitude);
10
+ return new Vector3(radius * Math.cos(latitudeRadians) * Math.sin(longitudeRadians), radius * Math.sin(latitudeRadians), radius * Math.cos(latitudeRadians) * Math.cos(longitudeRadians));
11
+ }
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/latitude-longitude-to-vector/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE7D;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAAgB,EAAE,SAAiB,EAAE,MAAM,GAAG,CAAC;IACvF,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5C,OAAO,IAAI,OAAO,CAChB,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAC/D,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,EAClC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAChE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { MarkerProperties } from "@sharadox/globe-web-library/marker/type";
2
+ /** A city dot lying flat on the surface. */
3
+ export declare function Marker({ latitude, longitude, color, home }: MarkerProperties): import("react").JSX.Element;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/marker/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,4CAA4C;AAC5C,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAY,EAAE,EAAE,gBAAgB,+BA2BpF"}
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useFrame } from "@react-three/fiber";
4
+ import { useMemo, useRef } from "react";
5
+ import { Quaternion, Vector3 } from "three";
6
+ import { latitudeLongitudeToVector } from "@sharadox/globe-web-library/latitude-longitude-to-vector";
7
+ /** A city dot lying flat on the surface. */
8
+ export function Marker({ latitude, longitude, color, home = false }) {
9
+ const ring = useRef(null);
10
+ const position = useMemo(() => latitudeLongitudeToVector(latitude, longitude, 1.004), [latitude, longitude]);
11
+ const quaternion = useMemo(() => new Quaternion().setFromUnitVectors(new Vector3(0, 0, 1), position.clone().normalize()), [position]);
12
+ useFrame(({ clock }) => {
13
+ if (!ring.current)
14
+ return;
15
+ const progress = (clock.elapsedTime * 0.6) % 1;
16
+ ring.current.scale.setScalar(1 + progress * 5);
17
+ ring.current.material.opacity = (1 - progress) * 0.8;
18
+ });
19
+ return (_jsxs("group", { position: position, quaternion: quaternion, children: [_jsxs("mesh", { children: [_jsx("circleGeometry", { args: [home ? 0.014 : 0.008, 20] }), _jsx("meshBasicMaterial", { color: color, transparent: true, opacity: home ? 1 : 0.85 })] }), home && (_jsxs("mesh", { ref: ring, children: [_jsx("ringGeometry", { args: [0.014, 0.018, 40] }), _jsx("meshBasicMaterial", { color: color, transparent: true, opacity: 0.8, depthWrite: false })] }))] }));
20
+ }
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/marker/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAqC,MAAM,OA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I,EACpD,4BAAmB,KAAK,EAAE,KAAK,EAAE,WAAW,QAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAI,IACpE,EACN,IAAI,IAAI,CACP,gBAAM,GAAG,EAAE,IAAI,aACb,uBAAc,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,GAAI,EAC1C,4BAAmB,KAAK,EAAE,KAAK,EAAE,WAAW,QAAC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,GAAI,IAC3E,CACR,IACK,CACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface MarkerProperties {
2
+ /** "#rrggbb". */
3
+ color: string;
4
+ latitude: number;
5
+ longitude: number;
6
+ /** The home marker is larger and sends out a pulsing ring. */
7
+ home?: boolean;
8
+ }
9
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/marker/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/marker/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /** A place on the globe. */
2
+ export interface Place {
3
+ latitude: number;
4
+ longitude: number;
5
+ }
6
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/place/type.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/place/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /** Arcs: a faint path plus a bright pulse travelling along it. */
2
+ export declare const ARC_SHADER: {
3
+ vertex: string;
4
+ fragment: string;
5
+ };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/shader/arc/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,UAAU;;;CAqBtB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /** Arcs: a faint path plus a bright pulse travelling along it. */
2
+ export const ARC_SHADER = {
3
+ vertex: /* glsl */ `
4
+ varying float alongArc;
5
+ void main() {
6
+ alongArc = uv.x;
7
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
8
+ }
9
+ `,
10
+ fragment: /* glsl */ `
11
+ uniform float time;
12
+ uniform float offset;
13
+ uniform vec3 color;
14
+ varying float alongArc;
15
+ void main() {
16
+ float phase = fract(time * 0.16 + offset);
17
+ float pulse = smoothstep(0.0, 0.16, 0.16 - abs(alongArc - phase * 1.3 + 0.15));
18
+ float base = 0.10;
19
+ float ends = smoothstep(0.0, 0.04, alongArc) * smoothstep(1.0, 0.96, alongArc);
20
+ gl_FragColor = vec4(color, (base + pulse * 0.95) * ends);
21
+ }
22
+ `,
23
+ };
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/shader/arc/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,MAAM,EAAE,UAAU,CAAC;;;;;;GAMlB;IACD,QAAQ,EAAE,UAAU,CAAC;;;;;;;;;;;;GAYpB;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Outer atmosphere, drawn on back faces: strongest just outside the edge, fading to zero at the rim. */
2
+ export declare const ATMOSPHERE_SHADER: {
3
+ vertex: string;
4
+ fragment: string;
5
+ };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/shader/atmosphere/index.ts"],"names":[],"mappings":"AAEA,yGAAyG;AACzG,eAAO,MAAM,iBAAiB;;;CAW7B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { GLOW_VERTEX } from "@sharadox/globe-web-library/shader/glow-vertex";
2
+ /** Outer atmosphere, drawn on back faces: strongest just outside the edge, fading to zero at the rim. */
3
+ export const ATMOSPHERE_SHADER = {
4
+ vertex: GLOW_VERTEX,
5
+ fragment: /* glsl */ `
6
+ varying vec3 viewNormal;
7
+ uniform float strength;
8
+ uniform vec3 color;
9
+ void main() {
10
+ float intensity = smoothstep(0.0, 0.55, -viewNormal.z);
11
+ gl_FragColor = vec4(color, intensity * intensity * strength);
12
+ }
13
+ `,
14
+ };
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/shader/atmosphere/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAE7E,yGAAyG;AACzG,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,WAAW;IACnB,QAAQ,EAAE,UAAU,CAAC;;;;;;;;GAQpB;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** The planet body with a fresnel rim, in the style's colours. */
2
+ export declare const BODY_SHADER: {
3
+ vertex: string;
4
+ fragment: string;
5
+ };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/shader/body/index.ts"],"names":[],"mappings":"AAEA,kEAAkE;AAClE,eAAO,MAAM,WAAW;;;CAWvB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { GLOW_VERTEX } from "@sharadox/globe-web-library/shader/glow-vertex";
2
+ /** The planet body with a fresnel rim, in the style's colours. */
3
+ export const BODY_SHADER = {
4
+ vertex: GLOW_VERTEX,
5
+ fragment: /* glsl */ `
6
+ varying vec3 viewNormal;
7
+ uniform vec3 base;
8
+ uniform vec3 rimColor;
9
+ void main() {
10
+ float rim = pow(1.0 - abs(viewNormal.z), 3.0);
11
+ gl_FragColor = vec4(mix(base, rimColor, rim), 1.0);
12
+ }
13
+ `,
14
+ };
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/shader/body/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAE7E,kEAAkE;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,WAAW;IACnB,QAAQ,EAAE,UAAU,CAAC;;;;;;;;GAQpB;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Land dots: facing dots are bright, edge dots fade, a few twinkle. */
2
+ export declare const DOT_SHADER: {
3
+ vertex: string;
4
+ fragment: string;
5
+ };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/shader/dot/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,UAAU;;;CA0BtB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /** Land dots: facing dots are bright, edge dots fade, a few twinkle. */
2
+ export const DOT_SHADER = {
3
+ vertex: /* glsl */ `
4
+ attribute float seed;
5
+ uniform float time;
6
+ uniform float pointSize;
7
+ varying float opacity;
8
+ void main() {
9
+ vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);
10
+ vec3 surfaceNormal = normalize(normalMatrix * position);
11
+ float facing = dot(surfaceNormal, vec3(0.0, 0.0, 1.0));
12
+ float twinkle = 0.75 + 0.25 * sin(time * 1.6 + seed * 40.0);
13
+ opacity = smoothstep(-0.05, 0.55, facing) * twinkle;
14
+ gl_PointSize = pointSize * (0.9 + 0.5 * seed) * (3.2 / -viewPosition.z);
15
+ gl_Position = projectionMatrix * viewPosition;
16
+ }
17
+ `,
18
+ fragment: /* glsl */ `
19
+ uniform vec3 color;
20
+ varying float opacity;
21
+ void main() {
22
+ vec2 fromCenter = gl_PointCoord - 0.5;
23
+ float distanceFromCenter = length(fromCenter);
24
+ if (distanceFromCenter > 0.5) discard;
25
+ gl_FragColor = vec4(color, smoothstep(0.5, 0.1, distanceFromCenter) * opacity);
26
+ }
27
+ `,
28
+ };
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/shader/dot/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;;;GAclB;IACD,QAAQ,EAAE,UAAU,CAAC;;;;;;;;;GASpB;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Vertex shader that passes the view-space normal on, for fresnel effects. */
2
+ export declare const GLOW_VERTEX = "\n varying vec3 viewNormal;\n void main() {\n viewNormal = normalize(normalMatrix * normal);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/shader/glow-vertex/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,eAAO,MAAM,WAAW,0LAMvB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** Vertex shader that passes the view-space normal on, for fresnel effects. */
2
+ export const GLOW_VERTEX = /* glsl */ `
3
+ varying vec3 viewNormal;
4
+ void main() {
5
+ viewNormal = normalize(normalMatrix * normal);
6
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
7
+ }
8
+ `;
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/shader/glow-vertex/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;;;;;;CAMrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Whether this browser can create a WebGL context. */
2
+ export declare function supportsWebGl(): boolean;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/web-gl-support/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,wBAAgB,aAAa,IAAI,OAAO,CAOvC"}
@@ -0,0 +1,11 @@
1
+ /** Whether this browser can create a WebGL context. */
2
+ export function supportsWebGl() {
3
+ try {
4
+ const canvas = document.createElement("canvas");
5
+ return !!(canvas.getContext("webgl2") || canvas.getContext("webgl"));
6
+ }
7
+ catch {
8
+ return false;
9
+ }
10
+ }
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/web-gl-support/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,UAAU,aAAa;IAC3B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { WorldProperties } from "@sharadox/globe-web-library/world/type";
2
+ /** The planet scene: body, atmosphere, land dots, arcs from home and markers. Rotation comes from the drag controller. */
3
+ export declare function World({ data, drag, colors, home, destinations }: WorldProperties): import("react").JSX.Element;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/world/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAE9E,0HAA0H;AAC1H,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,eAAe,+BAyDhF"}