@@ -21,8 +21,6 @@ export class PointCloudOctree extends PointCloudTree
2121
2222 boundingSphere : Sphere ;
2323
24- material : PointCloudMaterial ;
25-
2624 level : number = 0 ;
2725
2826 maxLevel : number = Infinity ;
@@ -44,6 +42,8 @@ export class PointCloudOctree extends PointCloudTree
4442
4543 showBoundingBox : boolean = false ;
4644
45+ private _material : PointCloudMaterial ;
46+
4747 private visibleBounds : Box3 = new Box3 ( ) ;
4848
4949 private picker : PointCloudOctreePicker | undefined ;
@@ -67,21 +67,6 @@ export class PointCloudOctree extends PointCloudTree
6767 this . updateMatrix ( ) ;
6868
6969 this . material = material || pcoGeometry instanceof OctreeGeometry ? new PointCloudMaterial ( { newFormat : true } ) : new PointCloudMaterial ( ) ;
70- this . initMaterial ( this . material ) ;
71- }
72-
73- private initMaterial ( material : PointCloudMaterial ) : void
74- {
75- this . updateMatrixWorld ( true ) ;
76-
77- const { min, max} = computeTransformedBoundingBox (
78- this . pcoGeometry . tightBoundingBox || this . getBoundingBoxWorld ( ) ,
79- this . matrixWorld ,
80- ) ;
81-
82- const bWidth = max . z - min . z ;
83- material . heightMin = min . z - 0.2 * bWidth ;
84- material . heightMax = max . z + 0.2 * bWidth ;
8570 }
8671
8772 dispose ( ) : void
@@ -106,6 +91,26 @@ export class PointCloudOctree extends PointCloudTree
10691
10792 this . disposed = true ;
10893 }
94+
95+ get material ( ) : PointCloudMaterial
96+ {
97+ return this . _material ;
98+ }
99+
100+ set material ( material : PointCloudMaterial )
101+ {
102+ this . _material = material ;
103+ this . updateMatrixWorld ( true ) ;
104+
105+ const { min, max} = computeTransformedBoundingBox (
106+ this . pcoGeometry . tightBoundingBox || this . getBoundingBoxWorld ( ) ,
107+ this . matrixWorld ,
108+ ) ;
109+
110+ const bWidth = max . z - min . z ;
111+ this . material . heightMin = min . z - 0.2 * bWidth ;
112+ this . material . heightMax = max . z + 0.2 * bWidth ;
113+ }
109114
110115 get pointSizeType ( ) : PointSizeType
111116 {
0 commit comments