@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.
@@ -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
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
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
  };
@@ -1,5 +1,7 @@
1
1
  export declare const rendererPresets: {
2
2
  realistic: {
3
+ shadows: boolean;
4
+ physicallyCorrectLights: boolean;
3
5
  outputColorSpace: "srgb";
4
6
  toneMapping: 4;
5
7
  toneMappingExposure: number;
@@ -71,7 +71,7 @@ export interface UseRendererOptions extends TransformToMaybeRefOrGetter<WebGLRen
71
71
  preset?: MaybeRefOrGetter<RendererPresetsType>;
72
72
  }
73
73
  /**
74
- * Reactive Three.js WebGLRenderer instance
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
- * Composable for loading textures.
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 {(Array<string> | { [key: string]: string })} paths
43
- * @return {*} {(Promise<Texture | Array<Texture> | PBRTextureMaps>)}
98
+ * @param paths
99
+ * @return A promise of the resulting pbr texture map
44
100
  */
45
- export declare function useTexture(paths: Array<string> | {
46
- [key: string]: string;
47
- }): Promise<Texture | Array<Texture> | PBRTextureMaps>;
101
+ export declare function useTexture<TextureMap extends PBRUseTextureMap>(paths: TextureMap): Promise<{
102
+ [K in keyof Required<PBRUseTextureMap>]: K extends keyof TextureMap ? Texture : null;
103
+ }>;