@3driseai/3drise-core 1.0.1 → 1.0.3
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/services/MaterialRegistry.d.ts +25 -0
- package/dist/services/MaterialRegistry.d.ts.map +1 -1
- package/dist/services/MaterialRegistry.js +102 -1
- package/dist/shaders/CircuitGridMaterial.d.ts +76 -0
- package/dist/shaders/CircuitGridMaterial.d.ts.map +1 -0
- package/dist/shaders/CircuitGridMaterial.js +298 -0
- package/dist/shaders/ContourGridMaterial.d.ts +80 -0
- package/dist/shaders/ContourGridMaterial.d.ts.map +1 -0
- package/dist/shaders/ContourGridMaterial.js +259 -0
- package/dist/shaders/FractalGridMaterial.d.ts +76 -0
- package/dist/shaders/FractalGridMaterial.d.ts.map +1 -0
- package/dist/shaders/FractalGridMaterial.js +247 -0
- package/dist/shaders/HexGridMaterial.d.ts +73 -0
- package/dist/shaders/HexGridMaterial.d.ts.map +1 -0
- package/dist/shaders/HexGridMaterial.js +265 -0
- package/dist/shaders/MoireGridMaterial.d.ts +79 -0
- package/dist/shaders/MoireGridMaterial.d.ts.map +1 -0
- package/dist/shaders/MoireGridMaterial.js +271 -0
- package/dist/shaders/MyGridMaterial.d.ts +7 -0
- package/dist/shaders/MyGridMaterial.d.ts.map +1 -1
- package/dist/shaders/MyGridMaterial.js +19 -0
- package/dist/shaders/QuasiGridMaterial.d.ts +76 -0
- package/dist/shaders/QuasiGridMaterial.d.ts.map +1 -0
- package/dist/shaders/QuasiGridMaterial.js +238 -0
- package/dist/shaders/RadarGridMaterial.d.ts +77 -0
- package/dist/shaders/RadarGridMaterial.d.ts.map +1 -0
- package/dist/shaders/RadarGridMaterial.js +291 -0
- package/dist/shaders/RainMaterial copy.d.ts +34 -0
- package/dist/shaders/RainMaterial copy.d.ts.map +1 -0
- package/dist/shaders/RainMaterial copy.js +56 -0
- package/dist/shaders/ShaderEffectsMaterial copy 2.d.ts +228 -0
- package/dist/shaders/ShaderEffectsMaterial copy 2.d.ts.map +1 -0
- package/dist/shaders/ShaderEffectsMaterial copy 2.js +233 -0
- package/dist/shaders/ShootingStarMaterial copy.d.ts +14 -0
- package/dist/shaders/ShootingStarMaterial copy.d.ts.map +1 -0
- package/dist/shaders/ShootingStarMaterial copy.js +33 -0
- package/dist/shaders/SkyboxMaterial copy.d.ts +38 -0
- package/dist/shaders/SkyboxMaterial copy.d.ts.map +1 -0
- package/dist/shaders/SkyboxMaterial copy.js +57 -0
- package/dist/shaders/VoronoiGridMaterial.d.ts +73 -0
- package/dist/shaders/VoronoiGridMaterial.d.ts.map +1 -0
- package/dist/shaders/VoronoiGridMaterial.js +266 -0
- package/dist/shaders/index.d.ts +11 -0
- package/dist/shaders/index.d.ts.map +1 -1
- package/dist/shaders/index.js +11 -0
- package/dist/types/objectsConfigs.d.ts +12 -0
- package/dist/types/objectsConfigs.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -79,6 +79,31 @@ export declare const MaterialRegistryAPI: {
|
|
|
79
79
|
* Get all registered user shader variant names.
|
|
80
80
|
*/
|
|
81
81
|
getUserShaderVariants(): string[];
|
|
82
|
+
/**
|
|
83
|
+
* Register (or update) a material type bucket from the `material_types` table.
|
|
84
|
+
* Types whose variants are implemented in code keep the variants they already
|
|
85
|
+
* have — only the metadata is refreshed.
|
|
86
|
+
*/
|
|
87
|
+
registerMaterialType(type: any): void;
|
|
88
|
+
/**
|
|
89
|
+
* Register a shader row from the `shaders` table as a variant of its material type.
|
|
90
|
+
*
|
|
91
|
+
* `chunks` are the resolved `shader_chunks` rows the shader includes; their code
|
|
92
|
+
* is prepended to the matching stage in the order the server returned them.
|
|
93
|
+
* The material type bucket is created on demand, so a shader can be registered
|
|
94
|
+
* before its type metadata arrives.
|
|
95
|
+
*
|
|
96
|
+
* Neither the shader source nor the chunks contain `uniform ...;` declarations —
|
|
97
|
+
* those are generated from `uniforms` by compileShaders() when the material is
|
|
98
|
+
* built, exactly as for a shader authored in MaterialCreator. Final stage source
|
|
99
|
+
* is therefore: generated declarations, then chunk functions, then the body.
|
|
100
|
+
*/
|
|
101
|
+
registerDbShader(shader: any, chunks?: any[]): void;
|
|
102
|
+
/**
|
|
103
|
+
* True when a variant for this shader name is already registered.
|
|
104
|
+
* Lets the client skip a source fetch it has already made.
|
|
105
|
+
*/
|
|
106
|
+
hasVariant(variantName: any): boolean;
|
|
82
107
|
};
|
|
83
108
|
export { MaterialRegistry };
|
|
84
109
|
export default MaterialRegistryAPI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialRegistry.d.ts","sourceRoot":"","sources":["../../src/services/MaterialRegistry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,GAAG,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,YAAY,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAA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OAEG;;IAOH;;;;OAIG;;IAgBH;;;;;;;;;;;;OAYG;;IA2DH;;;OAGG;;CAIN,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,eAAe,mBAAmB,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { FrontSide, ShaderMaterial } from 'three';
|
|
|
5
5
|
import { uniformConverter } from './UniformConverter.js';
|
|
6
6
|
import { settingsToProps } from '../utils/materialUtils.js';
|
|
7
7
|
import { compileShaders } from '../utils/utils.js';
|
|
8
|
-
import materials from '
|
|
8
|
+
import materials from '../data/allMaterials.js';
|
|
9
9
|
// =============================================================================
|
|
10
10
|
// MATERIAL REGISTRY
|
|
11
11
|
// =============================================================================
|
|
@@ -355,6 +355,107 @@ export const MaterialRegistryAPI = {
|
|
|
355
355
|
getUserShaderVariants() {
|
|
356
356
|
return Object.keys(MaterialRegistry.shaders.variants);
|
|
357
357
|
},
|
|
358
|
+
// =========================================================================
|
|
359
|
+
// DATABASE-BACKED SHADERS
|
|
360
|
+
// =========================================================================
|
|
361
|
+
/**
|
|
362
|
+
* Register (or update) a material type bucket from the `material_types` table.
|
|
363
|
+
* Types whose variants are implemented in code keep the variants they already
|
|
364
|
+
* have — only the metadata is refreshed.
|
|
365
|
+
*/
|
|
366
|
+
registerMaterialType(type) {
|
|
367
|
+
const slug = type.slug;
|
|
368
|
+
if (!slug) {
|
|
369
|
+
console.warn('[MaterialRegistry] Cannot register material type without a slug.');
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const existing = MaterialRegistry[slug];
|
|
373
|
+
MaterialRegistry[slug] = {
|
|
374
|
+
name: type.name || existing?.name || slug,
|
|
375
|
+
description: type.description || existing?.description || '',
|
|
376
|
+
defaultVariant: type.defaultVariant || existing?.defaultVariant || '',
|
|
377
|
+
useCases: type.useCases || existing?.useCases || [],
|
|
378
|
+
variants: existing?.variants || {},
|
|
379
|
+
};
|
|
380
|
+
},
|
|
381
|
+
/**
|
|
382
|
+
* Register a shader row from the `shaders` table as a variant of its material type.
|
|
383
|
+
*
|
|
384
|
+
* `chunks` are the resolved `shader_chunks` rows the shader includes; their code
|
|
385
|
+
* is prepended to the matching stage in the order the server returned them.
|
|
386
|
+
* The material type bucket is created on demand, so a shader can be registered
|
|
387
|
+
* before its type metadata arrives.
|
|
388
|
+
*
|
|
389
|
+
* Neither the shader source nor the chunks contain `uniform ...;` declarations —
|
|
390
|
+
* those are generated from `uniforms` by compileShaders() when the material is
|
|
391
|
+
* built, exactly as for a shader authored in MaterialCreator. Final stage source
|
|
392
|
+
* is therefore: generated declarations, then chunk functions, then the body.
|
|
393
|
+
*/
|
|
394
|
+
registerDbShader(shader, chunks = []) {
|
|
395
|
+
if (!shader?.name || !shader.vertex || !shader.fragment) {
|
|
396
|
+
console.warn(`[MaterialRegistry] Cannot register shader "${shader?.name}" — missing name, vertex, or fragment.`);
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const typeSlug = shader.materialTypeSlug;
|
|
400
|
+
if (!typeSlug) {
|
|
401
|
+
console.warn(`[MaterialRegistry] Shader "${shader.name}" has no materialTypeSlug.`);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (!MaterialRegistry[typeSlug]) {
|
|
405
|
+
MaterialRegistry[typeSlug] = {
|
|
406
|
+
name: typeSlug,
|
|
407
|
+
description: '',
|
|
408
|
+
defaultVariant: shader.name,
|
|
409
|
+
variants: {},
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
// Prepend chunk code to the stage it belongs to.
|
|
413
|
+
let vertex = shader.vertex;
|
|
414
|
+
let fragment = shader.fragment;
|
|
415
|
+
for (const chunk of chunks) {
|
|
416
|
+
if (!chunk?.code)
|
|
417
|
+
continue;
|
|
418
|
+
if (chunk.stage === 'vertex' || chunk.stage === 'both') {
|
|
419
|
+
vertex = chunk.code + '\n' + vertex;
|
|
420
|
+
}
|
|
421
|
+
if (chunk.stage === 'fragment' || chunk.stage === 'both') {
|
|
422
|
+
fragment = chunk.code + '\n' + fragment;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
const uniformDefs = shader.uniforms || [];
|
|
426
|
+
const defaultSettings = shader.defaultSettings && Object.keys(shader.defaultSettings).length > 0
|
|
427
|
+
? { ...shader.defaultSettings }
|
|
428
|
+
: uniformDefs.reduce((acc, u) => {
|
|
429
|
+
acc[u.name] = u.defaultValue;
|
|
430
|
+
return acc;
|
|
431
|
+
}, {});
|
|
432
|
+
MaterialRegistry[typeSlug].variants[shader.name] = {
|
|
433
|
+
name: shader.name,
|
|
434
|
+
description: shader.description || '',
|
|
435
|
+
materialClass: null,
|
|
436
|
+
defaultSettings,
|
|
437
|
+
useCases: shader.useCases || [],
|
|
438
|
+
textureProperties: uniformDefs
|
|
439
|
+
.filter((u) => u.type === 'sampler2D' || u.type === 'samplerCube')
|
|
440
|
+
.map((u) => u.name),
|
|
441
|
+
_shaderSource: {
|
|
442
|
+
vertex,
|
|
443
|
+
fragment,
|
|
444
|
+
uniforms: uniformDefs,
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
if (!MaterialRegistry[typeSlug].defaultVariant) {
|
|
448
|
+
MaterialRegistry[typeSlug].defaultVariant = shader.name;
|
|
449
|
+
}
|
|
450
|
+
console.log(`[MaterialRegistry] Registered DB shader "${shader.name}" under type "${typeSlug}"`);
|
|
451
|
+
},
|
|
452
|
+
/**
|
|
453
|
+
* True when a variant for this shader name is already registered.
|
|
454
|
+
* Lets the client skip a source fetch it has already made.
|
|
455
|
+
*/
|
|
456
|
+
hasVariant(variantName) {
|
|
457
|
+
return this.getTypeFromVariantName(variantName) !== null;
|
|
458
|
+
},
|
|
358
459
|
};
|
|
359
460
|
// Export the registry for direct access if needed
|
|
360
461
|
export { MaterialRegistry };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export interface CircuitGridMaterialUniforms {
|
|
3
|
+
u_time: number;
|
|
4
|
+
/** size of one Truchet tile, in world units */
|
|
5
|
+
u_cellSize: number;
|
|
6
|
+
/** trace thickness, in pixels */
|
|
7
|
+
u_lineWidth: number;
|
|
8
|
+
/** unused by the tiling; kept so the section knobs line up with the other grids */
|
|
9
|
+
u_sectionSize: number;
|
|
10
|
+
/** pad/chip outline thickness, in pixels */
|
|
11
|
+
u_sectionWidth: number;
|
|
12
|
+
u_lineColor: THREE.Color;
|
|
13
|
+
u_sectionColor: THREE.Color;
|
|
14
|
+
u_cellColor: THREE.Color;
|
|
15
|
+
u_glowColor: THREE.Color;
|
|
16
|
+
u_bgColor: THREE.Color;
|
|
17
|
+
u_bgOpacity: number;
|
|
18
|
+
u_lineMode: number;
|
|
19
|
+
u_cellMode: number;
|
|
20
|
+
u_animSpeed: number;
|
|
21
|
+
u_animScale: number;
|
|
22
|
+
u_animIntensity: number;
|
|
23
|
+
u_fadeDistance: number;
|
|
24
|
+
u_fadeStrength: number;
|
|
25
|
+
u_focus: THREE.Vector2;
|
|
26
|
+
u_mouse: THREE.Vector2;
|
|
27
|
+
u_displace: number;
|
|
28
|
+
/**
|
|
29
|
+
* 0..1 assemble/dissolve. The build boundary sweeps outward from u_focus
|
|
30
|
+
* with a bright leading edge; 1 is fully built, 0 is gone. Animate it
|
|
31
|
+
* downward to dissolve.
|
|
32
|
+
*/
|
|
33
|
+
u_reveal: number;
|
|
34
|
+
/** 0..1 — fraction of tiles carrying a powered trace */
|
|
35
|
+
u_powered: number;
|
|
36
|
+
/** 0..1 — fraction of tiles replaced by an IC package */
|
|
37
|
+
u_chipChance: number;
|
|
38
|
+
/** solder-pad radius as a fraction of a tile; 0 disables pads */
|
|
39
|
+
u_padSize: number;
|
|
40
|
+
}
|
|
41
|
+
declare module '@react-three/fiber' {
|
|
42
|
+
interface ThreeElements {
|
|
43
|
+
circuitGridMaterial: ThreeElements['shaderMaterial'] & Partial<CircuitGridMaterialUniforms>;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export declare const circuitGridMaterialDefaults: CircuitGridMaterialUniforms;
|
|
47
|
+
export declare const CircuitGridMaterial: import("@react-three/fiber").ConstructorRepresentation<THREE.ShaderMaterial & {
|
|
48
|
+
u_time: number;
|
|
49
|
+
u_cellSize: number;
|
|
50
|
+
u_lineWidth: number;
|
|
51
|
+
u_sectionSize: number;
|
|
52
|
+
u_sectionWidth: number;
|
|
53
|
+
u_lineColor: THREE.Color;
|
|
54
|
+
u_sectionColor: THREE.Color;
|
|
55
|
+
u_cellColor: THREE.Color;
|
|
56
|
+
u_glowColor: THREE.Color;
|
|
57
|
+
u_bgColor: THREE.Color;
|
|
58
|
+
u_bgOpacity: number;
|
|
59
|
+
u_lineMode: number;
|
|
60
|
+
u_cellMode: number;
|
|
61
|
+
u_animSpeed: number;
|
|
62
|
+
u_animScale: number;
|
|
63
|
+
u_animIntensity: number;
|
|
64
|
+
u_fadeDistance: number;
|
|
65
|
+
u_fadeStrength: number;
|
|
66
|
+
u_focus: THREE.Vector2;
|
|
67
|
+
u_mouse: THREE.Vector2;
|
|
68
|
+
u_displace: number;
|
|
69
|
+
u_reveal: number;
|
|
70
|
+
u_powered: number;
|
|
71
|
+
u_chipChance: number;
|
|
72
|
+
u_padSize: number;
|
|
73
|
+
}> & {
|
|
74
|
+
key: string;
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=CircuitGridMaterial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CircuitGridMaterial.d.ts","sourceRoot":"","sources":["../../src/shaders/CircuitGridMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,aAAa,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC;IAC5B,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,YAAY,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,OAAO,QAAQ,oBAAoB,CAAC;IAChC,UAAU,aAAa;QACnB,mBAAmB,EAAE,aAAa,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;KAC/F;CACJ;AAED,eAAO,MAAM,2BAA2B,EAAE,2BA0BzC,CAAC;AAqPF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B/B,CAAC"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { shaderMaterial } from '@react-three/drei';
|
|
3
|
+
import { extend } from '@react-three/fiber';
|
|
4
|
+
export const circuitGridMaterialDefaults = {
|
|
5
|
+
u_time: 0,
|
|
6
|
+
u_cellSize: 1.0,
|
|
7
|
+
u_lineWidth: 1.6,
|
|
8
|
+
u_sectionSize: 5.0,
|
|
9
|
+
u_sectionWidth: 1.4,
|
|
10
|
+
u_lineColor: new THREE.Color(0.09, 0.42, 0.36),
|
|
11
|
+
u_sectionColor: new THREE.Color(0.55, 0.95, 0.7),
|
|
12
|
+
u_cellColor: new THREE.Color(0.03, 0.14, 0.12),
|
|
13
|
+
u_glowColor: new THREE.Color(0.35, 1.0, 0.72),
|
|
14
|
+
u_bgColor: new THREE.Color(0.01, 0.04, 0.03),
|
|
15
|
+
u_bgOpacity: 0.0,
|
|
16
|
+
u_lineMode: 2,
|
|
17
|
+
u_cellMode: 0,
|
|
18
|
+
u_animSpeed: 1.0,
|
|
19
|
+
u_animScale: 0.5,
|
|
20
|
+
u_animIntensity: 1.0,
|
|
21
|
+
u_fadeDistance: 25.0,
|
|
22
|
+
u_fadeStrength: 0.7,
|
|
23
|
+
u_focus: new THREE.Vector2(0, 0),
|
|
24
|
+
u_mouse: new THREE.Vector2(0, 0),
|
|
25
|
+
u_displace: 0.0,
|
|
26
|
+
u_reveal: 1.0,
|
|
27
|
+
u_powered: 0.65,
|
|
28
|
+
u_chipChance: 0.06,
|
|
29
|
+
u_padSize: 1.0,
|
|
30
|
+
};
|
|
31
|
+
const circuitCommon = /*glsl*/ `
|
|
32
|
+
const float PI = 3.14159265359;
|
|
33
|
+
const float TAU = 6.28318530718;
|
|
34
|
+
|
|
35
|
+
float hash21(vec2 p){
|
|
36
|
+
p = fract(p * vec2(123.34, 456.21));
|
|
37
|
+
p += dot(p, p + 45.32);
|
|
38
|
+
return fract(p.x * p.y);
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
const vertex = /*glsl*/ `
|
|
42
|
+
uniform float u_time;
|
|
43
|
+
uniform float u_cellSize;
|
|
44
|
+
uniform float u_displace;
|
|
45
|
+
uniform float u_animSpeed;
|
|
46
|
+
uniform float u_animScale;
|
|
47
|
+
|
|
48
|
+
varying vec2 vGridPos;
|
|
49
|
+
|
|
50
|
+
${circuitCommon}
|
|
51
|
+
|
|
52
|
+
void main(){
|
|
53
|
+
vGridPos = position.xy;
|
|
54
|
+
vec3 pos = position;
|
|
55
|
+
if (u_displace > 0.0){
|
|
56
|
+
float t = u_time * u_animSpeed;
|
|
57
|
+
vec2 coord = position.xy / max(u_cellSize, 1e-4);
|
|
58
|
+
// board flex: a slow low-frequency swell rather than per-tile steps, so
|
|
59
|
+
// traces stay continuous across tile borders
|
|
60
|
+
float h = sin(coord.x * u_animScale * 0.5 - t) * cos(coord.y * u_animScale * 0.5 + t * 0.7);
|
|
61
|
+
pos.z += h * u_displace;
|
|
62
|
+
}
|
|
63
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
const fragment = /*glsl*/ `
|
|
67
|
+
precision highp float;
|
|
68
|
+
|
|
69
|
+
uniform float u_time;
|
|
70
|
+
uniform float u_cellSize;
|
|
71
|
+
uniform float u_lineWidth;
|
|
72
|
+
uniform float u_sectionSize;
|
|
73
|
+
uniform float u_sectionWidth;
|
|
74
|
+
uniform vec3 u_lineColor;
|
|
75
|
+
uniform vec3 u_sectionColor;
|
|
76
|
+
uniform vec3 u_cellColor;
|
|
77
|
+
uniform vec3 u_glowColor;
|
|
78
|
+
uniform vec3 u_bgColor;
|
|
79
|
+
uniform float u_bgOpacity;
|
|
80
|
+
uniform float u_lineMode;
|
|
81
|
+
uniform float u_cellMode;
|
|
82
|
+
uniform float u_animSpeed;
|
|
83
|
+
uniform float u_animScale;
|
|
84
|
+
uniform float u_animIntensity;
|
|
85
|
+
uniform float u_fadeDistance;
|
|
86
|
+
uniform float u_fadeStrength;
|
|
87
|
+
uniform vec2 u_focus;
|
|
88
|
+
uniform float u_reveal;
|
|
89
|
+
uniform float u_powered;
|
|
90
|
+
uniform float u_chipChance;
|
|
91
|
+
uniform float u_padSize;
|
|
92
|
+
|
|
93
|
+
varying vec2 vGridPos;
|
|
94
|
+
|
|
95
|
+
${circuitCommon}
|
|
96
|
+
|
|
97
|
+
/** signed distance to a rounded box of half-extent b and corner radius r */
|
|
98
|
+
float sdRoundBox(vec2 p, vec2 b, float r){
|
|
99
|
+
vec2 q = abs(p) - b + r;
|
|
100
|
+
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** straight axis-aligned lines on a lattice, same maths as the square grid */
|
|
104
|
+
float gridLines(vec2 c, float width){
|
|
105
|
+
vec2 d = fwidth(c);
|
|
106
|
+
vec2 g = abs(fract(c - 0.5) - 0.5) / max(d * width, 1e-5);
|
|
107
|
+
return 1.0 - clamp(min(g.x, g.y), 0.0, 1.0);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** IC legs: short lines bridging the package edge to the tile edge */
|
|
111
|
+
float chipPins(vec2 gv, float hw, float px){
|
|
112
|
+
float dy = abs(fract(gv.y * 4.0) - 0.5) * 0.25;
|
|
113
|
+
float dx = abs(fract(gv.x * 4.0) - 0.5) * 0.25;
|
|
114
|
+
float horiz = (1.0 - smoothstep(hw, hw + px, dy)) * step(0.30, abs(gv.x));
|
|
115
|
+
float vert = (1.0 - smoothstep(hw, hw + px, dx)) * step(0.30, abs(gv.y));
|
|
116
|
+
return max(horiz, vert);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
void main(){
|
|
120
|
+
vec2 coord = vGridPos / max(u_cellSize, 1e-4);
|
|
121
|
+
vec2 focus = u_focus / max(u_cellSize, 1e-4);
|
|
122
|
+
float t = u_time * u_animSpeed;
|
|
123
|
+
float px = max(length(fwidth(coord)), 1e-6);
|
|
124
|
+
|
|
125
|
+
vec2 id = floor(coord);
|
|
126
|
+
vec2 gv = fract(coord) - 0.5;
|
|
127
|
+
|
|
128
|
+
float seed = hash21(id);
|
|
129
|
+
// Mirroring half the tiles is what turns isolated quarter-arcs into long
|
|
130
|
+
// meandering paths: the two orientations chain across tile borders.
|
|
131
|
+
if (seed < 0.5) gv.x = -gv.x;
|
|
132
|
+
|
|
133
|
+
bool isChip = hash21(id + 7.77) < u_chipChance;
|
|
134
|
+
bool powered = hash21(id + 11.31) < u_powered;
|
|
135
|
+
|
|
136
|
+
float hw = px * max(u_lineWidth, 0.05) * 0.5;
|
|
137
|
+
|
|
138
|
+
// ---- Truchet traces --------------------------------------------------
|
|
139
|
+
vec2 c1 = vec2( 0.5, 0.5);
|
|
140
|
+
vec2 c2 = vec2(-0.5, -0.5);
|
|
141
|
+
float d1 = abs(length(gv - c1) - 0.5);
|
|
142
|
+
float d2 = abs(length(gv - c2) - 0.5);
|
|
143
|
+
float traceDist = min(d1, d2);
|
|
144
|
+
float trace = isChip ? 0.0 : 1.0 - smoothstep(hw, hw + px, traceDist);
|
|
145
|
+
|
|
146
|
+
// Position along whichever arc we are nearest, normalised over its quarter
|
|
147
|
+
// turn. Arc 1 spans atan in [-PI, -PI/2]; arc 2 spans [0, PI/2].
|
|
148
|
+
bool onA = d1 < d2;
|
|
149
|
+
vec2 rel = onA ? (gv - c1) : (gv - c2);
|
|
150
|
+
float ang = atan(rel.y, rel.x);
|
|
151
|
+
float along = onA ? (ang + PI) / (PI * 0.5) : ang / (PI * 0.5);
|
|
152
|
+
// per-arc offset so the whole board does not pulse in lockstep
|
|
153
|
+
float arcSeed = hash21(id + (onA ? vec2(0.0) : vec2(3.71, 1.09)));
|
|
154
|
+
|
|
155
|
+
// ---- trace animation -------------------------------------------------
|
|
156
|
+
float lineAnim = 1.0;
|
|
157
|
+
float head = 0.0;
|
|
158
|
+
if (u_lineMode > 0.5 && u_lineMode < 1.5){
|
|
159
|
+
float dist = length(coord - focus);
|
|
160
|
+
lineAnim = 0.5 + 0.5 * sin(dist * u_animScale - t);
|
|
161
|
+
} else if (u_lineMode < 2.5){
|
|
162
|
+
// signal pulses running along the traces themselves
|
|
163
|
+
lineAnim = 0.6;
|
|
164
|
+
float phase = fract(arcSeed + along * 0.25 - t * 0.18 * max(u_animScale, 0.05));
|
|
165
|
+
head = pow(phase, 16.0);
|
|
166
|
+
} else if (u_lineMode < 3.5){
|
|
167
|
+
// a data wavefront crossing the board diagonally
|
|
168
|
+
float s = fract((coord.x + coord.y) * 0.05 * u_animScale - t * 0.15);
|
|
169
|
+
lineAnim = 0.25 + smoothstep(0.0, 0.15, s) * (1.0 - smoothstep(0.15, 0.35, s));
|
|
170
|
+
} else if (u_lineMode < 4.5){
|
|
171
|
+
lineAnim = 0.5 + 0.5 * sin(t + seed * TAU);
|
|
172
|
+
}
|
|
173
|
+
if (!powered){ lineAnim *= 0.25; head = 0.0; }
|
|
174
|
+
lineAnim = mix(1.0, lineAnim, u_animIntensity);
|
|
175
|
+
head *= u_animIntensity;
|
|
176
|
+
|
|
177
|
+
// ---- bus lines -------------------------------------------------------
|
|
178
|
+
// Straight power/data buses every sectionSize tiles, cutting across the
|
|
179
|
+
// Truchet weave the way a real board's supply rails do.
|
|
180
|
+
float bus = 0.0;
|
|
181
|
+
if (u_sectionWidth > 0.0 && u_sectionSize > 0.0){
|
|
182
|
+
bus = gridLines(coord / u_sectionSize, u_sectionWidth);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ---- solder pads / vias ---------------------------------------------
|
|
186
|
+
// Every arc terminates on an edge midpoint, so that is where the pads go.
|
|
187
|
+
// Neighbouring tiles draw the same pad twice at the same point, which is
|
|
188
|
+
// exactly right — it is one via shared by both.
|
|
189
|
+
// A via on every junction turns the board into a dot field that drowns out
|
|
190
|
+
// the traces, so only a minority of tiles get one.
|
|
191
|
+
float pad = 0.0;
|
|
192
|
+
if (u_padSize > 0.0 && !isChip && hash21(id + 21.73) < 0.3){
|
|
193
|
+
float dp = min(
|
|
194
|
+
min(length(gv - vec2(0.5, 0.0)), length(gv + vec2(0.5, 0.0))),
|
|
195
|
+
min(length(gv - vec2(0.0, 0.5)), length(gv + vec2(0.0, 0.5)))
|
|
196
|
+
);
|
|
197
|
+
float pr = 0.05 * u_padSize;
|
|
198
|
+
pad = 1.0 - smoothstep(pr, pr + px * 1.5, dp);
|
|
199
|
+
pad *= smoothstep(pr * 0.30, pr * 0.50, dp); // punch the drill hole
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// ---- IC packages -----------------------------------------------------
|
|
203
|
+
float chipBody = 0.0, chipEdge = 0.0, chipCore = 0.0, pins = 0.0;
|
|
204
|
+
if (isChip){
|
|
205
|
+
float b = sdRoundBox(gv, vec2(0.30), 0.06);
|
|
206
|
+
chipBody = 1.0 - smoothstep(0.0, px * 2.0, b);
|
|
207
|
+
chipEdge = 1.0 - smoothstep(hw, hw + px, abs(b));
|
|
208
|
+
pins = chipPins(gv, hw, px);
|
|
209
|
+
float beat = 0.5 + 0.5 * sin(t * (1.0 + hash21(id + 2.3) * 2.0));
|
|
210
|
+
chipCore = (1.0 - smoothstep(0.0, px * 2.0, sdRoundBox(gv, vec2(0.10), 0.02))) * beat;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// ---- substrate fill --------------------------------------------------
|
|
214
|
+
float cell = 0.0;
|
|
215
|
+
if (u_cellMode > 0.5 && u_cellMode < 1.5){
|
|
216
|
+
cell = 0.5 + 0.5 * sin(dot(id, vec2(0.7, 0.3)) * u_animScale - t);
|
|
217
|
+
} else if (u_cellMode < 2.5){
|
|
218
|
+
cell = 0.5 + 0.5 * sin(t * (0.6 + seed) + seed * TAU);
|
|
219
|
+
} else if (u_cellMode < 3.5){
|
|
220
|
+
float d = length(id + 0.5 - focus);
|
|
221
|
+
cell = smoothstep(0.6, 1.0, sin(d * u_animScale - t));
|
|
222
|
+
} else if (u_cellMode < 4.5){
|
|
223
|
+
cell = mod(id.x + id.y, 2.0) * (0.5 + 0.5 * sin(t));
|
|
224
|
+
}
|
|
225
|
+
cell *= u_animIntensity;
|
|
226
|
+
vec2 f = abs(gv);
|
|
227
|
+
cell *= smoothstep(0.5, 0.4, max(f.x, f.y));
|
|
228
|
+
|
|
229
|
+
float r = length(vGridPos) / max(u_fadeDistance, 1e-4);
|
|
230
|
+
float fade = 1.0 - smoothstep(1.0 - u_fadeStrength, 1.0, r);
|
|
231
|
+
|
|
232
|
+
vec3 col = u_bgColor * u_bgOpacity;
|
|
233
|
+
float a = u_bgOpacity;
|
|
234
|
+
|
|
235
|
+
col += u_cellColor * (cell + chipBody * 0.8);
|
|
236
|
+
a = max(a, max(cell * 0.9, chipBody * 0.85));
|
|
237
|
+
|
|
238
|
+
float traceI = trace * lineAnim;
|
|
239
|
+
float busI = bus * lineAnim;
|
|
240
|
+
col += u_lineColor * traceI; a = max(a, traceI);
|
|
241
|
+
col += u_glowColor * trace * head * 2.2; a = max(a, trace * head);
|
|
242
|
+
col += u_sectionColor * busI * 0.8; a = max(a, busI * 0.8);
|
|
243
|
+
float padI = pad * 0.7;
|
|
244
|
+
col += u_sectionColor * (padI + chipEdge + pins); a = max(a, max(padI, max(chipEdge, pins)));
|
|
245
|
+
col += u_glowColor * chipCore * 1.5; a = max(a, chipCore);
|
|
246
|
+
col += u_glowColor * traceI * 0.15 * u_animIntensity;
|
|
247
|
+
|
|
248
|
+
col *= fade;
|
|
249
|
+
a *= fade;
|
|
250
|
+
|
|
251
|
+
// ---- reveal ----------------------------------------------------------
|
|
252
|
+
// The build boundary sweeps outward from the focus point. Its leading band
|
|
253
|
+
// mostly brightens whatever is already there rather than painting a solid
|
|
254
|
+
// disc, so the grid reads as assembling itself rather than fading in.
|
|
255
|
+
if (u_reveal < 0.999){
|
|
256
|
+
float rd = length(vGridPos - u_focus) / max(u_fadeDistance, 1e-4);
|
|
257
|
+
// 1.1, not 1.25: the boundary has to clear the fade radius by just the
|
|
258
|
+
// width of its own soft edge. Overshooting further finishes the build
|
|
259
|
+
// before reveal reaches 1 and leaves the tail of the range doing nothing.
|
|
260
|
+
float edge = u_reveal * 1.1;
|
|
261
|
+
float mask = 1.0 - smoothstep(edge - 0.05, edge, rd);
|
|
262
|
+
float front = mask * smoothstep(edge - 0.22, edge - 0.05, rd);
|
|
263
|
+
col = col * mask + u_glowColor * front * (a * 1.8 + 0.08);
|
|
264
|
+
a = max(a * mask, front * 0.10);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (a < 0.002) discard;
|
|
268
|
+
gl_FragColor = vec4(col, a);
|
|
269
|
+
}
|
|
270
|
+
`;
|
|
271
|
+
export const CircuitGridMaterial = shaderMaterial({
|
|
272
|
+
u_time: circuitGridMaterialDefaults.u_time,
|
|
273
|
+
u_cellSize: circuitGridMaterialDefaults.u_cellSize,
|
|
274
|
+
u_lineWidth: circuitGridMaterialDefaults.u_lineWidth,
|
|
275
|
+
u_sectionSize: circuitGridMaterialDefaults.u_sectionSize,
|
|
276
|
+
u_sectionWidth: circuitGridMaterialDefaults.u_sectionWidth,
|
|
277
|
+
u_lineColor: circuitGridMaterialDefaults.u_lineColor.clone(),
|
|
278
|
+
u_sectionColor: circuitGridMaterialDefaults.u_sectionColor.clone(),
|
|
279
|
+
u_cellColor: circuitGridMaterialDefaults.u_cellColor.clone(),
|
|
280
|
+
u_glowColor: circuitGridMaterialDefaults.u_glowColor.clone(),
|
|
281
|
+
u_bgColor: circuitGridMaterialDefaults.u_bgColor.clone(),
|
|
282
|
+
u_bgOpacity: circuitGridMaterialDefaults.u_bgOpacity,
|
|
283
|
+
u_lineMode: circuitGridMaterialDefaults.u_lineMode,
|
|
284
|
+
u_cellMode: circuitGridMaterialDefaults.u_cellMode,
|
|
285
|
+
u_animSpeed: circuitGridMaterialDefaults.u_animSpeed,
|
|
286
|
+
u_animScale: circuitGridMaterialDefaults.u_animScale,
|
|
287
|
+
u_animIntensity: circuitGridMaterialDefaults.u_animIntensity,
|
|
288
|
+
u_fadeDistance: circuitGridMaterialDefaults.u_fadeDistance,
|
|
289
|
+
u_fadeStrength: circuitGridMaterialDefaults.u_fadeStrength,
|
|
290
|
+
u_focus: circuitGridMaterialDefaults.u_focus.clone(),
|
|
291
|
+
u_mouse: circuitGridMaterialDefaults.u_mouse.clone(),
|
|
292
|
+
u_displace: circuitGridMaterialDefaults.u_displace,
|
|
293
|
+
u_reveal: circuitGridMaterialDefaults.u_reveal,
|
|
294
|
+
u_powered: circuitGridMaterialDefaults.u_powered,
|
|
295
|
+
u_chipChance: circuitGridMaterialDefaults.u_chipChance,
|
|
296
|
+
u_padSize: circuitGridMaterialDefaults.u_padSize,
|
|
297
|
+
}, vertex, fragment);
|
|
298
|
+
extend({ CircuitGridMaterial });
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export interface ContourGridMaterialUniforms {
|
|
3
|
+
u_time: number;
|
|
4
|
+
/** horizontal scale of the terrain, in world units per noise cell */
|
|
5
|
+
u_cellSize: number;
|
|
6
|
+
/** minor contour thickness, in pixels */
|
|
7
|
+
u_lineWidth: number;
|
|
8
|
+
/** every Nth contour is an index contour */
|
|
9
|
+
u_sectionSize: number;
|
|
10
|
+
/** index-contour thickness, in pixels; 0 disables the layer */
|
|
11
|
+
u_sectionWidth: number;
|
|
12
|
+
u_lineColor: THREE.Color;
|
|
13
|
+
u_sectionColor: THREE.Color;
|
|
14
|
+
u_cellColor: THREE.Color;
|
|
15
|
+
u_glowColor: THREE.Color;
|
|
16
|
+
u_bgColor: THREE.Color;
|
|
17
|
+
u_bgOpacity: number;
|
|
18
|
+
u_lineMode: number;
|
|
19
|
+
u_cellMode: number;
|
|
20
|
+
u_animSpeed: number;
|
|
21
|
+
u_animScale: number;
|
|
22
|
+
u_animIntensity: number;
|
|
23
|
+
u_fadeDistance: number;
|
|
24
|
+
u_fadeStrength: number;
|
|
25
|
+
u_focus: THREE.Vector2;
|
|
26
|
+
u_mouse: THREE.Vector2;
|
|
27
|
+
/**
|
|
28
|
+
* vertex displacement. Unlike the other grids this is literal: the surface
|
|
29
|
+
* rises to exactly the elevation its contours describe.
|
|
30
|
+
*/
|
|
31
|
+
u_displace: number;
|
|
32
|
+
/**
|
|
33
|
+
* 0..1 assemble/dissolve. The build boundary sweeps outward from u_focus
|
|
34
|
+
* with a bright leading edge; 1 is fully built, 0 is gone. Animate it
|
|
35
|
+
* downward to dissolve.
|
|
36
|
+
*/
|
|
37
|
+
u_reveal: number;
|
|
38
|
+
/** number of contour steps across the full height range */
|
|
39
|
+
u_levels: number;
|
|
40
|
+
/** fbm gain, 0.35 rolling to 0.65 craggy */
|
|
41
|
+
u_roughness: number;
|
|
42
|
+
/** domain warp; bends the contours into ridges and valleys */
|
|
43
|
+
u_warp: number;
|
|
44
|
+
}
|
|
45
|
+
declare module '@react-three/fiber' {
|
|
46
|
+
interface ThreeElements {
|
|
47
|
+
contourGridMaterial: ThreeElements['shaderMaterial'] & Partial<ContourGridMaterialUniforms>;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export declare const contourGridMaterialDefaults: ContourGridMaterialUniforms;
|
|
51
|
+
export declare const ContourGridMaterial: import("@react-three/fiber").ConstructorRepresentation<THREE.ShaderMaterial & {
|
|
52
|
+
u_time: number;
|
|
53
|
+
u_cellSize: number;
|
|
54
|
+
u_lineWidth: number;
|
|
55
|
+
u_sectionSize: number;
|
|
56
|
+
u_sectionWidth: number;
|
|
57
|
+
u_lineColor: THREE.Color;
|
|
58
|
+
u_sectionColor: THREE.Color;
|
|
59
|
+
u_cellColor: THREE.Color;
|
|
60
|
+
u_glowColor: THREE.Color;
|
|
61
|
+
u_bgColor: THREE.Color;
|
|
62
|
+
u_bgOpacity: number;
|
|
63
|
+
u_lineMode: number;
|
|
64
|
+
u_cellMode: number;
|
|
65
|
+
u_animSpeed: number;
|
|
66
|
+
u_animScale: number;
|
|
67
|
+
u_animIntensity: number;
|
|
68
|
+
u_fadeDistance: number;
|
|
69
|
+
u_fadeStrength: number;
|
|
70
|
+
u_focus: THREE.Vector2;
|
|
71
|
+
u_mouse: THREE.Vector2;
|
|
72
|
+
u_displace: number;
|
|
73
|
+
u_reveal: number;
|
|
74
|
+
u_levels: number;
|
|
75
|
+
u_roughness: number;
|
|
76
|
+
u_warp: number;
|
|
77
|
+
}> & {
|
|
78
|
+
key: string;
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=ContourGridMaterial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContourGridMaterial.d.ts","sourceRoot":"","sources":["../../src/shaders/ContourGridMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC;IAC5B,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,MAAM,EAAE,MAAM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