arcoda3d v0.0.8-rc1
3D Visualization Library
A TypeScript library designed to simplify the use of various 3D engines like Babylon.js and Three.js by abstracting their implementations into a unified API. This library enables effortless 3D model visualization and provides a suite of tools for advanced interactions, such as measurement tools for precise model analysis.
Features
- Engine Abstraction: Switch between 3D engines without changing your code.
- Model Visualization: Import and display 3D models in common formats like
.glb
and.gltf
. - Measurement Tools: Take precise measurements on 3D models.
Installation
You can integrate the library into your project in one of the following ways:
1. Using npm (recommended)
Install the library using npm:
npm install am3d
2. Using the UMD file
If your project does not use a package manager, you can download the .umd
file and include it in your solution. Then, reference the exports directly in your code:
<script src="path/to/am3d.umd.js"></script>
Getting Started
Here’s how to use the library to visualize a 3D model and interact with it.
Basic Usage
import { BabylonEngine } from 'am3d';
const engine = new am3d.BabylonEngine(); // or new am3d.ThreejsEngine
of(null)
.pipe(
switchMap(() => enginesSetup$()), // Engine initialization
)
.subscribe();
// Engine initialization
function enginesSetup$() {
let containerId = 'your-container-id';
let webGLRenderingContext = undefined; // if unified rendering context must be unique, set the very same instance
const api = {
GETAcquisitionInfoEndpoint: 'your-acquisition-info-endpoint',
GETAcquisitionDataEndpoint: 'your-acquisition-data-endpoint',
};
const properties = {
containerId,
webGLRenderingContext,
};
const setup = {
properties,
api,
};
return engine.setup$(setup);
}
API Documentation
See 'insert-link-when-compodoc-available' for technical documentation
Supported Engines
- Babylon.js: https://www.babylonjs.com/
- Three.js: https://threejs.org/
Supported Formats
.glb
.gltf
License
This project is licensed under the MIT License. See the LICENSE file for details.