@tresjs/core 3.2.2 → 3.3.0-next.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/components/TresCanvas.vue.d.ts +4 -1
- package/dist/composables/useRenderer/const.d.ts +2 -0
- package/dist/composables/useRenderer/index.d.ts +1 -1
- package/dist/composables/useTexture/index.d.ts +62 -6
- package/dist/tres.js +388 -389
- package/dist/tres.umd.cjs +2 -2
- package/dist/utils/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WebGLRendererParameters, ColorSpace, ShadowMapType, ToneMapping } from 'three';
|
|
2
|
+
import { type TresContext } from '../composables';
|
|
2
3
|
import type { RendererPresetsType } from '../composables/useRenderer/const';
|
|
3
4
|
import type { TresCamera } from '../types/';
|
|
4
5
|
export interface TresCanvasProps extends Omit<WebGLRendererParameters, 'canvas'> {
|
|
@@ -92,7 +93,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
92
93
|
type: import("vue").PropType<boolean>;
|
|
93
94
|
default: undefined;
|
|
94
95
|
};
|
|
95
|
-
}, {
|
|
96
|
+
}, {
|
|
97
|
+
context: import("vue").ShallowRef<TresContext | null>;
|
|
98
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
96
99
|
context: {
|
|
97
100
|
type: import("vue").PropType<WebGLRenderingContext>;
|
|
98
101
|
};
|
|
@@ -71,7 +71,7 @@ export interface UseRendererOptions extends TransformToMaybeRefOrGetter<WebGLRen
|
|
|
71
71
|
preset?: MaybeRefOrGetter<RendererPresetsType>;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
* Reactive
|
|
74
|
+
* Reactive three.js WebGLRenderer instance
|
|
75
75
|
*
|
|
76
76
|
* @param canvas
|
|
77
77
|
* @param {UseRendererOptions} [options]
|
|
@@ -19,7 +19,63 @@ export interface PBRTextureMaps {
|
|
|
19
19
|
[key: string]: Texture | null;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
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.
|
|
23
79
|
*
|
|
24
80
|
* ```ts
|
|
25
81
|
* import { useTexture } from 'tres'
|
|
@@ -39,9 +95,9 @@ export interface PBRTextureMaps {
|
|
|
39
95
|
* ```
|
|
40
96
|
* @see https://tresjs.org/examples/load-textures.html
|
|
41
97
|
* @export
|
|
42
|
-
* @param
|
|
43
|
-
* @return
|
|
98
|
+
* @param paths
|
|
99
|
+
* @return A promise of the resulting pbr texture map
|
|
44
100
|
*/
|
|
45
|
-
export declare function useTexture(paths:
|
|
46
|
-
[
|
|
47
|
-
}
|
|
101
|
+
export declare function useTexture<TextureMap extends PBRUseTextureMap>(paths: TextureMap): Promise<{
|
|
102
|
+
[K in keyof Required<PBRUseTextureMap>]: K extends keyof TextureMap ? Texture : null;
|
|
103
|
+
}>;
|