@tresjs/cientos 5.2.3 → 5.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @tresjs/cientos
3
- * version: v5.2.3
3
+ * version: v5.2.5
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/)
@@ -1079,14 +1079,17 @@ var component_vue_vue_type_script_setup_true_lang_default$16 = /* @__PURE__ */ d
1079
1079
  const props = __props;
1080
1080
  const imageRef = shallowRef();
1081
1081
  const texture$1 = shallowRef(props.texture ?? null);
1082
- const size = useTres().sizes;
1082
+ const { sizes: size, renderer } = useTres();
1083
1083
  const planeBounds = computed(() => Array.isArray(props.scale) ? [props.scale[0], props.scale[1]] : [props.scale, props.scale]);
1084
1084
  const imageBounds = computed(() => [texture$1.value?.image?.width ?? 0, texture$1.value?.image?.height ?? 0]);
1085
1085
  const resolution = computed(() => Math.max(size.width.value, size.height.value));
1086
1086
  const { state, isLoading } = useTexture(props.url);
1087
1087
  watchEffect(() => {
1088
1088
  if (props.texture) texture$1.value = props.texture;
1089
- if (!isLoading.value) texture$1.value = state.value;
1089
+ if (!isLoading.value) {
1090
+ texture$1.value = state.value;
1091
+ texture$1.value.colorSpace = renderer.outputColorSpace;
1092
+ }
1090
1093
  });
1091
1094
  const scale = computed(() => Array.isArray(props.scale) ? [...props.scale, 1] : props.scale);
1092
1095
  __expose({ instance: imageRef });
@@ -10692,9 +10695,9 @@ var Sky_default = Sky_vue_vue_type_script_setup_true_lang_default;
10692
10695
 
10693
10696
  //#endregion
10694
10697
  //#region src/core/staging/Smoke.vue?vue&type=script&setup=true&lang.ts
10695
- const _hoisted_1$4 = ["position"];
10698
+ const _hoisted_1$4 = ["scale"];
10696
10699
  const _hoisted_2$3 = ["position"];
10697
- const _hoisted_3$2 = ["scale"];
10700
+ const _hoisted_3$2 = ["position", "scale"];
10698
10701
  const _hoisted_4$2 = [
10699
10702
  "map",
10700
10703
  "depth-test",
@@ -10708,7 +10711,7 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10708
10711
  color: {
10709
10712
  type: null,
10710
10713
  required: false,
10711
- default: "#ffffff"
10714
+ default: "#f7f7f7"
10712
10715
  },
10713
10716
  opacity: {
10714
10717
  type: Number,
@@ -10720,20 +10723,15 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10720
10723
  required: false,
10721
10724
  default: .4
10722
10725
  },
10723
- width: {
10724
- type: Number,
10725
- required: false,
10726
- default: 10
10727
- },
10728
10726
  depth: {
10729
10727
  type: Number,
10730
10728
  required: false,
10731
- default: 1.5
10729
+ default: .3
10732
10730
  },
10733
10731
  segments: {
10734
10732
  type: Number,
10735
10733
  required: false,
10736
- default: 20
10734
+ default: 10
10737
10735
  },
10738
10736
  texture: {
10739
10737
  type: String,
@@ -10743,30 +10741,42 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10743
10741
  depthTest: {
10744
10742
  type: Boolean,
10745
10743
  required: false,
10746
- default: true
10744
+ default: false
10745
+ },
10746
+ spreadY: {
10747
+ type: Number,
10748
+ required: false,
10749
+ default: .1
10750
+ },
10751
+ spreadX: {
10752
+ type: Number,
10753
+ required: false,
10754
+ default: .5
10755
+ },
10756
+ scale: {
10757
+ type: Number,
10758
+ required: false,
10759
+ default: 1
10747
10760
  }
10748
10761
  },
10749
10762
  setup(__props, { expose: __expose }) {
10750
- const { width, depth, segments, texture: texture$1, color, depthTest, opacity, speed } = toRefs(__props);
10763
+ const { depth, segments, texture: texture$1, color, depthTest, opacity, speed, spreadY, spreadX, scale } = toRefs(__props);
10751
10764
  const smokeRef = shallowRef();
10752
10765
  const groupRef = shallowRef();
10753
10766
  __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;
10767
+ const smoke = computed(() => Array.from({ length: segments.value }, (_, index) => ({
10768
+ x: (Math.random() - .5) * spreadX.value,
10769
+ y: (Math.random() - .5) * spreadY.value,
10770
+ scale: Math.sin((index + 1) / segments.value) * scale.value
10771
+ })));
10762
10772
  const { state: map } = useTexture(texture$1.value);
10763
10773
  const { renderer, camera } = useTresContext();
10764
10774
  const colorSpace = computed(() => renderer.instance?.outputColorSpace);
10765
10775
  const { onBeforeRender } = useLoop();
10766
10776
  onBeforeRender(() => {
10767
10777
  if (smokeRef.value && camera.activeCamera.value && groupRef.value) {
10768
- groupRef.value?.children.forEach((child, index) => {
10769
- child.rotation.z += smoke[index].rotation;
10778
+ groupRef.value?.children.forEach((child) => {
10779
+ child.rotation.z += Math.max(.002, .005 * Math.random()) * speed.value;
10770
10780
  });
10771
10781
  smokeRef.value.lookAt(camera.activeCamera.value?.position);
10772
10782
  }
@@ -10774,7 +10784,8 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10774
10784
  return (_ctx, _cache) => {
10775
10785
  return openBlock(), createElementBlock("TresGroup", {
10776
10786
  ref_key: "smokeRef",
10777
- ref: smokeRef
10787
+ ref: smokeRef,
10788
+ scale: unref(scale)
10778
10789
  }, [createElementVNode("TresGroup", {
10779
10790
  ref_key: "groupRef",
10780
10791
  ref: groupRef,
@@ -10783,35 +10794,25 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10783
10794
  0,
10784
10795
  unref(segments) / 2 * unref(depth)
10785
10796
  ]
10786
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(smoke), ({ scale, x, y, density }, index) => {
10797
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(smoke.value, ({ x, y, scale: smokeScale }, index) => {
10787
10798
  return openBlock(), createElementBlock("TresMesh", {
10788
10799
  key: `${index}`,
10789
10800
  position: [
10790
10801
  x,
10791
10802
  y,
10792
10803
  -index * unref(depth)
10793
- ]
10794
- }, [createElementVNode("TresPlaneGeometry", {
10795
- scale: [
10796
- scale,
10797
- scale,
10798
- scale
10799
10804
  ],
10800
- rotation: [
10801
- 0,
10802
- 0,
10803
- 0
10804
- ]
10805
- }, null, 8, _hoisted_3$2), createElementVNode("TresMeshStandardMaterial", {
10805
+ scale: smokeScale
10806
+ }, [_cache[0] || (_cache[0] = createElementVNode("TresPlaneGeometry", null, null, -1)), createElementVNode("TresMeshStandardMaterial", {
10806
10807
  map: unref(map),
10807
10808
  "depth-test": unref(depthTest),
10808
10809
  "color-space": colorSpace.value,
10809
10810
  color: unref(color),
10810
10811
  "depth-write": false,
10811
10812
  transparent: "",
10812
- opacity: calculateOpacity(scale, density)
10813
- }, null, 8, _hoisted_4$2)], 8, _hoisted_2$3);
10814
- }), 128))], 8, _hoisted_1$4)], 512);
10813
+ opacity: unref(opacity)
10814
+ }, null, 8, _hoisted_4$2)], 8, _hoisted_3$2);
10815
+ }), 128))], 8, _hoisted_2$3)], 8, _hoisted_1$4);
10815
10816
  };
10816
10817
  }
10817
10818
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tresjs/cientos",
3
3
  "type": "module",
4
- "version": "5.2.3",
4
+ "version": "5.2.5",
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.1",
41
+ "@tresjs/core": "5.3.3",
42
42
  "three": ">=0.133",
43
43
  "vue": ">=3.5.17"
44
44
  },
@@ -48,11 +48,11 @@
48
48
  "stats-gl": "^2.0.1",
49
49
  "stats.js": "^0.17.0",
50
50
  "three-custom-shader-material": "^5.4.0",
51
- "three-stdlib": "^2.36.0"
51
+ "three-stdlib": "^2.36.1"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^24.3.0",
55
- "@types/three": "^0.180.0",
55
+ "@types/three": "^0.182.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.182.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.1",
74
+ "@tresjs/core": "5.3.3",
75
75
  "@tresjs/eslint-config": "1.5.1"
76
76
  },
77
77
  "nx": {