@tresjs/cientos 5.0.0-next.6 → 5.0.0-rc.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.
- package/dist/core/abstractions/useAnimations.d.ts +4 -2
- package/dist/core/loaders/useFBX/component.vue.d.ts +1 -7221
- package/dist/core/loaders/useFBX/index.d.ts +32 -0
- package/dist/core/loaders/useGLTF/component.vue.d.ts +1 -1
- package/dist/core/loaders/useGLTF/index.d.ts +43 -0
- package/dist/core/loaders/useSVG/component.vue.d.ts +1 -1
- package/dist/core/loaders/useSVG/index.d.ts +65 -0
- package/dist/core/loaders/useTexture/component.vue.d.ts +5 -5
- package/dist/trescientos.js +14843 -12652
- package/package.json +21 -21
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TresObject } from '@tresjs/core';
|
|
2
|
+
import { ComputedRef, MaybeRef, Ref } from 'vue';
|
|
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
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Vue composable for loading FBX models in TresJS
|
|
13
|
+
*
|
|
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
|
|
25
|
+
*/
|
|
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
|
+
};
|
|
@@ -51,7 +51,7 @@ export interface GLTFModelProps {
|
|
|
51
51
|
decoderPath?: string;
|
|
52
52
|
}
|
|
53
53
|
declare const _default: import('vue').DefineComponent<GLTFModelProps, {
|
|
54
|
-
instance: import('vue').Ref<import('three-stdlib').GLTF, import('three-stdlib').GLTF>;
|
|
54
|
+
instance: import('vue').Ref<import('three-stdlib').GLTF | null, import('three-stdlib').GLTF | null>;
|
|
55
55
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<GLTFModelProps> & Readonly<{}>, {
|
|
56
56
|
castShadow: boolean;
|
|
57
57
|
receiveShadow: boolean;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TresObject } from '@tresjs/core';
|
|
2
|
+
import { ComputedRef, MaybeRef, Ref } from 'vue';
|
|
3
|
+
import { GLTF } from 'three-stdlib';
|
|
4
|
+
export interface UseGLTFOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Whether to use DRACO compression for loading the model
|
|
7
|
+
* @type {boolean}
|
|
8
|
+
*/
|
|
9
|
+
draco?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Path to the DRACO decoder. Defaults to https://www.gstatic.com/draco/versioned/decoders/1.5.6/
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
decoderPath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A traverse function applied to the scene upon loading the model.
|
|
17
|
+
* @type {Function}
|
|
18
|
+
*/
|
|
19
|
+
traverse?: (child: TresObject) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
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
|
+
* ```
|
|
32
|
+
*
|
|
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
|
|
36
|
+
*/
|
|
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,7 @@ interface SVGProps {
|
|
|
91
91
|
depth?: 'renderOrder' | 'flat' | 'offsetZ' | number;
|
|
92
92
|
}
|
|
93
93
|
declare const _default: import('vue').DefineComponent<SVGProps, {
|
|
94
|
-
instance: import('vue').Ref<import('three-stdlib').SVGResult, import('three-stdlib').SVGResult>;
|
|
94
|
+
instance: import('vue').Ref<import('three-stdlib').SVGResult | null, import('three-stdlib').SVGResult | null>;
|
|
95
95
|
layers: import('vue').ComputedRef<import('.').SVGLayer[]>;
|
|
96
96
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SVGProps> & Readonly<{}>, {
|
|
97
97
|
depth: "renderOrder" | "flat" | "offsetZ" | number;
|
|
@@ -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
|
+
};
|
|
@@ -1383,7 +1383,7 @@ declare function __VLS_template(): {
|
|
|
1383
1383
|
};
|
|
1384
1384
|
width: number;
|
|
1385
1385
|
height: number;
|
|
1386
|
-
}[] | /*elided*/ any[]
|
|
1386
|
+
}[] | /*elided*/ any[];
|
|
1387
1387
|
channel: number;
|
|
1388
1388
|
wrapS: import('three').Wrapping;
|
|
1389
1389
|
wrapT: import('three').Wrapping;
|
|
@@ -2460,7 +2460,7 @@ declare function __VLS_template(): {
|
|
|
2460
2460
|
};
|
|
2461
2461
|
width: number;
|
|
2462
2462
|
height: number;
|
|
2463
|
-
}[] | /*elided*/ any[]
|
|
2463
|
+
}[] | /*elided*/ any[];
|
|
2464
2464
|
mapping: import('three').AnyMapping;
|
|
2465
2465
|
channel: number;
|
|
2466
2466
|
wrapS: import('three').Wrapping;
|
|
@@ -2767,7 +2767,7 @@ declare function __VLS_template(): {
|
|
|
2767
2767
|
dispatchEvent: <T extends "dispose">(event: import('three').BaseEvent<T> & {
|
|
2768
2768
|
dispose: {};
|
|
2769
2769
|
}[T]) => void;
|
|
2770
|
-
}[]
|
|
2770
|
+
}[];
|
|
2771
2771
|
mapping: import('three').AnyMapping;
|
|
2772
2772
|
channel: number;
|
|
2773
2773
|
wrapS: import('three').Wrapping;
|
|
@@ -4531,7 +4531,7 @@ declare function __VLS_template(): {
|
|
|
4531
4531
|
};
|
|
4532
4532
|
width: number;
|
|
4533
4533
|
height: number;
|
|
4534
|
-
}[] | /*elided*/ any[]
|
|
4534
|
+
}[] | /*elided*/ any[];
|
|
4535
4535
|
channel: number;
|
|
4536
4536
|
wrapS: import('three').Wrapping;
|
|
4537
4537
|
wrapT: import('three').Wrapping;
|
|
@@ -4802,7 +4802,7 @@ declare function __VLS_template(): {
|
|
|
4802
4802
|
dispatchEvent: <T extends "dispose">(event: import('three').BaseEvent<T> & {
|
|
4803
4803
|
dispose: {};
|
|
4804
4804
|
}[T]) => void;
|
|
4805
|
-
}[]
|
|
4805
|
+
}[];
|
|
4806
4806
|
mapping: import('three').AnyMapping;
|
|
4807
4807
|
channel: number;
|
|
4808
4808
|
wrapS: import('three').Wrapping;
|