@tresjs/core 4.3.6 → 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.
- package/dist/src/components/TresCanvas.vue.d.ts +70 -64
- package/dist/src/composables/index.d.ts +6 -12
- package/dist/src/composables/useCamera/index.d.ts +42 -8555
- package/dist/src/composables/useCreateRafLoop/index.d.ts +14 -0
- package/dist/src/composables/useEventManager/index.d.ts +10 -0
- package/dist/src/composables/useGraph/index.d.ts +3 -0
- package/dist/src/composables/useLoader/component.vue.d.ts +31 -17
- package/dist/src/composables/useLoader/index.d.ts +44 -37
- package/dist/src/composables/useLoop/index.d.ts +13 -16
- package/dist/src/composables/useRenderer/pixelRatio.d.ts +4 -0
- package/dist/src/composables/useRenderer/useRendererManager.d.ts +194 -0
- package/dist/src/composables/useTres/index.d.ts +37 -0
- package/dist/src/composables/useTresContextProvider/index.d.ts +14 -64
- package/dist/src/devtools/inspectorHandlers.d.ts +60 -0
- package/dist/src/devtools/plugin.d.ts +3 -8
- package/dist/src/devtools/setupDevtools.d.ts +14 -0
- package/dist/src/devtools/types.d.ts +90 -0
- package/dist/src/index.d.ts +4 -1
- package/dist/src/types/index.d.ts +13 -69
- package/dist/src/utils/array.d.ts +6 -0
- package/dist/src/utils/createPriorityEventHook.d.ts +4 -6
- package/dist/src/utils/graph.d.ts +15 -0
- package/dist/src/utils/index.d.ts +2 -34
- package/dist/src/utils/is/dom.d.ts +1 -0
- package/dist/src/utils/is/index.d.ts +4 -0
- package/dist/src/utils/is/three.d.ts +162 -0
- package/dist/src/utils/is/tres.d.ts +70 -0
- package/dist/src/utils/is/typed.d.ts +1 -0
- package/dist/src/utils/is/util.d.ts +1 -0
- package/dist/src/utils/logger.d.ts +25 -0
- package/dist/src/utils/makeMap.d.ts +9 -0
- package/dist/src/utils/perf.d.ts +1 -0
- package/dist/src/utils/pointerEvents.d.ts +10 -0
- package/dist/src/utils/string.d.ts +1 -0
- package/dist/src/utils/three.d.ts +9 -0
- package/dist/tres.js +5320 -1482
- package/package.json +42 -16
- package/dist/src/composables/useLogger.d.ts +0 -11
- package/dist/src/composables/useRaycaster/index.d.ts +0 -16
- package/dist/src/composables/useRenderLoop/index.d.ts +0 -17
- package/dist/src/composables/useRenderer/const.d.ts +0 -18
- package/dist/src/composables/useRenderer/index.d.ts +0 -91
- package/dist/src/composables/useSeek/index.d.ts +0 -20
- package/dist/src/composables/useTexture/component.vue.d.ts +0 -29
- package/dist/src/composables/useTexture/index.d.ts +0 -103
- package/dist/src/composables/useTresEventManager/index.d.ts +0 -25
- package/dist/src/composables/useTresReady/createReadyEventHook/index.d.ts +0 -4
- package/dist/src/composables/useTresReady/index.d.ts +0 -7
- package/dist/src/core/loop.d.ts +0 -38
- package/dist/src/utils/is.d.ts +0 -36
- package/dist/tres.umd.cjs +0 -8
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tresjs/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0-alpha.0",
|
|
5
5
|
"packageManager": "pnpm@10.6.3",
|
|
6
6
|
"description": "Declarative ThreeJS using Vue Components",
|
|
7
7
|
"author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
|
|
@@ -20,9 +20,15 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
|
+
"development": {
|
|
24
|
+
"types": "./src/index.ts",
|
|
25
|
+
"import": "./src/index.ts",
|
|
26
|
+
"default": "./src/index.ts"
|
|
27
|
+
},
|
|
23
28
|
"types": "./dist/index.d.ts",
|
|
24
29
|
"import": "./dist/tres.js",
|
|
25
|
-
"require": "./dist/tres.
|
|
30
|
+
"require": "./dist/tres.js",
|
|
31
|
+
"default": "./dist/tres.js"
|
|
26
32
|
},
|
|
27
33
|
"./components": {
|
|
28
34
|
"types": "./dist/src/components/index.d.ts"
|
|
@@ -59,27 +65,31 @@
|
|
|
59
65
|
"coverage": "vitest run --coverage",
|
|
60
66
|
"lint": "eslint .",
|
|
61
67
|
"lint:fix": "eslint . --fix",
|
|
62
|
-
"
|
|
63
|
-
"docs:
|
|
64
|
-
"docs:
|
|
65
|
-
"docs:
|
|
66
|
-
"docs:
|
|
68
|
+
"typecheck": "vue-tsc --noEmit",
|
|
69
|
+
"docs:dev": "pnpm --filter='./docs' dev",
|
|
70
|
+
"docs:generate": "pnpm --filter='./docs' generate",
|
|
71
|
+
"docs:prepare": "pnpm --filter='./docs' prepare",
|
|
72
|
+
"docs:lint": "pnpm --filter='./docs' lint",
|
|
73
|
+
"docs:typecheck": "pnpm --filter='./docs' typecheck",
|
|
74
|
+
"postinstall": "pnpm run build && pnpm --filter='./docs' prepare"
|
|
67
75
|
},
|
|
68
76
|
"peerDependencies": {
|
|
69
77
|
"three": ">=0.133",
|
|
70
78
|
"vue": ">=3.4"
|
|
71
79
|
},
|
|
72
80
|
"dependencies": {
|
|
73
|
-
"@
|
|
74
|
-
"@vue/devtools-api": "^
|
|
75
|
-
"@vueuse/core": "^12.5.0"
|
|
81
|
+
"@pmndrs/pointer-events": "^6.6.17",
|
|
82
|
+
"@vue/devtools-api": "^7.7.2",
|
|
83
|
+
"@vueuse/core": "^12.5.0",
|
|
84
|
+
"radashi": "^12.6.0"
|
|
76
85
|
},
|
|
77
86
|
"devDependencies": {
|
|
78
87
|
"@release-it/conventional-changelog": "^10.0.0",
|
|
79
88
|
"@stackblitz/sdk": "^1.11.0",
|
|
80
|
-
"@tresjs/cientos": "
|
|
89
|
+
"@tresjs/cientos": "5.0.0-next.0",
|
|
81
90
|
"@tresjs/eslint-config": "^1.4.0",
|
|
82
|
-
"@
|
|
91
|
+
"@tresjs/leches": "1.0.0-next.0",
|
|
92
|
+
"@types/three": "^0.177.0",
|
|
83
93
|
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
|
84
94
|
"@typescript-eslint/parser": "^8.23.0",
|
|
85
95
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
@@ -100,19 +110,35 @@
|
|
|
100
110
|
"rollup-plugin-copy": "^3.5.0",
|
|
101
111
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
102
112
|
"sponsorkit": "^16.3.0",
|
|
103
|
-
"three": "^0.
|
|
113
|
+
"three": "^0.177.0",
|
|
104
114
|
"unocss": "^65.4.3",
|
|
105
115
|
"unplugin": "^2.1.2",
|
|
106
116
|
"unplugin-vue-components": "^28.0.0",
|
|
107
117
|
"vite": "^6.1.0",
|
|
108
118
|
"vite-plugin-banner": "^0.8.0",
|
|
109
|
-
"vite-plugin-dts": "4.5.
|
|
119
|
+
"vite-plugin-dts": "4.5.4",
|
|
110
120
|
"vite-plugin-inspect": "^10.1.0",
|
|
111
121
|
"vite-plugin-require-transform": "^1.0.21",
|
|
112
122
|
"vite-svg-loader": "^5.1.0",
|
|
113
123
|
"vitepress": "1.6.3",
|
|
114
124
|
"vitest": "3.0.5",
|
|
115
|
-
"vue": "3.5.
|
|
116
|
-
"vue-demi": "^0.14.10"
|
|
125
|
+
"vue": "3.5.17",
|
|
126
|
+
"vue-demi": "^0.14.10",
|
|
127
|
+
"vue-tsc": "^2.2.0"
|
|
128
|
+
},
|
|
129
|
+
"pnpm": {
|
|
130
|
+
"onlyBuiltDependencies": [
|
|
131
|
+
"better-sqlite3"
|
|
132
|
+
],
|
|
133
|
+
"ignoredBuiltDependencies": [
|
|
134
|
+
"vue-demi"
|
|
135
|
+
],
|
|
136
|
+
"overrides": {
|
|
137
|
+
"vue": "^3.5.13",
|
|
138
|
+
"vue-router": "^4.5.0"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"resolutions": {
|
|
142
|
+
"unimport": "4.1.1"
|
|
117
143
|
}
|
|
118
144
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const isProd: boolean;
|
|
2
|
-
type OneOrMore<T> = {
|
|
3
|
-
0: T;
|
|
4
|
-
} & Array<T>;
|
|
5
|
-
interface LoggerComposition {
|
|
6
|
-
logError: (...args: OneOrMore<any>) => void;
|
|
7
|
-
logWarning: (...args: OneOrMore<any>) => void;
|
|
8
|
-
logMessage: (name: string, value: any) => void;
|
|
9
|
-
}
|
|
10
|
-
export declare function useLogger(): LoggerComposition;
|
|
11
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TresEvent, TresInstance } from 'src/types';
|
|
2
|
-
import { Intersection, Object3D, Object3DEventMap } from 'three';
|
|
3
|
-
import { ShallowRef } from 'vue';
|
|
4
|
-
import { TresContext } from '../useTresContextProvider';
|
|
5
|
-
export declare const useRaycaster: (objectsWithEvents: ShallowRef<TresInstance[]>, ctx: TresContext) => {
|
|
6
|
-
intersects: ShallowRef<Intersection<Object3D<Object3DEventMap>>[]>;
|
|
7
|
-
onClick: (fn: (value: TresEvent) => void) => () => void;
|
|
8
|
-
onDblClick: (fn: (value: TresEvent) => void) => () => void;
|
|
9
|
-
onContextMenu: (fn: (value: TresEvent) => void) => () => void;
|
|
10
|
-
onPointerMove: (fn: (value: TresEvent) => void) => () => void;
|
|
11
|
-
onPointerUp: (fn: (value: TresEvent) => void) => () => void;
|
|
12
|
-
onPointerDown: (fn: (value: TresEvent) => void) => () => void;
|
|
13
|
-
onPointerMissed: (fn: (value: TresEvent) => void) => () => void;
|
|
14
|
-
onWheel: (fn: (value: TresEvent) => void) => () => void;
|
|
15
|
-
forceUpdate: () => void;
|
|
16
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EventHookOn, Fn } from '@vueuse/core';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
import { Clock } from 'three';
|
|
4
|
-
export interface RenderLoop {
|
|
5
|
-
delta: number;
|
|
6
|
-
elapsed: number;
|
|
7
|
-
clock: Clock;
|
|
8
|
-
}
|
|
9
|
-
export interface UseRenderLoopReturn {
|
|
10
|
-
onBeforeLoop: EventHookOn<RenderLoop>;
|
|
11
|
-
onLoop: EventHookOn<RenderLoop>;
|
|
12
|
-
onAfterLoop: EventHookOn<RenderLoop>;
|
|
13
|
-
pause: Fn;
|
|
14
|
-
resume: Fn;
|
|
15
|
-
isActive: Ref<boolean>;
|
|
16
|
-
}
|
|
17
|
-
export declare const useRenderLoop: () => UseRenderLoopReturn;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const rendererPresets: {
|
|
2
|
-
realistic: {
|
|
3
|
-
shadows: boolean;
|
|
4
|
-
physicallyCorrectLights: boolean;
|
|
5
|
-
outputColorSpace: "srgb";
|
|
6
|
-
toneMapping: 4;
|
|
7
|
-
toneMappingExposure: number;
|
|
8
|
-
shadowMap: {
|
|
9
|
-
enabled: boolean;
|
|
10
|
-
type: 2;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
flat: {
|
|
14
|
-
toneMapping: 0;
|
|
15
|
-
toneMappingExposure: number;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export type RendererPresetsType = keyof typeof rendererPresets;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { ColorSpace, Scene, ShadowMapType, ToneMapping, WebGLRendererParameters, WebGLRenderer } from 'three';
|
|
2
|
-
import { EmitEventFn, TresColor } from '../../types';
|
|
3
|
-
import { TresContext } from '../useTresContextProvider';
|
|
4
|
-
import { RendererPresetsType } from './const';
|
|
5
|
-
import { MaybeRefOrGetter } from '@vueuse/core';
|
|
6
|
-
import { MaybeRef } from 'vue';
|
|
7
|
-
type TransformToMaybeRefOrGetter<T> = {
|
|
8
|
-
[K in keyof T]: MaybeRefOrGetter<T[K]> | MaybeRefOrGetter<T[K]>;
|
|
9
|
-
};
|
|
10
|
-
export interface UseRendererOptions extends TransformToMaybeRefOrGetter<WebGLRendererParameters> {
|
|
11
|
-
/**
|
|
12
|
-
* Enable shadows in the Renderer
|
|
13
|
-
*
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
shadows?: MaybeRefOrGetter<boolean>;
|
|
17
|
-
/**
|
|
18
|
-
* Set the shadow map type
|
|
19
|
-
* Can be PCFShadowMap, PCFSoftShadowMap, BasicShadowMap, VSMShadowMap
|
|
20
|
-
* [see](https://threejs.org/docs/?q=we#api/en/constants/Renderer)
|
|
21
|
-
*
|
|
22
|
-
* @default PCFSoftShadowMap
|
|
23
|
-
*/
|
|
24
|
-
shadowMapType?: MaybeRefOrGetter<ShadowMapType>;
|
|
25
|
-
/**
|
|
26
|
-
* Whether to use physically correct lighting mode.
|
|
27
|
-
* See the [lights / physical example](https://threejs.org/examples/#webgl_lights_physical).
|
|
28
|
-
*
|
|
29
|
-
* @default false
|
|
30
|
-
* @deprecated Use {@link WebGLRenderer.useLegacyLights useLegacyLights} instead.
|
|
31
|
-
*/
|
|
32
|
-
physicallyCorrectLights?: MaybeRefOrGetter<boolean>;
|
|
33
|
-
/**
|
|
34
|
-
* Whether to use legacy lighting mode.
|
|
35
|
-
*
|
|
36
|
-
* @type {MaybeRefOrGetter<boolean>}
|
|
37
|
-
* @memberof UseRendererOptions
|
|
38
|
-
*/
|
|
39
|
-
useLegacyLights?: MaybeRefOrGetter<boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* Defines the output encoding of the renderer.
|
|
42
|
-
* Can be LinearSRGBColorSpace, SRGBColorSpace
|
|
43
|
-
*
|
|
44
|
-
* @default LinearSRGBColorSpace
|
|
45
|
-
*/
|
|
46
|
-
outputColorSpace?: MaybeRefOrGetter<ColorSpace>;
|
|
47
|
-
/**
|
|
48
|
-
* Defines the tone mapping used by the renderer.
|
|
49
|
-
* Can be NoToneMapping, LinearToneMapping,
|
|
50
|
-
* ReinhardToneMapping, Uncharted2ToneMapping,
|
|
51
|
-
* CineonToneMapping, ACESFilmicToneMapping,
|
|
52
|
-
* CustomToneMapping
|
|
53
|
-
*
|
|
54
|
-
* @default ACESFilmicToneMapping
|
|
55
|
-
*/
|
|
56
|
-
toneMapping?: MaybeRefOrGetter<ToneMapping>;
|
|
57
|
-
/**
|
|
58
|
-
* Defines the tone mapping exposure used by the renderer.
|
|
59
|
-
*
|
|
60
|
-
* @default 1
|
|
61
|
-
*/
|
|
62
|
-
toneMappingExposure?: MaybeRefOrGetter<number>;
|
|
63
|
-
/**
|
|
64
|
-
* The color value to use when clearing the canvas.
|
|
65
|
-
*
|
|
66
|
-
* @default 0x000000
|
|
67
|
-
*/
|
|
68
|
-
clearColor?: MaybeRefOrGetter<TresColor>;
|
|
69
|
-
windowSize?: MaybeRefOrGetter<boolean | string>;
|
|
70
|
-
preset?: MaybeRefOrGetter<RendererPresetsType>;
|
|
71
|
-
renderMode?: MaybeRefOrGetter<'always' | 'on-demand' | 'manual'>;
|
|
72
|
-
/**
|
|
73
|
-
* A `number` sets the renderer's device pixel ratio.
|
|
74
|
-
* `[number, number]` clamp's the renderer's device pixel ratio.
|
|
75
|
-
*/
|
|
76
|
-
dpr?: MaybeRefOrGetter<number | [number, number]>;
|
|
77
|
-
}
|
|
78
|
-
export declare function useRenderer({ canvas, options, contextParts: { sizes, render, invalidate, advance }, }: {
|
|
79
|
-
canvas: MaybeRef<HTMLCanvasElement>;
|
|
80
|
-
scene: Scene;
|
|
81
|
-
options: UseRendererOptions;
|
|
82
|
-
emit: EmitEventFn;
|
|
83
|
-
contextParts: Pick<TresContext, 'sizes' | 'camera' | 'render'> & {
|
|
84
|
-
invalidate: () => void;
|
|
85
|
-
advance: () => void;
|
|
86
|
-
};
|
|
87
|
-
}): {
|
|
88
|
-
renderer: import('vue').ShallowRef<WebGLRenderer, WebGLRenderer>;
|
|
89
|
-
};
|
|
90
|
-
export type UseRendererReturn = ReturnType<typeof useRenderer>;
|
|
91
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Object3D, Scene } from 'three';
|
|
2
|
-
/**
|
|
3
|
-
* Seek composable return type
|
|
4
|
-
*
|
|
5
|
-
* @export
|
|
6
|
-
* @interface UseSeekReturn
|
|
7
|
-
*/
|
|
8
|
-
export interface UseSeekReturn {
|
|
9
|
-
seek: (parent: Scene | Object3D, property: string, value: string) => Object3D | null;
|
|
10
|
-
seekByName: (parent: Scene | Object3D, value: string) => Object3D | null;
|
|
11
|
-
seekAll: (parent: Scene | Object3D, property: string, value: string) => Object3D[];
|
|
12
|
-
seekAllByName: (parent: Scene | Object3D, value: string) => Object3D[];
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Composable that provides utilities to easily traverse and navigate through complex scenes and object children graphs
|
|
16
|
-
*
|
|
17
|
-
* @export
|
|
18
|
-
* @return {*} {UseSeekReturn}
|
|
19
|
-
*/
|
|
20
|
-
export declare function useSeek(): UseSeekReturn;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PBRUseTextureMap } from './index';
|
|
2
|
-
declare function __VLS_template(): {
|
|
3
|
-
attrs: Partial<{}>;
|
|
4
|
-
slots: {
|
|
5
|
-
default?(_: {
|
|
6
|
-
textures: {
|
|
7
|
-
map: import('three').Texture;
|
|
8
|
-
displacementMap: import('three').Texture;
|
|
9
|
-
normalMap: import('three').Texture;
|
|
10
|
-
roughnessMap: import('three').Texture;
|
|
11
|
-
metalnessMap: import('three').Texture;
|
|
12
|
-
aoMap: import('three').Texture;
|
|
13
|
-
alphaMap: import('three').Texture;
|
|
14
|
-
matcap: import('three').Texture;
|
|
15
|
-
};
|
|
16
|
-
}): any;
|
|
17
|
-
};
|
|
18
|
-
refs: {};
|
|
19
|
-
rootEl: any;
|
|
20
|
-
};
|
|
21
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
22
|
-
declare const __VLS_component: import('vue').DefineComponent<PBRUseTextureMap, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PBRUseTextureMap> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
24
|
-
export default _default;
|
|
25
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
26
|
-
new (): {
|
|
27
|
-
$slots: S;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Texture } from 'three';
|
|
2
|
-
export interface PBRMaterialOptions {
|
|
3
|
-
/**
|
|
4
|
-
* List of texture maps to load.
|
|
5
|
-
*
|
|
6
|
-
* @type {string[]}
|
|
7
|
-
* @memberof PBRMaterialOptions
|
|
8
|
-
*/
|
|
9
|
-
maps: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Path to the texture maps.
|
|
12
|
-
*
|
|
13
|
-
* @type {('png' | 'jpg')}
|
|
14
|
-
* @memberof PBRMaterialOptions
|
|
15
|
-
*/
|
|
16
|
-
ext: 'png' | 'jpg';
|
|
17
|
-
}
|
|
18
|
-
export interface PBRTextureMaps {
|
|
19
|
-
[key: string]: Texture | null;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Map of textures to load that can be passed to `useTexture()`.
|
|
23
|
-
*/
|
|
24
|
-
export interface PBRUseTextureMap {
|
|
25
|
-
map?: string;
|
|
26
|
-
displacementMap?: string;
|
|
27
|
-
normalMap?: string;
|
|
28
|
-
roughnessMap?: string;
|
|
29
|
-
metalnessMap?: string;
|
|
30
|
-
aoMap?: string;
|
|
31
|
-
alphaMap?: string;
|
|
32
|
-
matcap?: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Loads a single texture.
|
|
36
|
-
*
|
|
37
|
-
* ```ts
|
|
38
|
-
* import { useTexture } from 'tres'
|
|
39
|
-
*
|
|
40
|
-
* const matcapTexture = await useTexture(['path/to/texture.png'])
|
|
41
|
-
* ```
|
|
42
|
-
* Then you can use the texture in your material.
|
|
43
|
-
*
|
|
44
|
-
* ```vue
|
|
45
|
-
* <TresMeshMatcapMaterial :matcap="matcapTexture" />
|
|
46
|
-
* ```
|
|
47
|
-
* @see https://tresjs.org/examples/load-textures.html
|
|
48
|
-
* @export
|
|
49
|
-
* @param paths
|
|
50
|
-
* @return A promise of the resulting texture
|
|
51
|
-
*/
|
|
52
|
-
export declare function useTexture(paths: readonly [string]): Promise<Texture>;
|
|
53
|
-
/**
|
|
54
|
-
* Loads multiple textures.
|
|
55
|
-
*
|
|
56
|
-
* ```ts
|
|
57
|
-
* import { useTexture } from 'tres'
|
|
58
|
-
*
|
|
59
|
-
* const [texture1, texture2] = await useTexture([
|
|
60
|
-
* 'path/to/texture1.png',
|
|
61
|
-
* 'path/to/texture2.png',
|
|
62
|
-
* ])
|
|
63
|
-
* ```
|
|
64
|
-
* Then you can use the texture in your material.
|
|
65
|
-
*
|
|
66
|
-
* ```vue
|
|
67
|
-
* <TresMeshStandardMaterial map="texture1" />
|
|
68
|
-
* ```
|
|
69
|
-
* @see https://tresjs.org/examples/load-textures.html
|
|
70
|
-
* @export
|
|
71
|
-
* @param paths
|
|
72
|
-
* @return A promise of the resulting textures
|
|
73
|
-
*/
|
|
74
|
-
export declare function useTexture<T extends string[]>(paths: [...T]): Promise<{
|
|
75
|
-
[K in keyof T]: Texture;
|
|
76
|
-
}>;
|
|
77
|
-
/**
|
|
78
|
-
* Loads a PBR texture map.
|
|
79
|
-
*
|
|
80
|
-
* ```ts
|
|
81
|
-
* import { useTexture } from 'tres'
|
|
82
|
-
*
|
|
83
|
-
* const pbrTexture = await useTexture({
|
|
84
|
-
* map: 'path/to/texture.png',
|
|
85
|
-
* displacementMap: 'path/to/displacement-map.png',
|
|
86
|
-
* roughnessMap: 'path/to/roughness-map.png',
|
|
87
|
-
* normalMap: 'path/to/normal-map.png',
|
|
88
|
-
* ambientOcclusionMap: 'path/to/ambient-occlusion-map.png',
|
|
89
|
-
* })
|
|
90
|
-
* ```
|
|
91
|
-
* Then you can use the texture in your material.
|
|
92
|
-
*
|
|
93
|
-
* ```vue
|
|
94
|
-
* <TresMeshStandardMaterial v-bind="pbrTexture" />
|
|
95
|
-
* ```
|
|
96
|
-
* @see https://tresjs.org/examples/load-textures.html
|
|
97
|
-
* @export
|
|
98
|
-
* @param paths
|
|
99
|
-
* @return A promise of the resulting pbr texture map
|
|
100
|
-
*/
|
|
101
|
-
export declare function useTexture<TextureMap extends PBRUseTextureMap>(paths: TextureMap): Promise<{
|
|
102
|
-
[K in keyof Required<PBRUseTextureMap>]: K extends keyof TextureMap ? Texture : null;
|
|
103
|
-
}>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { EmitEventFn } from 'src/types';
|
|
2
|
-
import { Scene } from 'three';
|
|
3
|
-
import { TresContext } from '../useTresContextProvider';
|
|
4
|
-
export interface TresEventManager {
|
|
5
|
-
/**
|
|
6
|
-
* Forces the event system to refire events with the previous mouse event
|
|
7
|
-
*/
|
|
8
|
-
forceUpdate: () => void;
|
|
9
|
-
/**
|
|
10
|
-
* pointer-missed events by definition are fired when the pointer missed every object in the scene
|
|
11
|
-
* So we need to track them separately
|
|
12
|
-
* Note: These are used in nodeOps
|
|
13
|
-
*/
|
|
14
|
-
registerObject: (object: unknown) => void;
|
|
15
|
-
deregisterObject: (object: unknown) => void;
|
|
16
|
-
registerPointerMissedObject: (object: unknown) => void;
|
|
17
|
-
deregisterPointerMissedObject: (object: unknown) => void;
|
|
18
|
-
}
|
|
19
|
-
export declare function useTresEventManager(scene: Scene, context: TresContext, emit: EmitEventFn): {
|
|
20
|
-
forceUpdate: () => void;
|
|
21
|
-
registerObject: (maybeTresObject: unknown) => void;
|
|
22
|
-
deregisterObject: (maybeTresObject: unknown) => void;
|
|
23
|
-
registerPointerMissedObject: (maybeTresObject: unknown) => void;
|
|
24
|
-
deregisterPointerMissedObject: (maybeTresObject: unknown) => void;
|
|
25
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TresContext } from '../useTresContextProvider';
|
|
2
|
-
export declare function useTresReady(ctx?: TresContext): import('@vueuse/core').EventHook<TresContext> & {
|
|
3
|
-
cancel: () => void;
|
|
4
|
-
};
|
|
5
|
-
export declare function onTresReady(fn: (ctx: TresContext) => void): {
|
|
6
|
-
off: () => void;
|
|
7
|
-
} | undefined;
|
package/dist/src/core/loop.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Fn } from '@vueuse/core';
|
|
2
|
-
import { Camera, EventDispatcher, Raycaster, Scene, WebGLRenderer, Clock } from 'three';
|
|
3
|
-
import { Ref } from 'vue';
|
|
4
|
-
export type LoopStage = 'before' | 'render' | 'after';
|
|
5
|
-
export interface LoopCallback {
|
|
6
|
-
delta: number;
|
|
7
|
-
elapsed: number;
|
|
8
|
-
clock: Clock;
|
|
9
|
-
}
|
|
10
|
-
export interface LoopCallbackWithCtx extends LoopCallback {
|
|
11
|
-
camera: Camera;
|
|
12
|
-
scene: Scene;
|
|
13
|
-
renderer: WebGLRenderer;
|
|
14
|
-
raycaster: Raycaster;
|
|
15
|
-
controls: Ref<(EventDispatcher<object> & {
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
}) | null>;
|
|
18
|
-
invalidate: Fn;
|
|
19
|
-
advance: Fn;
|
|
20
|
-
}
|
|
21
|
-
export type LoopCallbackFn = (params: LoopCallbackWithCtx) => void;
|
|
22
|
-
export interface RendererLoop {
|
|
23
|
-
loopId: string;
|
|
24
|
-
register: (callback: LoopCallbackFn, stage: LoopStage, index?: number) => {
|
|
25
|
-
off: Fn;
|
|
26
|
-
};
|
|
27
|
-
start: Fn;
|
|
28
|
-
stop: Fn;
|
|
29
|
-
pause: Fn;
|
|
30
|
-
resume: Fn;
|
|
31
|
-
pauseRender: Fn;
|
|
32
|
-
resumeRender: Fn;
|
|
33
|
-
isActive: Ref<boolean>;
|
|
34
|
-
isRenderPaused: Ref<boolean>;
|
|
35
|
-
setContext: (newContext: Record<string, any>) => void;
|
|
36
|
-
setReady: (isReady: boolean) => void;
|
|
37
|
-
}
|
|
38
|
-
export declare function createRenderLoop(): RendererLoop;
|
package/dist/src/utils/is.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { TresObject, TresPrimitive } from 'src/types';
|
|
2
|
-
import { BufferGeometry, Camera, Color, ColorRepresentation, Fog, Light, Material, Object3D, Scene, Layers } from 'three';
|
|
3
|
-
export declare function und(u: unknown): u is undefined;
|
|
4
|
-
export declare function arr(u: unknown): u is Array<unknown>;
|
|
5
|
-
export declare function num(u: unknown): u is number;
|
|
6
|
-
export declare function str(u: unknown): u is string;
|
|
7
|
-
export declare function bool(u: unknown): u is boolean;
|
|
8
|
-
export declare function fun(u: unknown): u is (...args: any[]) => any;
|
|
9
|
-
export declare function obj(u: unknown): u is Record<string | number | symbol, unknown>;
|
|
10
|
-
export declare function object3D(u: unknown): u is Object3D;
|
|
11
|
-
export declare function color(u: unknown): u is Color;
|
|
12
|
-
export declare function colorRepresentation(u: unknown): u is ColorRepresentation;
|
|
13
|
-
interface VectorLike {
|
|
14
|
-
set: (...args: any[]) => void;
|
|
15
|
-
constructor?: (...args: any[]) => any;
|
|
16
|
-
}
|
|
17
|
-
export declare function vectorLike(u: unknown): u is VectorLike;
|
|
18
|
-
interface Copyable {
|
|
19
|
-
copy: (...args: any[]) => void;
|
|
20
|
-
constructor?: (...args: any[]) => any;
|
|
21
|
-
}
|
|
22
|
-
export declare function copyable(u: unknown): u is Copyable;
|
|
23
|
-
interface ClassInstance {
|
|
24
|
-
constructor?: (...args: any[]) => any;
|
|
25
|
-
}
|
|
26
|
-
export declare function classInstance(object: unknown): object is ClassInstance;
|
|
27
|
-
export declare function layers(u: unknown): u is Layers;
|
|
28
|
-
export declare function camera(u: unknown): u is Camera;
|
|
29
|
-
export declare function bufferGeometry(u: unknown): u is BufferGeometry;
|
|
30
|
-
export declare function material(u: unknown): u is Material;
|
|
31
|
-
export declare function light(u: unknown): u is Light;
|
|
32
|
-
export declare function fog(u: unknown): u is Fog;
|
|
33
|
-
export declare function scene(u: unknown): u is Scene;
|
|
34
|
-
export declare function tresObject(u: unknown): u is TresObject;
|
|
35
|
-
export declare function tresPrimitive(u: unknown): u is TresPrimitive;
|
|
36
|
-
export {};
|