How glob3mobile/g3m works
This project – “g3m” – is a multiplatform advanced visualization framework built to power high-performance mobile (and desktop) map apps and real–time 2D/2.5D/3D visualization. Its core architecture centers around a C++ engine that is then “translated” (via automated tools or manual bridges) into other languages and APIs for Android (Java), WebGL (via GWT/JavaScript, Emscripten) and iOS (Objective-C/Swift). The system “splits” into a core, cross–platform logic layer and platform–specific libraries that implement abstract interfaces for device–dependent features such as rendering, file I/O, and input handling.
Main Layers/Components
• Core Engine (C++):
– The heart of the framework which contains algorithms for rendering, geometry processing, camera management, scene construction, and general visualization.
• Platform Translation/Bridging Layer:
– Tools and processes that translate core C++ code to Java (“G3MAndroidSDK”, “JavaDesktop” modules) and JavaScript (through GWT and Emscripten for WebGL).
• Platform–Specific Implementations:
– Each target platform has its native implementations of a set of abstract interfaces. For instance:
∙ Android: Code under Android/G3MAndroidDemo and related Android-specific libraries.
∙ iOS: Code under iOS/G3MApp, with dedicated implementations of device handling and rendering.
∙ WebGL/HTML5: Modules under WebGL/G3MWebGLDemo, G3MWebGLSDK among others which use GWT, Emscripten.
∙ Desktop: JavaDesktop modules build native desktop versions.
• Tools and Utilities:
– Additional modules or tools such as Blender plugin (for exporting), point-cloud processing, extruders, and others which assist in converting and processing input data (e.g. for generating buildings, textures, point clouds).
Data Flow and Dependencies
• The Core C++ Layer provides a unified engine and algorithms.
• Abstract interfaces (declared in the core) define methods that “bridge” to the platform–specific functionality.
• For each platform, the translated core is integrated with that platform’s native libraries (Android: Java wrappers; iOS: Objective-C implementations; WebGL: GWT/JavaScript code compiled by Emscripten).
• Tools such as converters and extruders (found under “tools/…” and “converter”) process raw input data (geospatial formats, textures, point cloud data) and feed them into the core engine.
Architectural Patterns and Design Principles
• Multilayer/Modular architecture: Separate core logic from platform implementations.
• Abstraction / Interface design:
– Abstract classes/interfaces defined in the core that are implemented natively per platform.
• Cross-compilation/translation:
– The core is “translated” into Java and JavaScript (via GWT and Emscripten), ensuring maximum code reuse.
• High performance emphasis:
• Extensibility:
– New platforms can be added by implementing the abstract interfaces.
Technologies and Libraries
• Languages: C++ (core), Java, JavaScript (via GWT/Emscripten), Objective-C for iOS.
• Platforms: Android, iOS, WebGL (HTML5/Javascript), Desktop.
• SDKs and frameworks: support libraries like android-support-v4.jar on Android, WebGL shaders, and iOS specific rendering (OpenGL ES).
• Tools: Compilation scripts for Emscripten, Blender plugin for exporting scenes, tools for handling point-clouds, extruders.
Details Pertinent to This Project
• Unique multi–platform translation aspect:
"The engine is written once in C++ and then automatically translated to Java (Android) and JavaScript (via GWT/Emscripten for web), with native iOS wrappers created."
• Integration points for real–time and offline data (cache management) in the engine.
• Modular examples that exist in the file tree: they are present in directories such as “Android”, “iOS”, “WebGL”, “JavaDesktop”, “Emscripten”, and “Commons”.