import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
const loader = new GLTFLoader();
loader.load(
gltfurl,
(gltf) => {
let mesh = gltf.scene;
// 获取几何体和材质
const geometry = gltf.scene.children[0].geometry;
const material = gltf.scene.children[0].material;
// 创建three.points对象
const particles = new THREE.Points(geometry, material);
// 设置中心点,方便点云数据切片多次加载,看需要添加
particles.position.x = x;
particles.position.y = y;
particles.position.z = z;
this.scene.add(particles); // 将模型引入three
},
undefined,
function (error) {
console.error(error);
}
);