This module provides utilities for serializing and deserializing SceneModels
to and from the SDK’s canonical JSON representation, SceneModelParams. The format captures
a SceneModel’s complete renderable state, including geometry, meshes, textures, materials,
transforms, and coordinate-system information.
Shape
%%{init:{"theme":"dark"}}%%
classDiagram
direction TB
class SceneModelImporter {
+format : "SceneModelParams"
+load(params, options?) Promise~void~
}
class SceneModelExporter {
+format : "SceneModelParams"
+write(params, options?) Promise~SceneModelParams~
}
class SceneModelParams {
<<scene>>
}
class ModelLoader {
<<formats>>
}
class ModelExporter {
<<formats>>
}
ModelLoader <|-- SceneModelImporter
ModelExporter <|-- SceneModelExporter
SceneModelImporter ..> SceneModelParams : reads
SceneModelExporter ..> SceneModelParams : writes
%%{init:{"theme":"default"}}%%
classDiagram
direction TB
class SceneModelImporter {
+format : "SceneModelParams"
+load(params, options?) Promise~void~
}
class SceneModelExporter {
+format : "SceneModelParams"
+write(params, options?) Promise~SceneModelParams~
}
class SceneModelParams {
<<scene>>
}
class ModelLoader {
<<formats>>
}
class ModelExporter {
<<formats>>
}
ModelLoader <|-- SceneModelImporter
ModelExporter <|-- SceneModelExporter
SceneModelImporter ..> SceneModelParams : reads
SceneModelExporter ..> SceneModelParams : writes
classDiagram
direction TB
class SceneModelImporter {
+format : "SceneModelParams"
+load(params, options?) Promise~void~
}
class SceneModelExporter {
+format : "SceneModelParams"
+write(params, options?) Promise~SceneModelParams~
}
class SceneModelParams {
<<scene>>
}
class ModelLoader {
<<formats>>
}
class ModelExporter {
<<formats>>
}
ModelLoader <|-- SceneModelImporter
ModelExporter <|-- SceneModelExporter
SceneModelImporter ..> SceneModelParams : reads
SceneModelExporter ..> SceneModelParams : writes
Lossless — captures geometry buffers, textures, materials, transforms,
and the model's origin / scale / basis triplet, so re-loading reproduces
the original SceneModel without re-tessellating or re-quantizing.
Inspectable — a single JSON document the host can diff, hand-edit,
and version-control; useful as a debugging dump or fixture format in tests.
constjson = JSON.stringify(sceneModelParams, null, 2); // persist or transmit `json`
Importing a SceneModel from JSON
Use SceneModelImporter to reconstruct a SceneModel from a previously
serialized SceneModelParams object. Create the target SceneModel first,
pass the params as fileData, then build it once loaded — load resolves with no value.
import { SceneModelImporter } from"@xeokit/sdk/scenemodel"; import { Scene } from"@xeokit/sdk/model/scene";
SceneModelParams is a lossless representation of a SceneModel’s internal state.
A SceneModel can be exported and re-imported without changing geometry IDs, object IDs,
transforms, or coordinate-system settings, making this format suitable for caching and
synchronization workflows.
xeokit SceneModelParams Importer and Exporter
Import and export renderable SceneModels using xeokit’s JSON-based SceneModelParams interchange format.
This module provides utilities for serializing and deserializing SceneModels to and from the SDK’s canonical JSON representation, SceneModelParams. The format captures a SceneModel’s complete renderable state, including geometry, meshes, textures, materials, transforms, and coordinate-system information.
Shape
Features
Installation
Usage
Exporting a SceneModel to JSON
Use SceneModelExporter to serialize a SceneModel into a SceneModelParams object, which can then be stored or transmitted as JSON.
writeresolves with theSceneModelParamsobject itself — stringify it yourself to persist it.Importing a SceneModel from JSON
Use SceneModelImporter to reconstruct a SceneModel from a previously serialized SceneModelParams object. Create the target SceneModel first, pass the params as
fileData, thenbuildit once loaded —loadresolves with no value.Round-tripping SceneModels
SceneModelParams is a lossless representation of a SceneModel’s internal state. A SceneModel can be exported and re-imported without changing geometry IDs, object IDs, transforms, or coordinate-system settings, making this format suitable for caching and synchronization workflows.