@thatopen/components 3.2.3 → 3.2.5
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.
- package/dist/index.cjs +31 -18
- package/dist/index.d.ts +26 -0
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.mjs +3 -3
- package/dist/index.mjs +31 -18
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4655,24 +4655,19 @@ class SimpleRaycaster {
|
|
|
4655
4655
|
}
|
|
4656
4656
|
return fragResult;
|
|
4657
4657
|
}
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
// ) {
|
|
4672
|
-
// // TODO: Implement for fragmentsmodel
|
|
4673
|
-
// this.three.set(origin, direction);
|
|
4674
|
-
// return this.intersect(items);
|
|
4675
|
-
// }
|
|
4658
|
+
/**
|
|
4659
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
4660
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
4661
|
+
*
|
|
4662
|
+
* @param origin - The origin of the ray.
|
|
4663
|
+
* @param direction - The direction of the ray.
|
|
4664
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
4665
|
+
* @returns The first intersection found or `null` if no intersection was found.
|
|
4666
|
+
*/
|
|
4667
|
+
castRayFromVector(origin, direction, items = Array.from(this.world.meshes)) {
|
|
4668
|
+
this.three.set(origin, direction);
|
|
4669
|
+
return this.intersect(items);
|
|
4670
|
+
}
|
|
4676
4671
|
intersect(items = Array.from(this.world.meshes)) {
|
|
4677
4672
|
const result = this.three.intersectObjects(items);
|
|
4678
4673
|
const filtered = this.filterClippingPlanes(result);
|
|
@@ -5129,6 +5124,11 @@ class SimpleScene extends BaseScene {
|
|
|
5129
5124
|
configs.list.delete(this.config.uuid);
|
|
5130
5125
|
}
|
|
5131
5126
|
}
|
|
5127
|
+
var RendererMode = /* @__PURE__ */ ((RendererMode2) => {
|
|
5128
|
+
RendererMode2[RendererMode2["MANUAL"] = 0] = "MANUAL";
|
|
5129
|
+
RendererMode2[RendererMode2["AUTO"] = 1] = "AUTO";
|
|
5130
|
+
return RendererMode2;
|
|
5131
|
+
})(RendererMode || {});
|
|
5132
5132
|
class SimpleRenderer extends BaseRenderer {
|
|
5133
5133
|
/**
|
|
5134
5134
|
* Constructor for the SimpleRenderer class.
|
|
@@ -5152,6 +5152,14 @@ class SimpleRenderer extends BaseRenderer {
|
|
|
5152
5152
|
* The THREE.js WebGLRenderer instance.
|
|
5153
5153
|
*/
|
|
5154
5154
|
__publicField(this, "three");
|
|
5155
|
+
/**
|
|
5156
|
+
* The mode of the renderer. If MANUAL, the renderer will be updated manually. If AUTO, the renderer will render on every update tick.
|
|
5157
|
+
*/
|
|
5158
|
+
__publicField(this, "mode", 1);
|
|
5159
|
+
/**
|
|
5160
|
+
* Whether the renderer needs to be updated. If true, the renderer will be updated on the next frame.
|
|
5161
|
+
*/
|
|
5162
|
+
__publicField(this, "needsUpdate", false);
|
|
5155
5163
|
__publicField(this, "_canvas");
|
|
5156
5164
|
__publicField(this, "_parameters");
|
|
5157
5165
|
__publicField(this, "_resizeObserver", null);
|
|
@@ -5208,6 +5216,10 @@ class SimpleRenderer extends BaseRenderer {
|
|
|
5208
5216
|
update() {
|
|
5209
5217
|
if (!this.enabled || !this.currentWorld)
|
|
5210
5218
|
return;
|
|
5219
|
+
if (this.mode === 0 && !this.needsUpdate) {
|
|
5220
|
+
return;
|
|
5221
|
+
}
|
|
5222
|
+
this.needsUpdate = false;
|
|
5211
5223
|
this.onBeforeUpdate.trigger(this);
|
|
5212
5224
|
const scene = this.currentWorld.scene.three;
|
|
5213
5225
|
const camera = this.currentWorld.camera.three;
|
|
@@ -21590,6 +21602,7 @@ exports.OrthoPerspectiveCamera = OrthoPerspectiveCamera;
|
|
|
21590
21602
|
exports.PlanMode = PlanMode;
|
|
21591
21603
|
exports.ProjectionManager = ProjectionManager;
|
|
21592
21604
|
exports.Raycasters = Raycasters;
|
|
21605
|
+
exports.RendererMode = RendererMode;
|
|
21593
21606
|
exports.ShadowedScene = ShadowedScene;
|
|
21594
21607
|
exports.SimpleCamera = SimpleCamera;
|
|
21595
21608
|
exports.SimpleGrid = SimpleGrid;
|
package/dist/index.d.ts
CHANGED
|
@@ -2833,6 +2833,14 @@ export declare interface RemoveClassifierItemsConfig {
|
|
|
2833
2833
|
groupName?: string;
|
|
2834
2834
|
}
|
|
2835
2835
|
|
|
2836
|
+
/**
|
|
2837
|
+
* The mode of the renderer. If MANUAL, the renderer will be updated on command. If AUTO, the renderer will render on every update tick.
|
|
2838
|
+
*/
|
|
2839
|
+
export declare enum RendererMode {
|
|
2840
|
+
MANUAL = 0,
|
|
2841
|
+
AUTO = 1
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2836
2844
|
/**
|
|
2837
2845
|
* Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
|
|
2838
2846
|
*/
|
|
@@ -3342,6 +3350,16 @@ export declare class SimpleRaycaster implements Disposable_2 {
|
|
|
3342
3350
|
items?: THREE.Object3D[];
|
|
3343
3351
|
position?: THREE.Vector2;
|
|
3344
3352
|
}): Promise<THREE.Intersection | null>;
|
|
3353
|
+
/**
|
|
3354
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
3355
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
3356
|
+
*
|
|
3357
|
+
* @param origin - The origin of the ray.
|
|
3358
|
+
* @param direction - The direction of the ray.
|
|
3359
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3360
|
+
* @returns The first intersection found or `null` if no intersection was found.
|
|
3361
|
+
*/
|
|
3362
|
+
castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
|
|
3345
3363
|
private intersect;
|
|
3346
3364
|
private filterClippingPlanes;
|
|
3347
3365
|
}
|
|
@@ -3363,6 +3381,14 @@ export declare class SimpleRenderer extends BaseRenderer {
|
|
|
3363
3381
|
* The THREE.js WebGLRenderer instance.
|
|
3364
3382
|
*/
|
|
3365
3383
|
three: THREE.WebGLRenderer;
|
|
3384
|
+
/**
|
|
3385
|
+
* The mode of the renderer. If MANUAL, the renderer will be updated manually. If AUTO, the renderer will render on every update tick.
|
|
3386
|
+
*/
|
|
3387
|
+
mode: RendererMode;
|
|
3388
|
+
/**
|
|
3389
|
+
* Whether the renderer needs to be updated. If true, the renderer will be updated on the next frame.
|
|
3390
|
+
*/
|
|
3391
|
+
needsUpdate: boolean;
|
|
3366
3392
|
protected _canvas: HTMLCanvasElement;
|
|
3367
3393
|
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
3368
3394
|
protected _resizeObserver: ResizeObserver | null;
|