@@ -198,6 +198,12 @@ export default {
light.target.position.set(1, 0, 0);
mesh.add(light);
mesh.add(light.target);
+ } else if (type == "point_cloud") {
+ const geometry = new THREE.BufferGeometry();
+ geometry.setAttribute('position', new THREE.Float32BufferAttribute(args[0].flat(), 3));
+ geometry.setAttribute('color', new THREE.Float32BufferAttribute(args[1].flat(), 3));
+ const material = new THREE.PointsMaterial( { size: args[2], vertexColors: true } );
+ mesh = new THREE.Points(geometry, material);
} else {
let geometry;
const wireframe = args.pop();
@@ -52,6 +52,7 @@ class Scene(Element):
from .scene_objects import Text as text
from .scene_objects import Text3d as text3d
from .scene_objects import Texture as texture
+ from .scene_objects import PointCloud as pointcloud
def __init__(self, width: int = 400, height: int = 300, on_click: Optional[Callable] = None) -> None:
"""3D Scene
@@ -169,3 +169,13 @@ class SpotLight(Object3D):
decay: float = 1.0,
) -> None:
super().__init__('spot_light', color, intensity, distance, angle, penumbra, decay)
+
+class PointCloud(Object3D):
+ def __init__(self,
+ points: List[List[float]],
+ color: List[List[float]],
+ point_size: float = 1.0,
+ ) -> None:
+ super().__init__('point_cloud', points, color, point_size)