@tresjs/core 5.0.3 → 5.1.1
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/chunk-QpvadvMP.js +30 -0
- package/dist/template-compiler-options.d.mts +17 -0
- package/dist/template-compiler-options.mjs +18 -0
- package/dist/tres.d.ts +1056 -0
- package/dist/tres.js +2349 -5572
- package/package.json +25 -49
- package/components.d.ts +0 -1
- package/composables.d.ts +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/src/components/TresCanvas.vue.d.ts +0 -94
- package/dist/src/components/index.d.ts +0 -2
- package/dist/src/composables/index.d.ts +0 -9
- package/dist/src/composables/useCamera/index.d.ts +0 -43
- package/dist/src/composables/useCreateRafLoop/index.d.ts +0 -14
- package/dist/src/composables/useEventManager/index.d.ts +0 -10
- package/dist/src/composables/useGraph/index.d.ts +0 -3
- package/dist/src/composables/useLoader/component.vue.d.ts +0 -38
- package/dist/src/composables/useLoader/index.d.ts +0 -51
- package/dist/src/composables/useLoop/index.d.ts +0 -14
- package/dist/src/composables/useRenderer/pixelRatio.d.ts +0 -4
- package/dist/src/composables/useRenderer/useRendererManager.d.ts +0 -194
- package/dist/src/composables/useSizes/index.d.ts +0 -11
- package/dist/src/composables/useTres/index.d.ts +0 -37
- package/dist/src/composables/useTresContextProvider/index.d.ts +0 -24
- package/dist/src/core/catalogue.d.ts +0 -9
- package/dist/src/core/nodeOps.d.ts +0 -4
- package/dist/src/core/revision.d.ts +0 -1
- package/dist/src/devtools/DevtoolsMessenger.d.ts +0 -53
- package/dist/src/devtools/highlight.d.ts +0 -7
- package/dist/src/devtools/index.d.ts +0 -2
- package/dist/src/devtools/inspectorHandlers.d.ts +0 -60
- package/dist/src/devtools/plugin.d.ts +0 -10
- package/dist/src/devtools/setupDevtools.d.ts +0 -14
- package/dist/src/devtools/types.d.ts +0 -90
- package/dist/src/devtools/utils.d.ts +0 -7
- package/dist/src/directives/index.d.ts +0 -4
- package/dist/src/directives/vDistanceTo.d.ts +0 -6
- package/dist/src/directives/vLightHelper.d.ts +0 -6
- package/dist/src/directives/vLog.d.ts +0 -6
- package/dist/src/index.d.ts +0 -25
- package/dist/src/types/index.d.ts +0 -137
- package/dist/src/utils/array.d.ts +0 -6
- package/dist/src/utils/createPriorityEventHook.d.ts +0 -15
- package/dist/src/utils/graph.d.ts +0 -15
- package/dist/src/utils/index.d.ts +0 -19
- package/dist/src/utils/is/dom.d.ts +0 -1
- package/dist/src/utils/is/index.d.ts +0 -4
- package/dist/src/utils/is/three.d.ts +0 -162
- package/dist/src/utils/is/tres.d.ts +0 -70
- package/dist/src/utils/is/typed.d.ts +0 -1
- package/dist/src/utils/is/util.d.ts +0 -1
- package/dist/src/utils/logger.d.ts +0 -25
- package/dist/src/utils/makeMap.d.ts +0 -9
- package/dist/src/utils/normalize.d.ts +0 -17
- package/dist/src/utils/perf.d.ts +0 -7
- package/dist/src/utils/pointerEvents.d.ts +0 -10
- package/dist/src/utils/primitive/createRetargetingProxy.d.ts +0 -1
- package/dist/src/utils/string.d.ts +0 -1
- package/dist/src/utils/template-compiler-options.d.ts +0 -8
- package/dist/src/utils/test-utils.d.ts +0 -2
- package/dist/src/utils/three.d.ts +0 -9
- package/types.d.ts +0 -1
- package/utils.d.ts +0 -1
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ComputedRef } from 'vue';
|
|
2
|
-
import { TresContext } from '../useTresContextProvider';
|
|
3
|
-
import { Camera } from 'three';
|
|
4
|
-
import { TresRenderer } from '..';
|
|
5
|
-
export interface TresPartialContext extends Omit<TresContext, 'renderer' | 'camera'> {
|
|
6
|
-
/**
|
|
7
|
-
* The renderer instance
|
|
8
|
-
*
|
|
9
|
-
* @type {TresRenderer}
|
|
10
|
-
* @memberof TresPartialContext
|
|
11
|
-
*/
|
|
12
|
-
renderer: TresRenderer;
|
|
13
|
-
/**
|
|
14
|
-
* The current active camera
|
|
15
|
-
*
|
|
16
|
-
* @type {ComputedRef<Camera | undefined>}
|
|
17
|
-
* @memberof TresPartialContext
|
|
18
|
-
*/
|
|
19
|
-
camera: ComputedRef<Camera | undefined>;
|
|
20
|
-
/**
|
|
21
|
-
* Marks the scene as needing an update in the next frame.
|
|
22
|
-
* This is used in on-demand rendering mode to schedule a render.
|
|
23
|
-
*
|
|
24
|
-
* @type {() => void}
|
|
25
|
-
* @memberof TresPartialContext
|
|
26
|
-
*/
|
|
27
|
-
invalidate: () => void;
|
|
28
|
-
/**
|
|
29
|
-
* Manually advances the render loop by one frame.
|
|
30
|
-
* This is particularly useful in manual rendering mode where you want explicit control over when frames are rendered.
|
|
31
|
-
*
|
|
32
|
-
* @type {() => void}
|
|
33
|
-
* @memberof TresPartialContext
|
|
34
|
-
*/
|
|
35
|
-
advance: () => void;
|
|
36
|
-
}
|
|
37
|
-
export declare function useTres(): TresPartialContext;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { MaybeRef, MaybeRefOrGetter, Ref, ShallowRef } from 'vue';
|
|
2
|
-
import { TresControl, TresScene } from '../../types';
|
|
3
|
-
import { RendererOptions, UseRendererManagerReturn } from '../useRenderer/useRendererManager';
|
|
4
|
-
import { UseCameraReturn } from '../useCamera/';
|
|
5
|
-
import { SizesType } from '../useSizes';
|
|
6
|
-
import { useEventManager } from '../useEventManager';
|
|
7
|
-
export interface TresContext {
|
|
8
|
-
scene: ShallowRef<TresScene>;
|
|
9
|
-
sizes: SizesType;
|
|
10
|
-
extend: (objects: any) => void;
|
|
11
|
-
camera: UseCameraReturn;
|
|
12
|
-
controls: Ref<TresControl | null>;
|
|
13
|
-
renderer: UseRendererManagerReturn;
|
|
14
|
-
events: ReturnType<typeof useEventManager>;
|
|
15
|
-
}
|
|
16
|
-
export declare const INJECTION_KEY = "useTres";
|
|
17
|
-
declare const useTresContextProvider: (args_0: {
|
|
18
|
-
scene: TresScene;
|
|
19
|
-
canvas: MaybeRef<HTMLCanvasElement>;
|
|
20
|
-
windowSize: MaybeRefOrGetter<boolean>;
|
|
21
|
-
rendererOptions: RendererOptions;
|
|
22
|
-
}) => TresContext;
|
|
23
|
-
declare const useTresContext: () => TresContext;
|
|
24
|
-
export { useTresContext, useTresContextProvider };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
import { TresCatalogue } from '../types';
|
|
3
|
-
export declare const catalogue: Ref<TresCatalogue>;
|
|
4
|
-
export declare const extend: (objects: any) => any;
|
|
5
|
-
declare const _default: {
|
|
6
|
-
catalogue: Ref<TresCatalogue, TresCatalogue>;
|
|
7
|
-
extend: (objects: any) => any;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const revision: number;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export type DevtoolsMessageType = 'performance' | 'context' | 'asset-load';
|
|
2
|
-
export interface AssetLoadData {
|
|
3
|
-
url: string;
|
|
4
|
-
type: string;
|
|
5
|
-
loaded: boolean;
|
|
6
|
-
size: number;
|
|
7
|
-
asset: HTMLImageElement | HTMLScriptElement | HTMLLinkElement | Blob | ArrayBuffer | null;
|
|
8
|
-
}
|
|
9
|
-
export interface DevtoolsMessage<T = any> {
|
|
10
|
-
type: DevtoolsMessageType;
|
|
11
|
-
data: T;
|
|
12
|
-
timestamp?: number;
|
|
13
|
-
}
|
|
14
|
-
export type DevtoolsSubscriber = (message: DevtoolsMessage) => void;
|
|
15
|
-
/**
|
|
16
|
-
* Messenger class for communicating with Tres DevTools
|
|
17
|
-
* This class will be attached to window.__TRES__DEVTOOLS__
|
|
18
|
-
*/
|
|
19
|
-
export declare class DevtoolsMessenger {
|
|
20
|
-
private subscribers;
|
|
21
|
-
private messageQueue;
|
|
22
|
-
private maxQueueSize;
|
|
23
|
-
/**
|
|
24
|
-
* Send a message to devtools subscribers
|
|
25
|
-
* If no subscribers are available, only queueable message types are queued
|
|
26
|
-
*/
|
|
27
|
-
send<T>(type: DevtoolsMessageType, data: T): void;
|
|
28
|
-
/**
|
|
29
|
-
* Queue a message for later delivery
|
|
30
|
-
*/
|
|
31
|
-
private queueMessage;
|
|
32
|
-
/**
|
|
33
|
-
* Flush all queued messages to current subscribers
|
|
34
|
-
*/
|
|
35
|
-
private flushQueue;
|
|
36
|
-
/**
|
|
37
|
-
* Subscribe to devtools messages
|
|
38
|
-
* When a new subscriber is added, all queued messages (asset-load events) are immediately delivered
|
|
39
|
-
*/
|
|
40
|
-
subscribe(subscriber: DevtoolsSubscriber): () => void;
|
|
41
|
-
/**
|
|
42
|
-
* Check if there are any subscribers
|
|
43
|
-
*/
|
|
44
|
-
get hasSubscribers(): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Get the current queue size
|
|
47
|
-
*/
|
|
48
|
-
get queueSize(): number;
|
|
49
|
-
/**
|
|
50
|
-
* Clear all queued messages
|
|
51
|
-
*/
|
|
52
|
-
clearQueue(): void;
|
|
53
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Mesh } from 'three';
|
|
2
|
-
import { TresObject } from '../types';
|
|
3
|
-
import { SceneGraphObject } from './types';
|
|
4
|
-
import { TresContext } from '../composables/useTresContextProvider';
|
|
5
|
-
/**
|
|
6
|
-
* Creates a node representation of a Three.js object for the inspector tree
|
|
7
|
-
* @param object - The Three.js object to create a node for
|
|
8
|
-
* @returns A SceneGraphObject representing the Three.js object with relevant metadata
|
|
9
|
-
*/
|
|
10
|
-
export declare const createNode: (object: TresObject) => SceneGraphObject;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a context node for the inspector tree
|
|
13
|
-
* @param key - The key identifier for the context node
|
|
14
|
-
* @param uuid - The unique identifier for the context
|
|
15
|
-
* @param parentKey - Optional parent key for nested context nodes
|
|
16
|
-
* @returns A SceneGraphObject representing the context node
|
|
17
|
-
*/
|
|
18
|
-
export declare function createContextNode(key: string, uuid: string, parentKey?: string): SceneGraphObject;
|
|
19
|
-
/**
|
|
20
|
-
* Recursively builds a graph representation of Three.js objects for the inspector
|
|
21
|
-
* @param object - The root Three.js object to build the graph from
|
|
22
|
-
* @param node - The current node in the graph being built
|
|
23
|
-
* @param filter - Optional filter string to filter objects by type or name
|
|
24
|
-
*/
|
|
25
|
-
export declare function buildGraph(object: TresObject, node: SceneGraphObject, filter?: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Recursively builds a graph representation of context objects for the inspector
|
|
28
|
-
* @param object - The root object to build the context graph from
|
|
29
|
-
* @param node - The current node in the graph being built
|
|
30
|
-
* @param visited - WeakSet to track visited objects and prevent circular references
|
|
31
|
-
* @param depth - Current depth in the object tree
|
|
32
|
-
* @param maxDepth - Maximum depth to traverse
|
|
33
|
-
* @param contextUuid - Optional UUID for the context
|
|
34
|
-
* @param parentKey - Optional parent key for nested objects
|
|
35
|
-
*/
|
|
36
|
-
export declare function buildContextGraph(object: any, node: SceneGraphObject, visited?: WeakSet<WeakKey>, depth?: number, maxDepth?: number, contextUuid?: string, parentKey?: string): void;
|
|
37
|
-
/**
|
|
38
|
-
* Handler for inspector tree updates
|
|
39
|
-
* @param tres - The TresContext instance
|
|
40
|
-
* @returns A function that handles inspector tree payload updates
|
|
41
|
-
*/
|
|
42
|
-
export declare const inspectorTreeHandler: (tres: TresContext) => (payload: any) => void;
|
|
43
|
-
/**
|
|
44
|
-
* Handler for inspector state updates
|
|
45
|
-
* @param tres - The TresContext instance
|
|
46
|
-
* @param options - Options for the handler
|
|
47
|
-
* @param options.highlightMesh - The currently highlighted mesh
|
|
48
|
-
* @param options.prevInstance - The previously selected instance
|
|
49
|
-
* @returns A function that handles inspector state payload updates
|
|
50
|
-
*/
|
|
51
|
-
export declare const inspectorStateHandler: (tres: TresContext, { highlightMesh, prevInstance }: {
|
|
52
|
-
highlightMesh: Mesh | null;
|
|
53
|
-
prevInstance: TresObject | null;
|
|
54
|
-
}) => (payload: any) => void;
|
|
55
|
-
/**
|
|
56
|
-
* Handler for inspector state edits
|
|
57
|
-
* @param tres - The TresContext instance
|
|
58
|
-
* @returns A function that handles inspector state edit payload updates
|
|
59
|
-
*/
|
|
60
|
-
export declare const inspectorEditStateHandler: (tres: TresContext) => (payload: any) => void;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { TresContext } from '../composables';
|
|
2
|
-
import { App } from 'vue';
|
|
3
|
-
export interface Tags {
|
|
4
|
-
label: string;
|
|
5
|
-
textColor: number;
|
|
6
|
-
backgroundColor: number;
|
|
7
|
-
tooltip?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const INSPECTOR_ID = "tres:inspector";
|
|
10
|
-
export declare function registerTresDevtools(app: App, tres: TresContext): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TresContext } from '../composables';
|
|
2
|
-
export interface PerformanceState {
|
|
3
|
-
maxFrames: number;
|
|
4
|
-
fps: {
|
|
5
|
-
value: number;
|
|
6
|
-
accumulator: number[];
|
|
7
|
-
};
|
|
8
|
-
memory: {
|
|
9
|
-
currentMem: number;
|
|
10
|
-
allocatedMem: number;
|
|
11
|
-
accumulator: number[];
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare function setupTresDevtools(ctx: TresContext): void;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a tag that can be displayed in the inspector UI
|
|
3
|
-
* @interface Tags
|
|
4
|
-
*/
|
|
5
|
-
export interface Tags {
|
|
6
|
-
/** The text to display in the tag */
|
|
7
|
-
label: string;
|
|
8
|
-
/** The color of the text in hexadecimal format (e.g., 0xFFFFFF) */
|
|
9
|
-
textColor: number;
|
|
10
|
-
/** The background color of the tag in hexadecimal format (e.g., 0x000000) */
|
|
11
|
-
backgroundColor: number;
|
|
12
|
-
/** Optional tooltip text to show on hover */
|
|
13
|
-
tooltip?: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Represents a node in the scene graph that can be displayed in the inspector
|
|
17
|
-
* @interface SceneGraphObject
|
|
18
|
-
*/
|
|
19
|
-
export interface SceneGraphObject {
|
|
20
|
-
/** Unique identifier for the node */
|
|
21
|
-
id: string;
|
|
22
|
-
/** Display name of the node */
|
|
23
|
-
label: string;
|
|
24
|
-
/** Array of child nodes */
|
|
25
|
-
children: SceneGraphObject[];
|
|
26
|
-
/** Array of tags associated with the node */
|
|
27
|
-
tags: Tags[];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Represents memory usage statistics for Three.js resources
|
|
31
|
-
* @interface MemoryStats
|
|
32
|
-
*/
|
|
33
|
-
export interface MemoryStats {
|
|
34
|
-
/** Map of geometry names to their memory usage in bytes */
|
|
35
|
-
geometries: Map<string, number>;
|
|
36
|
-
/** Map of material names to their memory usage in bytes */
|
|
37
|
-
materials: Map<string, number>;
|
|
38
|
-
/** Map of texture names to their memory usage in bytes */
|
|
39
|
-
textures: Map<string, number>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Represents a property in the inspector state
|
|
43
|
-
* @interface InspectorStateProperty
|
|
44
|
-
*/
|
|
45
|
-
export interface InspectorStateProperty {
|
|
46
|
-
/** The name of the property */
|
|
47
|
-
key: string;
|
|
48
|
-
/** The value of the property */
|
|
49
|
-
value: unknown;
|
|
50
|
-
/** Whether the property can be edited in the inspector */
|
|
51
|
-
editable: boolean;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Represents the state of an inspector panel
|
|
55
|
-
* @interface InspectorState
|
|
56
|
-
*/
|
|
57
|
-
export interface InspectorState {
|
|
58
|
-
/** Array of properties to display in the inspector */
|
|
59
|
-
object: InspectorStateProperty[];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Represents the internal state of the devtools
|
|
63
|
-
* @interface DevtoolsState
|
|
64
|
-
*/
|
|
65
|
-
export interface DevtoolsState {
|
|
66
|
-
/** The current scene graph representation */
|
|
67
|
-
sceneGraph: SceneGraphObject | null;
|
|
68
|
-
/** Timestamp of the last update */
|
|
69
|
-
lastUpdate: number;
|
|
70
|
-
/** Minimum time between updates in milliseconds */
|
|
71
|
-
updateThreshold: number;
|
|
72
|
-
/** Current memory usage statistics */
|
|
73
|
-
memoryStats: MemoryStats;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Represents a payload sent to or received from the devtools
|
|
77
|
-
* @interface DevtoolsPayload
|
|
78
|
-
*/
|
|
79
|
-
export interface DevtoolsPayload {
|
|
80
|
-
/** The ID of the inspector panel */
|
|
81
|
-
inspectorId: string;
|
|
82
|
-
/** The ID of the node being inspected */
|
|
83
|
-
nodeId: string;
|
|
84
|
-
/** Optional filter string for searching */
|
|
85
|
-
filter?: string;
|
|
86
|
-
/** Optional state to update */
|
|
87
|
-
state?: InspectorState;
|
|
88
|
-
/** Optional path to the property being edited */
|
|
89
|
-
path?: string[];
|
|
90
|
-
}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { App } from 'vue';
|
|
2
|
-
import { disposeObject3D as dispose } from './utils';
|
|
3
|
-
import { normalizeColor, normalizeVectorFlexibleParam } from './utils/normalize';
|
|
4
|
-
import { default as templateCompilerOptions } from './utils/template-compiler-options';
|
|
5
|
-
export * from './components';
|
|
6
|
-
export * from './composables';
|
|
7
|
-
export * from './core/catalogue';
|
|
8
|
-
export * from './devtools';
|
|
9
|
-
export * from './directives';
|
|
10
|
-
export * from './types';
|
|
11
|
-
export * from './utils/graph';
|
|
12
|
-
export * from './utils/is/three';
|
|
13
|
-
export * from './utils/is/tres';
|
|
14
|
-
export * from './utils/logger';
|
|
15
|
-
export interface TresOptions {
|
|
16
|
-
extends?: Record<string, unknown>;
|
|
17
|
-
}
|
|
18
|
-
export interface TresPlugin {
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
install: (app: App, options?: TresOptions) => void;
|
|
21
|
-
}
|
|
22
|
-
declare const plugin: TresPlugin;
|
|
23
|
-
export default plugin;
|
|
24
|
-
export { dispose, normalizeColor, normalizeVectorFlexibleParam, templateCompilerOptions, };
|
|
25
|
-
export type { VectorFlexibleParams } from './utils/normalize';
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { DefineComponent, VNode, VNodeRef } from 'vue';
|
|
2
|
-
import { TresContext } from '../composables/useTresContextProvider';
|
|
3
|
-
import { PointerEventHandlers } from '../utils/pointerEvents';
|
|
4
|
-
import type * as THREE from 'three';
|
|
5
|
-
export type AttachFnType = (parent: any, self: TresInstance) => () => void;
|
|
6
|
-
export type AttachType = string | AttachFnType;
|
|
7
|
-
export type DisposeType = ((self: TresInstance) => void) | boolean | 'default';
|
|
8
|
-
export type ConstructorRepresentation = new (...args: any[]) => any;
|
|
9
|
-
export type NonFunctionKeys<P> = {
|
|
10
|
-
[K in keyof P]-?: P[K] extends (...args: any[]) => any ? never : K;
|
|
11
|
-
}[keyof P];
|
|
12
|
-
export type Overwrite<P, O> = Omit<P, NonFunctionKeys<O>> & O;
|
|
13
|
-
export type Properties<T> = Pick<T, NonFunctionKeys<T>>;
|
|
14
|
-
export type Mutable<P> = {
|
|
15
|
-
[K in keyof P]: P[K] | Readonly<P[K]>;
|
|
16
|
-
};
|
|
17
|
-
export type Args<T> = T extends ConstructorRepresentation ? ConstructorParameters<T> : any[];
|
|
18
|
-
export interface TresCatalogue {
|
|
19
|
-
[name: string]: ConstructorRepresentation;
|
|
20
|
-
}
|
|
21
|
-
export type TresCamera = THREE.OrthographicCamera | THREE.PerspectiveCamera;
|
|
22
|
-
/**
|
|
23
|
-
* Represents the properties of an instance.
|
|
24
|
-
*
|
|
25
|
-
* @template T - The type of the object.
|
|
26
|
-
* @template P - The type of the arguments.
|
|
27
|
-
*/
|
|
28
|
-
export interface InstanceProps<T = any, P = any> {
|
|
29
|
-
args?: Args<P>;
|
|
30
|
-
object?: T;
|
|
31
|
-
visible?: boolean;
|
|
32
|
-
dispose?: null;
|
|
33
|
-
attach?: AttachType;
|
|
34
|
-
}
|
|
35
|
-
interface TresBaseObject {
|
|
36
|
-
removeFromParent?: () => void;
|
|
37
|
-
dispose?: () => void;
|
|
38
|
-
[prop: string]: any;
|
|
39
|
-
}
|
|
40
|
-
export interface LocalState {
|
|
41
|
-
type: string;
|
|
42
|
-
root: TresContext;
|
|
43
|
-
memoizedProps: {
|
|
44
|
-
[key: string]: any;
|
|
45
|
-
};
|
|
46
|
-
objects: TresObject[];
|
|
47
|
-
parent: TresObject | null;
|
|
48
|
-
primitive?: boolean;
|
|
49
|
-
dispose?: DisposeType;
|
|
50
|
-
attach?: AttachType;
|
|
51
|
-
previousAttach: any;
|
|
52
|
-
}
|
|
53
|
-
export interface TresObject3D extends THREE.Object3D<THREE.Object3DEventMap> {
|
|
54
|
-
geometry?: THREE.BufferGeometry & TresBaseObject;
|
|
55
|
-
material?: THREE.Material & TresBaseObject;
|
|
56
|
-
}
|
|
57
|
-
export type TresObject = TresBaseObject & (TresObject3D | THREE.BufferGeometry | THREE.Material | THREE.Fog) & {
|
|
58
|
-
__tres?: LocalState;
|
|
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;
|
|
66
|
-
export type TresInstance = TresObject & {
|
|
67
|
-
__tres: LocalState;
|
|
68
|
-
};
|
|
69
|
-
export type TresPrimitive = TresInstance & {
|
|
70
|
-
object: TresInstance;
|
|
71
|
-
isPrimitive: true;
|
|
72
|
-
};
|
|
73
|
-
export interface TresScene extends THREE.Scene {
|
|
74
|
-
__tres: {
|
|
75
|
-
root: TresContext;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
interface MathRepresentation {
|
|
79
|
-
set(...args: number[] | [THREE.ColorRepresentation]): any;
|
|
80
|
-
}
|
|
81
|
-
interface VectorRepresentation extends MathRepresentation {
|
|
82
|
-
setScalar(s: number): any;
|
|
83
|
-
}
|
|
84
|
-
export interface VectorCoordinates {
|
|
85
|
-
x: number;
|
|
86
|
-
y: number;
|
|
87
|
-
z: number;
|
|
88
|
-
}
|
|
89
|
-
export type MathType<T extends MathRepresentation | THREE.Euler> = T extends THREE.Color ? ConstructorParameters<typeof THREE.Color> | THREE.ColorRepresentation : T extends VectorRepresentation | THREE.Layers | THREE.Euler ? T | Parameters<T['set']> | number | VectorCoordinates : T | Parameters<T['set']>;
|
|
90
|
-
type VectorLike<VectorClass extends THREE.Vector2 | THREE.Vector3 | THREE.Vector4> = VectorClass | Parameters<VectorClass['set']> | Readonly<Parameters<VectorClass['set']>> | Parameters<VectorClass['setScalar']>[0];
|
|
91
|
-
export type TresVector2 = VectorLike<THREE.Vector2>;
|
|
92
|
-
export type TresVector3 = VectorLike<THREE.Vector3>;
|
|
93
|
-
export type TresVector4 = VectorLike<THREE.Vector4>;
|
|
94
|
-
export type TresColor = ConstructorParameters<typeof THREE.Color> | THREE.Color | number | string;
|
|
95
|
-
export type TresColorArray = typeof THREE.Color | [color: THREE.ColorRepresentation];
|
|
96
|
-
export type TresLayers = THREE.Layers | Parameters<THREE.Layers['set']>[0];
|
|
97
|
-
export type TresQuaternion = THREE.Quaternion | Parameters<THREE.Quaternion['set']>;
|
|
98
|
-
export type TresEuler = THREE.Euler;
|
|
99
|
-
export type TresControl = THREE.EventDispatcher & {
|
|
100
|
-
enabled: boolean;
|
|
101
|
-
};
|
|
102
|
-
export type TresContextWithClock = TresContext & {
|
|
103
|
-
delta: number;
|
|
104
|
-
elapsed: number;
|
|
105
|
-
};
|
|
106
|
-
export type WithMathProps<P> = {
|
|
107
|
-
[K in keyof P]: P[K] extends MathRepresentation | THREE.Euler ? MathType<P[K]> : P[K];
|
|
108
|
-
};
|
|
109
|
-
interface RaycastableRepresentation {
|
|
110
|
-
raycast: (raycaster: THREE.Raycaster, intersects: THREE.Intersection[]) => void;
|
|
111
|
-
}
|
|
112
|
-
type EventProps<P> = P extends RaycastableRepresentation ? Partial<PointerEventHandlers> : unknown;
|
|
113
|
-
export type { TresPointerEvent } from '../utils/pointerEvents';
|
|
114
|
-
export interface VueProps {
|
|
115
|
-
children?: VNode[];
|
|
116
|
-
ref?: VNodeRef;
|
|
117
|
-
key?: string | number | symbol;
|
|
118
|
-
}
|
|
119
|
-
export type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = Partial<Overwrite<P, WithMathProps<P> & VueProps & EventProps<P>>>;
|
|
120
|
-
export type ThreeElement<T extends ConstructorRepresentation> = Mutable<Overwrite<ElementProps<T>, Omit<InstanceProps<InstanceType<T>, T>, 'object'>>>;
|
|
121
|
-
type ThreeExports = typeof THREE;
|
|
122
|
-
type ThreeInstancesImpl = {
|
|
123
|
-
[K in keyof ThreeExports as Uncapitalize<K>]: ThreeExports[K] extends ConstructorRepresentation ? ThreeElement<ThreeExports[K]> : never;
|
|
124
|
-
};
|
|
125
|
-
export interface ThreeInstances extends ThreeInstancesImpl {
|
|
126
|
-
primitive: Omit<ThreeElement<any>, 'args'> & {
|
|
127
|
-
object: object;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
type TresComponents = {
|
|
131
|
-
[K in keyof ThreeInstances as `Tres${Capitalize<string & K>}`]: DefineComponent<ThreeInstances[K]>;
|
|
132
|
-
};
|
|
133
|
-
declare module 'vue' {
|
|
134
|
-
interface GlobalComponents extends TresComponents {
|
|
135
|
-
primitive: DefineComponent<TresPrimitive>;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Like Array.filter, but modifies the array in place.
|
|
3
|
-
* @param array - Array to modify
|
|
4
|
-
* @param callbackFn - A function called for each element of the array. It should return a truthy value to keep the element in the array.
|
|
5
|
-
*/
|
|
6
|
-
export declare const filterInPlace: <T>(array: T[], callbackFn: (element: T, index: number) => unknown) => T[];
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { EventHookOff, EventHookTrigger } from '@vueuse/core';
|
|
2
|
-
export type Callback<T> = Parameters<EventHookOff<T>>[0];
|
|
3
|
-
export type PriorityEventHookOn<T> = (fn: Callback<T>, priority?: number) => {
|
|
4
|
-
off: () => void;
|
|
5
|
-
};
|
|
6
|
-
export type PriorityEventHookOff<T> = EventHookOff<T>;
|
|
7
|
-
export type PriorityEventHookTrigger<T> = EventHookTrigger<T>;
|
|
8
|
-
export interface PriorityEventHook<T = any> {
|
|
9
|
-
on: PriorityEventHookOn<T>;
|
|
10
|
-
off: (fn: Callback<T>) => void;
|
|
11
|
-
trigger: PriorityEventHookTrigger<T>;
|
|
12
|
-
dispose: () => void;
|
|
13
|
-
count: number;
|
|
14
|
-
}
|
|
15
|
-
export declare function createPriorityEventHook<T>(): PriorityEventHook<T>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Mesh, Object3D, Scene } from 'three';
|
|
2
|
-
import { TresMaterial, TresObject } from '../types';
|
|
3
|
-
export interface TresObjectMap {
|
|
4
|
-
nodes: {
|
|
5
|
-
[name: string]: TresObject;
|
|
6
|
-
};
|
|
7
|
-
materials: {
|
|
8
|
-
[name: string]: TresMaterial;
|
|
9
|
-
};
|
|
10
|
-
meshes: {
|
|
11
|
-
[name: string]: Mesh;
|
|
12
|
-
};
|
|
13
|
-
scene?: Scene;
|
|
14
|
-
}
|
|
15
|
-
export declare function buildGraph(object: Object3D | TresObject): TresObjectMap;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { nodeOps } from 'src/core/nodeOps';
|
|
2
|
-
import { AttachType, LocalState, TresInstance, TresObject, TresPrimitive } from 'src/types';
|
|
3
|
-
import { Material } from 'three';
|
|
4
|
-
import { TresContext } from '../composables/useTresContextProvider';
|
|
5
|
-
export * from './logger';
|
|
6
|
-
export declare function disposeMaterial(material: Material): void;
|
|
7
|
-
export declare function disposeObject3D(object: TresObject): void;
|
|
8
|
-
export declare function resolve(obj: Record<string, any>, key: string): {
|
|
9
|
-
target: Record<string, any>;
|
|
10
|
-
key: string;
|
|
11
|
-
};
|
|
12
|
-
export declare function attach(parent: TresInstance, child: TresInstance, type: AttachType): void;
|
|
13
|
-
export declare function detach(parent: any, child: TresInstance, type: AttachType): void;
|
|
14
|
-
export declare function prepareTresInstance<T extends TresObject>(obj: T, state: Partial<LocalState>, context: TresContext): TresInstance;
|
|
15
|
-
export declare function invalidateInstance(instance: TresObject): void;
|
|
16
|
-
export declare function setPrimitiveObject(newObject: TresObject, primitive: TresPrimitive, setTarget: (object: TresObject) => void, nodeOpsFns: Pick<ReturnType<typeof nodeOps>, 'patchProp' | 'insert' | 'remove'>, context: TresContext): boolean;
|
|
17
|
-
export declare function unboxTresPrimitive<T>(maybePrimitive: T): T | TresInstance;
|
|
18
|
-
export declare function doRemoveDetach(node: TresObject, context: TresContext): void;
|
|
19
|
-
export declare function doRemoveDeregister(node: TresObject, context: TresContext): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isHTMLTag: (key: string) => boolean;
|