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.
ReadonlycoordinateCaches 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.
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 ReadonlylayerReadonlymeshesSceneMeshes 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.
ReadonlytexturesTextures within this SceneModel, each mapped to SceneTexture.id.
ReadonlytextureTextureSets within this SceneModel, each mapped to SceneTextureSet.id.
ReadonlytransformsSceneTransform | SceneTransforms within this SceneModel, each mapped to SceneTransform.id | SceneTransform.id.
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/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/scene for more usage info.
Pre-compressed geometry parameters.
SDKResult with:
Creates a new SceneMesh within this SceneModel.
const redBoxMeshResult = 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 (!redBoxMeshResult.ok) {
console.error(redBoxMeshResult.error);
return;
} else {
const redBoxMesh = redBoxMeshResult.value;
}
See @xeokit/sdk/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/scene for more usage info.
SceneObject parameters.
SDKResult with:
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/scene for more usage info.
SceneTexture creation parameters.
SDKResult with:
Creates a new SceneTextureSet within this SceneModel.
const textureSetResult = sceneModel.createTextureSet({
id: "myTextureSet",
colorTextureId: "myColorTexture"
});
if (!textureSetResult.ok) {
console.error(textureSetResult.error);
return;
} else {
const textureSet = textureSetResult.value;
}
const textureSetAgain = sceneModel.textureSets["myTextureSet"];
See @xeokit/sdk/scene for more usage info.
SceneTextureSet 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]
});
Destroys this SceneModel.
Creates components in this SceneModel from SceneModelParams.
See @xeokit/sdk/scene for usage.
The batch of components to create.
SDKResult with:
undefined.Gets this SceneModel as SceneModelParams.
Currently serializes: transforms, geometriesCompressed, meshes, and objects.
(Textures and textureSets are intentionally omitted/commented.)
See @xeokit/sdk/scene for usage.
Contains a model's geometry and materials.
See @xeokit/sdk/scene for usage.