ReadonlycoordinateConfigures the SceneModel's local coordinate system.
Internally, a matrix is created to transform coordinates between SceneModel and Scene CoordinateSystems. The matrix of each SceneMesh is premultiplied by that matrix, effectively transforming the SceneModel into the global coordinate system.
Indicates if this SceneModel has been destroyed.
true by SceneModel.destroy.ReadonlygeometriesGeometries within this SceneModel, each mapped to SceneGeometry.id.
ReadonlyglobalizedWhether IDs of SceneObjects are globalized.
When globalized, the IDs are prefixed with the value of SceneModel.id
This is false by default.
ReadonlyidUnique ID of this SceneModel.
SceneModel are stored against this ID in Scene.models.
Optional ReadonlylayerReadonlymaterialsMaterials within this SceneModel, each mapped to SceneMaterial.id.
ReadonlymeshesSceneMeshes within this SceneModel, each mapped to SceneMesh.id.
ReadonlyobjectsSceneObjects within this SceneModel, each mapped to SceneObject.id.
ReadonlyrepRepresentation sets within this SceneModel, each mapped to SceneRepSet.id.
A representation set declares alternative groups of SceneObjects that represent the same logical content. It is generic model metadata and does not store the active representation for any view.
ReadonlysceneThe Scene that contains this SceneModel.
ReadonlystatsStatistics on this SceneModel.
ReadonlytexturesTextures within this SceneModel, each mapped to SceneTexture.id.
ReadonlytransformsSceneTransforms within this SceneModel, each mapped to SceneTransform.id.
Currently active component creation batch, if any.
Whether this SceneModel is currently being populated by a loader.
ModelLoader sets this true for the duration of a load and false
when it finishes (or fails). The renderer observes the paired
onSceneModelBuildStarted /
onSceneModelBuildFinished
events to suspend per-frame uploads + draws until the model is fully
assembled, then renders it once — avoiding redundant mid-load frames.
Setting the same value twice is a no-op (no event fired), so it's safe for
a loader to clear it in a finally even on the error path.
Caches a matrix used to transform positions between SceneModel and Scene CoordinateSystems. Each SceneMesh's matrix is pre-multiplied by this matrix to effectively move the vertex positions from the SceneModel CoordinateSystem to the Scene CoordinateSystem within.
Describes whether this SceneModel uses ordinary open authoring or expects streaming committed batches.
Whether this SceneModel is closed against further topology/resource growth.
Renderer-neutral update mode for this SceneModel.
Starts a component creation batch on this SceneModel.
Components created while the batch is active are recorded in SceneModel.activeBatch. Viewers and renderers may defer those components until commitBatch publishes the batch as a single unit.
Batches are designed for loaders or application code that need to know exactly which components were created during a named loading interval, and for importers that need to partition a loading process into explicit construction phases. For example, an importer might stage one model file or file section before making it visible. Only one batch can be active at once. Use rollbackBatch to discard the active batch before it is committed.
Commits the active component creation batch.
The batch is marked committed, SceneModel.activeBatch is cleared and SceneEvents.onSceneModelBatchCommitted is fired. Renderers can use the committed batch as a stable construction unit and combine it with updateMode to choose their own allocation strategy. A SceneModel batch is a model construction concept; it does not require renderers to preserve the same boundary as a GPU draw batch.
Returns true if this SceneModel currently holds at least one
SceneGeometry of the given primitive type — e.g.
model.containsPrimitive(GaussianSplatsPrimitive).
Backed by a live per-primitive count maintained as geometries are created and destroyed, so it is O(1) and correct regardless of when geometries were added relative to the model's creation event.
Creates a new SceneGeometry within this SceneModel, from non-compressed geometry parameters.
const boxGeometryResult = sceneModel.createGeometry({
id: "boxGeometry",
primitive: TrianglesPrimitive, // @xeokit/constants
positions: [
1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, // v0-v1-v2-v3 front
1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, // v0-v3-v4-v1 right
1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, // v0-v1-v6-v1 top
-1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, // v1-v6-v7-v2 left
-1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1,// v7-v4-v3-v2 bottom
1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1 // v4-v7-v6-v1 back
],
indices: [
0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15,
16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23
]
});
if (!boxGeometryResult.ok) {
console.error(boxGeometryResult.error);
return;
} else {
const boxGeometry = boxGeometryResult.value;
}
const boxGeometryAgain = sceneModel.geometries["boxGeometry"];
See @xeokit/sdk/model/scene for more usage info.
Non-compressed geometry parameters.
SDKResult with:
Creates a new SceneGeometry within this SceneModel, from pre-compressed geometry parameters.
const boxGeometryResult = sceneModel.createGeometryCompressed({
id: "boxGeometry",
primitive: TrianglesPrimitive, // @xeokit/constants
aabb: [-1,-1,-1, 1,1,1],
positionsCompressed: [
65525, 65525, 65525, 0, 65525, 65525, 0, 0,
65525, 65525, 0, 65525, 65525, 0, 0, 65525,
65525, 0, 0, 65525, 0, 0, 0, 0
],
indices: [
0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5, 0, 5, 6,
0, 6, 1, 1, 6, 7, 1, 7, 2, 7, 4, 3, 7, 3, 2,
4, 7, 6, 4, 6, 5
]
});
if (!boxGeometryResult.ok) {
console.error(boxGeometryResult.error);
return;
} else {
const boxGeometry = boxGeometryResult.value;
}
See @xeokit/sdk/model/scene for more usage info.
Pre-compressed geometry parameters.
SDKResult with:
Creates a new SceneMaterial within this SceneModel.
const materialResult = sceneModel.createMaterial({
id: "myMaterial",
colorTextureId: "myColorTexture"
});
if (!materialResult.ok) {
console.error(materialResult.error);
return;
} else {
const material = materialResult.value;
}
const materialAgain = sceneModel.materials["myMaterial"];
See @xeokit/sdk/model/scene for more usage info.
SceneMaterial creation parameters.
SDKResult with:
Creates a new SceneMesh within this SceneModel.
const redBoxMeshResult = sceneModel.createLayerMesh({
id: "redBoxMesh",
geometryId: "boxGeometry",
materialId: "myMaterial",
position: [-4, -6, -4],
scale: [1, 3, 1],
rotation: [0, 0, 0],
color: [1, 0.3, 0.3]
});
if (!redBoxMeshResult.ok) {
console.error(redBoxMeshResult.error);
return;
} else {
const redBoxMesh = redBoxMeshResult.value;
}
See @xeokit/sdk/model/scene for more usage info.
Pre-compressed mesh parameters.
SDKResult with:
Creates a new SceneObject.
const redBoxObjectResult = sceneModel.createObject({
id: "redBoxObject",
meshIds: ["redBoxMesh"]
});
if (!redBoxObjectResult.ok) {
console.error(redBoxObjectResult.error);
return;
} else {
const redBoxObject = redBoxObjectResult.value;
const redBoxObjectAgain = sceneModel.objects["redBoxObject"];
const redBoxObjectOnceMore = scene.objects["redBoxObject"];
}
See @xeokit/sdk/model/scene for more usage info.
SceneObject parameters.
SDKResult with:
Creates a representation set in this SceneModel.
A representation set declares alternative representations of the same logical content. Each representation references SceneObjects by ID; it does not own those objects and does not reference raw geometry or mesh resources.
The active representation is intentionally not stored on SceneModel. Future viewing-layer code can choose different representations for different views at the same time.
Representation set parameters.
SDKResult with the created representation set, or an error when validation fails.
Creates a new SceneTexture within this SceneModel.
const textureResult = sceneModel.createTexture({
id: "myColorTexture",
src: // Path to JPEG, PNG, KTX2,
image: // HTMLImageElement,
buffers: // ArrayBuffer[] containing KTX2 MIP levels
preloadColor: [1,0,0,1],
flipY: false,
encoding: LinearEncoding, // @xeokit/constants
magFilter: LinearFilter,
minFilter: LinearFilter,
wrapR: ClampToEdgeWrapping,
wrapS: ClampToEdgeWrapping,
wrapT: ClampToEdgeWrapping,
});
if (!textureResult.ok) {
console.error(textureResult.error);
return;
} else {
const texture = textureResult.value;
}
const textureAgain = sceneModel.textures["myColorTexture"];
See @xeokit/sdk/model/scene for more usage info.
SceneTexture creation parameters.
SDKResult with:
Creates a new SceneTransform within this SceneModel.
matrix or composed from
position, scale and rotation (Euler) or quaternion.Parameters describing the transform to create.
An SDKResult with:
const rootTransformResult = sceneModel.createTransform({
id: "root",
position: [10, 0, 0]
});
if (!rootTransformResult.ok) {
console.error(rootTransformResult.error);
return;
}
const rootTransform = rootTransformResult.value;
sceneModel.createTransform({
id: "child",
parentTransformId: "root",
rotation: [0, Math.PI * 0.5, 0]
});
const childTransform = sceneModel.transforms["child"];
childTransform.position = [0, 5, 0];
childTransform.rotation =[0, 0, 45];
Destroys this SceneModel.
Creates components in this SceneModel from SceneModelParams.
See @xeokit/sdk/model/scene for usage.
The batch of components to create.
SDKResult with:
undefined.Gets representation sets that reference a SceneObject.
SceneObject ID.
Representation sets that contain the object in at least one representation.
Destroys all components created in the active batch and clears it.
This is only valid before commitBatch. Components are destroyed in dependency order and SceneEvents.onSceneModelBatchRolledBack is fired.
Seals this SceneModel against further topology/resource growth.
After sealing, creation methods such as createGeometry, createMesh, createObject and beginBatch reject new content. Renderers can treat a sealed model as complete and may use snug allocations according to the renderer's policy for this model's updateMode.
Gets this SceneModel as SceneModelParams.
Currently serializes: transforms, geometriesCompressed, meshes, and objects.
(Textures and materials are intentionally omitted/commented.)
See @xeokit/sdk/model/scene for usage.
Contains a model's geometry and materials.
See @xeokit/sdk/model/scene for usage.