LCCRender::load
Loads LCC data and returns an LCCObject.
The Web SDK supports Three.js and CesiumJS engines. Pass the corresponding engine parameters to load an LCC model.
Version Requirement
SDK v0.2.0+
Engine Support
Three.js / CesiumJS
API
LCCRender::load(param: LoadOptions, successFunc: SuccessFunc, progressFunc: ProgressFunc, failureFunc: FailureFunc, preProcessFunc?: PreProcessFunc): LCCObject
Parameters
param (Three.js)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
param.camera | THREE.PerspectiveCamera / THREE.OrthographicCamera | Yes | - | Three.js camera object. |
param.scene | THREE.Scene | Yes | - | Three.js scene object. |
param.renderLib | THREE | Yes | - | Three.js library reference, e.g., import * as THREE from 'three'. |
param.renderLibWebgpu | typeof import('three/webgpu') | No | - | Three.js WebGPU module reference, e.g., import * as THREE_WEBGPU from 'three/webgpu'. |
param.renderLibTSL | typeof import('three/tsl') | No | - | Three.js TSL module reference, e.g., import * as TSL from 'three/tsl'. |
param.renderer | THREE.WebGLRenderer | Yes | - | Three.js renderer. |
param.dataPath | String / Object | Yes | - | LCC data path. Supports string path (.lcc / .lcc2 / meta.lcc with token) or path descriptor object. |
param.canvas | HTMLCanvasElement | Yes | - | Canvas element for rendering, available via renderer.domElement. |
param.appKey | String | No | - | AppKey for removing the watermark. |
param.useEnv | Boolean | No | - | Whether to display environment data. |
param.useIndexDB | Boolean | No | true | Whether to enable local data caching. SDK v0.5.0+ |
param.useLoadingEffect | Boolean | No | false | Whether to enable loading effects. SDK v0.5.1+ |
param.loadingEffectCenter | { x: number, y: number, z: number } | No | - | Center position of the loading effect. SDK v0.5.1+ |
param.pointsColor | String | No | 'default' | Point cloud display style: 'default' (original color) or 'rainbow' (elevation color). |
param.modelMatrix | THREE.Matrix4 | No | - | Model matrix. SDK v0.5.2+ |
param.maxHostCacheSize | number | No | - | Host cache size. SDK v0.5.4+ |
param.maxGpuCacheSize | number | No | - | GPU cache size. SDK v0.5.4+ |
param.usePrecisionRaycast | Boolean | No | true (PC) | Enable high-precision raycasting. Enabled by default on PC; not supported on mobile. SDK v0.6.3+ |
param (CesiumJS)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
param.camera | Cesium.Camera | Yes | - | Cesium camera object. |
param.scene | Cesium.Scene | Yes | - | Cesium scene object. |
param.renderLib | Cesium | Yes | - | CesiumJS library reference, e.g., import * as Cesium from 'cesium'. |
param.dataPath | String / Object | Yes | - | LCC data path. Supports string path (.lcc / .lcc2 / meta.lcc with token) or path descriptor object. |
param.canvas | HTMLCanvasElement | Yes | - | Canvas element for rendering, available via viewer.scene.canvas. |
param.modelMatrix | Cesium.Matrix4 | No | - | Model transformation matrix. Not required for RTK georeferenced data. |
param.appKey | String | No | - | AppKey for removing the watermark. |
param.useEnv | Boolean | No | - | Whether to display environment data. |
param.useIndexDB | Boolean | No | true | Whether to enable local data caching. SDK v0.5.0+ |
param.useLoadingEffect | Boolean | No | false | Whether to enable loading effects. SDK v0.5.1+ |
param.loadingEffectCenter | { x: number, y: number, z: number } | No | - | Center position of the loading effect. SDK v0.5.1+ |
param.pointsColor | String | No | 'default' | Point cloud display style: 'default' (original color) or 'rainbow' (elevation color). |
param.maxHostCacheSize | number | No | - | Host cache size. SDK v0.5.4+ |
param.maxGpuCacheSize | number | No | - | GPU cache size. SDK v0.5.4+ |
param.usePrecisionRaycast | Boolean | No | true (PC) | Enable high-precision raycasting. Enabled by default on PC; not supported on mobile. SDK v0.6.3+ |
Callback Functions
| Parameter | Type | Required | Description |
|---|---|---|---|
successFunc | (model: any) => void | Yes | Model load success callback. Parameter is the constructed mesh. |
progressFunc | (progress: number) => void | Yes | Model load progress callback. Parameter is the percentage (0–1). |
failureFunc | () => void | Yes | Model load failure callback. |
preProcessFunc | (buffer: ArrayBuffer, filename: string) => Promise<{ data: ArrayBuffer; rawData: ArrayBuffer }> | No | Data pre-processing callback for processing data before rendering. SDK v0.5.0+ |
dataPath Format
dataPath supports two formats:
Option 1: String path (recommended)
Pass a string directly specifying the LCC data path:
- Full
.lccfile path, e.g.,http://example.com/data/xxxx.lcc. SDK v0.4.1+ (recommended) - Full
.lcc2file path, e.g.,http://example.com/data/xxxx.lcc2. SDK v0.6.0+ (recommended) meta.lccfile path with token and other parameters for encrypted data scenarios, e.g.,https://example.com/data/meta.lcc?token=xxx&other=xxx- Directory path requiring a
meta.lccfile in the directory, e.g.,https://example.com/data(deprecated)
const lccObject = LCCRender.load({
// ...other params
dataPath: 'http://example.com/data/xxxx.lcc',
}, successFunc, progressFunc, failureFunc);
Option 2: Path descriptor collection (SDK v0.5.0+)
Use an object to customize all file paths with encryption support, applicable to LCC format.
File path descriptor format:
{
"fileName": {
"url": "xxxxxxxxxxxx",
"header": { "field1": "xxx", "field2": "yyy" } // Optional, added to HTTP request headers
}
}
Example:
const dataPath = {
meta: { url: 'http://example.com/xxx/meta.lcc' },
index: { url: 'http://example.com/xxx/index.bin' },
data: { url: 'http://example.com/xxx/data.bin' },
environment: { url: 'http://example.com/xxx/environment.bin' },
collision: { url: 'http://example.com/xxx/collision.lci' },
shcoef: { url: 'http://example.com/xxx/shcoef.bin' },
};
const lccObject = LCCRender.load({
// ...other params
dataPath: dataPath,
}, successFunc, progressFunc, failureFunc);
Return Value
LCCObject — LCC model object with interfaces for raycasting, clipping, render control, and more.
Notes
- Three.js engine requires calling
LCCRender.update()in the render loop. - The
param.useSHparameter is deprecated; use theLCCObject.useShcoef()method instead. - The
param.gpuAccelerationparameter is deprecated. - dataPath supports
.lccformat (SDK v0.4.1+) and.lcc2format (SDK v0.6.0+).
Related APIs
LCCRender::unload()LCCRender::update()LCCRender::dispose()