potree-core 2.0.12 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,16 @@
1
1
  import { Box3, Matrix4, Vector3 } from 'three';
2
+ export interface IClipSphere {
3
+ center: Vector3;
4
+ radius: number;
5
+ }
6
+ /**
7
+ * Creates an IClipSphere from a center position and radius.
8
+ *
9
+ * @param center - The center position of the clip sphere in world space. Defaults to the origin.
10
+ * @param radius - The radius of the clip sphere.
11
+ * @returns An IClipSphere object ready to be passed to PointCloudMaterial.setClipSpheres().
12
+ */
13
+ export declare function createClipSphere(center: Vector3, radius: number): IClipSphere;
2
14
  export declare enum ClipMode {
3
15
  DISABLED = 0,
4
16
  CLIP_OUTSIDE = 1,
@@ -11,3 +23,15 @@ export interface IClipBox {
11
23
  matrix: Matrix4;
12
24
  position: Vector3;
13
25
  }
26
+ /**
27
+ * Creates an IClipBox from a given size and position.
28
+ *
29
+ * The base shape is a unit cube centered at the origin (-0.5 to 0.5 on each axis).
30
+ * The transformation matrix is built by applying scale (size) followed by translation (position).
31
+ * The inverse matrix is computed from the transformation matrix and is used by the shader for clipping.
32
+ *
33
+ * @param size - The dimensions of the clip box.
34
+ * @param position - The center position of the clip box in world space. Defaults to the origin.
35
+ * @returns An IClipBox object ready to be passed to PointCloudMaterial.setClipBoxes().
36
+ */
37
+ export declare function createClipBox(size: Vector3, position?: Vector3): IClipBox;
@@ -10,6 +10,9 @@ export interface IEyeDomeLightingMaterialUniforms {
10
10
  neighbours: IUniform<Float32Array>;
11
11
  uProj: IUniform<Float32Array>;
12
12
  colorMap: IUniform<Texture | null>;
13
+ far: IUniform<number>;
14
+ useLogDepth: IUniform<boolean>;
15
+ useOrthographicCamera: IUniform<boolean>;
13
16
  }
14
17
  export declare class EyeDomeLightingMaterial extends RawShaderMaterial {
15
18
  uniforms: IEyeDomeLightingMaterialUniforms;
@@ -1,7 +1,7 @@
1
1
  import { BufferGeometry, Camera, Color, Material, RawShaderMaterial, Scene, Texture, Vector3, Vector4, WebGLRenderer } from 'three';
2
2
  import { PointCloudOctree } from '../point-cloud-octree';
3
3
  import { PointCloudOctreeNode } from '../point-cloud-octree-node';
4
- import { ClipMode, IClipBox } from './clipping';
4
+ import { ClipMode, IClipBox, IClipSphere } from './clipping';
5
5
  import { PointColorType, PointOpacityType, PointShape, PointSizeType, TreeType } from './enums';
6
6
  import { IClassification, IGradient, IUniform } from './types';
7
7
  import { ColorEncoding } from './color-encoding';
@@ -52,6 +52,14 @@ export interface IPointCloudMaterialUniforms {
52
52
  clipBoxCount: IUniform<number>;
53
53
  /** Array containing clipping box parameters */
54
54
  clipBoxes: IUniform<Float32Array>;
55
+ /** Number of active clipping spheres */
56
+ clipSphereCount: IUniform<number>;
57
+ /** Array containing clipping sphere parameters (vec4: xyz=center, w=radius) */
58
+ clipSpheres: IUniform<Float32Array>;
59
+ /** Number of active clipping planes */
60
+ clipPlaneCount: IUniform<number>;
61
+ /** Array containing clipping plane parameters (vec4: xyz=normal, w=constant) */
62
+ clipPlanes: IUniform<Float32Array>;
55
63
  /** Depth map texture for depth-based effects, null if not used */
56
64
  depthMap: IUniform<Texture | null>;
57
65
  /** Diffuse color as RGB values [r, g, b] */
@@ -149,6 +157,9 @@ export declare class PointCloudMaterial extends RawShaderMaterial {
149
157
  fog: boolean;
150
158
  numClipBoxes: number;
151
159
  clipBoxes: IClipBox[];
160
+ numClipSpheres: number;
161
+ clipSpheres: IClipSphere[];
162
+ private numClipPlanes;
152
163
  visibleNodesTexture: Texture | undefined;
153
164
  private visibleNodeTextureOffsets;
154
165
  private _gradient;
@@ -196,6 +207,7 @@ export declare class PointCloudMaterial extends RawShaderMaterial {
196
207
  highlightedPointScale: number;
197
208
  viewScale: number;
198
209
  useClipBox: boolean;
210
+ useClipSphere: boolean;
199
211
  weighted: boolean;
200
212
  pointColorType: PointColorType;
201
213
  pointSizeType: PointSizeType;
@@ -254,6 +266,12 @@ export declare class PointCloudMaterial extends RawShaderMaterial {
254
266
  updateShaderSource(): void;
255
267
  applyDefines(shaderSrc: string): string;
256
268
  setClipBoxes(clipBoxes: IClipBox[]): void;
269
+ setClipSpheres(clipSpheres: IClipSphere[]): void;
270
+ /**
271
+ * Syncs the inherited `clippingPlanes` property to internal shader uniforms.
272
+ * Called automatically each frame from `updateMaterial()`.
273
+ */
274
+ private syncClippingPlanes;
257
275
  get gradient(): IGradient;
258
276
  set gradient(value: IGradient);
259
277
  get classification(): IClassification;
@@ -19,6 +19,9 @@ export interface PickParams {
19
19
  */
20
20
  onBeforePickRender: (material: PointCloudMaterial, renterTarget: WebGLRenderTarget) => void;
21
21
  }
22
+ /**
23
+ * Handle picking for points in octree.
24
+ */
22
25
  export declare class PointCloudOctreePicker {
23
26
  private static readonly helperVec3;
24
27
  private static readonly helperSphere;
@@ -1,4 +1,4 @@
1
- import { Box3, Camera, Object3D, Ray, Sphere, WebGLRenderer } from 'three';
1
+ import { Box3, Camera, Intersection, Object3D, Ray, Raycaster, Sphere, WebGLRenderer } from 'three';
2
2
  import { PointCloudMaterial, PointSizeType } from './materials';
3
3
  import { PointCloudOctreeGeometryNode } from './point-cloud-octree-geometry-node';
4
4
  import { PointCloudOctreeNode } from './point-cloud-octree-node';
@@ -111,5 +111,20 @@ export declare class PointCloudOctree extends PointCloudTree {
111
111
  getBoundingBoxWorld(): Box3;
112
112
  getVisibleExtent(): Box3;
113
113
  pick(renderer: WebGLRenderer, camera: Camera, ray: Ray, params?: Partial<PickParams>): PickPoint | null;
114
+ /**
115
+ * Implements THREE.js raycaster support for point cloud picking.
116
+ *
117
+ * When EDL is active, point cloud child nodes are moved to a dedicated rendering layer
118
+ * (e.g. layer 1) so they are excluded from the normal scene render pass. This means
119
+ * the default THREE.js layer test inside `Raycaster.intersectObject()` will fail for
120
+ * those nodes, making `raycaster.intersectObject()` return no hits.
121
+ *
122
+ * This override handles that case by directly calling `raycast()` on each visible node's
123
+ * scene node whenever the node's layer is NOT visible to the raycaster (i.e. EDL mode).
124
+ * When nodes ARE on a raycaster-visible layer (non-EDL mode), this method does nothing
125
+ * and lets the normal recursive traversal call `Points.raycast()` instead, avoiding
126
+ * double-counting of intersections.
127
+ */
128
+ raycast(raycaster: Raycaster, intersects: Intersection[]): void;
114
129
  get progress(): number;
115
130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "potree-core",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
4
4
  "description": "Potree wrapper for three.js applications",
5
5
  "repository": {
6
6
  "type": "git",