string-tune-3d 0.0.11 → 0.0.13
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/index.cjs +134 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +380 -120
- package/dist/index.d.ts +380 -120
- package/dist/index.js +135 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +134 -133
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/readme.md +11 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StringModule, StringContext, StringObject, StringData } from '@fiddle-digital/string-tune';
|
|
2
2
|
|
|
3
3
|
type UniformType = "float" | "int" | "vec2" | "vec3" | "vec4" | "color" | "texture" | "mat3" | "mat4";
|
|
4
4
|
type UniformDefinition = {
|
|
@@ -16,18 +16,33 @@ type MaterialBlendMode = "normal" | "additive" | "subtractive" | "multiply";
|
|
|
16
16
|
type MaterialSide = "front" | "back" | "double";
|
|
17
17
|
type String3DCustomMaterialDefinition = {
|
|
18
18
|
name: string;
|
|
19
|
-
extends?: "basic" | "standard" | "physical" | "shader";
|
|
19
|
+
extends?: "basic" | "standard" | "physical" | "transmission" | "shader";
|
|
20
20
|
vertexShader?: string;
|
|
21
21
|
fragmentShader?: string;
|
|
22
22
|
injections?: ShaderInjection[];
|
|
23
23
|
uniforms?: Record<string, UniformDefinition>;
|
|
24
24
|
properties?: {
|
|
25
25
|
transparent?: boolean;
|
|
26
|
+
opacity?: number;
|
|
26
27
|
side?: MaterialSide;
|
|
27
28
|
depthWrite?: boolean;
|
|
28
29
|
depthTest?: boolean;
|
|
29
30
|
blending?: MaterialBlendMode;
|
|
30
31
|
wireframe?: boolean;
|
|
32
|
+
color?: string | number;
|
|
33
|
+
emissive?: string | number;
|
|
34
|
+
metalness?: number;
|
|
35
|
+
roughness?: number;
|
|
36
|
+
transmission?: number;
|
|
37
|
+
thickness?: number;
|
|
38
|
+
ior?: number;
|
|
39
|
+
reflectivity?: number;
|
|
40
|
+
clearcoat?: number;
|
|
41
|
+
clearcoatRoughness?: number;
|
|
42
|
+
attenuationDistance?: number;
|
|
43
|
+
attenuationColor?: string | number;
|
|
44
|
+
transmissionSamples?: number;
|
|
45
|
+
transmissionSampler?: boolean;
|
|
31
46
|
};
|
|
32
47
|
lights?: boolean;
|
|
33
48
|
parse?: (element: HTMLElement, style: CSSStyleDeclaration) => Record<string, any>;
|
|
@@ -56,8 +71,135 @@ interface IMaterialFactory {
|
|
|
56
71
|
supports(definition: String3DCustomMaterialDefinition): boolean;
|
|
57
72
|
create(definition: String3DCustomMaterialDefinition, initialUniforms?: Record<string, any>): IMaterialInstance;
|
|
58
73
|
parseUniformsFromCSS(definition: String3DCustomMaterialDefinition, element: HTMLElement, style: CSSStyleDeclaration): Record<string, any>;
|
|
74
|
+
getMaterialDefinition?(material: any): String3DCustomMaterialDefinition | null;
|
|
75
|
+
applyUniforms?(material: any, definition: String3DCustomMaterialDefinition, values: Record<string, any>): void;
|
|
76
|
+
isShaderMaterial?(material: any): boolean;
|
|
59
77
|
}
|
|
60
78
|
|
|
79
|
+
type String3DCustomFilterImplementation = {
|
|
80
|
+
kind: "shader";
|
|
81
|
+
language: "glsl" | "wgsl" | "custom";
|
|
82
|
+
stage?: "fragment" | "pipeline";
|
|
83
|
+
code: string;
|
|
84
|
+
vertexCode?: string;
|
|
85
|
+
entryPoint?: string;
|
|
86
|
+
metadata?: Record<string, any>;
|
|
87
|
+
};
|
|
88
|
+
type String3DCustomFilterDefinition = {
|
|
89
|
+
name: string;
|
|
90
|
+
implementations?: Partial<Record<I3DBackend, String3DCustomFilterImplementation>>;
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated Use `implementations.webgl` instead.
|
|
93
|
+
*/
|
|
94
|
+
fragmentShader?: string;
|
|
95
|
+
uniforms?: Record<string, any>;
|
|
96
|
+
parse?: (args: string) => Record<string, any> | null;
|
|
97
|
+
};
|
|
98
|
+
declare class String3DCustomFilterRegistry {
|
|
99
|
+
private static filters;
|
|
100
|
+
static register(definition: String3DCustomFilterDefinition): void;
|
|
101
|
+
static get(name: string): String3DCustomFilterDefinition | undefined;
|
|
102
|
+
static has(name: string): boolean;
|
|
103
|
+
static list(): String3DCustomFilterDefinition[];
|
|
104
|
+
static getImplementation(name: string, backend: I3DBackend): String3DCustomFilterImplementation | undefined;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare class String3DObject {
|
|
108
|
+
id: string;
|
|
109
|
+
type: string;
|
|
110
|
+
private _object;
|
|
111
|
+
private _material?;
|
|
112
|
+
private _geometry?;
|
|
113
|
+
private _texture?;
|
|
114
|
+
private _uniforms;
|
|
115
|
+
private _originalBoundingBox?;
|
|
116
|
+
private _quaternion;
|
|
117
|
+
private _originalSize;
|
|
118
|
+
private _bbox;
|
|
119
|
+
el: any;
|
|
120
|
+
private _children;
|
|
121
|
+
private _flatObjectsCache;
|
|
122
|
+
private _subtreeCache;
|
|
123
|
+
private engine;
|
|
124
|
+
get children(): String3DObject[];
|
|
125
|
+
constructor(id: string, type: string, object: I3DObject, engine: I3DEngine, options?: {
|
|
126
|
+
material?: I3DMaterial;
|
|
127
|
+
geometry?: I3DGeometry;
|
|
128
|
+
texture?: any;
|
|
129
|
+
});
|
|
130
|
+
get object(): I3DObject;
|
|
131
|
+
get material(): I3DMaterial | undefined;
|
|
132
|
+
get originalSize(): I3DVector3;
|
|
133
|
+
get boundingBox(): I3DBox3;
|
|
134
|
+
addChild(child: String3DObject): void;
|
|
135
|
+
getWorldMatrix(): I3DMatrix4;
|
|
136
|
+
getWorldPosition(): I3DVector3;
|
|
137
|
+
getOriginalBoundingBox(): I3DBox3;
|
|
138
|
+
syncTransformFromMatrix(matrix: I3DMatrix4): void;
|
|
139
|
+
applyWorldTransform(position: I3DVector3, quaternion: I3DQuaternion, scale: I3DVector3): void;
|
|
140
|
+
set quaternion(quaternion: I3DQuaternion);
|
|
141
|
+
set position(position: I3DVector3);
|
|
142
|
+
set scale(scale: I3DVector3);
|
|
143
|
+
set rotation(euler: I3DEuler);
|
|
144
|
+
set opacity(value: number);
|
|
145
|
+
set metalness(value: number);
|
|
146
|
+
set roughness(value: number);
|
|
147
|
+
set texture(texture: any);
|
|
148
|
+
set material(material: I3DMaterial | undefined);
|
|
149
|
+
set geometry(geometry: I3DGeometry | undefined);
|
|
150
|
+
updateBoundingBox(): void;
|
|
151
|
+
destroy(): void;
|
|
152
|
+
getFlatObjects(): I3DObject[];
|
|
153
|
+
getSubtreeObjects(): I3DObject[];
|
|
154
|
+
private invalidateFlatCache;
|
|
155
|
+
private invalidateSubtreeCache;
|
|
156
|
+
private disposeObjectResources;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
type String3DFilterEffect = {
|
|
160
|
+
type: "blur";
|
|
161
|
+
amount: number;
|
|
162
|
+
} | {
|
|
163
|
+
type: "pixel";
|
|
164
|
+
size: number;
|
|
165
|
+
} | {
|
|
166
|
+
type: "bloom";
|
|
167
|
+
intensity: number;
|
|
168
|
+
threshold: number;
|
|
169
|
+
} | {
|
|
170
|
+
type: "brightness";
|
|
171
|
+
amount: number;
|
|
172
|
+
} | {
|
|
173
|
+
type: "contrast";
|
|
174
|
+
amount: number;
|
|
175
|
+
} | {
|
|
176
|
+
type: "saturate";
|
|
177
|
+
amount: number;
|
|
178
|
+
} | {
|
|
179
|
+
type: "grayscale";
|
|
180
|
+
amount: number;
|
|
181
|
+
} | {
|
|
182
|
+
type: "sepia";
|
|
183
|
+
amount: number;
|
|
184
|
+
} | {
|
|
185
|
+
type: "invert";
|
|
186
|
+
amount: number;
|
|
187
|
+
} | {
|
|
188
|
+
type: "hue-rotate";
|
|
189
|
+
angle: number;
|
|
190
|
+
} | {
|
|
191
|
+
type: "custom";
|
|
192
|
+
name: string;
|
|
193
|
+
uniforms: Record<string, any>;
|
|
194
|
+
};
|
|
195
|
+
type String3DFilterChain = String3DFilterEffect[];
|
|
196
|
+
type String3DFilterTarget = {
|
|
197
|
+
object: String3DObject;
|
|
198
|
+
effects: String3DFilterChain;
|
|
199
|
+
effectsKey: string;
|
|
200
|
+
dirty: boolean;
|
|
201
|
+
};
|
|
202
|
+
|
|
61
203
|
interface I3DVector3 {
|
|
62
204
|
x: number;
|
|
63
205
|
y: number;
|
|
@@ -238,6 +380,17 @@ interface I3DRenderer {
|
|
|
238
380
|
interface I3DTextureLoader {
|
|
239
381
|
load(url: string, onLoad?: (texture: any) => void): any;
|
|
240
382
|
}
|
|
383
|
+
type I3DMaterialVisualProps = {
|
|
384
|
+
opacity?: number;
|
|
385
|
+
color?: string;
|
|
386
|
+
metalness?: number;
|
|
387
|
+
roughness?: number;
|
|
388
|
+
emissive?: string;
|
|
389
|
+
};
|
|
390
|
+
type I3DModelLoaderOptions = {
|
|
391
|
+
textureBaseUrl?: string;
|
|
392
|
+
textureMap?: Record<string, string>;
|
|
393
|
+
};
|
|
241
394
|
type TextGeometryOptions = {
|
|
242
395
|
size: number;
|
|
243
396
|
height: number;
|
|
@@ -259,9 +412,82 @@ type TextGeometryOptions = {
|
|
|
259
412
|
elementWidth?: number;
|
|
260
413
|
elementHeight?: number;
|
|
261
414
|
};
|
|
415
|
+
type SVGGeometryOptions = {
|
|
416
|
+
depth: number;
|
|
417
|
+
curveSegments: number;
|
|
418
|
+
bevelEnabled: boolean;
|
|
419
|
+
bevelThickness: number;
|
|
420
|
+
bevelSize: number;
|
|
421
|
+
bevelOffset: number;
|
|
422
|
+
bevelSegments: number;
|
|
423
|
+
};
|
|
424
|
+
type SVGPathData = {
|
|
425
|
+
d: string;
|
|
426
|
+
transform: {
|
|
427
|
+
a: number;
|
|
428
|
+
b: number;
|
|
429
|
+
c: number;
|
|
430
|
+
d: number;
|
|
431
|
+
e: number;
|
|
432
|
+
f: number;
|
|
433
|
+
} | null;
|
|
434
|
+
};
|
|
435
|
+
type SVGViewBox = {
|
|
436
|
+
x: number;
|
|
437
|
+
y: number;
|
|
438
|
+
width: number;
|
|
439
|
+
height: number;
|
|
440
|
+
};
|
|
262
441
|
interface I3DModelLoader {
|
|
263
442
|
load(url: string, onLoad?: (model: any) => void, onProgress?: (progress: any) => void, onError?: (error: any) => void): void;
|
|
264
443
|
}
|
|
444
|
+
type I3DBackend = "webgl" | "webgpu" | "custom";
|
|
445
|
+
type I3DEngineCapabilities = {
|
|
446
|
+
renderTargets: boolean;
|
|
447
|
+
shaderMaterials: boolean;
|
|
448
|
+
postProcess: boolean;
|
|
449
|
+
customMaterialFactory: boolean;
|
|
450
|
+
particles: boolean;
|
|
451
|
+
text: boolean;
|
|
452
|
+
geometrySimplify: boolean;
|
|
453
|
+
};
|
|
454
|
+
interface I3DPostProcessRuntime {
|
|
455
|
+
isSupported(renderer: I3DRenderer): boolean;
|
|
456
|
+
createRenderTarget(width: number, height: number, options?: any): I3DRenderTarget;
|
|
457
|
+
createShaderMaterial(params?: any): I3DMaterial;
|
|
458
|
+
setRenderTarget(renderer: I3DRenderer, target: I3DRenderTarget | null): void;
|
|
459
|
+
clear(renderer: I3DRenderer, color?: boolean, depth?: boolean, stencil?: boolean): void;
|
|
460
|
+
createPipeline?(context: {
|
|
461
|
+
engine: I3DEngine;
|
|
462
|
+
renderer: I3DRenderer;
|
|
463
|
+
width: number;
|
|
464
|
+
height: number;
|
|
465
|
+
customFilterRegistry: I3DCustomFilterRegistryRuntime;
|
|
466
|
+
}): I3DPostProcessPipelineRuntime | null;
|
|
467
|
+
}
|
|
468
|
+
interface I3DPostProcessPipelineRuntime {
|
|
469
|
+
isSupported(): boolean;
|
|
470
|
+
resize(width: number, height: number): void;
|
|
471
|
+
setScale(scale: number): void;
|
|
472
|
+
applyFilters(input: I3DRenderTarget, effects: String3DFilterChain, quality?: number): I3DRenderTarget;
|
|
473
|
+
acquireTarget(): I3DRenderTarget;
|
|
474
|
+
releaseTarget(target: I3DRenderTarget): void;
|
|
475
|
+
renderToScreen(input: I3DRenderTarget): void;
|
|
476
|
+
dispose(): void;
|
|
477
|
+
}
|
|
478
|
+
interface I3DCustomFilterRegistryRuntime {
|
|
479
|
+
get(name: string): String3DCustomFilterDefinition | undefined;
|
|
480
|
+
}
|
|
481
|
+
interface I3DCustomMaterialRegistryRuntime {
|
|
482
|
+
get(name: string): String3DCustomMaterialDefinition | undefined;
|
|
483
|
+
}
|
|
484
|
+
type I3DLayerIsolationState = unknown;
|
|
485
|
+
type I3DRendererConfigContext = {
|
|
486
|
+
width: number;
|
|
487
|
+
height: number;
|
|
488
|
+
pixelRatio: number;
|
|
489
|
+
container: HTMLElement;
|
|
490
|
+
};
|
|
265
491
|
interface I3DEngine {
|
|
266
492
|
createVector3(x?: number, y?: number, z?: number): I3DVector3;
|
|
267
493
|
createVector2(x?: number, y?: number): I3DVector2;
|
|
@@ -275,6 +501,8 @@ interface I3DEngine {
|
|
|
275
501
|
alpha?: boolean;
|
|
276
502
|
logarithmicDepthBuffer?: boolean;
|
|
277
503
|
}): I3DRenderer;
|
|
504
|
+
getRecommendedPixelRatio?(): number;
|
|
505
|
+
configureRenderer?(renderer: I3DRenderer, context: I3DRendererConfigContext): void;
|
|
278
506
|
createPerspectiveCamera(fov?: number, aspect?: number, near?: number, far?: number): I3DPerspectiveCamera;
|
|
279
507
|
createOrthographicCamera(left: number, right: number, top: number, bottom: number, near?: number, far?: number): I3DOrthographicCamera;
|
|
280
508
|
createGroup(): I3DObject;
|
|
@@ -293,67 +521,45 @@ interface I3DEngine {
|
|
|
293
521
|
createDirectionalLight(color?: string | number, intensity?: number): I3DLight;
|
|
294
522
|
createTextureLoader(): I3DTextureLoader;
|
|
295
523
|
createModelLoader(type: string): I3DModelLoader;
|
|
524
|
+
configureModelLoader?(loader: I3DModelLoader, options: I3DModelLoaderOptions): void;
|
|
525
|
+
resolveLoadedModelRoot?(loadedModel: any): I3DObject | null;
|
|
296
526
|
createRenderTarget?(width: number, height: number, options?: any): I3DRenderTarget;
|
|
297
527
|
getMaterialFactory?(): IMaterialFactory | null;
|
|
298
528
|
createParticleSystem?(config: ParticleSystemConfig): I3DParticleSystem;
|
|
529
|
+
setObjectPosition?(target: any, x: number, y: number, z: number): boolean;
|
|
530
|
+
applyMaterialProps?(material: I3DMaterial, props: I3DMaterialVisualProps): boolean;
|
|
531
|
+
supportsObjectLayerIsolation?(camera: I3DCamera, objects: I3DObject[]): boolean;
|
|
532
|
+
beginObjectLayerIsolation?(camera: I3DCamera, objects: I3DObject[], lights: I3DObject[], layer: number): I3DLayerIsolationState | null;
|
|
533
|
+
endObjectLayerIsolation?(camera: I3DCamera, state: I3DLayerIsolationState): void;
|
|
534
|
+
forEachMesh(object: I3DObject, callback: (mesh: I3DMesh) => void): void;
|
|
535
|
+
forEachMaterial(object: I3DObject, callback: (material: I3DMaterial) => void): void;
|
|
536
|
+
getPrimaryMesh(object: I3DObject): I3DMesh | null;
|
|
537
|
+
applyTextGeometryToMesh(mesh: I3DMesh, geometry: I3DGeometry): boolean;
|
|
299
538
|
loadFont?(url: string): Promise<any>;
|
|
300
539
|
createTextGeometry?(text: string, font: any, options: TextGeometryOptions): I3DGeometry | null;
|
|
540
|
+
createSVGGeometry?(paths: SVGPathData[], viewBox: SVGViewBox | null, options: SVGGeometryOptions): I3DGeometry | null;
|
|
541
|
+
getTextGeometryLayoutSignature?(context: {
|
|
542
|
+
text: string;
|
|
543
|
+
layoutSignature: string;
|
|
544
|
+
layout: Array<{
|
|
545
|
+
char: string;
|
|
546
|
+
x: number;
|
|
547
|
+
y: number;
|
|
548
|
+
scale?: number;
|
|
549
|
+
}>;
|
|
550
|
+
elementWidth: number;
|
|
551
|
+
elementHeight: number;
|
|
552
|
+
fontSize: number;
|
|
553
|
+
}): string;
|
|
301
554
|
simplifyGeometry?(geometry: I3DGeometry, quality: number): I3DGeometry | null;
|
|
302
555
|
degToRad(degrees: number): number;
|
|
303
556
|
radToDeg(radians: number): number;
|
|
304
557
|
computeBoundingBoxRecursively(object: I3DObject): I3DBox3;
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
private _object;
|
|
311
|
-
private _material?;
|
|
312
|
-
private _geometry?;
|
|
313
|
-
private _texture?;
|
|
314
|
-
private _uniforms;
|
|
315
|
-
private _originalBoundingBox?;
|
|
316
|
-
private _quaternion;
|
|
317
|
-
private _originalSize;
|
|
318
|
-
private _bbox;
|
|
319
|
-
el: any;
|
|
320
|
-
private _children;
|
|
321
|
-
private _flatObjectsCache;
|
|
322
|
-
private _subtreeCache;
|
|
323
|
-
private engine;
|
|
324
|
-
get children(): String3DObject[];
|
|
325
|
-
constructor(id: string, type: string, object: I3DObject, engine: I3DEngine, options?: {
|
|
326
|
-
material?: I3DMaterial;
|
|
327
|
-
geometry?: I3DGeometry;
|
|
328
|
-
texture?: any;
|
|
329
|
-
});
|
|
330
|
-
get object(): I3DObject;
|
|
331
|
-
get material(): I3DMaterial | undefined;
|
|
332
|
-
get originalSize(): I3DVector3;
|
|
333
|
-
get boundingBox(): I3DBox3;
|
|
334
|
-
addChild(child: String3DObject): void;
|
|
335
|
-
getWorldMatrix(): I3DMatrix4;
|
|
336
|
-
getWorldPosition(): I3DVector3;
|
|
337
|
-
getOriginalBoundingBox(): I3DBox3;
|
|
338
|
-
syncTransformFromMatrix(matrix: I3DMatrix4): void;
|
|
339
|
-
applyWorldTransform(position: I3DVector3, quaternion: I3DQuaternion, scale: I3DVector3): void;
|
|
340
|
-
set quaternion(quaternion: I3DQuaternion);
|
|
341
|
-
set position(position: I3DVector3);
|
|
342
|
-
set scale(scale: I3DVector3);
|
|
343
|
-
set rotation(euler: I3DEuler);
|
|
344
|
-
set opacity(value: number);
|
|
345
|
-
set metalness(value: number);
|
|
346
|
-
set roughness(value: number);
|
|
347
|
-
set texture(texture: any);
|
|
348
|
-
set material(material: I3DMaterial | undefined);
|
|
349
|
-
set geometry(geometry: I3DGeometry | undefined);
|
|
350
|
-
updateBoundingBox(): void;
|
|
351
|
-
destroy(): void;
|
|
352
|
-
getFlatObjects(): I3DObject[];
|
|
353
|
-
getSubtreeObjects(): I3DObject[];
|
|
354
|
-
private invalidateFlatCache;
|
|
355
|
-
private invalidateSubtreeCache;
|
|
356
|
-
private disposeObjectResources;
|
|
558
|
+
getBackend?(): I3DBackend;
|
|
559
|
+
getCapabilities?(): I3DEngineCapabilities;
|
|
560
|
+
getPostProcessRuntime?(): I3DPostProcessRuntime | null;
|
|
561
|
+
getCustomFilterRegistry?(): I3DCustomFilterRegistryRuntime | null;
|
|
562
|
+
getCustomMaterialRegistry?(): I3DCustomMaterialRegistryRuntime | null;
|
|
357
563
|
}
|
|
358
564
|
|
|
359
565
|
type CameraMode = "orthographic" | "perspective";
|
|
@@ -392,6 +598,7 @@ declare class String3DSynchronizer {
|
|
|
392
598
|
private strategies;
|
|
393
599
|
private styleReadIntervalMs;
|
|
394
600
|
private layoutReadIntervalMs;
|
|
601
|
+
private scene?;
|
|
395
602
|
constructor(camera: String3DCamera, viewportWidth: number, viewportHeight: number, engine: I3DEngine);
|
|
396
603
|
syncElement(el: HTMLElement, object: String3DObject, parentData: any, hints?: {
|
|
397
604
|
dirtySet?: Set<HTMLElement> | null;
|
|
@@ -401,10 +608,16 @@ declare class String3DSynchronizer {
|
|
|
401
608
|
styleReadIntervalMs?: number;
|
|
402
609
|
layoutReadIntervalMs?: number;
|
|
403
610
|
}): void;
|
|
611
|
+
setScene(scene: String3DScene): void;
|
|
404
612
|
updateViewportSize(width: number, height: number): void;
|
|
405
613
|
cleanupElement(el: HTMLElement, object: String3DObject): void;
|
|
406
614
|
}
|
|
407
615
|
|
|
616
|
+
type String3DSourceObject = {
|
|
617
|
+
id: string;
|
|
618
|
+
htmlElement: HTMLElement | null;
|
|
619
|
+
getProperty<T>(name: string): T;
|
|
620
|
+
};
|
|
408
621
|
interface String3DSceneOptions {
|
|
409
622
|
modelLoader?: I3DModelLoader;
|
|
410
623
|
modelLoaderFactory?: (engine: I3DEngine, type?: string) => I3DModelLoader;
|
|
@@ -420,6 +633,7 @@ declare class String3DScene {
|
|
|
420
633
|
private _modelLoaderFactory?;
|
|
421
634
|
private _modelLoaderCache;
|
|
422
635
|
private _synchronizer?;
|
|
636
|
+
private customMaterialRegistry;
|
|
423
637
|
get rootObjects(): String3DObject[];
|
|
424
638
|
constructor(engine: I3DEngine, options?: String3DSceneOptions);
|
|
425
639
|
setSynchronizer(synchronizer: String3DSynchronizer): void;
|
|
@@ -429,7 +643,7 @@ declare class String3DScene {
|
|
|
429
643
|
getAllObjects(): String3DObject[];
|
|
430
644
|
hasObject(id: string): boolean;
|
|
431
645
|
deleteObject(id: string): boolean;
|
|
432
|
-
createFromElement(object:
|
|
646
|
+
createFromElement(object: String3DSourceObject): void;
|
|
433
647
|
private createGroup;
|
|
434
648
|
private createLight;
|
|
435
649
|
private applyShadowProps;
|
|
@@ -440,6 +654,7 @@ declare class String3DScene {
|
|
|
440
654
|
private createModel;
|
|
441
655
|
private createParticles;
|
|
442
656
|
private createText;
|
|
657
|
+
private createSVG;
|
|
443
658
|
private getGeometryQuality;
|
|
444
659
|
private resolveModelLoader;
|
|
445
660
|
private centerObject;
|
|
@@ -453,13 +668,16 @@ declare class String3DScene {
|
|
|
453
668
|
private loadTexture;
|
|
454
669
|
private parseFlipY;
|
|
455
670
|
private shouldOverrideModelMaterial;
|
|
456
|
-
private
|
|
671
|
+
private parseModelLoaderOptions;
|
|
457
672
|
destroy(): void;
|
|
458
673
|
}
|
|
459
674
|
|
|
460
675
|
interface I3DEngineProvider {
|
|
676
|
+
initialize?(): void | Promise<void>;
|
|
461
677
|
getEngine(): I3DEngine;
|
|
462
678
|
getName(): string;
|
|
679
|
+
getBackend?(): I3DBackend;
|
|
680
|
+
getCapabilities?(): I3DEngineCapabilities;
|
|
463
681
|
}
|
|
464
682
|
|
|
465
683
|
interface String3DOptions {
|
|
@@ -489,6 +707,8 @@ declare class String3D extends StringModule {
|
|
|
489
707
|
private lastSyncData;
|
|
490
708
|
private filterController;
|
|
491
709
|
private needsInitialResize;
|
|
710
|
+
private providerBootstrapped;
|
|
711
|
+
private pendingConnectedObjects;
|
|
492
712
|
static getInstance(): String3D | null;
|
|
493
713
|
get scene(): String3DScene | null;
|
|
494
714
|
static setProvider(provider: I3DEngineProvider): void;
|
|
@@ -501,6 +721,8 @@ declare class String3D extends StringModule {
|
|
|
501
721
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
502
722
|
onResize(): void;
|
|
503
723
|
onInit(): void;
|
|
724
|
+
private bootstrapProvider;
|
|
725
|
+
private flushPendingConnections;
|
|
504
726
|
onSettingsChange(): void;
|
|
505
727
|
private buildOptionsFromSettings;
|
|
506
728
|
private getSettingValue;
|
|
@@ -517,49 +739,70 @@ declare class String3D extends StringModule {
|
|
|
517
739
|
destroy(): void;
|
|
518
740
|
}
|
|
519
741
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
} |
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
742
|
+
interface SVGTransformMatrix {
|
|
743
|
+
a: number;
|
|
744
|
+
b: number;
|
|
745
|
+
c: number;
|
|
746
|
+
d: number;
|
|
747
|
+
e: number;
|
|
748
|
+
f: number;
|
|
749
|
+
}
|
|
750
|
+
interface ParsedSVGPath {
|
|
751
|
+
d: string;
|
|
752
|
+
transform: SVGTransformMatrix | null;
|
|
753
|
+
}
|
|
754
|
+
interface ParsedSVGData {
|
|
755
|
+
paths: ParsedSVGPath[];
|
|
756
|
+
viewBox: {
|
|
757
|
+
x: number;
|
|
758
|
+
y: number;
|
|
759
|
+
width: number;
|
|
760
|
+
height: number;
|
|
761
|
+
} | null;
|
|
762
|
+
naturalWidth: number;
|
|
763
|
+
naturalHeight: number;
|
|
764
|
+
}
|
|
765
|
+
declare class SVGParser {
|
|
766
|
+
static fromElement(svgEl: SVGSVGElement): ParsedSVGData;
|
|
767
|
+
static fromString(svgString: string): ParsedSVGData | null;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
interface SyncContext {
|
|
771
|
+
camera: String3DCamera;
|
|
772
|
+
viewportWidth: number;
|
|
773
|
+
viewportHeight: number;
|
|
774
|
+
engine: I3DEngine;
|
|
775
|
+
scene?: String3DScene;
|
|
776
|
+
dirtySet?: Set<HTMLElement> | null;
|
|
777
|
+
forceSync?: boolean;
|
|
778
|
+
styleReadIntervalMs?: number;
|
|
779
|
+
layoutReadIntervalMs?: number;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
interface String3DObjectSyncStrategy {
|
|
783
|
+
sync(el: HTMLElement, object: String3DObject, context: SyncContext, parentData: any): void;
|
|
784
|
+
cleanup?(el: HTMLElement, object: String3DObject): void;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
declare class SVGSynchronizer implements String3DObjectSyncStrategy {
|
|
788
|
+
private static styleCache;
|
|
789
|
+
private static geometryKeys;
|
|
790
|
+
private static lastMaterialType;
|
|
791
|
+
private static svgCache;
|
|
792
|
+
private static svgFetchCache;
|
|
793
|
+
private static svgFetchPromises;
|
|
794
|
+
private static pendingSrcObjects;
|
|
795
|
+
private static mutationObservers;
|
|
796
|
+
private static morphStates;
|
|
797
|
+
private static svgSignatures;
|
|
798
|
+
sync(el: HTMLElement, object: String3DObject, ctx: SyncContext, parentData: any): any;
|
|
799
|
+
cleanup(el: HTMLElement, object: String3DObject): void;
|
|
800
|
+
private resolveSVGData;
|
|
801
|
+
private static markObjectPendingSrc;
|
|
802
|
+
private static invalidatePendingSrcObjects;
|
|
803
|
+
private static setupMutationObserver;
|
|
804
|
+
private readStyleBundle;
|
|
805
|
+
}
|
|
563
806
|
|
|
564
807
|
declare class String3DRenderer {
|
|
565
808
|
private _container;
|
|
@@ -567,6 +810,7 @@ declare class String3DRenderer {
|
|
|
567
810
|
private _width;
|
|
568
811
|
private _height;
|
|
569
812
|
private engine;
|
|
813
|
+
private postProcessRuntime;
|
|
570
814
|
private filterPipeline;
|
|
571
815
|
private filterCache;
|
|
572
816
|
private frameId;
|
|
@@ -592,26 +836,6 @@ declare class String3DRenderer {
|
|
|
592
836
|
private updateQuality;
|
|
593
837
|
private invalidateFilterCache;
|
|
594
838
|
private evictCache;
|
|
595
|
-
private supportsLayers;
|
|
596
|
-
private hasLayers;
|
|
597
|
-
private applyLayerMask;
|
|
598
|
-
private restoreLayerMask;
|
|
599
|
-
private setCameraLayer;
|
|
600
|
-
private restoreCameraLayer;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
type String3DCustomFilterDefinition = {
|
|
604
|
-
name: string;
|
|
605
|
-
fragmentShader: string;
|
|
606
|
-
uniforms?: Record<string, any>;
|
|
607
|
-
parse?: (args: string) => Record<string, any> | null;
|
|
608
|
-
};
|
|
609
|
-
declare class String3DCustomFilterRegistry {
|
|
610
|
-
private static filters;
|
|
611
|
-
static register(definition: String3DCustomFilterDefinition): void;
|
|
612
|
-
static get(name: string): String3DCustomFilterDefinition | undefined;
|
|
613
|
-
static has(name: string): boolean;
|
|
614
|
-
static list(): String3DCustomFilterDefinition[];
|
|
615
839
|
}
|
|
616
840
|
|
|
617
841
|
type String3DFontEntry = {
|
|
@@ -690,6 +914,8 @@ declare class ThreeJSEngine implements I3DEngine {
|
|
|
690
914
|
alpha?: boolean;
|
|
691
915
|
logarithmicDepthBuffer?: boolean;
|
|
692
916
|
}): I3DRenderer;
|
|
917
|
+
getRecommendedPixelRatio(): number;
|
|
918
|
+
configureRenderer(renderer: I3DRenderer, _context: I3DRendererConfigContext): void;
|
|
693
919
|
createPerspectiveCamera(fov?: number, aspect?: number, near?: number, far?: number): I3DPerspectiveCamera;
|
|
694
920
|
createOrthographicCamera(left: number, right: number, top: number, bottom: number, near?: number, far?: number): I3DOrthographicCamera;
|
|
695
921
|
createGroup(): I3DObject;
|
|
@@ -708,6 +934,8 @@ declare class ThreeJSEngine implements I3DEngine {
|
|
|
708
934
|
createDirectionalLight(color?: string | number, intensity?: number): I3DLight;
|
|
709
935
|
createTextureLoader(): I3DTextureLoader;
|
|
710
936
|
createModelLoader(type: string): I3DModelLoader;
|
|
937
|
+
configureModelLoader(loader: I3DModelLoader, options: I3DModelLoaderOptions): void;
|
|
938
|
+
resolveLoadedModelRoot(loadedModel: any): I3DObject | null;
|
|
711
939
|
createRenderTarget(width: number, height: number, options?: any): I3DRenderTarget;
|
|
712
940
|
loadFont(url: string): Promise<any>;
|
|
713
941
|
private loadFontWithConverter;
|
|
@@ -723,33 +951,65 @@ declare class ThreeJSEngine implements I3DEngine {
|
|
|
723
951
|
private getInteriorPoint;
|
|
724
952
|
private parseOutlineToShapes;
|
|
725
953
|
private reversePath;
|
|
954
|
+
private getCurveEndPoint;
|
|
726
955
|
createTextGeometry(text: string, font: any, options: any): I3DGeometry | null;
|
|
956
|
+
createSVGGeometry(paths: SVGPathData[], viewBox: SVGViewBox | null, options: SVGGeometryOptions): I3DGeometry | null;
|
|
957
|
+
private buildShapesWithHoles;
|
|
958
|
+
private svgPathContains;
|
|
959
|
+
private parseSVGPathToSubpaths;
|
|
960
|
+
private ensurePathWinding;
|
|
961
|
+
private clonePathAsShape;
|
|
962
|
+
private tokenizeSVGPath;
|
|
963
|
+
private nextNum;
|
|
964
|
+
private arcToBezier;
|
|
727
965
|
private buildLineShapes;
|
|
728
966
|
private getGlyphAdvance;
|
|
729
967
|
private translateShape;
|
|
730
968
|
private scaleShape;
|
|
731
969
|
private resolveParticleModelGeometry;
|
|
732
970
|
createParticleSystem(config: ParticleSystemConfig): I3DParticleSystem;
|
|
971
|
+
forEachMesh(object: I3DObject, callback: (mesh: I3DMesh) => void): void;
|
|
972
|
+
forEachMaterial(object: I3DObject, callback: (material: I3DMaterial) => void): void;
|
|
973
|
+
getPrimaryMesh(object: I3DObject): I3DMesh | null;
|
|
974
|
+
applyTextGeometryToMesh(mesh: I3DMesh, geometry: I3DGeometry): boolean;
|
|
975
|
+
setObjectPosition(target: any, x: number, y: number, z: number): boolean;
|
|
976
|
+
supportsObjectLayerIsolation(camera: I3DCamera, objects: I3DObject[]): boolean;
|
|
977
|
+
beginObjectLayerIsolation(camera: I3DCamera, objects: I3DObject[], lights: I3DObject[], layer: number): I3DLayerIsolationState | null;
|
|
978
|
+
endObjectLayerIsolation(camera: I3DCamera, state: I3DLayerIsolationState): void;
|
|
979
|
+
applyMaterialProps(material: I3DMaterial, props: I3DMaterialVisualProps): boolean;
|
|
980
|
+
private hasLayers;
|
|
733
981
|
simplifyGeometry(geometry: I3DGeometry, quality: number): I3DGeometry | null;
|
|
734
982
|
degToRad(degrees: number): number;
|
|
735
983
|
radToDeg(radians: number): number;
|
|
736
984
|
computeBoundingBoxRecursively(object: I3DObject): I3DBox3;
|
|
985
|
+
getBackend(): I3DBackend;
|
|
986
|
+
getCapabilities(): I3DEngineCapabilities;
|
|
987
|
+
getPostProcessRuntime(): I3DPostProcessRuntime;
|
|
988
|
+
getCustomFilterRegistry(): I3DCustomFilterRegistryRuntime;
|
|
989
|
+
getCustomMaterialRegistry(): I3DCustomMaterialRegistryRuntime;
|
|
737
990
|
}
|
|
738
991
|
declare class ThreeJSProvider implements I3DEngineProvider {
|
|
739
992
|
private engine;
|
|
740
993
|
constructor(THREE: any, loaders?: Record<string, any>);
|
|
994
|
+
initialize(): void;
|
|
741
995
|
getEngine(): I3DEngine;
|
|
742
996
|
getName(): string;
|
|
997
|
+
getBackend(): I3DBackend;
|
|
998
|
+
getCapabilities(): I3DEngineCapabilities;
|
|
743
999
|
}
|
|
744
1000
|
|
|
745
1001
|
declare class ThreeJSMaterialFactory implements IMaterialFactory {
|
|
746
1002
|
private THREE;
|
|
747
1003
|
private textureLoader;
|
|
748
1004
|
private textureCache;
|
|
1005
|
+
private meshTransmissionMaterialClass;
|
|
749
1006
|
constructor(THREE: any);
|
|
750
1007
|
supports(definition: String3DCustomMaterialDefinition): boolean;
|
|
751
1008
|
create(definition: String3DCustomMaterialDefinition, initialUniforms?: Record<string, any>): IMaterialInstance;
|
|
752
1009
|
parseUniformsFromCSS(definition: String3DCustomMaterialDefinition, element: HTMLElement, style: CSSStyleDeclaration): Record<string, any>;
|
|
1010
|
+
getMaterialDefinition(material: any): String3DCustomMaterialDefinition | null;
|
|
1011
|
+
isShaderMaterial(material: any): boolean;
|
|
1012
|
+
applyUniforms(material: any, definition: String3DCustomMaterialDefinition, values: Record<string, any>): void;
|
|
753
1013
|
private buildUniforms;
|
|
754
1014
|
private convertUniformValue;
|
|
755
1015
|
private loadTexture;
|
|
@@ -766,4 +1026,4 @@ declare class ThreeJSMaterialFactory implements IMaterialFactory {
|
|
|
766
1026
|
dispose(): void;
|
|
767
1027
|
}
|
|
768
1028
|
|
|
769
|
-
export { type CameraMode, FontConverter, type FontData, type FontSource, type I3DBox3, type I3DCamera, type I3DEngine, type I3DEngineProvider, type I3DEuler, type I3DGeometry, type I3DLight, type I3DMaterial, type I3DMatrix4, type I3DMesh, type I3DModelLoader, type I3DObject, type I3DOrthographicCamera, type I3DParticleSystem, type I3DPerspectiveCamera, type I3DQuaternion, type I3DRenderTarget, type I3DRenderer, type I3DScene, type I3DTextureLoader, type I3DVector2, type I3DVector3, type IMaterialFactory, type IMaterialInstance, type MaterialBlendMode, type MaterialSide, type ParticleMode, type ParticleSystemConfig, type ShaderInjection, type ShaderInjectionPoint, String3D, String3DCamera, type String3DCustomFilterDefinition, String3DCustomFilterRegistry, type String3DCustomMaterialDefinition, String3DCustomMaterialRegistry, type String3DFontEntry, String3DFontRegistry, String3DObject, type String3DOptions, String3DRenderer, String3DScene, String3DSynchronizer, ThreeJSEngine, ThreeJSMaterialFactory, ThreeJSProvider, type UniformDefinition, type UniformType };
|
|
1029
|
+
export { type CameraMode, FontConverter, type FontData, type FontSource, type I3DBackend, type I3DBox3, type I3DCamera, type I3DCustomFilterRegistryRuntime, type I3DCustomMaterialRegistryRuntime, type I3DEngine, type I3DEngineCapabilities, type I3DEngineProvider, type I3DEuler, type I3DGeometry, type I3DLight, type I3DMaterial, type I3DMatrix4, type I3DMesh, type I3DModelLoader, type I3DObject, type I3DOrthographicCamera, type I3DParticleSystem, type I3DPerspectiveCamera, type I3DPostProcessPipelineRuntime, type I3DPostProcessRuntime, type I3DQuaternion, type I3DRenderTarget, type I3DRenderer, type I3DScene, type I3DTextureLoader, type I3DVector2, type I3DVector3, type IMaterialFactory, type IMaterialInstance, type MaterialBlendMode, type MaterialSide, type ParsedSVGData, type ParsedSVGPath, type ParticleMode, type ParticleSystemConfig, type SVGGeometryOptions, SVGParser, type SVGPathData, SVGSynchronizer, type SVGTransformMatrix, type SVGViewBox, type ShaderInjection, type ShaderInjectionPoint, String3D, String3DCamera, type String3DCustomFilterDefinition, String3DCustomFilterRegistry, type String3DCustomMaterialDefinition, String3DCustomMaterialRegistry, type String3DFontEntry, String3DFontRegistry, String3DObject, type String3DOptions, String3DRenderer, String3DScene, String3DSynchronizer, ThreeJSEngine, ThreeJSMaterialFactory, ThreeJSProvider, type UniformDefinition, type UniformType };
|