globe#
Reusable 3D Earth globe widget (pure OCaml + WebGL).
Interactive 3D globe with dot-cloud Earth rendering, satellite orbits, ground coverage footprints, coordinate grid, and star background. Pure OCaml compiled to JavaScript via js_of_ocaml, using WebGL2 for rendering and Brr for DOM interaction.
Installation#
opam install globe
Usage#
(* Initialize a globe scene on a canvas element *)
let scene = Globe_webgl.Scene.v canvas_el in
(* Add satellites from J2000 state vectors *)
let sat =
Globe.Satellite.v ~pos ~vel ~color:(Globe.Color.v 0.2 0.8 1.0 1.0)
~epoch_unix:t0 ()
in
Globe_webgl.Scene.set_satellites scene [ sat ];
(* Render loop *)
let frame = Globe_webgl.Scene.begin_frame scene dt in
Globe_webgl.Scene.update_time scene current_unix;
Globe_webgl.Scene.draw scene frame Globe_webgl.Scene.default_layers
API Overview#
Core (Globe)#
Sphere-- Dot-cloud generation via golden spiral with continent/coast brightnessSatellite-- Satellite state: cached Kepler elements, ghost orbits, trail positionsMath.Vec3-- 3D vector operationsColor-- RGBA color typeGeometry,Raycast,Visibility-- Spatial computations
WebGL (Globe_webgl)#
Scene-- Canvas setup, satellite management, layer compositing, interactionCamera-- Orbit camera with smooth zoom/panEarth,Stars,Grid,Orbit,Coverage-- Rendering layersShader-- WebGL2 shader compilation
License#
ISC