Indicates if this SceneModel has already been built.
true
by SceneModel.build.Readonly
destroyedIndicates if this SceneModel has been destroyed.
true
by SceneModel.destroy.Protected
dirtyReadonly
edgeThe edge threshold for automatic edge primitive generation.
Readonly
geometriesGeometries within this SceneModel, each mapped to SceneGeometry.id.
Readonly
globalizedWhether IDs of SceneObjects are globalized.
When globalized, the IDs are prefixed with the value of SceneModel.id
This is false
by default.
Readonly
idUnique ID of this SceneModel.
SceneModel are stored against this ID in Scene.models.
Optional
Readonly
layerReadonly
meshesSceneMeshes within this SceneModel, each mapped to SceneMesh.id.
Readonly
objectsSceneObjects within this SceneModel, each mapped to SceneObject.id.
Readonly
objectsList of SceneObjects within this SceneModel.
Internal
rendererInternal interface through which a SceneModel can load updated content into a renderers.
Readonly
retainedWhether this SceneModel retains SceneObjects, SceneMeshes, SceneGeometries etc after we call SceneModel.build.
Default value is true
.
Readonly
sceneThe Scene that contains this SceneModel.
Readonly
statsStatistics on this SceneModel.
Optional
streamIndicates what renderer resources will need to be allocated in a Viewer's Renderer to support progressive loading for the SceneModel.
See @xeokit/sdk/scene for usage.
Readonly
texturesTextures within this SceneModel, each mapped to SceneTexture.id.
Readonly
textureTextureSets within this SceneModel, each mapped to SceneTextureSet.id.
Readonly
tilesThe Tiles used by this SceneModel, each mapped to SceneTile.id.
Readonly
tilesThe Tiles used by this SceneModel.
Gets the axis-aligned 3D World-space boundary of this SceneModel.
Finalizes this SceneModel, readying it for use.
true
.sceneMode.onBuilt.subscribe(()=>{
// Our SceneModel is built and ready to use
});
myScene.onModelCreated.subscribe((sceneModel)=>{
// Another way to subscribe to SceneModel readiness
});
mySceneModel.build().then((result) => { // Asynchronous (texture compression etc).
if (result instanceof SDKError) {
console.log(result.message);
} else {
// Now we can do things with our SceneModel
}
}).catch(sdkError) {// SDKError
console.log(sdkError.message);
};
See @xeokit/sdk/scene for more usage info.
Protected
cleanProtected
cleanCreates a new SceneGeometry within this SceneModel, from non-compressed geometry parameters.
const boxGeometry = 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 (boxGeometry instanceof SDKError) {
console.log(boxGeometry.message);
} else {
const boxGeometryAgain = sceneModel.geometries["boxGeometry"];
}
See @xeokit/sdk/scene for more usage info.
Non-compressed geometry parameters.
Creates a new SceneGeometry within this SceneModel, from pre-compressed geometry parameters.
const boxGeometry = 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 (boxGeometry instanceof SDKError) {
console.log(boxGeometry.message);
} else {
const boxGeometryAgain = sceneModel.geometries["boxGeometry"];
}
See @xeokit/sdk/scene for more usage info.
Pre-compressed geometry parameters.
Creates a new SceneMesh within this SceneModel.
const redBoxMesh = sceneModel.createLayerMesh({
id: "redBoxMesh",
geometryId: "boxGeometry",
textureSetId: "myTextureSet",
position: [-4, -6, -4],
scale: [1, 3, 1],
rotation: [0, 0, 0],
color: [1, 0.3, 0.3]
});
if (redBoxMesh instanceof SDKError) {
console.log(redBoxMesh.message);
} else {
const redBoxMeshAgain = sceneModel.meshes["redBoxMesh"];
}
See @xeokit/sdk/scene for more usage info.
Pre-compressed mesh parameters.
Creates a new SceneObject.
const redBoxObject = sceneModel.createObject({
id: "redBoxObject",
meshIds: ["redBoxMesh"]
});
if (redBoxObject instanceof SDKError) {
console.log(redBoxObject.message);
} else {
const redBoxObjectAgain = sceneModel.objects["redBoxObject"];
const redBoxObjectOnceMore = scene.objects["redBoxObject"];
}
See @xeokit/sdk/scene for more usage info.
SceneObject parameters.
Creates a new SceneTexture within this SceneModel.
const texture = 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,
});
const textureAgain = sceneModel.textures["myColorTexture"];
See @xeokit/sdk/scene for more usage info.
SceneTexture creation parameters.
Creates a new SceneTextureSet within this SceneModel.
const textureSet = sceneModel.createTextureSet({
id: "myTextureSet",
colorTextureId: "myColorTexture"
});
const textureSetAgain = sceneModel.textureSets["myTextureSet"];
See @xeokit/sdk/scene for more usage info.
SceneTextureSet creation parameters.
Destroys this SceneModel.
Sets Component.destroyed true
.
Protected
errorCreates components in this SceneModel from SceneModelParams.
See @xeokit/sdk/scene for usage.
void
Protected
logProtected
setGets this SceneModel as SceneModelParams.
See @xeokit/sdk/scene for usage.
Protected
warnReadonly
onReadonly
onEmits an event when this SceneModel has been destroyed.
onDestroyed
Contains a model's geometry and materials
See @xeokit/sdk/scene for usage.