The following lists only some of the main APIs called in the sample code in this guide.
| API | Description |
|---|---|
| static loadGSNode(scene: Scene, params: GSImportSettings, parent?: Node): Promise<GSNode> | Loads a 3DGS model. |
In the entry directory, open /src/main/ets/entryability/EntryAbility.ets and import the spatial modeling module.
import { spatialRender } from '@kit.SpatialReconKit';
import { Scene, RenderContext } from '@kit.ArkGraphics3D' Load the context of the current scene.
let renderContext: RenderContext | null = Scene.getDefaultRenderContext();
Call the API for loading a 3DGS model.
if (renderContext != null) {
renderContext.loadPlugin(spatialRender.GSPlugin.PLUGIN_ID);
let scene = Scene.load().then(async (scene: Scene) => {
let uri = "OhosRawFile://assets/gltf/model.glb"; // URI of the 3DGS model. Change it as needed.
let offset = 0;
let gsNodeext: spatialRender.GSNode = await spatialRender.GSPlugin.loadGSNode(scene, {uri, offset}, scene.root);
});
}