@tresjs/core 1.6.3 → 1.8.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/index.d.ts +1 -0
- package/dist/core/useCamera/index.d.ts +70 -5
- package/dist/core/useCatalogue/index.d.ts +14 -0
- package/dist/core/useInstanceCreator/index.d.ts +7 -0
- package/dist/core/useLoader/index.d.ts +31 -0
- package/dist/core/useRaycaster/index.d.ts +31 -65
- package/dist/core/useRenderer/component.d.ts +15 -5
- package/dist/core/useRenderer/const.d.ts +12 -0
- package/dist/core/useRenderer/index.d.ts +12 -1
- package/dist/core/useScene/index.d.ts +6 -0
- package/dist/core/useTexture/index.d.ts +38 -0
- package/dist/core/useTres/index.d.ts +103 -1
- package/dist/index.d.ts +1 -0
- package/dist/tres.js +372 -304
- package/dist/tres.umd.cjs +2 -2
- package/dist/types/index.d.ts +25 -32
- package/dist/utils/index.d.ts +2 -0
- package/package.json +20 -15
package/dist/core/index.d.ts
CHANGED
|
@@ -1,31 +1,96 @@
|
|
|
1
1
|
import { PerspectiveCamera, OrthographicCamera } from 'three';
|
|
2
|
-
import {
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
3
|
export declare enum CameraType {
|
|
4
4
|
Perspective = "Perspective",
|
|
5
5
|
Orthographic = "Orthographic"
|
|
6
6
|
}
|
|
7
7
|
export type Camera = PerspectiveCamera | OrthographicCamera;
|
|
8
|
-
export type CameraState = {
|
|
9
|
-
cameras: Array<Camera>;
|
|
10
|
-
};
|
|
11
8
|
export interface PerspectiveCameraOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Camera frustum vertical field of view, from bottom to top of view, in degrees.
|
|
11
|
+
*
|
|
12
|
+
* @type {number}
|
|
13
|
+
* @memberof PerspectiveCameraOptions
|
|
14
|
+
*/
|
|
12
15
|
fov?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Camera frustum near plane.
|
|
18
|
+
*
|
|
19
|
+
* @type {number}
|
|
20
|
+
* @memberof PerspectiveCameraOptions
|
|
21
|
+
*/
|
|
13
22
|
near?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Camera frustum far plane.
|
|
25
|
+
*
|
|
26
|
+
* @type {number}
|
|
27
|
+
* @memberof PerspectiveCameraOptions
|
|
28
|
+
*/
|
|
14
29
|
far?: number;
|
|
15
30
|
}
|
|
16
31
|
export interface OrthographicCameraOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Camera frustum left plane.
|
|
34
|
+
*
|
|
35
|
+
* @type {number}
|
|
36
|
+
* @memberof OrthographicCameraOptions
|
|
37
|
+
*/
|
|
17
38
|
left?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Camera frustum right plane.
|
|
41
|
+
*
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @memberof OrthographicCameraOptions
|
|
44
|
+
*/
|
|
18
45
|
right?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Camera frustum top plane.
|
|
48
|
+
*
|
|
49
|
+
* @type {number}
|
|
50
|
+
* @memberof OrthographicCameraOptions
|
|
51
|
+
*/
|
|
19
52
|
top?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Camera frustum bottom plane.
|
|
55
|
+
*
|
|
56
|
+
* @type {number}
|
|
57
|
+
* @memberof OrthographicCameraOptions
|
|
58
|
+
*/
|
|
20
59
|
bottom?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Camera frustum near plane.
|
|
62
|
+
*
|
|
63
|
+
* @type {number}
|
|
64
|
+
* @memberof OrthographicCameraOptions
|
|
65
|
+
*/
|
|
21
66
|
near?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Camera frustum far plane.
|
|
69
|
+
*
|
|
70
|
+
* @type {number}
|
|
71
|
+
* @memberof OrthographicCameraOptions
|
|
72
|
+
*/
|
|
22
73
|
far?: number;
|
|
23
74
|
}
|
|
24
75
|
interface UseCameraReturn {
|
|
25
|
-
activeCamera:
|
|
76
|
+
activeCamera: Ref<Camera | undefined>;
|
|
26
77
|
createCamera: (cameraType?: CameraType, options?: PerspectiveCameraOptions | OrthographicCameraOptions) => Camera;
|
|
27
78
|
updateCamera: () => void;
|
|
28
79
|
pushCamera: (camera: Camera) => void;
|
|
80
|
+
clearCameras: () => void;
|
|
29
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Create and update cameras
|
|
84
|
+
*
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { useCamera } from '@tresjs/core'
|
|
87
|
+
* const { createCamera, updateCamera } = useCamera()
|
|
88
|
+
* const camera = createCamera(new PerspectiveCamera(45, 1, 0.1, 1000))
|
|
89
|
+
* updateCamera()
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @export
|
|
93
|
+
* @return {*} {UseCameraReturn}
|
|
94
|
+
*/
|
|
30
95
|
export declare function useCamera(): UseCameraReturn;
|
|
31
96
|
export {};
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { App, Ref } from 'vue';
|
|
2
2
|
import { TresCatalogue } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* State for the catalogue of THREE objects
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* const { catalogue } = useCatalogue()
|
|
8
|
+
*
|
|
9
|
+
* console.log(catalogue.value.Mesh) // Mesh
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @param {App} [app]
|
|
14
|
+
* @param {string} [prefix='Tres']
|
|
15
|
+
* @return {*}
|
|
16
|
+
*/
|
|
3
17
|
export declare function useCatalogue(app?: App, prefix?: string): {
|
|
4
18
|
extend: (objects: any) => void;
|
|
5
19
|
catalogue: Ref<TresCatalogue>;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { TresCatalogue, TresInstance, TresVNode } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Composable responsible for creating instances out of Three.js objects.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @param {string} prefix
|
|
8
|
+
* @return {*}
|
|
9
|
+
*/
|
|
3
10
|
export declare function useInstanceCreator(prefix: string): {
|
|
4
11
|
createComponentInstances: (catalogue: Ref<TresCatalogue>) => (string | import("vue").DefineComponent<{}, () => void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>)[][];
|
|
5
12
|
processProps: (props: Record<string, any>, instance: TresInstance) => void;
|
|
@@ -1,13 +1,44 @@
|
|
|
1
1
|
import { Object3D } from 'three';
|
|
2
2
|
export interface TresLoader<T> extends THREE.Loader {
|
|
3
3
|
load(url: string, onLoad?: (result: T) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): unknown;
|
|
4
|
+
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<T>;
|
|
4
5
|
}
|
|
5
6
|
export type LoaderProto<T> = new (...args: any) => TresLoader<T extends unknown ? any : T>;
|
|
6
7
|
export type LoaderReturnType<T, L extends LoaderProto<T>> = T extends unknown ? Awaited<ReturnType<InstanceType<L>['loadAsync']>> : T;
|
|
8
|
+
/**
|
|
9
|
+
* Traverse an object and return all the nodes and materials
|
|
10
|
+
*
|
|
11
|
+
* @export
|
|
12
|
+
* @param {Object3D} object
|
|
13
|
+
* @return { [key: string]: any }
|
|
14
|
+
*/
|
|
7
15
|
export declare function trasverseObjects(object: Object3D): {
|
|
8
16
|
[key: string]: any;
|
|
9
17
|
};
|
|
10
18
|
export type Extensions<T extends {
|
|
11
19
|
prototype: LoaderProto<any>;
|
|
12
20
|
}> = (loader: T['prototype']) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Load resources using THREE loaders and return the result as a promise
|
|
23
|
+
*
|
|
24
|
+
* @see https://tresjs.org/api/composables.html#useloader
|
|
25
|
+
* @see https://threejs.org/docs/index.html?q=loader#api/en/loaders/Loader
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { useLoader } from '@tresjs/core'
|
|
29
|
+
* import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
|
|
30
|
+
*
|
|
31
|
+
* const { scene } = await useLoader(THREE.GLTFLoader, 'path/to/asset.gltf')
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @export
|
|
35
|
+
* @template T
|
|
36
|
+
* @template U
|
|
37
|
+
* @param {T} Loader
|
|
38
|
+
* @param {U} url
|
|
39
|
+
* @param {Extensions<T>} [extensions]
|
|
40
|
+
* @param {(event: ProgressEvent<EventTarget>) => void} [onProgress]
|
|
41
|
+
* @param {(proto: TresLoader<T>) => void} [cb]
|
|
42
|
+
* @return {*}
|
|
43
|
+
*/
|
|
13
44
|
export declare function useLoader<T extends LoaderProto<T>, U extends string | string[]>(Loader: T, url: U, extensions?: Extensions<T>, onProgress?: (event: ProgressEvent<EventTarget>) => void, cb?: (proto: TresLoader<T>) => void): Promise<U extends any[] ? LoaderReturnType<T, T>[] : LoaderReturnType<T, T>>;
|
|
@@ -1,66 +1,32 @@
|
|
|
1
1
|
import { Raycaster, Vector2 } from 'three';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
clampScalar: (min: number, max: number) => Vector2;
|
|
34
|
-
clampLength: (min: number, max: number) => Vector2;
|
|
35
|
-
floor: () => Vector2;
|
|
36
|
-
ceil: () => Vector2;
|
|
37
|
-
round: () => Vector2;
|
|
38
|
-
roundToZero: () => Vector2;
|
|
39
|
-
negate: () => Vector2;
|
|
40
|
-
dot: (v: Vector2) => number;
|
|
41
|
-
cross: (v: Vector2) => number;
|
|
42
|
-
lengthSq: () => number;
|
|
43
|
-
length: () => number;
|
|
44
|
-
lengthManhattan: () => number;
|
|
45
|
-
manhattanLength: () => number;
|
|
46
|
-
normalize: () => Vector2;
|
|
47
|
-
angle: () => number;
|
|
48
|
-
distanceTo: (v: Vector2) => number;
|
|
49
|
-
distanceToSquared: (v: Vector2) => number;
|
|
50
|
-
distanceToManhattan: (v: Vector2) => number;
|
|
51
|
-
manhattanDistanceTo: (v: Vector2) => number;
|
|
52
|
-
setLength: (length: number) => Vector2;
|
|
53
|
-
lerp: (v: Vector2, alpha: number) => Vector2;
|
|
54
|
-
lerpVectors: (v1: Vector2, v2: Vector2, alpha: number) => Vector2;
|
|
55
|
-
equals: (v: Vector2) => boolean;
|
|
56
|
-
fromArray: (array: number[] | ArrayLike<number>, offset?: number | undefined) => Vector2;
|
|
57
|
-
toArray: {
|
|
58
|
-
(array?: number[] | undefined, offset?: number | undefined): number[];
|
|
59
|
-
(array?: import("three").Vector2Tuple | undefined, offset?: 0 | undefined): import("three").Vector2Tuple;
|
|
60
|
-
(array: ArrayLike<number>, offset?: number | undefined): ArrayLike<number>;
|
|
61
|
-
};
|
|
62
|
-
fromBufferAttribute: (attribute: import("three").BufferAttribute, index: number) => Vector2;
|
|
63
|
-
rotateAround: (center: Vector2, angle: number) => Vector2;
|
|
64
|
-
random: () => Vector2;
|
|
65
|
-
}>;
|
|
66
|
-
};
|
|
2
|
+
import { Ref, ShallowRef } from 'vue';
|
|
3
|
+
/**
|
|
4
|
+
* Raycaster composable return type
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @interface UseRaycasterReturn
|
|
8
|
+
*/
|
|
9
|
+
export interface UseRaycasterReturn {
|
|
10
|
+
/**
|
|
11
|
+
* Raycaster instance
|
|
12
|
+
*
|
|
13
|
+
* @type {ShallowRef<Raycaster>}
|
|
14
|
+
* @memberof UseRaycasterReturn
|
|
15
|
+
*/
|
|
16
|
+
raycaster: ShallowRef<Raycaster>;
|
|
17
|
+
/**
|
|
18
|
+
* Pointer position
|
|
19
|
+
*
|
|
20
|
+
* @type {Ref<Vector2>}
|
|
21
|
+
* @memberof UseRaycasterReturn
|
|
22
|
+
*/
|
|
23
|
+
pointer: Ref<Vector2>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Composable to provide raycaster support and pointer information
|
|
27
|
+
*
|
|
28
|
+
* @see https://threejs.org/docs/index.html?q=raycas#api/en/core/Raycaster
|
|
29
|
+
* @export
|
|
30
|
+
* @return {*} {UseRaycasterReturn}
|
|
31
|
+
*/
|
|
32
|
+
export declare function useRaycaster(): UseRaycasterReturn;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ShadowMapType, TextureEncoding, ToneMapping } from 'three';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
|
-
/**
|
|
4
|
-
* Vue component for rendering a Tres component.
|
|
5
|
-
*/
|
|
6
3
|
export declare const TresCanvas: import("vue").DefineComponent<{
|
|
7
4
|
shadows: BooleanConstructor;
|
|
8
5
|
shadowMapType: PropType<ShadowMapType>;
|
|
9
|
-
physicallyCorrectLights:
|
|
6
|
+
physicallyCorrectLights: {
|
|
7
|
+
type: BooleanConstructor;
|
|
8
|
+
default: boolean;
|
|
9
|
+
validator: (value: boolean) => boolean;
|
|
10
|
+
};
|
|
11
|
+
useLegacyLights: BooleanConstructor;
|
|
10
12
|
outputEncoding: PropType<TextureEncoding>;
|
|
11
13
|
toneMapping: PropType<ToneMapping>;
|
|
12
14
|
toneMappingExposure: NumberConstructor;
|
|
@@ -18,12 +20,18 @@ export declare const TresCanvas: import("vue").DefineComponent<{
|
|
|
18
20
|
type: BooleanConstructor;
|
|
19
21
|
default: boolean;
|
|
20
22
|
};
|
|
23
|
+
preset: PropType<"realistic">;
|
|
21
24
|
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
25
|
[key: string]: any;
|
|
23
26
|
}> | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
27
|
shadows: BooleanConstructor;
|
|
25
28
|
shadowMapType: PropType<ShadowMapType>;
|
|
26
|
-
physicallyCorrectLights:
|
|
29
|
+
physicallyCorrectLights: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
validator: (value: boolean) => boolean;
|
|
33
|
+
};
|
|
34
|
+
useLegacyLights: BooleanConstructor;
|
|
27
35
|
outputEncoding: PropType<TextureEncoding>;
|
|
28
36
|
toneMapping: PropType<ToneMapping>;
|
|
29
37
|
toneMappingExposure: NumberConstructor;
|
|
@@ -35,9 +43,11 @@ export declare const TresCanvas: import("vue").DefineComponent<{
|
|
|
35
43
|
type: BooleanConstructor;
|
|
36
44
|
default: boolean;
|
|
37
45
|
};
|
|
46
|
+
preset: PropType<"realistic">;
|
|
38
47
|
}>>, {
|
|
39
48
|
shadows: boolean;
|
|
40
49
|
physicallyCorrectLights: boolean;
|
|
50
|
+
useLegacyLights: boolean;
|
|
41
51
|
preserveDrawingBuffer: boolean;
|
|
42
52
|
windowSize: boolean;
|
|
43
53
|
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const rendererPresets: {
|
|
2
|
+
realistic: {
|
|
3
|
+
outputEncoding: import("three").TextureEncoding;
|
|
4
|
+
toneMapping: import("three").ToneMapping;
|
|
5
|
+
toneMappingExposure: number;
|
|
6
|
+
shadowMap: {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
type: import("three").ShadowMapType;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type RendererPresetsType = keyof typeof rendererPresets;
|
|
@@ -2,6 +2,7 @@ import { MaybeComputedRef, MaybeElementRef } from '@vueuse/core';
|
|
|
2
2
|
import { WebGLRendererParameters, WebGLRenderer, ShadowMapType } from 'three';
|
|
3
3
|
import type { TextureEncoding, ToneMapping } from 'three';
|
|
4
4
|
import { TresColor } from '../../types';
|
|
5
|
+
import { RendererPresetsType } from './const';
|
|
5
6
|
export interface UseRendererOptions extends WebGLRendererParameters {
|
|
6
7
|
/**
|
|
7
8
|
* Enable shadows in the Renderer
|
|
@@ -22,8 +23,16 @@ export interface UseRendererOptions extends WebGLRendererParameters {
|
|
|
22
23
|
* See the [lights / physical example](https://threejs.org/examples/#webgl_lights_physical).
|
|
23
24
|
*
|
|
24
25
|
* @default false
|
|
26
|
+
* @deprecated Use {@link WebGLRenderer.useLegacyLights useLegacyLights} instead.
|
|
25
27
|
*/
|
|
26
28
|
physicallyCorrectLights?: MaybeComputedRef<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to use legacy lighting mode.
|
|
31
|
+
*
|
|
32
|
+
* @type {MaybeComputedRef<boolean>}
|
|
33
|
+
* @memberof UseRendererOptions
|
|
34
|
+
*/
|
|
35
|
+
useLegacyLights?: MaybeComputedRef<boolean>;
|
|
27
36
|
/**
|
|
28
37
|
* Defines the output encoding of the renderer.
|
|
29
38
|
* Can be LinearEncoding, sRGBEncoding
|
|
@@ -70,12 +79,14 @@ export interface UseRendererOptions extends WebGLRendererParameters {
|
|
|
70
79
|
*/
|
|
71
80
|
clearColor?: MaybeComputedRef<TresColor>;
|
|
72
81
|
windowSize?: MaybeComputedRef<boolean>;
|
|
82
|
+
preset?: RendererPresetsType;
|
|
73
83
|
}
|
|
74
84
|
/**
|
|
75
85
|
* Reactive Three.js WebGLRenderer instance
|
|
76
86
|
*
|
|
77
87
|
* @param canvas
|
|
78
|
-
* @param
|
|
88
|
+
* @param container
|
|
89
|
+
* @param {UseRendererOptions} [options]
|
|
79
90
|
*/
|
|
80
91
|
export declare function useRenderer(canvas: MaybeElementRef, container: MaybeElementRef, options: UseRendererOptions): {
|
|
81
92
|
renderer: import("vue").ShallowRef<WebGLRenderer | undefined>;
|
|
@@ -1,11 +1,49 @@
|
|
|
1
1
|
import { Texture } from 'three';
|
|
2
2
|
export interface PBRMaterialOptions {
|
|
3
|
+
/**
|
|
4
|
+
* List of texture maps to load.
|
|
5
|
+
*
|
|
6
|
+
* @type {string[]}
|
|
7
|
+
* @memberof PBRMaterialOptions
|
|
8
|
+
*/
|
|
3
9
|
maps: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Path to the texture maps.
|
|
12
|
+
*
|
|
13
|
+
* @type {('png' | 'jpg')}
|
|
14
|
+
* @memberof PBRMaterialOptions
|
|
15
|
+
*/
|
|
4
16
|
ext: 'png' | 'jpg';
|
|
5
17
|
}
|
|
6
18
|
export interface PBRTextureMaps {
|
|
7
19
|
[key: string]: Texture | null;
|
|
8
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Composable for loading textures.
|
|
23
|
+
*
|
|
24
|
+
* @see https://tresjs.org/examples/load-textures.html
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { useTexture } from 'tres'
|
|
28
|
+
*
|
|
29
|
+
* const pbrTexture = await useTexture({
|
|
30
|
+
* map: 'path/to/texture.png',
|
|
31
|
+
* displacementMap: 'path/to/displacement-map.png',
|
|
32
|
+
* roughnessMap: 'path/to/roughness-map.png',
|
|
33
|
+
* normalMap: 'path/to/normal-map.png',
|
|
34
|
+
* ambientOcclusionMap: 'path/to/ambient-occlusion-map.png',
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
* Then you can use the texture in your material.
|
|
38
|
+
*
|
|
39
|
+
* ```vue
|
|
40
|
+
* <TresMeshStandardMaterial v-bind="pbrTexture" />
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @export
|
|
44
|
+
* @param {(Array<string> | { [key: string]: string })} paths
|
|
45
|
+
* @return {*} {(Promise<Texture | Array<Texture> | PBRTextureMaps>)}
|
|
46
|
+
*/
|
|
9
47
|
export declare function useTexture(paths: Array<string> | {
|
|
10
48
|
[key: string]: string;
|
|
11
49
|
}): Promise<Texture | Array<Texture> | PBRTextureMaps>;
|
|
@@ -1,14 +1,116 @@
|
|
|
1
|
-
import { WebGLRenderer } from 'three';
|
|
1
|
+
import { Clock, EventDispatcher, Raycaster, Scene, Vector2, WebGLRenderer } from 'three';
|
|
2
|
+
import { ComputedRef } from 'vue';
|
|
2
3
|
import { Camera } from '../../core';
|
|
3
4
|
export interface TresState {
|
|
5
|
+
/**
|
|
6
|
+
* The active camera used for rendering the scene.
|
|
7
|
+
*
|
|
8
|
+
* @see https://threejs.org/docs/index.html?q=camera#api/en/cameras/Camera
|
|
9
|
+
*
|
|
10
|
+
* @type {Camera}
|
|
11
|
+
* @memberof TresState
|
|
12
|
+
*/
|
|
4
13
|
camera?: Camera;
|
|
14
|
+
/**
|
|
15
|
+
* All cameras available in the scene.
|
|
16
|
+
*
|
|
17
|
+
* @see https://threejs.org/docs/index.html?q=camera#api/en/cameras/Camera
|
|
18
|
+
*
|
|
19
|
+
* @type {Camera[]}
|
|
20
|
+
* @memberof TresState
|
|
21
|
+
*/
|
|
22
|
+
cameras?: Camera[];
|
|
23
|
+
/**
|
|
24
|
+
* The aspect ratio of the scene.
|
|
25
|
+
*
|
|
26
|
+
* @type {ComputedRef<number>}
|
|
27
|
+
* @memberof TresState
|
|
28
|
+
*/
|
|
29
|
+
aspectRatio?: ComputedRef<number>;
|
|
30
|
+
/**
|
|
31
|
+
* The WebGLRenderer used to display the scene using WebGL.
|
|
32
|
+
*
|
|
33
|
+
* @see https://threejs.org/docs/index.html?q=webglren#api/en/renderers/WebGLRenderer
|
|
34
|
+
*
|
|
35
|
+
* @type {WebGLRenderer}
|
|
36
|
+
* @memberof TresState
|
|
37
|
+
*/
|
|
5
38
|
renderer?: WebGLRenderer;
|
|
39
|
+
/**
|
|
40
|
+
* The scene. This is the place where you place objects, lights and cameras.
|
|
41
|
+
*
|
|
42
|
+
* @see https://threejs.org/docs/index.html?q=scene#api/en/scenes/Scene
|
|
43
|
+
*
|
|
44
|
+
* @type {Scene}
|
|
45
|
+
* @memberof TresState
|
|
46
|
+
*/
|
|
47
|
+
scene?: Scene;
|
|
48
|
+
/**
|
|
49
|
+
* The raycaster.
|
|
50
|
+
*
|
|
51
|
+
* @see https://threejs.org/docs/index.html?q=raycas#api/en/core/Raycaster
|
|
52
|
+
*
|
|
53
|
+
* @type {Raycaster}
|
|
54
|
+
* @memberof TresState
|
|
55
|
+
*/
|
|
56
|
+
raycaster?: Raycaster;
|
|
57
|
+
/**
|
|
58
|
+
* Object for keeping track of time. This uses `performance.now` if it is available,
|
|
59
|
+
* otherwise it reverts to the less accurate `Date.now`.
|
|
60
|
+
*
|
|
61
|
+
* @see https://threejs.org/docs/index.html?q=clock#api/en/core/Clock
|
|
62
|
+
*
|
|
63
|
+
* @type {Clock}
|
|
64
|
+
* @memberof TresState
|
|
65
|
+
*/
|
|
66
|
+
clock?: Clock;
|
|
67
|
+
/**
|
|
68
|
+
* The current mouse position.
|
|
69
|
+
*
|
|
70
|
+
* @type {Vector2}
|
|
71
|
+
* @memberof TresState
|
|
72
|
+
*/
|
|
73
|
+
pointer?: Vector2;
|
|
74
|
+
/**
|
|
75
|
+
* The current instance of the component.
|
|
76
|
+
*
|
|
77
|
+
* @type {*}
|
|
78
|
+
* @memberof TresState
|
|
79
|
+
*/
|
|
80
|
+
currentInstance?: any;
|
|
81
|
+
/**
|
|
82
|
+
* The current active scene control
|
|
83
|
+
*
|
|
84
|
+
* @type {((EventDispatcher & { enabled: boolean }) | null)}
|
|
85
|
+
* @memberof TresState
|
|
86
|
+
*/
|
|
87
|
+
controls?: (EventDispatcher & {
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
}) | null;
|
|
6
90
|
[key: string]: any;
|
|
7
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* The Tres state.
|
|
94
|
+
*
|
|
95
|
+
* @see https://threejs.org/docs/index.html?q=scene#api/en/scenes/Scene
|
|
96
|
+
*
|
|
97
|
+
* @export
|
|
98
|
+
* @return {*} {TresState, getState, setState}
|
|
99
|
+
*/
|
|
8
100
|
export declare function useTres(): {
|
|
9
101
|
getState: (key: string) => any;
|
|
10
102
|
setState: (key: string, value: any) => void;
|
|
11
103
|
camera?: import("vue").Ref<Camera | undefined> | undefined;
|
|
104
|
+
cameras?: import("vue").Ref<Camera[] | undefined> | undefined;
|
|
105
|
+
aspectRatio?: import("vue").Ref<ComputedRef<number> | undefined> | undefined;
|
|
12
106
|
renderer?: import("vue").Ref<WebGLRenderer | undefined> | undefined;
|
|
107
|
+
scene?: import("vue").Ref<Scene | undefined> | undefined;
|
|
108
|
+
raycaster?: import("vue").Ref<Raycaster | undefined> | undefined;
|
|
109
|
+
clock?: import("vue").Ref<Clock | undefined> | undefined;
|
|
110
|
+
pointer?: import("vue").Ref<Vector2 | undefined> | undefined;
|
|
111
|
+
currentInstance?: import("vue").Ref<any> | undefined;
|
|
112
|
+
controls?: import("vue").Ref<(EventDispatcher<import("three").Event> & {
|
|
113
|
+
enabled: boolean;
|
|
114
|
+
}) | null | undefined> | undefined;
|
|
13
115
|
state: TresState;
|
|
14
116
|
};
|