Function
Static Public Summary | ||
public |
DrawShaderSource(mesh: *) |
|
public |
buildBoxGeometry(cfg: *): Object Creates box-shaped Geometry. |
|
public |
buildBoxLinesGeometry(cfg: *): Object Creates a box-shaped lines Geometry. |
|
public |
buildCylinderGeometry(cfg: *): Object Creates a cylinder-shaped Geometry. |
|
public |
buildGridGeometry(cfg: *): Object Creates a grid-shaped Geometry. |
|
public |
buildPlaneGeometry(cfg: *): Object Creates a plane-shaped Geometry. |
|
public |
buildSphereGeometry(cfg: *): Object Creates a sphere-shaped Geometry. |
|
public |
buildTorusGeometry(cfg: *): Object Creates a torus-shaped Geometry. |
|
public |
buildVectorTextGeometry(cfg: *): Object Creates wireframe vector text Geometry. |
|
public |
load3DSGeometry(scene: Scene, cfg: *): Object Loads Geometry from 3DS. |
|
public |
loadOBJGeometry(scene: Scene, cfg: *): Object Loads Geometry from OBJ. |
|
public |
validateMetaModelForTreeViewContainmentHierarchy(metaModel: MetaModel, errors: String[]): boolean Tests if TreeViewPlugin would be able to create a "containment" hierarchy for the given MetaModel. |
|
public |
validateMetaModelForTreeViewStoreysHierarchy(metaModel: MetaModel, errors: String[]): boolean Tests if TreeViewPlugin would be able to create a "storeys" hierarchy for the given MetaModel. |
|
public |
validateMetaModelForTreeViewTypesHierarchy(metaModel: MetaModel, errors: String[]): boolean Tests if TreeViewPlugin would be able to create a "types" hierarchy for the given MetaModel. |
Static Public
public DrawShaderSource(mesh: *) source
import {DrawShaderSource} from '@xeokit/xeokit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js'
Params:
Name | Type | Attribute | Description |
mesh | * |
public buildBoxGeometry(cfg: *): Object source
import {buildBoxGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js'
Creates box-shaped Geometry.
Usage
In the example below we'll create a Mesh with a box-shaped ReadableGeometry.
import {Viewer, Mesh, buildBoxGeometry, ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.scene.camera.eye = [0, 0, 5];
viewer.scene.camera.look = [0, 0, 0];
viewer.scene.camera.up = [0, 1, 0];
new Mesh(viewer.scene, {
geometry: new ReadableGeometry(viewer.scene, buildBoxGeometry({
center: [0,0,0],
xSize: 1, // Half-size on each axis
ySize: 1,
zSize: 1
}),
material: new PhongMaterial(viewer.scene, {
diffuseMap: new Texture(viewer.scene, {
src: "textures/diffuse/uvGrid2.jpg"
})
})
});
Params:
Name | Type | Attribute | Description |
cfg | * |
|
Configs |
cfg.id | String |
|
Optional ID, unique among all components in the parent Scene, generated automatically when omitted. |
cfg.center | Number[] |
|
3D point indicating the center position. |
cfg.xSize | Number |
|
Half-size on the X-axis. |
cfg.ySize | Number |
|
Half-size on the Y-axis. |
cfg.zSize | Number |
|
Half-size on the Z-axis. |
public buildBoxLinesGeometry(cfg: *): Object source
import {buildBoxLinesGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js'
Creates a box-shaped lines Geometry.
Usage
In the example below we'll create a Mesh with a box-shaped ReadableGeometry that has lines primitives.
import {Viewer, Mesh, buildBoxLinesGeometry, ReadableGeometry, PhongMaterial} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.scene.camera.eye = [0, 0, 5];
viewer.scene.camera.look = [0, 0, 0];
viewer.scene.camera.up = [0, 1, 0];
new Mesh(viewer.scene, {
geometry: new ReadableGeometry(viewer.scene, buildBoxLinesGeometry({
center: [0,0,0],
xSize: 1, // Half-size on each axis
ySize: 1,
zSize: 1
}),
material: new PhongMaterial(viewer.scene, {
emissive: [0,1,0]
})
});
Params:
Name | Type | Attribute | Description |
cfg | * |
|
Configs |
cfg.id | String |
|
Optional ID, unique among all components in the parent Scene, generated automatically when omitted. |
cfg.center | Number[] |
|
3D point indicating the center position. |
cfg.xSize | Number |
|
Half-size on the X-axis. |
cfg.ySize | Number |
|
Half-size on the Y-axis. |
cfg.zSize | Number |
|
Half-size on the Z-axis. |
public buildCylinderGeometry(cfg: *): Object source
import {buildCylinderGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js'
Creates a cylinder-shaped Geometry.
Usage
Creating a Mesh with a cylinder-shaped ReadableGeometry :
import {Viewer, Mesh, buildCylinderGeometry, ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.camera.eye = [0, 0, 5];
viewer.camera.look = [0, 0, 0];
viewer.camera.up = [0, 1, 0];
new Mesh(viewer.scene, {
geometry: new ReadableGeometry(viewer.scene, buildCylinderGeometry({
center: [0,0,0],
radiusTop: 2.0,
radiusBottom: 2.0,
height: 5.0,
radialSegments: 20,
heightSegments: 1,
openEnded: false
}),
material: new PhongMaterial(viewer.scene, {
diffuseMap: new Texture(viewer.scene, {
src: "textures/diffuse/uvGrid2.jpg"
})
})
});
Params:
Name | Type | Attribute | Description |
cfg | * |
|
Configs |
cfg.id | String |
|
Optional ID for the Geometry, unique among all components in the parent Scene, generated automatically when omitted. |
cfg.center | Number[] |
|
3D point indicating the center position. |
cfg.radiusTop | Number |
|
Radius of top. |
cfg.radiusBottom | Number |
|
Radius of bottom. |
cfg.height | Number |
|
Height. |
cfg.radialSegments | Number |
|
Number of horizontal segments. |
cfg.heightSegments | Number |
|
Number of vertical segments. |
cfg.openEnded | Boolean |
|
Whether or not the cylinder has solid caps on the ends. |
public buildGridGeometry(cfg: *): Object source
import {buildGridGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js'
Creates a grid-shaped Geometry.
Usage
Creating a Mesh with a GridGeometry and a PhongMaterial:
import {Viewer, Mesh, buildGridGeometry, VBOGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.camera.eye = [0, 0, 5];
viewer.camera.look = [0, 0, 0];
viewer.camera.up = [0, 1, 0];
new Mesh(viewer.scene, {
geometry: new VBOGeometry(viewer.scene, buildGridGeometry({
size: 1000,
divisions: 500
})),
material: new PhongMaterial(viewer.scene, {
color: [0.0, 0.0, 0.0],
emissive: [0.4, 0.4, 0.4]
}),
position: [0, -1.6, 0]
});
Params:
Name | Type | Attribute | Description |
cfg | * |
|
Configs |
cfg.id | String |
|
Optional ID for the Geometry, unique among all components in the parent Scene, generated automatically when omitted. |
cfg.size | Number |
|
Dimension on the X and Z-axis. |
cfg.divisions | Number |
|
Number of divisions on X and Z axis.. |
public buildPlaneGeometry(cfg: *): Object source
import {buildPlaneGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js'
Creates a plane-shaped Geometry.
Usage
Creating a Mesh with a PlaneGeometry and a PhongMaterial with diffuse Texture:
import {Viewer, Mesh, buildPlaneGeometry, ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.camera.eye = [0, 0, 5];
viewer.camera.look = [0, 0, 0];
viewer.camera.up = [0, 1, 0];
new Mesh(viewer.scene, {
geometry: new ReadableGeometry(viewer.scene, buildPlaneGeometry({
center: [0,0,0],
xSize: 2,
zSize: 2,
xSegments: 10,
zSegments: 10
}),
material: new PhongMaterial(viewer.scene, {
diffuseMap: new Texture(viewer.scene, {
src: "textures/diffuse/uvGrid2.jpg"
})
})
});
Params:
Name | Type | Attribute | Description |
cfg | * |
|
Configs |
cfg.center | Number[] |
|
3D point indicating the center position. |
cfg.id | String |
|
Optional ID for the Geometry, unique among all components in the parent Scene, generated automatically when omitted. |
cfg.xSize | Number |
|
Dimension on the X-axis. |
cfg.zSize | Number |
|
Dimension on the Z-axis. |
cfg.xSegments | Number |
|
Number of segments on the X-axis. |
cfg.zSegments | Number |
|
Number of segments on the Z-axis. |
public buildSphereGeometry(cfg: *): Object source
import {buildSphereGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js'
Creates a sphere-shaped Geometry.
Usage
Creating a Mesh with a sphere-shaped ReadableGeometry :
import {Viewer, Mesh, buildSphereGeometry, ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.camera.eye = [0, 0, 5];
viewer.camera.look = [0, 0, 0];
viewer.camera.up = [0, 1, 0];
new Mesh(viewer.scene, {
geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({
center: [0,0,0],
radius: 1.5,
heightSegments: 60,
widthSegments: 60
}),
material: new PhongMaterial(viewer.scene, {
diffuseMap: new Texture(viewer.scene, {
src: "textures/diffuse/uvGrid2.jpg"
})
})
});
Params:
Name | Type | Attribute | Description |
cfg | * |
|
Configs |
cfg.id | String |
|
Optional ID for the Geometry, unique among all components in the parent Scene, generated automatically when omitted. |
cfg.center | Number[] |
|
3D point indicating the center position. |
cfg.radius | Number |
|
Radius. |
cfg.heightSegments | Number |
|
Number of latitudinal bands. |
cfg.widthSegments | Number |
|
Number of longitudinal bands. |
public buildTorusGeometry(cfg: *): Object source
import {buildTorusGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js'
Creates a torus-shaped Geometry.
Usage
Creating a Mesh with a torus-shaped ReadableGeometry :
import {Viewer, Mesh, buildTorusGeometry, ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.camera.eye = [0, 0, 5];
viewer.camera.look = [0, 0, 0];
viewer.camera.up = [0, 1, 0];
new Mesh(viewer.scene, {
geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({
center: [0,0,0],
radius: 1.0,
tube: 0.5,
radialSegments: 32,
tubeSegments: 24,
arc: Math.PI * 2.0
}),
material: new PhongMaterial(viewer.scene, {
diffuseMap: new Texture(viewer.scene, {
src: "textures/diffuse/uvGrid2.jpg"
})
})
});
Params:
Name | Type | Attribute | Description |
cfg | * |
|
Configs |
cfg.id | String |
|
Optional ID for the Geometry, unique among all components in the parent Scene, generated automatically when omitted. |
cfg.center | Number[] |
|
3D point indicating the center position. |
cfg.radius | Number |
|
The overall radius. |
cfg.tube | Number |
|
The tube radius. |
cfg.radialSegments | Number |
|
The number of radial segments. |
cfg.tubeSegments | Number |
|
The number of tubular segments. |
cfg.arc | Number |
|
The length of the arc in radians, where Math.PI*2 is a closed torus. |
public buildVectorTextGeometry(cfg: *): Object source
import {buildVectorTextGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js'
Creates wireframe vector text Geometry.
Usage
Creating a Mesh with vector text ReadableGeometry :
import {Viewer, Mesh, buildVectorTextGeometry, ReadableGeometry, PhongMaterial} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.camera.eye = [0, 0, 100];
viewer.camera.look = [0, 0, 0];
viewer.camera.up = [0, 1, 0];
new Mesh(viewer.scene, {
geometry: new ReadableGeometry(viewer.scene, buildVectorTextGeometry({
origin: [0,0,0],
text: "On the other side of the screen, it all looked so easy"
}),
material: new PhongMaterial(viewer.scene, {
diffuseMap: new Texture(viewer.scene, {
src: "textures/diffuse/uvGrid2.jpg"
})
})
});
Params:
Name | Type | Attribute | Description |
cfg | * |
|
Configs |
cfg.id | String |
|
Optional ID, unique among all components in the parent Scene, generated automatically when omitted. |
cfg.center | Number[] |
|
3D point indicating the center position. |
cfg.origin | Number[] |
|
3D point indicating the top left corner. |
cfg.size | Number |
|
Size of each character. |
cfg.text | String |
|
The text. |
public load3DSGeometry(scene: Scene, cfg: *): Object source
import {load3DSGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js'
Loads Geometry from 3DS.
Usage
In the example below we'll create a Mesh with PhongMaterial, Texture and a ReadableGeometry loaded from 3DS.
import {Viewer, Mesh, load3DSGeometry, ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.scene.camera.eye = [40.04, 23.46, 79.06];
viewer.scene.camera.look = [-6.48, 13.92, -0.56];
viewer.scene.camera.up = [-0.04, 0.98, -0.08];
load3DSGeometry(viewer.scene, {
src: "models/3ds/lexus.3ds",
compressGeometry: false
}).then(function (geometryCfg) {
// Success
new Mesh(viewer.scene, {
geometry: new ReadableGeometry(viewer.scene, geometryCfg),
material: new PhongMaterial(viewer.scene, {
emissive: [1, 1, 1],
emissiveMap: new Texture({ // .3DS has no normals so relies on emissive illumination
src: "models/3ds/lexus.jpg"
})
}),
rotation: [-90, 0, 0] // +Z is up for this particular 3DS
});
}, function () {
// Error
});
public loadOBJGeometry(scene: Scene, cfg: *): Object source
import {loadOBJGeometry} from '@xeokit/xeokit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js'
Loads Geometry from OBJ.
Usage
In the example below we'll create a Mesh with MetallicMaterial and ReadableGeometry loaded from OBJ.
import {Viewer, Mesh, loadOBJGeometry, ReadableGeometry,
MetallicMaterial, Texture} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas"
});
viewer.scene.camera.eye = [0.57, 1.37, 1.14];
viewer.scene.camera.look = [0.04, 0.58, 0.00];
viewer.scene.camera.up = [-0.22, 0.84, -0.48];
loadOBJGeometry(viewer.scene, {
src: "models/obj/fireHydrant/FireHydrantMesh.obj",
compressGeometry: false
}).then(function (geometryCfg) {
// Success
new Mesh(viewer.scene, {
geometry: new ReadableGeometry(viewer.scene, geometryCfg),
material: new MetallicMaterial(viewer.scene, {
baseColor: [1, 1, 1],
metallic: 1.0,
roughness: 1.0,
baseColorMap: new Texture(viewer.scene, {
src: "models/obj/fireHydrant/fire_hydrant_Base_Color.png",
encoding: "sRGB"
}),
normalMap: new Texture(viewer.scene, {
src: "models/obj/fireHydrant/fire_hydrant_Normal_OpenGL.png"
}),
roughnessMap: new Texture(viewer.scene, {
src: "models/obj/fireHydrant/fire_hydrant_Roughness.png"
}),
metallicMap: new Texture(viewer.scene, {
src: "models/obj/fireHydrant/fire_hydrant_Metallic.png"
}),
occlusionMap: new Texture(viewer.scene, {
src: "models/obj/fireHydrant/fire_hydrant_Mixed_AO.png"
}),
specularF0: 0.7
})
});
}, function () {
// Error
});
public validateMetaModelForTreeViewContainmentHierarchy(metaModel: MetaModel, errors: String[]): boolean source
import {validateMetaModelForTreeViewContainmentHierarchy} from '@xeokit/xeokit-sdk/src/plugins/TreeViewPlugin/modelValidation.js'
Tests if TreeViewPlugin would be able to create a "containment" hierarchy for the given MetaModel.
public validateMetaModelForTreeViewStoreysHierarchy(metaModel: MetaModel, errors: String[]): boolean source
import {validateMetaModelForTreeViewStoreysHierarchy} from '@xeokit/xeokit-sdk/src/plugins/TreeViewPlugin/modelValidation.js'
Tests if TreeViewPlugin would be able to create a "storeys" hierarchy for the given MetaModel.
public validateMetaModelForTreeViewTypesHierarchy(metaModel: MetaModel, errors: String[]): boolean source
import {validateMetaModelForTreeViewTypesHierarchy} from '@xeokit/xeokit-sdk/src/plugins/TreeViewPlugin/modelValidation.js'
Tests if TreeViewPlugin would be able to create a "types" hierarchy for the given MetaModel.