@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.mjs CHANGED
@@ -4636,24 +4636,19 @@ class SimpleRaycaster {
4636
4636
  }
4637
4637
  return fragResult;
4638
4638
  }
4639
- // /**
4640
- // * Casts a ray from a given origin in a given direction and returns the first item found.
4641
- // * This method also takes into account the clipping planes used by the renderer.
4642
- // *
4643
- // * @param origin - The origin of the ray.
4644
- // * @param direction - The direction of the ray.
4645
- // * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
4646
- // * @returns The first intersection found or `null` if no intersection was found.
4647
- // */
4648
- // castRayFromVector(
4649
- // origin: THREE.Vector3,
4650
- // direction: THREE.Vector3,
4651
- // items = Array.from(this.world.meshes),
4652
- // ) {
4653
- // // TODO: Implement for fragmentsmodel
4654
- // this.three.set(origin, direction);
4655
- // return this.intersect(items);
4656
- // }
4639
+ /**
4640
+ * Casts a ray from a given origin in a given direction and returns the first item found.
4641
+ * This method also takes into account the clipping planes used by the renderer.
4642
+ *
4643
+ * @param origin - The origin of the ray.
4644
+ * @param direction - The direction of the ray.
4645
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
4646
+ * @returns The first intersection found or `null` if no intersection was found.
4647
+ */
4648
+ castRayFromVector(origin, direction, items = Array.from(this.world.meshes)) {
4649
+ this.three.set(origin, direction);
4650
+ return this.intersect(items);
4651
+ }
4657
4652
  intersect(items = Array.from(this.world.meshes)) {
4658
4653
  const result = this.three.intersectObjects(items);
4659
4654
  const filtered = this.filterClippingPlanes(result);
@@ -5110,6 +5105,11 @@ class SimpleScene extends BaseScene {
5110
5105
  configs.list.delete(this.config.uuid);
5111
5106
  }
5112
5107
  }
5108
+ var RendererMode = /* @__PURE__ */ ((RendererMode2) => {
5109
+ RendererMode2[RendererMode2["MANUAL"] = 0] = "MANUAL";
5110
+ RendererMode2[RendererMode2["AUTO"] = 1] = "AUTO";
5111
+ return RendererMode2;
5112
+ })(RendererMode || {});
5113
5113
  class SimpleRenderer extends BaseRenderer {
5114
5114
  /**
5115
5115
  * Constructor for the SimpleRenderer class.
@@ -5133,6 +5133,14 @@ class SimpleRenderer extends BaseRenderer {
5133
5133
  * The THREE.js WebGLRenderer instance.
5134
5134
  */
5135
5135
  __publicField(this, "three");
5136
+ /**
5137
+ * The mode of the renderer. If MANUAL, the renderer will be updated manually. If AUTO, the renderer will render on every update tick.
5138
+ */
5139
+ __publicField(this, "mode", 1);
5140
+ /**
5141
+ * Whether the renderer needs to be updated. If true, the renderer will be updated on the next frame.
5142
+ */
5143
+ __publicField(this, "needsUpdate", false);
5136
5144
  __publicField(this, "_canvas");
5137
5145
  __publicField(this, "_parameters");
5138
5146
  __publicField(this, "_resizeObserver", null);
@@ -5189,6 +5197,10 @@ class SimpleRenderer extends BaseRenderer {
5189
5197
  update() {
5190
5198
  if (!this.enabled || !this.currentWorld)
5191
5199
  return;
5200
+ if (this.mode === 0 && !this.needsUpdate) {
5201
+ return;
5202
+ }
5203
+ this.needsUpdate = false;
5192
5204
  this.onBeforeUpdate.trigger(this);
5193
5205
  const scene = this.currentWorld.scene.three;
5194
5206
  const camera = this.currentWorld.camera.three;
@@ -21572,6 +21584,7 @@ export {
21572
21584
  PlanMode,
21573
21585
  ProjectionManager,
21574
21586
  Raycasters,
21587
+ RendererMode,
21575
21588
  ShadowedScene,
21576
21589
  SimpleCamera,
21577
21590
  SimpleGrid,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@thatopen/components",
3
3
  "description": "Collection of core functionalities to author BIM apps.",
4
- "version": "3.2.3",
4
+ "version": "3.2.5",
5
5
  "author": "That Open Company",
6
6
  "contributors": [
7
7
  "Antonio Gonzalez Viegas (https://github.com/agviegas)",