useloadpcd
v1.0.5
Published
A .pcd file loader for React with React hooks and Three.js.
Downloads
5
Maintainers
Readme
UseLoadPCD
Installation
useLoadPCD requires atleast React and React-DOM v.16.8.0 (with Hooks).
If you are using npm:
npm install useloadpcd --save
or Yarn:
yarn add useloadpcd
Usage
The path given to useLoadPCD is the path relative to the public directory.
import React from 'react';
import useLoadPCD from 'useloadpcd';
const App = () => {
const [pcdRef, status] = useLoadPCD('./simple.pcd');
return <div ref={pcdRef} style={{ width: 800, height: 800 }} />;
};
export default App;
The second argument given to useLoadPCD has the following structure:
{
backgroundColor: '#000000',
camera: {
aspect: window.innerWidth / window.innerHeight,
far: 2000,
fov: 50,
near: 0.01,
position: {
x: 0.4,
z: 4
}
},
controls: {
dynamicDampingFactor: 0.3,
maxDistance: 100,
minDistance: 2,
noPan: false,
noRotate: false,
noZoom: false,
panSpeed: 0.25,
rotateSpeed: 2.0,
staticMoving: true,
zoomSpeed: 0.7
},
particalColor: '#ffffff',
particalSize: 0.1,
windowSize: {
height: window.innerHeight,
width: window.innerWidth
}
};