@tresjs/cientos 5.1.1 → 5.2.0

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.1.1
3
+ * version: v5.2.0
4
4
  * (c) 2025
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/)
@@ -10,10 +10,9 @@ import { buildGraph, extend, logError, logWarning, normalizeColor, normalizeVect
10
10
  import * as THREE from "three";
11
11
  import { AdditiveBlending, AlwaysStencilFunc, AnimationMixer, Audio, AudioListener, AudioLoader, BackSide, Box2, Box3, BoxGeometry, BufferAttribute, BufferGeometry, Camera, CatmullRomCurve3, ClampToEdgeWrapping, Clock, Color, CubeCamera, CubeReflectionMapping, CubeTextureLoader, CubicBezierCurve3, DataTexture, DefaultLoadingManager, DepthTexture, DirectionalLight, DoubleSide, EdgesGeometry, EqualStencilFunc, EquirectangularReflectionMapping, Euler, FloatType, FramebufferTexture, FrontSide, Group, HalfFloatType, IcosahedronGeometry, InstancedMesh, InterleavedBuffer, InterleavedBufferAttribute, KeepStencilOp, LOD, LinearFilter, MOUSE, MathUtils, Matrix4, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshLambertMaterial, MeshStandardMaterial, NearestFilter, NoBlending, NotEqualStencilFunc, Object3D, OrthographicCamera, PerspectiveCamera, Plane, PlaneGeometry, Points, PointsMaterial, QuadraticBezierCurve3, Quaternion, REVISION, RGBAFormat, RawShaderMaterial, Raycaster, RepeatWrapping, ReplaceStencilOp, Scene, ShaderChunk, ShaderMaterial, ShapeGeometry, SkinnedMesh, Sphere, Spherical, TOUCH, TangentSpaceNormalMap, Texture, TextureLoader, UVMapping, Uniform, UniformsUtils, UnsignedByteType, Vector2, Vector3, Vector4, VideoTexture, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer } from "three";
12
12
  import { tryOnScopeDispose, useDebounceFn, useElementSize, useEventListener, useMagicKeys, useMouse, useScroll, useWindowScroll, useWindowSize, watchThrottled, whenever } from "@vueuse/core";
13
- import { DRACOLoader, FBXLoader, FontLoader, GLTFExporter, GLTFLoader, HorizontalBlurShader, Line2, LineGeometry, LineMaterial, MapControls, MarchingCubes, MeshSurfaceSampler, OrbitControls, PointerLockControls, PositionalAudioHelper, RGBELoader, Reflector, RoundedBoxGeometry, SVGLoader, Sky, TextGeometry, TransformControls, VerticalBlurShader, Water, toCreasedNormals } from "three-stdlib";
13
+ import { DRACOLoader, FBXLoader, FontLoader, GLTFExporter, GLTFLoader, HorizontalBlurShader, Line2, LineGeometry, LineMaterial, MapControls, MarchingCubes, MeshSurfaceSampler, OrbitControls, PointerLockControls, PositionalAudioHelper, RGBELoader, Reflector, RoundedBoxGeometry, SVGLoader, SimplexNoise, Sky, TextGeometry, TransformControls, VerticalBlurShader, Water, toCreasedNormals } from "three-stdlib";
14
14
  import BaseCameraControls, { default as CameraControls } from "camera-controls";
15
15
  import CustomShaderMaterial from "three-custom-shader-material/vanilla";
16
- import { WebGPURenderer } from "three/webgpu";
17
16
  import StatsImpl from "stats.js";
18
17
  import StatsGlImpl from "stats-gl";
19
18
 
@@ -916,7 +915,7 @@ function shaderMaterial(uniforms, vertexShader, fragmentShader, onInit) {
916
915
  * NOTE: Source:
917
916
  * https://threejs.org/docs/?q=material#api/en/materials/Material.transparent
918
917
  */
919
- const imageMaterialImpl = shaderMaterial({
918
+ const ImageMaterialImpl = /* @__PURE__ */ shaderMaterial({
920
919
  color: /* @__PURE__ */ new Color("white"),
921
920
  scale: /* @__PURE__ */ new Vector2(1, 1),
922
921
  imageBounds: /* @__PURE__ */ new Vector2(1, 1),
@@ -954,14 +953,14 @@ const imageMaterialImpl = shaderMaterial({
954
953
  vec2 aspect(vec2 size) {
955
954
  return size / min(size.x, size.y);
956
955
  }
957
-
956
+
958
957
  const float PI = 3.14159265;
959
-
958
+
960
959
  // from https://iquilezles.org/articles/distfunctions
961
960
  float udRoundBox( vec2 p, vec2 b, float r ) {
962
961
  return length(max(abs(p)-b+r,0.0))-r;
963
962
  }
964
-
963
+
965
964
  void main() {
966
965
  vec2 s = aspect(scale);
967
966
  vec2 i = aspect(imageBounds);
@@ -971,25 +970,24 @@ const imageMaterialImpl = shaderMaterial({
971
970
  vec2 offset = (rs < ri ? vec2((new.x - s.x) / 2.0, 0.0) : vec2(0.0, (new.y - s.y) / 2.0)) / new;
972
971
  vec2 uv = vUv * s / new + offset;
973
972
  vec2 zUv = (uv - vec2(0.5, 0.5)) / zoom + vec2(0.5, 0.5);
974
-
973
+
975
974
  vec2 res = vec2(scale * resolution);
976
975
  vec2 halfRes = 0.5 * res;
977
- float b = udRoundBox(vUv.xy * res - halfRes, halfRes, resolution * radius);
976
+ float b = udRoundBox(vUv.xy * res - halfRes, halfRes, resolution * radius);
978
977
  vec3 a = mix(vec3(1.0,0.0,0.0), vec3(0.0,0.0,0.0), smoothstep(0.0, 1.0, b));
979
978
  gl_FragColor = toGrayscale(texture2D(map, zUv) * vec4(color, opacity * a), grayscale);
980
-
979
+
981
980
  #include <tonemapping_fragment>
982
981
  #include <colorspace_fragment>
983
982
  }
984
983
  `);
985
- var ImageMaterialImpl_default = imageMaterialImpl;
986
984
 
987
985
  //#endregion
988
986
  //#region src/core/abstractions/Image/ImageMaterial.vue?vue&type=script&setup=true&lang.ts
989
987
  var ImageMaterial_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
990
988
  __name: "ImageMaterial",
991
989
  setup(__props, { expose: __expose }) {
992
- extend({ ImageMaterial: ImageMaterialImpl_default });
990
+ extend({ ImageMaterial: ImageMaterialImpl });
993
991
  const materialRef = shallowRef();
994
992
  __expose({ instance: materialRef });
995
993
  return (_ctx, _cache) => {
@@ -1085,12 +1083,10 @@ var component_vue_vue_type_script_setup_true_lang_default$16 = /* @__PURE__ */ d
1085
1083
  const planeBounds = computed(() => Array.isArray(props.scale) ? [props.scale[0], props.scale[1]] : [props.scale, props.scale]);
1086
1084
  const imageBounds = computed(() => [texture$1.value?.image?.width ?? 0, texture$1.value?.image?.height ?? 0]);
1087
1085
  const resolution = computed(() => Math.max(size.width.value, size.height.value));
1086
+ const { state, isLoading } = useTexture(props.url);
1088
1087
  watchEffect(() => {
1089
1088
  if (props.texture) texture$1.value = props.texture;
1090
- else {
1091
- const { state: t } = useTexture(props.url);
1092
- texture$1.value = t.value;
1093
- }
1089
+ if (!isLoading.value) texture$1.value = state.value;
1094
1090
  });
1095
1091
  const scale = computed(() => Array.isArray(props.scale) ? [...props.scale, 1] : props.scale);
1096
1092
  __expose({ instance: imageRef });
@@ -2221,7 +2217,7 @@ var MouseParallax_default = MouseParallax_vue_vue_type_script_setup_true_lang_de
2221
2217
 
2222
2218
  //#endregion
2223
2219
  //#region src/core/abstractions/Outline/OutlineMaterialImpl.ts
2224
- const OutlineMaterialImpl = shaderMaterial({
2220
+ const OutlineMaterialImpl = /* @__PURE__ */ shaderMaterial({
2225
2221
  screenspace: false,
2226
2222
  color: new Color("black"),
2227
2223
  opacity: 1,
@@ -2253,7 +2249,7 @@ const OutlineMaterialImpl = shaderMaterial({
2253
2249
  #endif
2254
2250
  if (screenspace) {
2255
2251
  vec3 newPosition = tPosition.xyz + tNormal.xyz * thickness;
2256
- gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
2252
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
2257
2253
  } else {
2258
2254
  vec4 clipPosition = projectionMatrix * modelViewMatrix * tPosition;
2259
2255
  vec4 clipNormal = projectionMatrix * modelViewMatrix * tNormal;
@@ -2268,7 +2264,6 @@ const OutlineMaterialImpl = shaderMaterial({
2268
2264
  #include <tonemapping_fragment>
2269
2265
  #include <colorspace_fragment>
2270
2266
  }`);
2271
- var OutlineMaterialImpl_default = OutlineMaterialImpl;
2272
2267
 
2273
2268
  //#endregion
2274
2269
  //#region src/core/abstractions/Outline/component.vue?vue&type=script&setup=true&lang.ts
@@ -2330,7 +2325,7 @@ var component_vue_vue_type_script_setup_true_lang_default$13 = /* @__PURE__ */ d
2330
2325
  const props = __props;
2331
2326
  const groupRef = shallowRef();
2332
2327
  __expose({ instance: groupRef });
2333
- const material = new OutlineMaterialImpl_default({ ...props });
2328
+ const material = new OutlineMaterialImpl({ ...props });
2334
2329
  const contextSize = new Vector2(1, 1);
2335
2330
  let oldAngle = 0;
2336
2331
  let oldGeometry = null;
@@ -2623,6 +2618,7 @@ var Reflector_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
2623
2618
  const reflectorRef = shallowRef();
2624
2619
  extend$1({ Reflector });
2625
2620
  const { color, textureWidth, textureHeight, clipBias, multisample, shader } = toRefs(props);
2621
+ const colorValue = computed(() => new Color(color.value));
2626
2622
  watch(props, () => {
2627
2623
  invalidate();
2628
2624
  });
@@ -2638,7 +2634,7 @@ var Reflector_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
2638
2634
  multisample: unref(multisample),
2639
2635
  shader: unref(shader)
2640
2636
  }],
2641
- "material-uniforms-color-value": unref(color)
2637
+ "material-uniforms-color-value": colorValue.value
2642
2638
  }, [renderSlot(_ctx.$slots, "default", {}, () => [_cache[0] || (_cache[0] = createElementVNode("TresPlaneGeometry", { args: [5, 5] }, null, -1))])], 8, _hoisted_1$50);
2643
2639
  };
2644
2640
  }
@@ -5504,6 +5500,7 @@ var index_vue_vue_type_script_setup_true_lang_default$5 = /* @__PURE__ */ define
5504
5500
  root: MeshHolographicMaterialClass,
5505
5501
  constructor: HolographicMaterialParameters_default
5506
5502
  });
5503
+ const colorValue = computed(() => new Color(props.hologramColor));
5507
5504
  const { onBeforeRender } = useLoop();
5508
5505
  onBeforeRender(() => {
5509
5506
  MeshHolographicMaterialClass.value?.update();
@@ -5518,7 +5515,7 @@ var index_vue_vue_type_script_setup_true_lang_default$5 = /* @__PURE__ */ define
5518
5515
  "uniforms-hologramBrightness-value": props.hologramBrightness,
5519
5516
  "uniforms-scanlineSize-value": props.scanlineSize,
5520
5517
  "uniforms-signalSpeed-value": props.signalSpeed,
5521
- "uniforms-hologramColor-value": props.hologramColor,
5518
+ "uniforms-hologramColor-value": colorValue.value,
5522
5519
  "uniforms-hologramOpacity-value": props.hologramOpacity,
5523
5520
  "uniforms-blinkFresnelOnly-value": props.blinkFresnelOnly,
5524
5521
  enableAdditive: props.enableAdditive,
@@ -6429,7 +6426,7 @@ var index_vue_vue_type_script_setup_true_lang_default$2 = /* @__PURE__ */ define
6429
6426
  onBeforeRender(({ renderer, scene, camera }) => {
6430
6427
  const parent = materialRef.value?.__tres?.parent;
6431
6428
  if (!parent) return;
6432
- if (renderer instanceof WebGPURenderer) {
6429
+ if ("isWebGPURenderer" in renderer && renderer.isWebGPURenderer === true) {
6433
6430
  console.warn("MeshReflectionMaterial: WebGPURenderer is not supported yet");
6434
6431
  return;
6435
6432
  }
@@ -6731,7 +6728,11 @@ var fragment_default = "void main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0)
6731
6728
 
6732
6729
  //#endregion
6733
6730
  //#region src/core/misc/html/shaders/vertex.glsl
6734
- var vertex_default = "#include <common>\n\nvoid main() {\n vec2 center = vec2(0., 1.);\n float rotation = 0.0;\n\n \n \n float size = 0.03;\n\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n}";
6731
+ var vertex_default = "#include <common>\n\nuniform float uWidth;\nuniform float uHeight;\n\nvoid main() {\n\n vec4 mvPosition = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n\n vec2 quad = position.xy;\n\n vec2 alignedPosition = quad * vec2(uWidth, uHeight);\n\n mvPosition.xy += alignedPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n}";
6732
+
6733
+ //#endregion
6734
+ //#region src/core/misc/html/shaders/passthrough-vertex.glsl
6735
+ var passthrough_vertex_default = "#include <common>\n\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}";
6735
6736
 
6736
6737
  //#endregion
6737
6738
  //#region src/core/misc/html/utils.ts
@@ -6768,6 +6769,17 @@ function isObjectVisible(el, camera, raycaster, occlude) {
6768
6769
  }
6769
6770
  return true;
6770
6771
  }
6772
+ function getViewportFactor(camera, target = new Vector3(0, 0, 0), size) {
6773
+ const { width, height } = size;
6774
+ const aspect = width / height;
6775
+ const position = v1;
6776
+ const tempTarget = v2;
6777
+ tempTarget.copy(target);
6778
+ const distance = camera.getWorldPosition(position).distanceTo(tempTarget);
6779
+ if (camera instanceof OrthographicCamera) return 1;
6780
+ const fov = camera.fov * Math.PI / 180;
6781
+ return width / (2 * Math.tan(fov / 2) * distance * aspect);
6782
+ }
6771
6783
  function objectScale(el, camera) {
6772
6784
  if (camera instanceof OrthographicCamera) return camera.zoom;
6773
6785
  else if (camera instanceof PerspectiveCamera) {
@@ -6812,35 +6824,41 @@ const getCameraCSSMatrix = ((multipliers) => (matrix) => getCSSMatrix(matrix, mu
6812
6824
  1,
6813
6825
  1
6814
6826
  ]);
6815
- const getObjectCSSMatrix = ((scaleMultipliers) => (matrix, factor) => getCSSMatrix(matrix, scaleMultipliers(factor), "translate(-50%,-50%)"))((f) => [
6816
- 1 / f,
6817
- 1 / f,
6818
- 1 / f,
6819
- 1,
6820
- -1 / f,
6821
- -1 / f,
6822
- -1 / f,
6823
- -1,
6824
- 1 / f,
6825
- 1 / f,
6826
- 1 / f,
6827
- 1,
6828
- 1,
6829
- 1,
6830
- 1,
6831
- 1
6832
- ]);
6827
+ const getObjectCSSMatrix = (matrix, factor) => {
6828
+ return getCSSMatrix(matrix, [
6829
+ 1 / factor,
6830
+ 1 / factor,
6831
+ 1 / factor,
6832
+ 1,
6833
+ -1 / factor,
6834
+ -1 / factor,
6835
+ -1 / factor,
6836
+ -1,
6837
+ 1 / factor,
6838
+ 1 / factor,
6839
+ 1 / factor,
6840
+ 1,
6841
+ 1,
6842
+ 1,
6843
+ 1,
6844
+ 1
6845
+ ], "translate(-50%,-50%)");
6846
+ };
6833
6847
 
6834
6848
  //#endregion
6835
6849
  //#region src/core/misc/html/HTML.vue?vue&type=script&setup=true&lang.ts
6836
- const _hoisted_1$33 = ["geometry", "material"];
6850
+ const _hoisted_1$33 = [
6851
+ "material",
6852
+ "cast-shadow",
6853
+ "receive-shadow",
6854
+ "geometry"
6855
+ ];
6837
6856
  var HTML_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
6838
6857
  __name: "HTML",
6839
6858
  props: {
6840
6859
  geometry: {
6841
6860
  type: null,
6842
- required: false,
6843
- default: new PlaneGeometry()
6861
+ required: false
6844
6862
  },
6845
6863
  material: {
6846
6864
  type: null,
@@ -6856,6 +6874,11 @@ var HTML_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
6856
6874
  required: false,
6857
6875
  default: false
6858
6876
  },
6877
+ prepend: {
6878
+ type: Boolean,
6879
+ required: false,
6880
+ default: false
6881
+ },
6859
6882
  portal: {
6860
6883
  type: null,
6861
6884
  required: false
@@ -6891,11 +6914,21 @@ var HTML_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
6891
6914
  required: false,
6892
6915
  default: false
6893
6916
  },
6917
+ transparentMaterial: {
6918
+ type: Boolean,
6919
+ required: false,
6920
+ default: false
6921
+ },
6894
6922
  zIndexRange: {
6895
6923
  type: Array,
6896
6924
  required: false,
6897
6925
  default: () => [16777271, 0]
6898
6926
  },
6927
+ calculatePosition: {
6928
+ type: null,
6929
+ required: false,
6930
+ default: () => calculatePosition
6931
+ },
6899
6932
  occlude: {
6900
6933
  type: [
6901
6934
  Object,
@@ -6905,6 +6938,16 @@ var HTML_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
6905
6938
  String
6906
6939
  ],
6907
6940
  required: false
6941
+ },
6942
+ castShadow: {
6943
+ type: Boolean,
6944
+ required: false,
6945
+ default: false
6946
+ },
6947
+ receiveShadow: {
6948
+ type: Boolean,
6949
+ required: false,
6950
+ default: false
6908
6951
  }
6909
6952
  },
6910
6953
  emits: ["onOcclude"],
@@ -6912,217 +6955,267 @@ var HTML_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
6912
6955
  const props = __props;
6913
6956
  const emits = __emit;
6914
6957
  const slots = useSlots();
6958
+ const { geometry, material, as, transform, portal, wrapperClass, eps, distanceFactor, fullscreen, center, pointerEvents, sprite, prepend, occlude, zIndexRange, castShadow, receiveShadow, transparentMaterial, calculatePosition: calculatePosition$1 } = toRefs(props);
6915
6959
  const attrs = useAttrs();
6916
- const groupRef = ref();
6917
- const meshRef = ref();
6918
- const { geometry, material, as, transform, portal, wrapperClass, eps, distanceFactor, fullscreen, center, pointerEvents, sprite, occlude, zIndexRange } = toRefs(props);
6960
+ const groupRef = shallowRef(null);
6961
+ const occlusionMeshRef = shallowRef(null);
6962
+ const defaultPlaneGeometry = new PlaneGeometry();
6919
6963
  const { renderer, scene, camera, sizes } = useTresContext();
6920
6964
  const el = computed(() => document.createElement(as.value));
6965
+ const raycaster = new Raycaster();
6966
+ const tmpVec = new Vector3();
6967
+ const tmpMatrix = new Matrix4();
6968
+ const tmpQuat = new Quaternion();
6921
6969
  const previousPosition = ref([
6922
6970
  0,
6923
6971
  0,
6924
6972
  0
6925
6973
  ]);
6926
6974
  const previousZoom = ref(0);
6927
- const vnode = ref();
6928
- const raycaster = ref(new Raycaster());
6975
+ const vnode = ref(null);
6976
+ const isVisible = ref(true);
6977
+ const isMeshSizeSet = ref(false);
6978
+ const baseStyle = computed(() => ({
6979
+ position: "absolute",
6980
+ top: "0",
6981
+ left: "0",
6982
+ willChange: "transform",
6983
+ pointerEvents: pointerEvents.value,
6984
+ ...typeof attrs.style === "object" ? attrs.style : {}
6985
+ }));
6929
6986
  const styles = computed(() => {
6987
+ const w = sizes.width.value;
6988
+ const h = sizes.height.value;
6930
6989
  if (transform.value) return {
6931
- position: "absolute",
6932
- top: 0,
6933
- left: 0,
6934
- width: `${sizes.width.value}px`,
6935
- height: `${sizes.height.value}px`,
6990
+ ...baseStyle.value,
6936
6991
  transformStyle: "preserve-3d",
6937
6992
  pointerEvents: "none",
6938
- zIndex: 2
6993
+ width: `${w}px`,
6994
+ height: `${h}px`
6939
6995
  };
6940
- else return {
6941
- position: "absolute",
6996
+ return {
6997
+ ...baseStyle.value,
6942
6998
  transform: center.value ? "translate3d(-50%,-50%,0)" : "none",
6943
6999
  ...fullscreen.value && {
6944
- top: -sizes.height.value / 2,
6945
- left: -sizes.width.value / 2,
6946
- width: `${sizes.width.value}px`,
6947
- height: `${sizes.height.value}px`
7000
+ top: `-${h / 2}px`,
7001
+ left: `-${w / 2}px`,
7002
+ width: `${w}px`,
7003
+ height: `${h}px`
6948
7004
  },
6949
- zIndex: 2,
6950
- ...Object.assign({}, attrs.style)
7005
+ pointerEvents: fullscreen.value ? "none" : pointerEvents.value
6951
7006
  };
6952
7007
  });
6953
7008
  const transformInnerStyles = computed(() => ({
6954
7009
  position: "absolute",
6955
7010
  pointerEvents: pointerEvents.value
6956
7011
  }));
6957
- const occlusionMeshRef = ref(null);
6958
- const isMeshSizeSet = ref(false);
6959
- const isRayCastOcclusion = computed(() => occlude?.value && occlude?.value !== "blending" || Array.isArray(occlude?.value) && occlude?.value.length && isRef(occlude.value[0]));
6960
- watch(() => occlude, ({ value }) => {
6961
- if (value === "blending") {
6962
- el.value.style.zIndex = `${Math.floor(zIndexRange.value[0] / 2)}`;
6963
- el.value.style.position = "absolute";
6964
- el.value.style.pointerEvents = "none";
6965
- } else {
6966
- el.value.style.zIndex = null;
6967
- el.value.style.position = null;
6968
- el.value.style.pointerEvents = null;
6969
- }
7012
+ const isRayCastOcclusion = computed(() => {
7013
+ const o = occlude.value;
7014
+ return o && o !== "blending" && (Array.isArray(o) ? o.length && typeof o[0] !== "boolean" : true);
7015
+ });
7016
+ const effectiveMaterial = computed(() => {
7017
+ if (material.value) return material.value;
7018
+ return new ShaderMaterial({
7019
+ vertexShader: sprite.value ? vertex_default : transform.value ? passthrough_vertex_default : vertex_default,
7020
+ fragmentShader: fragment_default,
7021
+ side: DoubleSide,
7022
+ transparent: transparentMaterial.value,
7023
+ uniforms: {
7024
+ uWidth: { value: 1 },
7025
+ uHeight: { value: 1 }
7026
+ }
7027
+ });
7028
+ });
7029
+ watchEffect(() => {
7030
+ effectiveMaterial.value.transparent = transparentMaterial.value;
6970
7031
  });
7032
+ watch([occlude, () => renderer.instance], ([occludeVal, r]) => {
7033
+ if (!r || occludeVal !== "blending") return;
7034
+ const target = r.domElement;
7035
+ target.style.zIndex = `${Math.floor(zIndexRange.value[0] / 2)}`;
7036
+ target.style.position = "absolute";
7037
+ }, { immediate: true });
6971
7038
  watch(() => [
6972
7039
  groupRef.value,
6973
7040
  renderer.instance,
6974
7041
  sizes.width.value,
6975
7042
  sizes.height.value,
6976
- slots.default?.()
6977
- ], ([group, renderer$1]) => {
6978
- if (group && renderer$1) {
6979
- const target = portal?.value || renderer$1.domElement;
6980
- scene.value?.updateMatrixWorld();
6981
- if (transform.value) el.value.style.cssText = "position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";
6982
- else {
6983
- const vector = calculatePosition(group, camera.activeCamera.value, {
6984
- width: sizes.width.value,
6985
- height: sizes.height.value
6986
- });
6987
- el.value.style.cssText = `position:absolute;top:0;left:0;transform:translate3d(${vector[0]}px,${vector[1]}px,0);transform-origin:0 0;`;
6988
- }
6989
- if (target && !el.value.parentNode) target.parentNode?.appendChild(el.value);
6990
- if (transform.value) vnode.value = createVNode("div", {
6991
- id: "outer",
6992
- style: styles.value
6993
- }, [createVNode("div", {
6994
- id: "inner",
6995
- style: transformInnerStyles.value
6996
- }, [createVNode("div", {
6997
- key: meshRef.value?.uuid,
6998
- id: scene?.value.uuid,
6999
- class: attrs.class,
7000
- style: attrs.style
7001
- }, slots.default?.())])]);
7002
- else vnode.value = createVNode("div", {
7003
- key: meshRef.value?.uuid,
7004
- id: scene?.value.uuid,
7005
- style: styles.value
7006
- }, slots.default?.());
7007
- render(vnode.value, el.value);
7043
+ slots.default?.(),
7044
+ camera.activeCamera.value
7045
+ ], ([group, r]) => {
7046
+ if (!group || !r || !camera.activeCamera.value) return;
7047
+ isMeshSizeSet.value = false;
7048
+ scene.value?.updateMatrixWorld();
7049
+ const elStyle = el.value.style;
7050
+ elStyle.position = "absolute";
7051
+ elStyle.top = "0";
7052
+ elStyle.left = "0";
7053
+ if (transform.value) {
7054
+ elStyle.pointerEvents = "none";
7055
+ elStyle.overflow = "hidden";
7056
+ elStyle.transformStyle = "preserve-3d";
7057
+ } else {
7058
+ elStyle.transformOrigin = "0 0";
7059
+ elStyle.willChange = "transform";
7060
+ if (!occlude.value) elStyle.zIndex = `${zIndexRange.value[0]}`;
7008
7061
  }
7062
+ const parent = portal.value || r.domElement?.parentNode;
7063
+ if (parent && !el.value.parentNode) prepend.value ? parent.prepend(el.value) : parent.appendChild(el.value);
7064
+ vnode.value = transform.value ? createVNode("div", { style: styles.value }, [createVNode("div", { style: transformInnerStyles.value }, [createVNode("div", {
7065
+ key: groupRef.value?.uuid,
7066
+ class: attrs.class,
7067
+ style: attrs.style
7068
+ }, slots.default?.())])]) : createVNode("div", {
7069
+ key: groupRef.value?.uuid,
7070
+ style: styles.value,
7071
+ class: attrs.class
7072
+ }, slots.default?.());
7073
+ render(vnode.value, el.value);
7009
7074
  });
7010
7075
  watchEffect(() => {
7011
- if (wrapperClass?.value) el.value.className = wrapperClass.value;
7076
+ if (wrapperClass.value) el.value.className = wrapperClass.value;
7012
7077
  });
7013
- const visible = ref(true);
7014
7078
  const { onBeforeRender } = useLoop();
7015
- onBeforeRender(() => {
7016
- if (groupRef.value && camera.activeCamera.value && renderer.instance) {
7017
- camera.activeCamera.value?.updateMatrixWorld();
7018
- groupRef.value.updateWorldMatrix(true, false);
7019
- const vector = transform.value ? previousPosition.value : calculatePosition(groupRef.value, camera.activeCamera.value, {
7020
- width: sizes.width.value || 0,
7021
- height: sizes.height.value || 0
7022
- });
7023
- if (transform.value || Math.abs(previousZoom.value - camera.activeCamera.value.zoom) > eps.value || Math.abs(previousPosition.value[0] - vector[0]) > eps.value || Math.abs(previousPosition.value[1] - vector[1]) > eps.value || Math.abs(previousPosition.value[2] - vector[2]) > eps.value) {
7024
- const isBehindCamera = isObjectBehindCamera(groupRef.value, camera.activeCamera.value);
7025
- let raytraceTarget = false;
7026
- if (isRayCastOcclusion.value) {
7027
- if (Array.isArray(occlude?.value)) raytraceTarget = occlude?.value;
7028
- else if (occlude?.value !== "blending") raytraceTarget = [scene.value];
7029
- }
7030
- const previouslyVisible = visible.value;
7031
- if (raytraceTarget) visible.value = isObjectVisible(groupRef.value, camera.activeCamera.value, raycaster.value, raytraceTarget) && !isBehindCamera;
7032
- else visible.value = !isBehindCamera;
7033
- if (previouslyVisible !== visible.value) {
7034
- emits("onOcclude", !visible.value);
7035
- el.value.style.display = visible.value ? "block" : "none";
7036
- }
7037
- const halfRange = Math.floor(zIndexRange.value[0] / 2);
7038
- const zRange = occlude?.value ? isRayCastOcclusion.value ? [zIndexRange.value[0], halfRange] : [halfRange - 1, 0] : zIndexRange.value;
7039
- el.value.style.zIndex = `${objectZIndex(groupRef.value, camera.activeCamera.value, zRange)}`;
7040
- if (transform.value) {
7041
- const [widthHalf, heightHalf] = [sizes.width.value / 2, sizes.height.value / 2];
7042
- const fov = camera.activeCamera.value.projectionMatrix.elements[5] * heightHalf;
7043
- const { isOrthographicCamera: isOrthographicCamera$2, top, left, bottom, right } = camera.activeCamera.value;
7044
- const cameraMatrix = getCameraCSSMatrix(camera.activeCamera.value.matrixWorldInverse);
7045
- const cameraTransform = isOrthographicCamera$2 ? `scale(${fov})translate(${epsilon(-(right + left) / 2)}px,${epsilon((top + bottom) / 2)}px)` : `translateZ(${fov}px)`;
7046
- let matrix = groupRef.value.matrixWorld;
7047
- if (sprite.value) {
7048
- matrix = camera.activeCamera.value.matrixWorldInverse.clone().transpose().copyPosition(matrix).scale(groupRef.value.scale);
7049
- matrix.elements[3] = matrix.elements[7] = matrix.elements[11] = 0;
7050
- matrix.elements[15] = 1;
7051
- }
7052
- el.value.style.width = `${sizes.width.value}px`;
7053
- el.value.style.height = `${sizes.height.value}px`;
7054
- el.value.style.perspective = isOrthographicCamera$2 ? "" : `${fov}px`;
7055
- if (vnode.value?.el && vnode.value?.children && Array.isArray(vnode.value.children)) {
7056
- vnode.value.el.style.transform = `${cameraTransform}${cameraMatrix}translate(${widthHalf}px,${heightHalf}px)`;
7057
- const firstChild = vnode.value.children[0];
7058
- if (firstChild && firstChild.el) firstChild.el.style.transform = getObjectCSSMatrix(matrix, 1 / ((distanceFactor?.value || 10) / 400));
7059
- }
7060
- } else {
7061
- const scale = distanceFactor?.value === void 0 ? 1 : objectScale(groupRef.value, camera.activeCamera.value) * distanceFactor?.value;
7062
- el.value.style.transform = `translate3d(${vector[0]}px,${vector[1]}px,0) scale(${scale})`;
7063
- }
7079
+ onBeforeRender(({ invalidate }) => {
7080
+ const group = groupRef.value;
7081
+ const cam = camera.activeCamera.value;
7082
+ const rend = renderer.instance;
7083
+ if (!group || !cam || !rend) return;
7084
+ cam.updateMatrixWorld();
7085
+ group.updateWorldMatrix(true, false);
7086
+ const width = sizes.width.value;
7087
+ const height = sizes.height.value;
7088
+ const widthHalf = width * .5;
7089
+ const heightHalf = height * .5;
7090
+ const newPos = transform.value ? previousPosition.value : calculatePosition$1.value(group, cam, {
7091
+ width,
7092
+ height
7093
+ });
7094
+ const posChanged = Math.abs(previousZoom.value - cam.zoom) > eps.value || Math.abs(previousPosition.value[0] - newPos[0]) > eps.value || Math.abs(previousPosition.value[1] - newPos[1]) > eps.value || Math.abs(previousPosition.value[2] - newPos[2]) > eps.value;
7095
+ let changed = transform.value || posChanged;
7096
+ let visible = true;
7097
+ const behind = isObjectBehindCamera(group, cam);
7098
+ if (isRayCastOcclusion.value) {
7099
+ let targets = false;
7100
+ if (Array.isArray(occlude.value)) targets = occlude.value;
7101
+ else if (occlude.value !== "blending") targets = [scene.value];
7102
+ if (targets) visible = isObjectVisible(group, cam, raycaster, targets) && !behind;
7103
+ } else visible = !behind;
7104
+ if (visible !== isVisible.value) {
7105
+ isVisible.value = visible;
7106
+ el.value.style.display = visible ? "block" : "none";
7107
+ emits("onOcclude", !visible);
7108
+ changed = true;
7109
+ }
7110
+ const halfRange = Math.floor(zIndexRange.value[0] / 2);
7111
+ const zRange = occlude.value ? isRayCastOcclusion.value ? [zIndexRange.value[0], halfRange] : [halfRange - 1, 0] : zIndexRange.value;
7112
+ el.value.style.zIndex = `${objectZIndex(group, cam, zRange)}`;
7113
+ if (transform.value) {
7114
+ const persp = cam.projectionMatrix.elements[5] * heightHalf;
7115
+ const camMatrix = getCameraCSSMatrix(cam.matrixWorldInverse);
7116
+ const isOrtho = cam instanceof OrthographicCamera;
7117
+ const cameraTransform = isOrtho ? `scale(${persp})translate(${epsilon(-(cam.right + cam.left) / 2)}px,${epsilon((cam.top + cam.bottom) / 2)}px)` : `translateZ(${persp}px)`;
7118
+ let finalMatrix = group.matrixWorld;
7119
+ if (sprite.value) {
7120
+ tmpMatrix.copy(group.matrixWorld);
7121
+ const invCamMat = cam.matrixWorldInverse.clone().transpose();
7122
+ tmpQuat.setFromRotationMatrix(invCamMat);
7123
+ tmpMatrix.makeRotationFromQuaternion(tmpQuat);
7124
+ group.getWorldPosition(tmpVec);
7125
+ tmpMatrix.setPosition(tmpVec);
7126
+ tmpMatrix.scale(group.scale);
7127
+ tmpMatrix.elements[3] = tmpMatrix.elements[7] = tmpMatrix.elements[11] = 0;
7128
+ tmpMatrix.elements[15] = 1;
7129
+ finalMatrix = tmpMatrix;
7130
+ }
7131
+ const style = el.value.style;
7132
+ style.width = `${width}px`;
7133
+ style.height = `${height}px`;
7134
+ style.perspective = isOrtho ? "" : `${persp}px`;
7135
+ if (vnode.value?.el) {
7136
+ vnode.value.el.style.transform = `${cameraTransform}${camMatrix}translate(${widthHalf}px,${heightHalf}px)`;
7137
+ let inner;
7138
+ if (Array.isArray(vnode.value.children)) inner = vnode.value.children[0];
7139
+ if (inner?.el) inner.el.style.transform = getObjectCSSMatrix(finalMatrix, 1 / ((distanceFactor.value || 10) / 400));
7064
7140
  }
7065
- previousPosition.value = vector;
7066
- previousZoom.value = camera.activeCamera.value.zoom;
7141
+ } else {
7142
+ const scale = distanceFactor.value === void 0 ? 1 : objectScale(group, cam) * distanceFactor.value;
7143
+ el.value.style.transform = `translate3d(${newPos[0]}px,${newPos[1]}px,0) scale(${scale})`;
7067
7144
  }
7068
- if (!isRayCastOcclusion.value && meshRef.value && !isMeshSizeSet.value) if (transform.value) {
7069
- if (vnode.value?.el && vnode.value?.children) {
7070
- const el$1 = (vnode.value?.children)[0];
7071
- if (el$1?.clientWidth && el$1?.clientHeight) {
7072
- const { isOrthographicCamera: isOrthographicCamera$2 } = camera.activeCamera.value;
7073
- if (isOrthographicCamera$2 || geometry) {
7074
- if (attrs.scale) if (!Array.isArray(attrs.scale)) meshRef.value.scale.setScalar(1 / attrs.scale);
7075
- else if (attrs.scale instanceof Vector3) meshRef.value.scale.copy(attrs.scale.clone().divideScalar(1));
7076
- else meshRef.value.scale.set(1 / attrs.scale[0], 1 / attrs.scale[1], 1 / attrs.scale[2]);
7077
- } else {
7078
- const ratio = (distanceFactor?.value || 10) / 400;
7079
- const w = el$1.clientWidth * ratio;
7080
- const h = el$1.clientHeight * ratio;
7081
- meshRef.value.scale.set(w, h, 1);
7145
+ previousPosition.value = [
7146
+ newPos[0],
7147
+ newPos[1],
7148
+ newPos[2]
7149
+ ];
7150
+ previousZoom.value = cam.zoom;
7151
+ if (!isRayCastOcclusion.value && occlusionMeshRef.value && !isMeshSizeSet.value) {
7152
+ const mesh = occlusionMeshRef.value;
7153
+ if (transform.value) {
7154
+ const children = vnode.value?.children;
7155
+ if (Array.isArray(children)) {
7156
+ const element = children[0]?.el;
7157
+ if (element) {
7158
+ const isOrtho = cam instanceof OrthographicCamera;
7159
+ if (isOrtho && geometry.value && attrs.scale) if (!Array.isArray(attrs.scale)) mesh.scale.setScalar(1 / attrs.scale);
7160
+ else if (attrs.scale instanceof Vector3) mesh.scale.copy(attrs.scale);
7161
+ else mesh.scale.set(1 / attrs.scale[0], 1 / attrs.scale[1], 1 / attrs.scale[2]);
7162
+ else if (!isOrtho && !geometry.value) {
7163
+ const ratio = (distanceFactor.value || 10) / 400;
7164
+ if (sprite.value) {
7165
+ effectiveMaterial.value.uniforms.uWidth.value = element.clientWidth * ratio;
7166
+ effectiveMaterial.value.uniforms.uHeight.value = element.clientHeight * ratio;
7167
+ mesh.lookAt(cam.position);
7168
+ mesh.scale.set(1, 1, 1);
7169
+ } else {
7170
+ const w = element.clientWidth * ratio;
7171
+ const h = element.clientHeight * ratio;
7172
+ mesh.scale.set(w, h, 1);
7173
+ }
7174
+ }
7175
+ isMeshSizeSet.value = true;
7082
7176
  }
7177
+ }
7178
+ } else {
7179
+ const element = el.value.children[0];
7180
+ if (element?.clientWidth && element?.clientHeight) {
7181
+ group.getWorldPosition(tmpVec);
7182
+ const ratio = 1 / getViewportFactor(cam, tmpVec, {
7183
+ width,
7184
+ height
7185
+ });
7186
+ effectiveMaterial.value.uniforms.uWidth.value = element.clientWidth * ratio;
7187
+ effectiveMaterial.value.uniforms.uHeight.value = element.clientHeight * ratio;
7188
+ mesh.scale.set(1, 1, 1);
7189
+ mesh.lookAt(cam.position);
7083
7190
  isMeshSizeSet.value = true;
7084
7191
  }
7085
7192
  }
7086
- } else {
7087
- const ele = el.value.children[0];
7088
- if (ele?.clientWidth && ele?.clientHeight) {
7089
- const ratio = 1 / 1;
7090
- const w = ele.clientWidth * ratio;
7091
- const h = ele.clientHeight * ratio;
7092
- meshRef.value.scale.set(w, h, 1);
7093
- isMeshSizeSet.value = true;
7094
- }
7095
- occlusionMeshRef.value.lookAt(camera.activeCamera.value?.position);
7096
7193
  }
7097
- });
7098
- const shaders = computed(() => ({
7099
- vertexShader: transform.value ? void 0 : vertex_default,
7100
- fragmentShader: fragment_default
7101
- }));
7102
- const shaderMaterial$1 = computed(() => {
7103
- const shader = shaders.value;
7104
- return material.value || new ShaderMaterial({
7105
- vertexShader: shader.vertexShader,
7106
- fragmentShader: shader.fragmentShader,
7107
- side: DoubleSide
7108
- });
7194
+ if (changed) invalidate();
7109
7195
  });
7110
7196
  onUnmounted(() => {
7111
- if (shaderMaterial$1.value) shaderMaterial$1.value.dispose();
7112
- el.value.remove();
7197
+ defaultPlaneGeometry?.dispose();
7198
+ effectiveMaterial.value?.dispose();
7199
+ if (el.value?.parentNode) el.value.parentNode.removeChild(el.value);
7200
+ });
7201
+ __expose({
7202
+ instance: groupRef,
7203
+ isVisible,
7204
+ occlusionMesh: occlusionMeshRef
7113
7205
  });
7114
- __expose({ instance: groupRef });
7115
7206
  return (_ctx, _cache) => {
7116
- return openBlock(), createElementBlock("TresGroup", {
7207
+ return openBlock(), createElementBlock("TresGroup", mergeProps(_ctx.$attrs, {
7117
7208
  ref_key: "groupRef",
7118
7209
  ref: groupRef
7119
- }, [unref(occlude) && !isRayCastOcclusion.value ? (openBlock(), createElementBlock("TresMesh", {
7210
+ }), [unref(occlude) && !isRayCastOcclusion.value ? (openBlock(), createElementBlock("TresMesh", {
7120
7211
  key: 0,
7121
- ref_key: "meshRef",
7122
- ref: meshRef,
7123
- geometry: unref(geometry),
7124
- material: shaderMaterial$1.value
7125
- }, null, 8, _hoisted_1$33)) : createCommentVNode("v-if", true)], 512);
7212
+ ref_key: "occlusionMeshRef",
7213
+ ref: occlusionMeshRef,
7214
+ material: effectiveMaterial.value,
7215
+ "cast-shadow": unref(castShadow),
7216
+ "receive-shadow": unref(receiveShadow),
7217
+ geometry: unref(geometry) || unref(defaultPlaneGeometry)
7218
+ }, null, 8, _hoisted_1$33)) : createCommentVNode("v-if", true)], 16);
7126
7219
  };
7127
7220
  }
7128
7221
  });
@@ -10726,6 +10819,111 @@ var Smoke_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
10726
10819
  //#region src/core/staging/Smoke.vue
10727
10820
  var Smoke_default = Smoke_vue_vue_type_script_setup_true_lang_default;
10728
10821
 
10822
+ //#endregion
10823
+ //#region src/core/staging/CameraShake.vue?vue&type=script&setup=true&lang.ts
10824
+ var CameraShake_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
10825
+ __name: "CameraShake",
10826
+ props: {
10827
+ intensity: {
10828
+ type: Number,
10829
+ required: false,
10830
+ default: 1
10831
+ },
10832
+ decay: {
10833
+ type: Boolean,
10834
+ required: false,
10835
+ default: false
10836
+ },
10837
+ decayRate: {
10838
+ type: Number,
10839
+ required: false,
10840
+ default: .65
10841
+ },
10842
+ maxYaw: {
10843
+ type: Number,
10844
+ required: false,
10845
+ default: .01
10846
+ },
10847
+ maxPitch: {
10848
+ type: Number,
10849
+ required: false,
10850
+ default: .01
10851
+ },
10852
+ maxRoll: {
10853
+ type: Number,
10854
+ required: false,
10855
+ default: .01
10856
+ },
10857
+ yawFrequency: {
10858
+ type: Number,
10859
+ required: false,
10860
+ default: .1
10861
+ },
10862
+ pitchFrequency: {
10863
+ type: Number,
10864
+ required: false,
10865
+ default: .1
10866
+ },
10867
+ rollFrequency: {
10868
+ type: Number,
10869
+ required: false,
10870
+ default: .1
10871
+ }
10872
+ },
10873
+ setup(__props) {
10874
+ const props = __props;
10875
+ const { intensity, decay, decayRate, maxYaw, maxPitch, maxRoll, yawFrequency, pitchFrequency, rollFrequency } = toRefs(props);
10876
+ const { camera, controls } = useTresContext();
10877
+ let cleanUpFn = null;
10878
+ const currentIntensity = shallowRef(props.intensity);
10879
+ const initialRotation = shallowRef(camera.activeCamera.value?.rotation.clone());
10880
+ const yawNoise = new SimplexNoise();
10881
+ const pitchNoise = new SimplexNoise();
10882
+ const rollNoise = new SimplexNoise();
10883
+ function constrainIntensity() {
10884
+ if (currentIntensity.value < 0) currentIntensity.value = 0;
10885
+ if (currentIntensity.value > 1) currentIntensity.value = 1;
10886
+ }
10887
+ watch(intensity, (newVal) => {
10888
+ currentIntensity.value = newVal;
10889
+ constrainIntensity();
10890
+ });
10891
+ function updateInitialRotation() {
10892
+ if (camera.activeCamera.value) initialRotation.value = camera.activeCamera.value.rotation.clone();
10893
+ }
10894
+ watch([camera.activeCamera, controls], () => {
10895
+ cleanUpFn?.();
10896
+ if (controls.value) cleanUpFn = useEventListener(controls.value, "change", updateInitialRotation);
10897
+ updateInitialRotation();
10898
+ });
10899
+ function setIntensity(v) {
10900
+ currentIntensity.value = Math.min(1, Math.max(0, v));
10901
+ }
10902
+ const { onBeforeRender } = useLoop();
10903
+ onBeforeRender(({ elapsed, delta }) => {
10904
+ const cam = camera.activeCamera.value;
10905
+ if (!cam) return;
10906
+ if (!decay.value && currentIntensity.value < intensity.value) setIntensity(currentIntensity.value + decayRate.value * delta);
10907
+ const shakeFactor = currentIntensity.value * currentIntensity.value;
10908
+ const yaw = maxYaw.value * shakeFactor * yawNoise.noise(elapsed * yawFrequency.value, 1);
10909
+ const pitch = maxPitch.value * shakeFactor * pitchNoise.noise(elapsed * pitchFrequency.value, 1);
10910
+ const roll = maxRoll.value * shakeFactor * rollNoise.noise(elapsed * rollFrequency.value, 1);
10911
+ cam.rotation.set(initialRotation.value.x + pitch, initialRotation.value.y + yaw, initialRotation.value.z + roll);
10912
+ if (decay.value) setIntensity(currentIntensity.value - decayRate.value * delta);
10913
+ });
10914
+ onUnmounted(() => {
10915
+ cleanUpFn?.();
10916
+ });
10917
+ return (_ctx, _cache) => {
10918
+ return renderSlot(_ctx.$slots, "default");
10919
+ };
10920
+ }
10921
+ });
10922
+
10923
+ //#endregion
10924
+ //#region src/core/staging/CameraShake.vue
10925
+ var CameraShake_default = CameraShake_vue_vue_type_script_setup_true_lang_default;
10926
+
10729
10927
  //#endregion
10730
10928
  //#region src/core/staging/SoftShadows.vue?vue&type=script&setup=true&lang.ts
10731
10929
  const PCSSGetShadow = `
@@ -11520,7 +11718,8 @@ const _hoisted_3$1 = [
11520
11718
  "castShadow",
11521
11719
  "shadow-bias",
11522
11720
  "shadow-normalBias",
11523
- "shadow-mapSize"
11721
+ "shadow-mapSize-x",
11722
+ "shadow-mapSize-y"
11524
11723
  ];
11525
11724
  const _hoisted_4$1 = ["position", "intensity"];
11526
11725
  const _hoisted_5 = ["position"];
@@ -11688,7 +11887,8 @@ var Stage_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
11688
11887
  castShadow: !!__props.shadows,
11689
11888
  "shadow-bias": __props.shadows?.bias ?? 0,
11690
11889
  "shadow-normalBias": __props.shadows?.normalBias ?? 0,
11691
- "shadow-mapSize": __props.shadows?.size ?? 1024
11890
+ "shadow-mapSize-x": __props.shadows?.size ?? 1024,
11891
+ "shadow-mapSize-y": __props.shadows?.size ?? 1024
11692
11892
  }, null, 8, _hoisted_3$1),
11693
11893
  createElementVNode("TresPointLight", {
11694
11894
  position: lightingFillComputed.value,
@@ -12201,4 +12401,4 @@ function extractBindingPosition(binding) {
12201
12401
  }
12202
12402
 
12203
12403
  //#endregion
12204
- export { component_default as AccumulativeShadows, Align_default as Align, component_default$1 as AnimatedSprite, Backdrop_default as Backdrop, BakeShadows, BaseCameraControls, Billboard_default as Billboard, component_default$2 as Bounds, Box_default as Box, CameraControls_default as CameraControls, CatmullRomCurve3_default as CatmullRomCurve3, Circle_default as Circle, CircleShadow_default as CircleShadow, Cone_default as Cone, ContactShadows_default as ContactShadows, component_default$3 as CubeCamera, CubicBezierLine_default as CubicBezierLine, customShaderMaterial_default as CustomShaderMaterial, Cylinder_default as Cylinder, Dodecahedron_default as Dodecahedron, Edges_default as Edges, component_default$4 as Environment, component_default$5 as FBXModel, component_default$6 as Fbo, Fit_default as Fit, component_default$7 as GLTFModel, GlobalAudio, GradientTexture_default as GradientTexture, Grid_default as Grid, component_default$8 as Helper, holographicMaterial_default as HolographicMaterial, HTML_default as Html, Icosahedron_default as Icosahedron, component_default$9 as Image, KeyboardControls_default as KeyboardControls, LOD_default as LOD, component_default$10 as Lensflare, Levioso_default as Levioso, lightformer_default as Lightformer, Line2_default as Line2, MapControls_default as MapControls, MarchingCube_default as MarchingCube, MarchingCubes_default as MarchingCubes, MarchingPlane_default as MarchingPlane, component_default$11 as Mask, meshDiscardMaterial_default as MeshDiscardMaterial, meshGlassMaterial_default as MeshGlassMaterial, meshReflectionMaterial_default as MeshReflectionMaterial, meshWobbleMaterial_default as MeshWobbleMaterial, MouseParallax_default as MouseParallax, Ocean_default as Ocean, Octahedron_default as Octahedron, OrbitControls_default as OrbitControls, component_default$12 as Outline, Plane_default as Plane, component_default$13 as PointMaterial, PointerLockControls_default as PointerLockControls, PositionalAudio_default as PositionalAudio, Precipitation_default as Precipitation, QuadraticBezierLine_default as QuadraticBezierLine, component_default$14 as RandomizedLights, Reflector_default as Reflector, Ring_default as Ring, RoundedBox_default as RoundedBox, component_default$15 as Sampler, ScreenQuad_default as ScreenQuad, ScreenSizer_default as ScreenSizer, ScreenSpace_default as ScreenSpace, ScrollControls_default as ScrollControls, Sky_default as Sky, Smoke_default as Smoke, SoftShadows_default as SoftShadows, component_default$16 as Sparkles, Sphere_default as Sphere, Stage_default as Stage, Stars_default as Stars, Stats, StatsGl, Superformula_default as Superformula, Tetrahedron_default as Tetrahedron, Text3D_default as Text3D, Torus_default as Torus, TorusKnot_default as TorusKnot, TransformControls_default as TransformControls, Tube_default as Tube, component_default$17 as UseSVG, component_default$18 as UseTexture, extractBindingPosition, hasSetter, pick, useAnimations, useEnvironment, useFBO, useFBX, useGLTF, useGLTFExporter, useIntersect, useMask, useProgress, useSVG, useSurfaceSampler, useTexture, useTextures, useVideoTexture };
12404
+ export { component_default as AccumulativeShadows, Align_default as Align, component_default$1 as AnimatedSprite, Backdrop_default as Backdrop, BakeShadows, BaseCameraControls, Billboard_default as Billboard, component_default$2 as Bounds, Box_default as Box, CameraControls_default as CameraControls, CameraShake_default as CameraShake, CatmullRomCurve3_default as CatmullRomCurve3, Circle_default as Circle, CircleShadow_default as CircleShadow, Cone_default as Cone, ContactShadows_default as ContactShadows, component_default$3 as CubeCamera, CubicBezierLine_default as CubicBezierLine, customShaderMaterial_default as CustomShaderMaterial, Cylinder_default as Cylinder, Dodecahedron_default as Dodecahedron, Edges_default as Edges, component_default$4 as Environment, component_default$5 as FBXModel, component_default$6 as Fbo, Fit_default as Fit, component_default$7 as GLTFModel, GlobalAudio, GradientTexture_default as GradientTexture, Grid_default as Grid, component_default$8 as Helper, holographicMaterial_default as HolographicMaterial, HTML_default as Html, Icosahedron_default as Icosahedron, component_default$9 as Image, KeyboardControls_default as KeyboardControls, LOD_default as LOD, component_default$10 as Lensflare, Levioso_default as Levioso, lightformer_default as Lightformer, Line2_default as Line2, MapControls_default as MapControls, MarchingCube_default as MarchingCube, MarchingCubes_default as MarchingCubes, MarchingPlane_default as MarchingPlane, component_default$11 as Mask, meshDiscardMaterial_default as MeshDiscardMaterial, meshGlassMaterial_default as MeshGlassMaterial, meshReflectionMaterial_default as MeshReflectionMaterial, meshWobbleMaterial_default as MeshWobbleMaterial, MouseParallax_default as MouseParallax, Ocean_default as Ocean, Octahedron_default as Octahedron, OrbitControls_default as OrbitControls, component_default$12 as Outline, Plane_default as Plane, component_default$13 as PointMaterial, PointerLockControls_default as PointerLockControls, PositionalAudio_default as PositionalAudio, Precipitation_default as Precipitation, QuadraticBezierLine_default as QuadraticBezierLine, component_default$14 as RandomizedLights, Reflector_default as Reflector, Ring_default as Ring, RoundedBox_default as RoundedBox, component_default$15 as Sampler, ScreenQuad_default as ScreenQuad, ScreenSizer_default as ScreenSizer, ScreenSpace_default as ScreenSpace, ScrollControls_default as ScrollControls, Sky_default as Sky, Smoke_default as Smoke, SoftShadows_default as SoftShadows, component_default$16 as Sparkles, Sphere_default as Sphere, Stage_default as Stage, Stars_default as Stars, Stats, StatsGl, Superformula_default as Superformula, Tetrahedron_default as Tetrahedron, Text3D_default as Text3D, Torus_default as Torus, TorusKnot_default as TorusKnot, TransformControls_default as TransformControls, Tube_default as Tube, component_default$17 as UseSVG, component_default$18 as UseTexture, extractBindingPosition, hasSetter, pick, useAnimations, useEnvironment, useFBO, useFBX, useGLTF, useGLTFExporter, useIntersect, useMask, useProgress, useSVG, useSurfaceSampler, useTexture, useTextures, useVideoTexture };