@tresjs/cientos 4.3.0 → 5.0.0-alpha.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.
Files changed (108) hide show
  1. package/dist/core/abstractions/AnimatedSprite/component.vue.d.ts +14 -4
  2. package/dist/core/abstractions/Billboard.vue.d.ts +24 -6
  3. package/dist/core/abstractions/CubeCamera/component.vue.d.ts +14 -4
  4. package/dist/core/abstractions/CubeCamera/useCubeCamera.d.ts +3 -2
  5. package/dist/core/abstractions/Edges.vue.d.ts +15 -5
  6. package/dist/core/abstractions/GradientTexture.vue.d.ts +14 -1
  7. package/dist/core/abstractions/Image/ImageMaterial.vue.d.ts +3 -1
  8. package/dist/core/abstractions/Image/component.vue.d.ts +3 -9
  9. package/dist/core/abstractions/Lensflare/LensflareImpl.d.ts +23 -0
  10. package/dist/core/abstractions/Lensflare/component.vue.d.ts +12 -3
  11. package/dist/core/abstractions/Levioso.vue.d.ts +22 -16
  12. package/dist/core/abstractions/MarchingCubes/MarchingCube.vue.d.ts +22 -0
  13. package/dist/core/abstractions/MarchingCubes/MarchingCubes.vue.d.ts +35 -0
  14. package/dist/core/abstractions/MarchingCubes/MarchingPlane.vue.d.ts +20 -0
  15. package/dist/core/abstractions/MarchingCubes/const.d.ts +2 -0
  16. package/dist/core/abstractions/Mask/component.vue.d.ts +15 -5
  17. package/dist/core/abstractions/MouseParallax.vue.d.ts +11 -1
  18. package/dist/core/abstractions/Outline/component.vue.d.ts +12 -2
  19. package/dist/core/abstractions/PositionalAudio.vue.d.ts +11 -2
  20. package/dist/core/abstractions/Reflector.vue.d.ts +5 -2
  21. package/dist/core/abstractions/ScreenSizer.vue.d.ts +24 -6
  22. package/dist/core/abstractions/ScreenSpace.vue.d.ts +14 -4
  23. package/dist/core/abstractions/Text3D.vue.d.ts +14 -4
  24. package/dist/core/abstractions/index.d.ts +4 -1
  25. package/dist/core/abstractions/useAnimations.d.ts +4 -4
  26. package/dist/core/abstractions/useSurfaceSampler/component.vue.d.ts +14 -4
  27. package/dist/core/abstractions/useSurfaceSampler/index.d.ts +3 -2
  28. package/dist/core/controls/CameraControls.vue.d.ts +4 -2
  29. package/dist/core/controls/Helper/component.vue.d.ts +16 -0
  30. package/dist/core/controls/Helper/useHelper.d.ts +10 -0
  31. package/dist/core/controls/MapControls.vue.d.ts +3 -1
  32. package/dist/core/controls/OrbitControls.vue.d.ts +3 -1
  33. package/dist/core/controls/PointerLockControls.vue.d.ts +3 -1
  34. package/dist/core/controls/ScrollControls.vue.d.ts +23 -18
  35. package/dist/core/controls/TransformControls.vue.d.ts +3 -1
  36. package/dist/core/controls/index.d.ts +2 -1
  37. package/dist/core/loaders/index.d.ts +6 -2
  38. package/dist/core/loaders/useFBX/component.vue.d.ts +4 -11
  39. package/dist/core/loaders/useFBX/index.d.ts +28 -5
  40. package/dist/core/loaders/useGLTF/component.vue.d.ts +3 -15
  41. package/dist/core/loaders/useGLTF/index.d.ts +31 -27
  42. package/dist/core/loaders/{SVG → useSVG}/component.vue.d.ts +2 -1
  43. package/dist/core/loaders/useSVG/index.d.ts +65 -0
  44. package/dist/core/loaders/useTexture/component.vue.d.ts +5134 -0
  45. package/dist/core/loaders/useTexture/index.d.ts +3 -0
  46. package/dist/core/loaders/useTextures/index.d.ts +13 -0
  47. package/dist/core/materials/customShaderMaterial/index.vue.d.ts +3 -1
  48. package/dist/core/materials/holographicMaterial/index.vue.d.ts +7 -16
  49. package/dist/core/materials/index.d.ts +2 -1
  50. package/dist/core/materials/meshDiscardMaterial/index.vue.d.ts +3 -1
  51. package/dist/core/materials/meshGlassMaterial/index.vue.d.ts +3 -1
  52. package/dist/core/materials/meshGlassMaterial/material.d.ts +11 -2
  53. package/dist/core/materials/meshReflectionMaterial/index.vue.d.ts +7 -5
  54. package/dist/core/materials/meshWobbleMaterial/index.vue.d.ts +7 -7
  55. package/dist/core/materials/pointMaterial/component.vue.d.ts +8 -0
  56. package/dist/core/materials/pointMaterial/material.d.ts +4 -0
  57. package/dist/core/misc/LOD.vue.d.ts +52 -0
  58. package/dist/core/misc/html/HTML.vue.d.ts +25 -7
  59. package/dist/core/misc/index.d.ts +3 -1
  60. package/dist/core/misc/useIntersect.d.ts +9 -0
  61. package/dist/core/shapes/Box.vue.d.ts +14 -4
  62. package/dist/core/shapes/Circle.vue.d.ts +15 -5
  63. package/dist/core/shapes/Cone.vue.d.ts +14 -4
  64. package/dist/core/shapes/CubicBezierLine.vue.d.ts +49 -0
  65. package/dist/core/shapes/Cylinder.vue.d.ts +14 -4
  66. package/dist/core/shapes/Dodecahedron.vue.d.ts +14 -4
  67. package/dist/core/shapes/Icosahedron.vue.d.ts +14 -4
  68. package/dist/core/shapes/Line2.vue.d.ts +2 -2
  69. package/dist/core/shapes/Octahedron.vue.d.ts +14 -4
  70. package/dist/core/shapes/Plane.vue.d.ts +15 -5
  71. package/dist/core/shapes/QuadraticBezierLine.vue.d.ts +48 -0
  72. package/dist/core/shapes/Ring.vue.d.ts +14 -4
  73. package/dist/core/shapes/RoundedBox.vue.d.ts +14 -4
  74. package/dist/core/shapes/ScreenQuad.vue.d.ts +38 -0
  75. package/dist/core/shapes/Sphere.vue.d.ts +14 -4
  76. package/dist/core/shapes/Superformula.vue.d.ts +14 -4
  77. package/dist/core/shapes/Tetrahedron.vue.d.ts +14 -4
  78. package/dist/core/shapes/Torus.vue.d.ts +14 -4
  79. package/dist/core/shapes/TorusKnot.vue.d.ts +14 -4
  80. package/dist/core/shapes/Tube.vue.d.ts +14 -4
  81. package/dist/core/shapes/index.d.ts +4 -1
  82. package/dist/core/staging/AccumulativeShadows/ProgressiveLightMap.d.ts +35 -0
  83. package/dist/core/staging/AccumulativeShadows/SoftShadowMaterial.d.ts +10 -0
  84. package/dist/core/staging/AccumulativeShadows/component.vue.d.ts +115 -0
  85. package/dist/core/staging/Align.vue.d.ts +46 -16
  86. package/dist/core/staging/Backdrop.vue.d.ts +23 -5
  87. package/dist/core/staging/Bounds/Bounds.d.ts +73 -0
  88. package/dist/core/staging/Bounds/component.vue.d.ts +60 -0
  89. package/dist/core/staging/CircleShadow.vue.d.ts +27 -0
  90. package/dist/core/staging/ContactShadows.vue.d.ts +2 -2
  91. package/dist/core/staging/Fit.vue.d.ts +35 -9
  92. package/dist/core/staging/Grid.vue.d.ts +11 -2
  93. package/dist/core/staging/Ocean.vue.d.ts +5 -2
  94. package/dist/core/staging/Precipitation.vue.d.ts +18 -1
  95. package/dist/core/staging/RandomizedLights/RandomizedLights.d.ts +29 -0
  96. package/dist/core/staging/RandomizedLights/component.vue.d.ts +43 -0
  97. package/dist/core/staging/Sky.vue.d.ts +1 -1
  98. package/dist/core/staging/Smoke.vue.d.ts +18 -1
  99. package/dist/core/staging/Sparkles/component.vue.d.ts +1 -1
  100. package/dist/core/staging/Stage.vue.d.ts +677 -0
  101. package/dist/core/staging/Stars.vue.d.ts +10 -1
  102. package/dist/core/staging/index.d.ts +6 -1
  103. package/dist/core/staging/useEnvironment/component.vue.d.ts +7 -4
  104. package/dist/core/staging/useEnvironment/lightformer/index.vue.d.ts +24 -13
  105. package/dist/trescientos.js +52469 -11173
  106. package/package.json +29 -27
  107. package/dist/composables/useLogger.d.ts +0 -8
  108. package/dist/trescientos.umd.cjs +0 -1721
@@ -1,3 +1,4 @@
1
+ import { Group } from 'three';
1
2
  export interface FBXModelProps {
2
3
  /**
3
4
  * Path to the FBX file.
@@ -28,17 +29,9 @@ export interface FBXModelProps {
28
29
  */
29
30
  receiveShadow?: boolean;
30
31
  }
31
- declare const _default: import('vue').DefineComponent<{
32
- path: string;
33
- castShadow?: boolean;
34
- receiveShadow?: boolean;
35
- }, {
36
- instance: import('vue').Ref<any, any>;
37
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
38
- path: string;
39
- castShadow?: boolean;
40
- receiveShadow?: boolean;
41
- }> & Readonly<{}>, {
32
+ declare const _default: import('vue').DefineComponent<FBXModelProps, {
33
+ instance: import('vue').Ref<Group<import('three').Object3DEventMap> | null, Group<import('three').Object3DEventMap> | null>;
34
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FBXModelProps> & Readonly<{}>, {
42
35
  castShadow: boolean;
43
36
  receiveShadow: boolean;
44
37
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -1,9 +1,32 @@
1
+ import { TresObject } from '@tresjs/core';
2
+ import { ComputedRef, MaybeRef, Ref } from 'vue';
1
3
  import { Group } from 'three';
4
+ export interface UseFBXOptions {
5
+ /**
6
+ * A traverse function applied to the scene upon loading the model.
7
+ * @type {Function}
8
+ */
9
+ traverse?: (child: TresObject) => void;
10
+ }
2
11
  /**
3
- * Loads an FBX file and returns a THREE.Object3D.
12
+ * Vue composable for loading FBX models in TresJS
4
13
  *
5
- * @export
6
- * @param {(string | string[])} path
7
- * @return {*} {Promise<Group>}
14
+ * @remarks
15
+ * This composable uses Three.js FBXLoader under the hood to load FBX 3D models.
16
+ * The loaded model is automatically parsed and made available as a reactive state.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const { state: model } = useFBX('/path/to/model.fbx')
21
+ * ```
22
+ *
23
+ * @param {MaybeRef<string>} path - Path to the FBX model file
24
+ * @returns {{ state: Group, isLoading: boolean, execute: () => Promise<void>, nodes: object, materials: object }} Object containing the model state, loading state, reload function, and parsed nodes/materials
8
25
  */
9
- export declare function useFBX<T extends string | string[]>(path: T): Promise<T extends string[] ? Group[] : Group>;
26
+ export declare function useFBX(path: MaybeRef<string>, options?: UseFBXOptions): {
27
+ state: Ref<Group | null>;
28
+ isLoading: Ref<boolean>;
29
+ execute: (delay?: number, ...args: any[]) => Promise<Group>;
30
+ nodes: ComputedRef<Record<string, any>>;
31
+ materials: ComputedRef<Record<string, any>>;
32
+ };
@@ -50,21 +50,9 @@ export interface GLTFModelProps {
50
50
  */
51
51
  decoderPath?: string;
52
52
  }
53
- declare const _default: import('vue').DefineComponent<{
54
- path: string;
55
- draco?: boolean;
56
- decoderPath?: string;
57
- castShadow?: boolean;
58
- receiveShadow?: boolean;
59
- }, {
60
- instance: import('vue').Ref<any, any>;
61
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
62
- path: string;
63
- draco?: boolean;
64
- decoderPath?: string;
65
- castShadow?: boolean;
66
- receiveShadow?: boolean;
67
- }> & Readonly<{}>, {
53
+ declare const _default: import('vue').DefineComponent<GLTFModelProps, {
54
+ instance: import('vue').Ref<import('three-stdlib').GLTF | null, import('three-stdlib').GLTF | null>;
55
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<GLTFModelProps> & Readonly<{}>, {
68
56
  castShadow: boolean;
69
57
  receiveShadow: boolean;
70
58
  draco: boolean;
@@ -1,39 +1,43 @@
1
- import { TresLoader, TresObject3D } from '@tresjs/core';
2
- import { DRACOLoader, GLTF } from 'three-stdlib';
3
- import { AnimationClip, Material, Scene } from 'three';
4
- export interface GLTFLoaderOptions {
1
+ import { TresObject } from '@tresjs/core';
2
+ import { ComputedRef, MaybeRef, Ref } from 'vue';
3
+ import { GLTF } from 'three-stdlib';
4
+ export interface UseGLTFOptions {
5
5
  /**
6
- * Whether to use Draco compression.
7
- *
6
+ * Whether to use DRACO compression for loading the model
8
7
  * @type {boolean}
9
- * @memberof GLTFLoaderOptions
10
8
  */
11
9
  draco?: boolean;
12
10
  /**
13
- * The path to the Draco decoder.
14
- *
11
+ * Path to the DRACO decoder. Defaults to https://www.gstatic.com/draco/versioned/decoders/1.5.6/
15
12
  * @type {string}
16
- * @memberof GLTFLoaderOptions
17
13
  */
18
14
  decoderPath?: string;
19
- }
20
- export interface GLTFResult {
21
- animations: Array<AnimationClip>;
22
- nodes: Record<string, TresObject3D>;
23
- materials: Record<string, Material>;
24
- scene: Scene;
25
- }
26
- export interface TresGLTFLoaderType extends TresLoader<GLTF> {
27
- setDRACOLoader?: (dracoLoader: DRACOLoader) => void;
15
+ /**
16
+ * A traverse function applied to the scene upon loading the model.
17
+ * @type {Function}
18
+ */
19
+ traverse?: (child: TresObject) => void;
28
20
  }
29
21
  /**
30
- * Loads a GLTF file and returns a THREE.Object3D.
22
+ * Vue composable for loading GLTF models in TresJS
23
+ *
24
+ * @remarks
25
+ * This composable uses Three.js GLTFLoader under the hood and supports DRACO compression.
26
+ * When DRACO compression is enabled, it will use the specified decoder path or fallback to Google's CDN.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const { state: model } = useGLTF('/path/to/model.glb', { draco: true })
31
+ * ```
31
32
  *
32
- * @export
33
- * @template T
34
- * @param {T} path - Path or array of paths to the GLTF file(s)
35
- * @param {GLTFLoaderOptions} [options] - Options for the loader
36
- * @param {(loader: TresGLTFLoaderType) => void} [extendLoader] - Function to extend the loader
37
- * @returns {Promise<T extends string[] ? GLTFResult[] : GLTFResult>} Promise that resolves with the loaded model(s)
33
+ * @param {MaybeRef<string>} path - Path to the GLTF model file
34
+ * @param {UseGLTFOptions} options - Options for loading the model
35
+ * @returns {{ state: GLTF, isLoading: boolean, execute: () => Promise<void> }} Object containing the model state, loading state and reload function
38
36
  */
39
- export declare function useGLTF<T extends string | string[]>(path: T, options?: GLTFLoaderOptions, extendLoader?: (loader: TresGLTFLoaderType) => void): Promise<T extends string[] ? GLTFResult[] : GLTFResult>;
37
+ export declare function useGLTF(path: MaybeRef<string>, options?: UseGLTFOptions): {
38
+ state: Ref<GLTF | null>;
39
+ isLoading: Ref<boolean>;
40
+ execute: (delay?: number, ...args: any[]) => Promise<GLTF>;
41
+ nodes: ComputedRef<Record<string, any>>;
42
+ materials: ComputedRef<Record<string, any>>;
43
+ };
@@ -91,7 +91,8 @@ interface SVGProps {
91
91
  depth?: 'renderOrder' | 'flat' | 'offsetZ' | number;
92
92
  }
93
93
  declare const _default: import('vue').DefineComponent<SVGProps, {
94
- instance: import('vue').ShallowRef<any, any>;
94
+ instance: import('vue').Ref<import('three-stdlib').SVGResult | null, import('three-stdlib').SVGResult | null>;
95
+ layers: import('vue').ComputedRef<import('.').SVGLayer[]>;
95
96
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SVGProps> & Readonly<{}>, {
96
97
  depth: "renderOrder" | "flat" | "offsetZ" | number;
97
98
  skipStrokes: boolean;
@@ -0,0 +1,65 @@
1
+ import { ComputedRef, MaybeRef, Ref } from 'vue';
2
+ import { BufferGeometry, MeshBasicMaterialParameters } from 'three';
3
+ import { SVGResult } from 'three-stdlib';
4
+ export interface UseSVGOptions {
5
+ /**
6
+ * Whether to skip rendering strokes
7
+ * @type {boolean}
8
+ * @default false
9
+ */
10
+ skipStrokes?: boolean;
11
+ /**
12
+ * Whether to skip rendering fills
13
+ * @type {boolean}
14
+ * @default false
15
+ */
16
+ skipFills?: boolean;
17
+ /**
18
+ * Fill material properties
19
+ * @type {MeshBasicMaterialParameters}
20
+ */
21
+ fillMaterial?: MeshBasicMaterialParameters;
22
+ /**
23
+ * Stroke material properties
24
+ * @type {MeshBasicMaterialParameters}
25
+ */
26
+ strokeMaterial?: MeshBasicMaterialParameters;
27
+ /**
28
+ * Depth type - how should the resulting meshes be rendered?
29
+ * 'renderOrder' disables depthWrite and sets renderOrder of each layer
30
+ * 'flat' disables depthWrite on materials
31
+ * 'offsetZ' enables depthWrite and inserts small distance between layers
32
+ * number is treated same as 'offsetZ' using the number as distance
33
+ * @type {'renderOrder' | 'flat' | 'offsetZ' | number}
34
+ * @default 'renderOrder'
35
+ */
36
+ depth?: 'renderOrder' | 'flat' | 'offsetZ' | number;
37
+ }
38
+ export interface SVGLayer {
39
+ geometry: BufferGeometry;
40
+ material: MeshBasicMaterialParameters;
41
+ isStroke: boolean;
42
+ }
43
+ /**
44
+ * Vue composable for loading SVG files in TresJS
45
+ *
46
+ * @remarks
47
+ * This composable uses Three.js SVGLoader under the hood to load and process SVG files
48
+ * into geometries and materials that can be rendered in a 3D scene.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const { state: svg, layers } = useSVG('/path/to/file.svg', { skipStrokes: false })
53
+ * ```
54
+ *
55
+ * @param {MaybeRef<string>} path - Path to the SVG file or SVG data string
56
+ * @param {UseSVGOptions} options - Options for processing the SVG
57
+ * @returns Object containing the SVG state, loading state, processed layers and disposal function
58
+ */
59
+ export declare function useSVG(path: MaybeRef<string>, options?: UseSVGOptions): {
60
+ state: Ref<SVGResult | null>;
61
+ isLoading: Ref<boolean>;
62
+ execute: (delay?: number, ...args: any[]) => Promise<SVGResult>;
63
+ layers: ComputedRef<SVGLayer[]>;
64
+ dispose: () => void;
65
+ };