The starting point for these instructions is to have point cloud model open in Cyclone REGISTER 360 that you have decided is ready to be converted to the Potree format.
Note: you might need to map the drive to X and Z folder first. If you need to map them first, go open File Explorer, click This PC, click Computer at the top of the bar, click Map Network Drive, and select the drive you need.
Required: a .obj file, a .mtl file, & a .jpg texture file. All named similarly, Ex. mouse.obj, mouse.mtl, mouse.jpg
{
let manager = new THREE.LoadingManager();
manager.onProgress = function ( item, loaded, total ) {
console.log( item, loaded, total );
};
let textureLoader = new THREE.TextureLoader( manager );
let texture = textureLoader.load(`${Potree.resourcePath}/textures/mouse.jpg`);
let onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
let percentComplete = xhr.loaded / xhr.total * 100;
console.log( Math.round(percentComplete, 2) + '% downloaded' );
}
};
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
let onError = function ( xhr ) {};
let loader = new THREE.OBJLoader( manager );
loader.load(`${Potree.resourcePath}/models/mouse.obj`, function ( object ) {
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
child.material.map = texture;
}
} );
object.position.set(-10, -8.578, -1);
object.scale.multiplyScalar(1.075);
object.rotation.set(Math.PI / 2, Math.PI/32+1*Math.PI/150,0);
viewer.scene.scene.add( object );
viewer.onGUILoaded(() => {
// Add entries to object list in sidebar
let tree = $(`#jstree_scene`);
let parentNode = "other";
let artID = tree.jstree('create_node', parentNode, {
text: "Bigallo",
icon: `${Potree.resourcePath}/icons/triangle.svg`,
data: object
},
"last", false, false);
tree.jstree(object.visible ? "check_node" : "uncheck_node", artID);
//tree.jstree("open_node", parentNode);
});
}, onProgress, onError );
}
<script> </script>
tags and after the Potree.loadPointCloud(); function.