|
1 | 1 | import { Ray, Sphere } from 'three'; |
2 | 2 | import { OBB } from '3d-tiles-renderer/three'; |
3 | 3 |
|
| 4 | +/** |
| 5 | + * Plugin that restricts tile loading and traversal to one or more geometric regions |
| 6 | + * (`SphereRegion`, `RayRegion`, `OBBRegion`). Only tiles that intersect an active |
| 7 | + * region are loaded and refined. Regions marked as masks additionally prevent tiles |
| 8 | + * outside them from loading. |
| 9 | + */ |
4 | 10 | export class LoadRegionPlugin { |
5 | 11 |
|
6 | 12 | constructor() { |
@@ -111,6 +117,14 @@ export class LoadRegionPlugin { |
111 | 117 | } |
112 | 118 |
|
113 | 119 | // Definitions of predefined regions |
| 120 | + |
| 121 | +/** |
| 122 | + * Abstract base class for `LoadRegionPlugin` regions. Subclass and override |
| 123 | + * `intersectsTile` to define custom load regions. |
| 124 | + * @param {Object} [options] |
| 125 | + * @param {number} [options.errorTarget=10] Geometric error target used when this region controls refinement. |
| 126 | + * @param {boolean} [options.mask=false] When `true`, tiles outside this region are suppressed (mask mode). |
| 127 | + */ |
114 | 128 | export class BaseRegion { |
115 | 129 |
|
116 | 130 | constructor( options = {} ) { |
@@ -152,6 +166,13 @@ export class BaseRegion { |
152 | 166 |
|
153 | 167 | } |
154 | 168 |
|
| 169 | +/** |
| 170 | + * A spherical load region. Only tiles that intersect `sphere` are loaded. |
| 171 | + * @param {Object} [options] |
| 172 | + * @param {Sphere} [options.sphere] The sphere volume; defaults to an empty sphere at the origin. |
| 173 | + * @param {number} [options.errorTarget=10] Geometric error target for tiles inside the region. |
| 174 | + * @param {boolean} [options.mask=false] Mask mode — suppresses tiles outside this region. |
| 175 | + */ |
155 | 176 | export class SphereRegion extends BaseRegion { |
156 | 177 |
|
157 | 178 | constructor( options = {} ) { |
@@ -181,6 +202,13 @@ export class SphereRegion extends BaseRegion { |
181 | 202 |
|
182 | 203 | } |
183 | 204 |
|
| 205 | +/** |
| 206 | + * A ray-based load region. Only tiles that intersect `ray` are loaded. |
| 207 | + * @param {Object} [options] |
| 208 | + * @param {Ray} [options.ray] The ray; defaults to a ray at the origin pointing in +Z. |
| 209 | + * @param {number} [options.errorTarget=10] Geometric error target for tiles inside the region. |
| 210 | + * @param {boolean} [options.mask=false] Mask mode — suppresses tiles outside this region. |
| 211 | + */ |
184 | 212 | export class RayRegion extends BaseRegion { |
185 | 213 |
|
186 | 214 | constructor( options = {} ) { |
@@ -210,6 +238,13 @@ export class RayRegion extends BaseRegion { |
210 | 238 |
|
211 | 239 | } |
212 | 240 |
|
| 241 | +/** |
| 242 | + * An oriented bounding-box load region. Only tiles that intersect `obb` are loaded. |
| 243 | + * @param {Object} [options] |
| 244 | + * @param {OBB} [options.obb] The oriented bounding box; defaults to an empty OBB at the origin. |
| 245 | + * @param {number} [options.errorTarget=10] Geometric error target for tiles inside the region. |
| 246 | + * @param {boolean} [options.mask=false] Mask mode — suppresses tiles outside this region. |
| 247 | + */ |
213 | 248 | export class OBBRegion extends BaseRegion { |
214 | 249 |
|
215 | 250 | constructor( options = {} ) { |
|
0 commit comments