Can you update the point size of a point cloud without re-creating the point cloud?
At the moment I am copying and remaking the point cloud to change the point size. This is a slow process. Is it possible to do a faster update of an existing point cloud?
const pcs = new BABYLON.PointsCloudSystem(
Settings.ui.pointcloud.babylonScenePrefix,
Settings.ui.pointcloud.pointSize,
scene);
or the opacity
pcs.buildMeshAsync().then((mesh) => {
mesh.rotationQuaternion = value.pcs.mesh.rotationQuaternion;
mesh.position = value.pcs.mesh.position;
mesh.hasVertexAlpha = true;
mesh.visibility = Settings.ui.pointcloud.pointOpacity;
// Copies the point cloud
public copyPointCloud(value: any) {
const scene = this.getScene();
const pcs = new BABYLON.PointsCloudSystem(
Settings.ui.pointcloud.babylonScenePrefix,
**Settings.ui.pointcloud.pointSize,**
scene);
let idx = 0;
const numParts = value.pcs.nbParticles;
pcs.addPoints(numParts, particle => {
this.copyPointFunction(particle, idx, value.pcs);
idx++;
});
pcs.buildMeshAsync().then((mesh) => {
mesh.rotationQuaternion = value.pcs.mesh.rotationQuaternion;
mesh.position = value.pcs.mesh.position;
mesh.hasVertexAlpha = true;
**mesh.visibility = Settings.ui.pointcloud.pointOpacity;**
// Delete old pcs, Save current pcs info
value.pcs.dispose();
value.pcs = pcs;
// Update frame and point counters.
this.updateFrameAndPointCounters();
// Update the point cloud
this.updateColourisation(Settings.ui.pointcloud.colourisation.method, true);
});
}
private copyPointFunction(particle: BABYLON.Particle,
idx: number,
pcs: BABYLON.PointsCloudSystem ) {
particle.position = new BABYLON.Vector3(
pcs.particles[idx].position.x,
pcs.particles[idx].position.y,
pcs.particles[idx].position.z,
);
particle.color = pcs.particles[idx].color;
}