Skip to content

Commit

Permalink
feat: Add loadPCDFile for render .pcd files
Browse files Browse the repository at this point in the history
  • Loading branch information
Glenfiddish committed Jun 14, 2022
1 parent c5a56e1 commit 2cea7a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
10 changes: 9 additions & 1 deletion packages/lb-annotation/src/core/pointCloud/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class PointCloud {
}

public renderCircle() {
const radius = 15;
const radius = 100;
const curve = new THREE.EllipseCurve(
15,
15, // ax, aY
Expand All @@ -124,6 +124,14 @@ export class PointCloud {
this.render();
}

public loadPCDFile = (src: string) => {
this.pcdLoader.load(src, (points: any) => {
this.scene.add(points);
points.material.size = 0.3;
this.render();
});
};

public render() {
this.renderer.render(this.scene, this.camera);
}
Expand Down
13 changes: 6 additions & 7 deletions packages/lb-demo/src/components/PointCloud/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { PointCloud } from '@labelbee/lb-annotation';
import { useEffect, useRef } from 'react';

const pointCloudID = "LABELBEE-POINTCLOUD"
const pointCloudID = 'LABELBEE-POINTCLOUD';

const PointCloudDom = () => {
const ref = useRef();
Expand All @@ -16,13 +16,12 @@ const PointCloudDom = () => {
useEffect(() => {
console.log(ref.current);
if (ref.current) {
pointCloudRef.current = new PointCloud({ container: ref.current});
pointCloudRef.current = new PointCloud({ container: ref.current });
pointCloudRef.current.loadPCDFile('http://10.53.25.142:8001/1/000001.pcd');
}
}, []);

return (
<div id={pointCloudID} ref={ref} />
)
}
return <div id={pointCloudID} ref={ref} />;
};

export default PointCloudDom
export default PointCloudDom;

0 comments on commit 2cea7a0

Please sign in to comment.