How to use @xeokit/xeokit-sdk - 3 common examples

To help you get started, we’ve selected a few @xeokit/xeokit-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opf / openproject / frontend / src / app / modules / ifc_models / xeokit-viewer.js View on Github external
cameraControl.panToPointer = true;
    cameraControl.doublePickFlyTo = true;
    cameraFlight.duration = 1.0;
    cameraFlight.fitFOV = 25;
    viewer.camera.eye = [-2.56, 8.38, 8.27];
    viewer.camera.look = [13.44, 3.31, -14.83];
    viewer.camera.up = [0.10, 0.98, -0.14];
    viewer.scene.xrayMaterial.fillAlpha = 0.1;
    viewer.scene.xrayMaterial.fillColor = [0, 0, 0];
    viewer.scene.xrayMaterial.edgeAlpha = 0.4;
    viewer.scene.xrayMaterial.edgeColor = [0, 0, 0];
    viewer.scene.highlightMaterial.fill = false;
    viewer.scene.highlightMaterial.fillAlpha = 0.3;
    viewer.scene.highlightMaterial.edgeColor = [1, 1, 0];

    const xktLoader = new XKTLoaderPlugin(viewer);
    const model = xktLoader.load({
      id: "xeokit-model-" + ifcModelId,
      src: xktFileUrl,
      metaModelSrc: metadataFileUrl,
      edges: true
    });
    //------------------------------------------------------------------------------------------------------------------
    // Mouse over entities to highlight them
    //------------------------------------------------------------------------------------------------------------------
    var lastEntity = null;
    viewer.scene.input.on("mousemove", function (coords) {
      var hit = viewer.scene.pick({
        canvasPos: coords
      });
      if (hit) {
        if (!lastEntity || hit.entity.id !== lastEntity.id) {
github opf / openproject / frontend / src / app / modules / bim / ifc_models / xeokit / xeokit-server.ts View on Github external
getGeometry(projectId:string, modelId:number, done:Function, error:Function) {
    const attachmentId = this.ifcModels.xkt_attachment_ids[modelId];
    console.log(`Loading model geometry for: ${attachmentId}`);
    utils.loadArraybuffer(this.pathHelper.attachmentContentPath(attachmentId), done, error);
  }
}
github opf / openproject / frontend / src / app / modules / ifc_models / xeokit-viewer.js View on Github external
constructor(ifcModelId, xktFileUrl, metadataFileUrl) {
    const viewer = new Viewer({
      canvasId: 'xeokit-model-canvas-' + ifcModelId,
      transparent: true
    });
    const cameraControl = viewer.cameraControl;
    const scene = viewer.scene;
    const cameraFlight = viewer.cameraFlight;
    cameraControl.panToPointer = true;
    cameraControl.doublePickFlyTo = true;
    cameraFlight.duration = 1.0;
    cameraFlight.fitFOV = 25;
    viewer.camera.eye = [-2.56, 8.38, 8.27];
    viewer.camera.look = [13.44, 3.31, -14.83];
    viewer.camera.up = [0.10, 0.98, -0.14];
    viewer.scene.xrayMaterial.fillAlpha = 0.1;
    viewer.scene.xrayMaterial.fillColor = [0, 0, 0];
    viewer.scene.xrayMaterial.edgeAlpha = 0.4;