How strandedkitty/streets-gl-legacy works
Main Components
• Browser/UI Layer: Represented by the main HTML file (src/index.html) which bootstraps the application.
• Rendering Engine: The heart of Streets GL, found primarily in src/js. This includes:
– Core modules (e.g., Object3D, SceneGraph, Cameras in src/js/core)
– Renderer and WebGL abstraction (src/js/renderer/)
– Shader manager and shader passes (src/js/passes/; also related GLSL shaders in src/glsl/)
– Material and mesh handling (src/js/materials/ and src/js/Models.js)
• Data & Resource Management:
– Assets such as textures (src/textures/), models (src/models/), and additional static resources.
• /OSM Data Handling & Workers:
– Worker scripts (located in src/js/worker/) for asynchronous processing, vector tile handling, and mapping functionalities (including files like MapWorker.js, MapWorkerManager.js).
• Configuration & Build Tools: Files such as package.json, webpack.config.js, which govern dependency management and bundling.
Relationships and Interactions
• The Browser/UI layer launches the application and initiates main.js, which in turn creates the rendering context.
• The Rendering Engine, through its various submodules, organizes the scene graph, loads assets, applies material/shader pipelines, and renders each frame.
• Resources (textures, models) are loaded from the file system via resource manager components and then passed to the renderer.
Architectural Patterns & Design Principles
• Asynchronous Processing: Emphasize web workers for offloading map data and tile processing. This is critical for performance in a WebGL visualization.
Technology & Framework Detail
• JavaScript for application logic (all source in src/js).
• WebGL 2 for rendering, indicated by custom GLSL shader files in src/glsl.
• Web Workers handling heavy computation in parallel.
• Use of npm for dependency management (package.json, package-lock.json) and webpack for bundling (webpack.config.js).