@lijuhong1981/xktloader

1.1.3 • Public • Published

XKTLoader

一个加载解析.xkt BIM模型文件的插件,基于xeokit-sdk源码精简而来,去除了XKTLoaderPlugin对Viewer和Renderer的依赖,只对.xkt文件进行加载和解析,并返回解析后的数据,可以使用其它的Web3D引擎,如Cesium、threejs等,来对数据进行绘制和展示。

安装

    npm install @lijuhong1981/xktloader

使用

    import XKTLoaderPlugin from "@lijuhong1981/xktloader";
    or
    import XKTLoaderPlugin from "@lijuhong1981/xktloader/src/index.js";

    const xktLoader = new XKTLoaderPlugin();
    xktLoader.load({
        id: id,
        src: url,
        edges: true,
        saoEnabled: false,
        dtxEnabled: false
    }, (sceneModel, metaModel) => {
        console.log(sceneModel, metaModel);
    }, (errMsg) => {
        console.error(errMsg);
    });

获得sceneModel对象后,遍历meshList

    for (let i = 0, len = sceneModel.meshList.length; i < len; i++) {
        const mesh = sceneModel.meshList[i];
        console.log(mesh.cfg);
    }

mesh.cfg下即可看到positions、normals、uv、color、texture等等模型数据,可使用Cesium或threejs各自对应的绘制接口进行模型绘制

Package Sidebar

Install

npm i @lijuhong1981/xktloader

Weekly Downloads

59

Version

1.1.3

License

ISC

Unpacked Size

10.2 MB

Total Files

434

Last publish

Collaborators

  • lijuhong1981