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.
ReadonlysceneThe Scene that contains this SceneModel.
ReadonlystatsStatistics on this SceneModel.
ReadonlytechniquesTechniques within this SceneModel, each mapped to SceneTechnique.id.
ReadonlytexturesTextures within this SceneModel, each mapped to SceneTexture.id.
ReadonlytransformsSceneTransforms within this SceneModel, each mapped to SceneTransform.id.
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.
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 SceneTechnique within this SceneModel.
Techniques carry rendering-style state — which non-default shader family runs for meshes that bind them — orthogonal to SceneMaterial, which carries the surface shading model. A SceneMesh may attach either, both, or neither.
The factory dispatches on params.type to the matching
concrete subclass. Fires
SceneEvents.onSceneTechniqueCreated on success.
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.InternalMarks this transform globally dirty and propagates that state to all descendants.
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.