@tresjs/cientos 5.2.2 → 5.2.4

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,6 +1,6 @@
1
1
  /**
2
2
  * name: @tresjs/cientos
3
- * version: v5.2.2
3
+ * version: v5.2.4
4
4
  * (c) 2026
5
5
  * description: Collection of useful helpers and fully functional, ready-made abstractions for Tres
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
@@ -10692,9 +10692,9 @@ var Sky_default = Sky_vue_vue_type_script_setup_true_lang_default;
10692
10692
 
10693
10693
  //#endregion
10694
10694
  //#region src/core/staging/Smoke.vue?vue&type=script&setup=true&lang.ts
10695
- const _hoisted_1$4 = ["position"];
10695
+ const _hoisted_1$4 = ["scale"];
10696
10696
  const _hoisted_2$3 = ["position"];
10697
- const _hoisted_3$2 = ["scale"];
10697
+ const _hoisted_3$2 = ["position", "scale"];
10698
10698
  const _hoisted_4$2 = [
10699
10699
  "map",
10700
10700
  "depth-test",
@@ -10708,7 +10708,7 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10708
10708
  color: {
10709
10709
  type: null,
10710
10710
  required: false,
10711
- default: "#ffffff"
10711
+ default: "#f7f7f7"
10712
10712
  },
10713
10713
  opacity: {
10714
10714
  type: Number,
@@ -10720,20 +10720,15 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10720
10720
  required: false,
10721
10721
  default: .4
10722
10722
  },
10723
- width: {
10724
- type: Number,
10725
- required: false,
10726
- default: 10
10727
- },
10728
10723
  depth: {
10729
10724
  type: Number,
10730
10725
  required: false,
10731
- default: 1.5
10726
+ default: .3
10732
10727
  },
10733
10728
  segments: {
10734
10729
  type: Number,
10735
10730
  required: false,
10736
- default: 20
10731
+ default: 10
10737
10732
  },
10738
10733
  texture: {
10739
10734
  type: String,
@@ -10743,30 +10738,42 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10743
10738
  depthTest: {
10744
10739
  type: Boolean,
10745
10740
  required: false,
10746
- default: true
10741
+ default: false
10742
+ },
10743
+ spreadY: {
10744
+ type: Number,
10745
+ required: false,
10746
+ default: .1
10747
+ },
10748
+ spreadX: {
10749
+ type: Number,
10750
+ required: false,
10751
+ default: .5
10752
+ },
10753
+ scale: {
10754
+ type: Number,
10755
+ required: false,
10756
+ default: 1
10747
10757
  }
10748
10758
  },
10749
10759
  setup(__props, { expose: __expose }) {
10750
- const { width, depth, segments, texture: texture$1, color, depthTest, opacity, speed } = toRefs(__props);
10760
+ const { depth, segments, texture: texture$1, color, depthTest, opacity, speed, spreadY, spreadX, scale } = toRefs(__props);
10751
10761
  const smokeRef = shallowRef();
10752
10762
  const groupRef = shallowRef();
10753
10763
  __expose({ instance: smokeRef });
10754
- const smoke = [...[segments]].map((_, index) => ({
10755
- x: width.value / 2 - Math.random() * width.value,
10756
- y: width.value / 2 - Math.random() * width.value,
10757
- scale: .4 + Math.sin((index + 1) / segments.value * Math.PI) * ((.2 + Math.random()) * 10),
10758
- density: Math.max(.2, Math.random()),
10759
- rotation: Math.max(.002, .005 * Math.random()) * speed.value
10760
- }));
10761
- const calculateOpacity = (scale, density) => scale / 6 * density * opacity.value;
10764
+ const smoke = computed(() => Array.from({ length: segments.value }, (_, index) => ({
10765
+ x: (Math.random() - .5) * spreadX.value,
10766
+ y: (Math.random() - .5) * spreadY.value,
10767
+ scale: Math.sin((index + 1) / segments.value) * scale.value
10768
+ })));
10762
10769
  const { state: map } = useTexture(texture$1.value);
10763
10770
  const { renderer, camera } = useTresContext();
10764
10771
  const colorSpace = computed(() => renderer.instance?.outputColorSpace);
10765
10772
  const { onBeforeRender } = useLoop();
10766
10773
  onBeforeRender(() => {
10767
10774
  if (smokeRef.value && camera.activeCamera.value && groupRef.value) {
10768
- groupRef.value?.children.forEach((child, index) => {
10769
- child.rotation.z += smoke[index].rotation;
10775
+ groupRef.value?.children.forEach((child) => {
10776
+ child.rotation.z += Math.max(.002, .005 * Math.random()) * speed.value;
10770
10777
  });
10771
10778
  smokeRef.value.lookAt(camera.activeCamera.value?.position);
10772
10779
  }
@@ -10774,7 +10781,8 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10774
10781
  return (_ctx, _cache) => {
10775
10782
  return openBlock(), createElementBlock("TresGroup", {
10776
10783
  ref_key: "smokeRef",
10777
- ref: smokeRef
10784
+ ref: smokeRef,
10785
+ scale: unref(scale)
10778
10786
  }, [createElementVNode("TresGroup", {
10779
10787
  ref_key: "groupRef",
10780
10788
  ref: groupRef,
@@ -10783,35 +10791,25 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10783
10791
  0,
10784
10792
  unref(segments) / 2 * unref(depth)
10785
10793
  ]
10786
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(smoke), ({ scale, x, y, density }, index) => {
10794
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(smoke.value, ({ x, y, scale: smokeScale }, index) => {
10787
10795
  return openBlock(), createElementBlock("TresMesh", {
10788
10796
  key: `${index}`,
10789
10797
  position: [
10790
10798
  x,
10791
10799
  y,
10792
10800
  -index * unref(depth)
10793
- ]
10794
- }, [createElementVNode("TresPlaneGeometry", {
10795
- scale: [
10796
- scale,
10797
- scale,
10798
- scale
10799
10801
  ],
10800
- rotation: [
10801
- 0,
10802
- 0,
10803
- 0
10804
- ]
10805
- }, null, 8, _hoisted_3$2), createElementVNode("TresMeshStandardMaterial", {
10802
+ scale: smokeScale
10803
+ }, [_cache[0] || (_cache[0] = createElementVNode("TresPlaneGeometry", null, null, -1)), createElementVNode("TresMeshStandardMaterial", {
10806
10804
  map: unref(map),
10807
10805
  "depth-test": unref(depthTest),
10808
10806
  "color-space": colorSpace.value,
10809
10807
  color: unref(color),
10810
10808
  "depth-write": false,
10811
10809
  transparent: "",
10812
- opacity: calculateOpacity(scale, density)
10813
- }, null, 8, _hoisted_4$2)], 8, _hoisted_2$3);
10814
- }), 128))], 8, _hoisted_1$4)], 512);
10810
+ opacity: unref(opacity)
10811
+ }, null, 8, _hoisted_4$2)], 8, _hoisted_3$2);
10812
+ }), 128))], 8, _hoisted_2$3)], 8, _hoisted_1$4);
10815
10813
  };
10816
10814
  }
10817
10815
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tresjs/cientos",
3
3
  "type": "module",
4
- "version": "5.2.2",
4
+ "version": "5.2.4",
5
5
  "description": "Collection of useful helpers and fully functional, ready-made abstractions for Tres",
6
6
  "author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
7
7
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "access": "public"
39
39
  },
40
40
  "peerDependencies": {
41
- "@tresjs/core": "5.3.0",
41
+ "@tresjs/core": "5.3.2",
42
42
  "three": ">=0.133",
43
43
  "vue": ">=3.5.17"
44
44
  },
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^24.3.0",
55
- "@types/three": "^0.180.0",
55
+ "@types/three": "^0.181.0",
56
56
  "@typescript-eslint/eslint-plugin": "^8.42.0",
57
57
  "@typescript-eslint/parser": "^8.42.0",
58
58
  "@vitejs/plugin-vue": "^6.0.1",
@@ -62,7 +62,7 @@
62
62
  "pathe": "^2.0.3",
63
63
  "rollup-plugin-analyzer": "^4.0.0",
64
64
  "rollup-plugin-visualizer": "^6.0.3",
65
- "three": "^0.180.0",
65
+ "three": "^0.181.0",
66
66
  "tsdown": "0.18.3",
67
67
  "typescript": "^5.8.3",
68
68
  "vite": "^7.1.9",
@@ -71,7 +71,7 @@
71
71
  "vite-plugin-glsl": "^1.5.1",
72
72
  "vite-svg-loader": "^5.1.0",
73
73
  "vue-tsc": "^3.2.1",
74
- "@tresjs/core": "5.3.0",
74
+ "@tresjs/core": "5.3.2",
75
75
  "@tresjs/eslint-config": "1.5.1"
76
76
  },
77
77
  "nx": {