Indicates if this SceneModel has already been built.
true by SceneModel.build.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.
ReadonlydestroyedIndicates if this SceneModel has been destroyed.
true by SceneModel.destroy.ProtecteddirtyReadonlyedgeThe edge threshold for automatic edge primitive generation.
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 ReadonlylayerReadonlymeshesSceneMeshes within this SceneModel, each mapped to SceneMesh.id.
ReadonlyobjectsSceneObjects within this SceneModel, each mapped to SceneObject.id.
ReadonlyobjectsList of SceneObjects within this SceneModel.
InternalrendererInternal interface through which a SceneModel can load updated content into a renderers.
ReadonlyretainedWhether this SceneModel retains SceneObjects, SceneMeshes, SceneGeometries etc after we call SceneModel.build.
Default value is true.
ReadonlysceneThe Scene that contains this SceneModel.
ReadonlystatsStatistics on this SceneModel.
OptionalstreamIndicates 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.
ReadonlytexturesTextures within this SceneModel, each mapped to SceneTexture.id.
ReadonlytextureTextureSets within this SceneModel, each mapped to SceneTextureSet.id.
ReadonlytilesThe Tiles used by this SceneModel, each mapped to SceneTile.id.
ReadonlytilesThe 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.
ProtectedcleanForces this component to action any deferred state updates.
ProtectedcleanGives this component an opportunity to action any defered state updates.
Creates 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.
ProtectederrorProtectedLogs an error for this component to the JavaScript console.
The console message will have this format: [ERROR] [<component type> =<component id>: <message>
The error message to log
Creates components in this SceneModel from SceneModelParams.
See @xeokit/sdk/scene for usage.
void
ProtectedlogProtectedLogs a message for this component.
The message will have this format: [LOG] [<component type> <component id>: <message>
The message to log
ProtectedsetFlags this component as having a defered state updates it needs to perform.
Gets this SceneModel as SceneModelParams.
See @xeokit/sdk/scene for usage.
ProtectedwarnProtectedLogs a warning for this component to the JavaScript console.
The console message will have this format: [WARN] [<component type> =<component id>: <message>
The warning message to log
ReadonlyonReadonlyonEmits an event when this SceneModel has been destroyed.
onDestroyed
Contains a model's geometry and materials.
See @xeokit/sdk/scene for usage.