mapspinner 0.1.1

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.
package/src/index.js ADDED
@@ -0,0 +1,41 @@
1
+ // mapspinner SDK entry point
2
+ // Primary exports for external consumers (e.g., spoint integration)
3
+
4
+ export { initMapspinnerPlanet, initMapspinnerRender } from './planet-orchestrator.js';
5
+ export { Quadtree } from './quadtree.js';
6
+ export { createAnchorField } from './anchor-field.js';
7
+
8
+ // Version marker
9
+ export const VERSION = '0.1.0';
10
+
11
+ /**
12
+ * Initialize mapspinner renderer on a WebGL2 context.
13
+ *
14
+ * @param {WebGL2RenderingContext} gl - WebGL2 context (must support required extensions)
15
+ * @param {Object} config - Configuration object
16
+ * @param {number} config.radius - Planet radius in meters (default 6360000)
17
+ * @param {number} config.gridMeshSize - Mesh subdivision level (default 16)
18
+ * @param {HTMLCanvasElement} config.canvas - Target canvas element
19
+ * @returns {Promise<Object>} - Renderer instance with methods: render(cam), dispose()
20
+ *
21
+ * Example:
22
+ * const renderer = await mapspinner.createRenderer(gl, { radius: 6360000 });
23
+ * // In animation loop:
24
+ * renderer.render(camera);
25
+ */
26
+ export async function createRenderer(gl, config = {}) {
27
+ const { initMapspinnerRender } = await import('./gl-render.js');
28
+ return initMapspinnerRender(gl, config);
29
+ }
30
+
31
+ /**
32
+ * Initialize a full planet+camera+LOD system.
33
+ *
34
+ * @param {WebGL2RenderingContext} gl - WebGL2 context
35
+ * @param {Object} config - Configuration object
36
+ * @returns {Promise<Object>} - Planet instance with properties: cam, quadtree, render(gl)
37
+ */
38
+ export async function createPlanet(gl, config = {}) {
39
+ const { initMapspinnerPlanet } = await import('./planet-orchestrator.js');
40
+ return initMapspinnerPlanet(gl, config);
41
+ }