@tresjs/core 5.0.0-next.4 → 5.0.0-next.6
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 +1 -1
- package/dist/src/composables/index.d.ts +1 -1
- package/dist/src/composables/useCreateRafLoop/index.d.ts +2 -6
- package/dist/src/composables/useGraph/index.d.ts +1 -2
- package/dist/src/composables/useLoop/index.d.ts +1 -1
- package/dist/src/composables/useRenderer/useRendererManager.d.ts +2 -1
- package/dist/src/composables/useTresContextProvider/index.d.ts +5 -3
- package/dist/src/types/index.d.ts +6 -0
- package/dist/src/utils/graph.d.ts +5 -4
- package/dist/tres.js +543 -538
- package/package.json +5 -5
|
@@ -63,6 +63,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Tr
|
|
|
63
63
|
onPointermissed?: ((event: PointerEvent<MouseEvent>) => any) | undefined;
|
|
64
64
|
onBeforeLoop?: ((context: TresContextWithClock) => any) | undefined;
|
|
65
65
|
}>, {
|
|
66
|
+
windowSize: boolean;
|
|
66
67
|
antialias: boolean;
|
|
67
68
|
stencil: boolean;
|
|
68
69
|
depth: boolean;
|
|
@@ -77,7 +78,6 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Tr
|
|
|
77
78
|
shadowMapType: THREE.ShadowMapType;
|
|
78
79
|
useLegacyLights: boolean;
|
|
79
80
|
renderMode: "always" | "on-demand" | "manual";
|
|
80
|
-
windowSize: boolean;
|
|
81
81
|
enableProvideBridge: boolean;
|
|
82
82
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
83
83
|
canvasRef: HTMLCanvasElement;
|
|
@@ -5,5 +5,5 @@ export * from './useLoader';
|
|
|
5
5
|
export * from './useLoop';
|
|
6
6
|
export * from './useRenderer/useRendererManager';
|
|
7
7
|
export * from './useTres';
|
|
8
|
-
export
|
|
8
|
+
export { type TresContext, useTresContext, useTresContextProvider } from './useTresContextProvider';
|
|
9
9
|
export { UseLoader };
|
|
@@ -2,17 +2,13 @@ export interface RafLoopContext {
|
|
|
2
2
|
delta: number;
|
|
3
3
|
elapsed: number;
|
|
4
4
|
}
|
|
5
|
-
type LoopFunction = (notifySuccess: () => void) => void;
|
|
6
5
|
/**
|
|
7
|
-
* @param
|
|
8
|
-
* @param notifySuccess a callback that should be called to indicate a successfull cycle.
|
|
6
|
+
* @param cycleFn the function that is called before the after event hook is triggered and after the before event hook is triggered.
|
|
9
7
|
*/
|
|
10
|
-
export declare const useCreateRafLoop: (
|
|
8
|
+
export declare const useCreateRafLoop: (cycleFn: () => void) => {
|
|
11
9
|
start: () => void;
|
|
12
10
|
stop: () => void;
|
|
13
11
|
isActive: Readonly<import('vue').ShallowRef<boolean>>;
|
|
14
12
|
onBeforeLoop: import('@vueuse/core').EventHookOn<RafLoopContext>;
|
|
15
13
|
onLoop: import('@vueuse/core').EventHookOn<RafLoopContext>;
|
|
16
|
-
replaceLoopFunction: (fn: LoopFunction) => void;
|
|
17
14
|
};
|
|
18
|
-
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Object3D } from 'three';
|
|
2
1
|
import { MaybeRef } from '@vueuse/core';
|
|
3
2
|
import { TresObject } from '../../types';
|
|
4
|
-
export declare function useGraph(object: MaybeRef<
|
|
3
|
+
export declare function useGraph(object: MaybeRef<TresObject>): import('vue').ComputedRef<import('../..').TresObjectMap>;
|
|
@@ -10,5 +10,5 @@ export declare const useLoop: () => {
|
|
|
10
10
|
isActive: Readonly<import('vue').ShallowRef<boolean>>;
|
|
11
11
|
onBeforeRender: import('../../utils/createPriorityEventHook').PriorityEventHookOn<LoopContext>;
|
|
12
12
|
onRender: import('../../utils/createPriorityEventHook').PriorityEventHookOn<LoopContext>;
|
|
13
|
-
render: (fn: (
|
|
13
|
+
render: (fn: import('..').RenderFunction) => void;
|
|
14
14
|
};
|
|
@@ -11,6 +11,7 @@ import { TresScene } from '../../types';
|
|
|
11
11
|
* If set to 'always', the scene will be rendered every frame
|
|
12
12
|
*/
|
|
13
13
|
export type RenderMode = 'always' | 'on-demand' | 'manual';
|
|
14
|
+
export type RenderFunction = (notifySuccess: () => void) => void;
|
|
14
15
|
export type TresRenderer = WebGLRenderer | Renderer;
|
|
15
16
|
export interface RendererOptions {
|
|
16
17
|
/**
|
|
@@ -180,7 +181,6 @@ export declare function useRendererManager({ scene, canvas, options, contextPart
|
|
|
180
181
|
isActive: Readonly<ShallowRef<boolean>>;
|
|
181
182
|
onBeforeLoop: import('@vueuse/core').EventHookOn<import('../useCreateRafLoop').RafLoopContext>;
|
|
182
183
|
onLoop: import('@vueuse/core').EventHookOn<import('../useCreateRafLoop').RafLoopContext>;
|
|
183
|
-
replaceLoopFunction: (fn: (notifySuccess: () => void) => void) => void;
|
|
184
184
|
};
|
|
185
185
|
instance: TresRenderer;
|
|
186
186
|
advance: () => void;
|
|
@@ -189,5 +189,6 @@ export declare function useRendererManager({ scene, canvas, options, contextPart
|
|
|
189
189
|
invalidate: (amountOfFramesToInvalidate?: number) => void;
|
|
190
190
|
canBeInvalidated: import('vue').ComputedRef<boolean>;
|
|
191
191
|
mode: "always" | "on-demand" | "manual" | undefined;
|
|
192
|
+
replaceRenderFunction: (fn: RenderFunction) => void;
|
|
192
193
|
};
|
|
193
194
|
export type UseRendererManagerReturn = ReturnType<typeof useRendererManager>;
|
|
@@ -13,10 +13,12 @@ export interface TresContext {
|
|
|
13
13
|
renderer: UseRendererManagerReturn;
|
|
14
14
|
events: ReturnType<typeof useEventManager>;
|
|
15
15
|
}
|
|
16
|
-
export declare
|
|
16
|
+
export declare const INJECTION_KEY = "useTres";
|
|
17
|
+
declare const useTresContextProvider: (args_0: {
|
|
17
18
|
scene: TresScene;
|
|
18
19
|
canvas: MaybeRef<HTMLCanvasElement>;
|
|
19
20
|
windowSize: MaybeRefOrGetter<boolean>;
|
|
20
21
|
rendererOptions: RendererOptions;
|
|
21
|
-
})
|
|
22
|
-
|
|
22
|
+
}) => TresContext;
|
|
23
|
+
declare const useTresContext: () => TresContext;
|
|
24
|
+
export { useTresContext, useTresContextProvider };
|
|
@@ -57,6 +57,12 @@ export interface TresObject3D extends THREE.Object3D<THREE.Object3DEventMap> {
|
|
|
57
57
|
export type TresObject = TresBaseObject & (TresObject3D | THREE.BufferGeometry | THREE.Material | THREE.Fog) & {
|
|
58
58
|
__tres?: LocalState;
|
|
59
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Union type covering all common Three.js material types
|
|
62
|
+
* This provides better TypeScript intellisense and type checking
|
|
63
|
+
* when accessing specific material properties
|
|
64
|
+
*/
|
|
65
|
+
export type TresMaterial = THREE.MeshBasicMaterial | THREE.MeshStandardMaterial | THREE.MeshPhysicalMaterial | THREE.MeshLambertMaterial | THREE.MeshPhongMaterial | THREE.MeshToonMaterial | THREE.MeshNormalMaterial | THREE.MeshMatcapMaterial | THREE.MeshDepthMaterial | THREE.MeshDistanceMaterial | THREE.LineBasicMaterial | THREE.LineDashedMaterial | THREE.PointsMaterial | THREE.SpriteMaterial | THREE.ShaderMaterial | THREE.RawShaderMaterial | THREE.ShadowMaterial | THREE.Material;
|
|
60
66
|
export type TresInstance = TresObject & {
|
|
61
67
|
__tres: LocalState;
|
|
62
68
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mesh, Scene } from 'three';
|
|
2
|
+
import { TresMaterial, TresObject } from '../types';
|
|
2
3
|
export interface TresObjectMap {
|
|
3
4
|
nodes: {
|
|
4
|
-
[name: string]:
|
|
5
|
+
[name: string]: TresObject;
|
|
5
6
|
};
|
|
6
7
|
materials: {
|
|
7
|
-
[name: string]:
|
|
8
|
+
[name: string]: TresMaterial;
|
|
8
9
|
};
|
|
9
10
|
meshes: {
|
|
10
11
|
[name: string]: Mesh;
|
|
11
12
|
};
|
|
12
13
|
scene?: Scene;
|
|
13
14
|
}
|
|
14
|
-
export declare function buildGraph(object:
|
|
15
|
+
export declare function buildGraph(object: TresObject): TresObjectMap;
|