Falko Schindler 2 anni fa
parent
commit
a22546103b

+ 3 - 3
nicegui/elements/scene.js

@@ -200,9 +200,9 @@ export default {
         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 } );
+        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;

+ 1 - 1
nicegui/elements/scene.py

@@ -44,6 +44,7 @@ class Scene(Element):
     from .scene_objects import Extrusion as extrusion
     from .scene_objects import Group as group
     from .scene_objects import Line as line
+    from .scene_objects import PointCloud as point_cloud
     from .scene_objects import QuadraticBezierTube as quadratic_bezier_tube
     from .scene_objects import Ring as ring
     from .scene_objects import Sphere as sphere
@@ -52,7 +53,6 @@ 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

+ 5 - 5
nicegui/elements/scene_objects.py

@@ -174,8 +174,8 @@ class SpotLight(Object3D):
 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)
+                 points: List[List[float]],
+                 colors: List[List[float]],
+                 point_size: float = 1.0,
+                 ) -> None:
+        super().__init__('point_cloud', points, colors, point_size)