@3driseai/3drise-core 1.0.20 → 1.0.22

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.
Files changed (185) hide show
  1. package/dist/autoAnimate/composer.d.ts +6 -0
  2. package/dist/autoAnimate/composer.d.ts.map +1 -1
  3. package/dist/autoAnimate/composer.js +4 -3
  4. package/dist/autoAnimate/describeScene.js +1 -1
  5. package/dist/catalog/catalogInfo.d.ts +22 -0
  6. package/dist/catalog/catalogInfo.d.ts.map +1 -0
  7. package/dist/catalog/catalogInfo.js +204 -0
  8. package/dist/catalog/index.d.ts +3 -0
  9. package/dist/catalog/index.d.ts.map +1 -0
  10. package/dist/catalog/index.js +2 -0
  11. package/dist/catalog/objectCatalog.d.ts +33 -0
  12. package/dist/catalog/objectCatalog.d.ts.map +1 -0
  13. package/dist/catalog/objectCatalog.js +99 -0
  14. package/dist/data/allMaterials.js +2 -2
  15. package/dist/data/environmentDefaults.d.ts +10 -0
  16. package/dist/data/environmentDefaults.d.ts.map +1 -0
  17. package/dist/data/environmentDefaults.js +126 -0
  18. package/dist/data/gridsDefaults.d.ts +2 -0
  19. package/dist/data/gridsDefaults.d.ts.map +1 -1
  20. package/dist/data/gridsDefaults.js +186 -0
  21. package/dist/data/index.d.ts +4 -0
  22. package/dist/data/index.d.ts.map +1 -1
  23. package/dist/data/index.js +4 -0
  24. package/dist/data/landDefaults.d.ts +26 -0
  25. package/dist/data/landDefaults.d.ts.map +1 -0
  26. package/dist/data/landDefaults.js +76 -0
  27. package/dist/data/spaceDefaults.d.ts +10 -0
  28. package/dist/data/spaceDefaults.d.ts.map +1 -0
  29. package/dist/data/spaceDefaults.js +46 -0
  30. package/dist/data/textDefaults.d.ts +16 -0
  31. package/dist/data/textDefaults.d.ts.map +1 -0
  32. package/dist/data/textDefaults.js +199 -0
  33. package/dist/environment/oceanConfigs.d.ts +5 -4
  34. package/dist/environment/oceanConfigs.d.ts.map +1 -1
  35. package/dist/environment/oceanConfigs.js +2 -2
  36. package/dist/environment/terrainConfigs.d.ts +78 -0
  37. package/dist/environment/terrainConfigs.d.ts.map +1 -1
  38. package/dist/environment/terrainConfigs.js +72 -2
  39. package/dist/index.d.ts +3 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +3 -1
  42. package/dist/properties/registry.d.ts +10 -1
  43. package/dist/properties/registry.d.ts.map +1 -1
  44. package/dist/properties/registry.js +60 -9
  45. package/dist/properties/tables/environmentProperties.d.ts +9 -0
  46. package/dist/properties/tables/environmentProperties.d.ts.map +1 -0
  47. package/dist/properties/tables/environmentProperties.js +127 -0
  48. package/dist/properties/tables/gridProperties.d.ts.map +1 -1
  49. package/dist/properties/tables/gridProperties.js +184 -82
  50. package/dist/properties/tables/index.d.ts +4 -1
  51. package/dist/properties/tables/index.d.ts.map +1 -1
  52. package/dist/properties/tables/index.js +4 -1
  53. package/dist/properties/tables/landProperties.d.ts +5 -0
  54. package/dist/properties/tables/landProperties.d.ts.map +1 -0
  55. package/dist/properties/tables/landProperties.js +24 -0
  56. package/dist/properties/tables/lightProperties.js +1 -1
  57. package/dist/properties/tables/materialBounds.js +1 -1
  58. package/dist/properties/tables/optionalProperties.d.ts +1 -2
  59. package/dist/properties/tables/optionalProperties.d.ts.map +1 -1
  60. package/dist/properties/tables/optionalProperties.js +21 -0
  61. package/dist/properties/tables/spaceProperties.d.ts +8 -0
  62. package/dist/properties/tables/spaceProperties.d.ts.map +1 -0
  63. package/dist/properties/tables/spaceProperties.js +42 -0
  64. package/dist/properties/tables/textProperties.d.ts +4 -0
  65. package/dist/properties/tables/textProperties.d.ts.map +1 -0
  66. package/dist/properties/tables/textProperties.js +361 -0
  67. package/dist/properties/types.d.ts +1 -1
  68. package/dist/properties/types.d.ts.map +1 -1
  69. package/dist/services/MaterialRegistry.d.ts.map +1 -1
  70. package/dist/services/MaterialRegistry.js +2 -0
  71. package/dist/services/SkySystemManager.d.ts +22 -0
  72. package/dist/services/SkySystemManager.d.ts.map +1 -1
  73. package/dist/services/SkySystemManager.js +50 -18
  74. package/dist/services/TextureResolver.d.ts.map +1 -1
  75. package/dist/services/TextureResolver.js +22 -0
  76. package/dist/services/index.d.ts +1 -1
  77. package/dist/services/index.d.ts.map +1 -1
  78. package/dist/services/index.js +1 -1
  79. package/dist/shaders/ApollonianGridMaterial.d.ts +70 -0
  80. package/dist/shaders/ApollonianGridMaterial.d.ts.map +1 -0
  81. package/dist/shaders/ApollonianGridMaterial.js +289 -0
  82. package/dist/shaders/ConformalGridMaterial.d.ts +91 -0
  83. package/dist/shaders/ConformalGridMaterial.d.ts.map +1 -0
  84. package/dist/shaders/ConformalGridMaterial.js +335 -0
  85. package/dist/shaders/HilbertGridMaterial.d.ts +79 -0
  86. package/dist/shaders/HilbertGridMaterial.d.ts.map +1 -0
  87. package/dist/shaders/HilbertGridMaterial.js +329 -0
  88. package/dist/shaders/LensingGridMaterial.d.ts +73 -0
  89. package/dist/shaders/LensingGridMaterial.d.ts.map +1 -0
  90. package/dist/shaders/LensingGridMaterial.js +253 -0
  91. package/dist/shaders/ParastichyGridMaterial.d.ts +76 -0
  92. package/dist/shaders/ParastichyGridMaterial.d.ts.map +1 -0
  93. package/dist/shaders/ParastichyGridMaterial.js +282 -0
  94. package/dist/shaders/PhyllotaxisGridMaterial.d.ts +85 -0
  95. package/dist/shaders/PhyllotaxisGridMaterial.d.ts.map +1 -0
  96. package/dist/shaders/PhyllotaxisGridMaterial.js +532 -0
  97. package/dist/shaders/SkyboxMaterial.js +3 -3
  98. package/dist/shaders/StarsMaterial.d.ts +5 -0
  99. package/dist/shaders/StarsMaterial.d.ts.map +1 -1
  100. package/dist/shaders/StarsMaterial.js +59 -57
  101. package/dist/shaders/TruchetGridMaterial.d.ts +76 -0
  102. package/dist/shaders/TruchetGridMaterial.d.ts.map +1 -0
  103. package/dist/shaders/TruchetGridMaterial.js +290 -0
  104. package/dist/shaders/index.d.ts +7 -0
  105. package/dist/shaders/index.d.ts.map +1 -1
  106. package/dist/shaders/index.js +7 -0
  107. package/dist/types/actions.d.ts +6 -5
  108. package/dist/types/actions.d.ts.map +1 -1
  109. package/dist/types/commands.d.ts +61 -0
  110. package/dist/types/commands.d.ts.map +1 -0
  111. package/dist/types/commands.js +1 -0
  112. package/dist/types/environment.d.ts +34 -1
  113. package/dist/types/environment.d.ts.map +1 -1
  114. package/dist/types/environment.js +15 -0
  115. package/dist/types/environmentObjects.d.ts +152 -0
  116. package/dist/types/environmentObjects.d.ts.map +1 -0
  117. package/dist/types/environmentObjects.js +10 -0
  118. package/dist/types/index.d.ts +5 -1
  119. package/dist/types/index.d.ts.map +1 -1
  120. package/dist/types/landObjects.d.ts +15 -0
  121. package/dist/types/landObjects.d.ts.map +1 -0
  122. package/dist/types/landObjects.js +1 -0
  123. package/dist/types/objectSettings.d.ts +187 -16
  124. package/dist/types/objectSettings.d.ts.map +1 -1
  125. package/dist/types/objectsConfigs.d.ts +0 -3
  126. package/dist/types/objectsConfigs.d.ts.map +1 -1
  127. package/dist/types/scene3d.d.ts +8 -5
  128. package/dist/types/scene3d.d.ts.map +1 -1
  129. package/dist/types/spaceObjects.d.ts +65 -0
  130. package/dist/types/spaceObjects.d.ts.map +1 -0
  131. package/dist/types/spaceObjects.js +11 -0
  132. package/dist/types/textObjects.d.ts +352 -0
  133. package/dist/types/textObjects.d.ts.map +1 -0
  134. package/dist/types/textObjects.js +14 -0
  135. package/dist/types/types.d.ts +3 -6
  136. package/dist/types/types.d.ts.map +1 -1
  137. package/dist/types/users.d.ts +3 -1
  138. package/dist/types/users.d.ts.map +1 -1
  139. package/dist/types/users.js +2 -0
  140. package/dist/ui/index.d.ts +5 -0
  141. package/dist/ui/index.d.ts.map +1 -0
  142. package/dist/ui/index.js +4 -0
  143. package/dist/ui/uiBindings.d.ts +45 -0
  144. package/dist/ui/uiBindings.d.ts.map +1 -0
  145. package/dist/ui/uiBindings.js +172 -0
  146. package/dist/ui/uiKeys.d.ts +14 -0
  147. package/dist/ui/uiKeys.d.ts.map +1 -0
  148. package/dist/ui/uiKeys.js +22 -0
  149. package/dist/ui/uiSanitize.d.ts +18 -0
  150. package/dist/ui/uiSanitize.d.ts.map +1 -0
  151. package/dist/ui/uiSanitize.js +251 -0
  152. package/dist/ui/uiSpec.d.ts +116 -0
  153. package/dist/ui/uiSpec.d.ts.map +1 -0
  154. package/dist/ui/uiSpec.js +173 -0
  155. package/dist/utils/environmentMigration.d.ts +3 -0
  156. package/dist/utils/environmentMigration.d.ts.map +1 -0
  157. package/dist/utils/environmentMigration.js +50 -0
  158. package/dist/utils/generativeAnimatable.d.ts +1 -1
  159. package/dist/utils/generativeAnimatable.d.ts.map +1 -1
  160. package/dist/utils/generativeAnimatable.js +12 -0
  161. package/dist/utils/getAnimatableProperties.d.ts +1 -1
  162. package/dist/utils/getAnimatableProperties.d.ts.map +1 -1
  163. package/dist/utils/getAnimatableProperties.js +1 -1
  164. package/dist/utils/gridMigration.d.ts +3 -0
  165. package/dist/utils/gridMigration.d.ts.map +1 -0
  166. package/dist/utils/gridMigration.js +34 -0
  167. package/dist/utils/index.d.ts +5 -0
  168. package/dist/utils/index.d.ts.map +1 -1
  169. package/dist/utils/index.js +5 -0
  170. package/dist/utils/objectEffects.d.ts +24 -2
  171. package/dist/utils/objectEffects.d.ts.map +1 -1
  172. package/dist/utils/objectEffects.js +29 -2
  173. package/dist/utils/objectMigration.d.ts +9 -0
  174. package/dist/utils/objectMigration.d.ts.map +1 -0
  175. package/dist/utils/objectMigration.js +12 -0
  176. package/dist/utils/skyPhase.d.ts +61 -0
  177. package/dist/utils/skyPhase.d.ts.map +1 -0
  178. package/dist/utils/skyPhase.js +93 -0
  179. package/dist/utils/spaceMigration.d.ts +3 -0
  180. package/dist/utils/spaceMigration.d.ts.map +1 -0
  181. package/dist/utils/spaceMigration.js +46 -0
  182. package/dist/utils/sunUtils.d.ts +26 -1
  183. package/dist/utils/sunUtils.d.ts.map +1 -1
  184. package/dist/utils/sunUtils.js +37 -6
  185. package/package.json +1 -1
@@ -2,64 +2,65 @@ import { extend } from "@react-three/fiber";
2
2
  import { shaderMaterial } from "@react-three/drei";
3
3
  import * as THREE from "three";
4
4
  // Vertex shader with twinkling effect
5
- const vertexShader = /*glsl*/ `
6
- attribute float size;
7
- attribute vec3 color;
8
- attribute float phase;
9
- attribute float freq;
10
-
11
- varying vec3 vColor;
12
- varying float vDepth;
13
-
14
- uniform float time;
15
-
16
- void main() {
17
- vColor = color;
18
- vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
19
- vDepth = mvPosition.z;
20
-
21
- // Twinkling effect based on time, frequency, and phase
22
- float twinkle = sin(time * freq + phase) * 0.2 + 0.8;
23
- gl_PointSize = size * twinkle;
24
-
25
- // Position stars at far depth to appear behind everything
26
- vec4 pos = projectionMatrix * mvPosition;
27
- pos.z = pos.w * 0.999999;
28
- gl_Position = pos;
29
- }
5
+ const vertexShader = /*glsl*/ `
6
+ attribute float size;
7
+ attribute vec3 color;
8
+ attribute float phase;
9
+ attribute float freq;
10
+
11
+ varying vec3 vColor;
12
+ varying float vDepth;
13
+
14
+ uniform float time;
15
+ uniform float sizeScale;
16
+
17
+ void main() {
18
+ vColor = color;
19
+ vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
20
+ vDepth = mvPosition.z;
21
+
22
+ // Twinkling effect based on time, frequency, and phase
23
+ float twinkle = sin(time * freq + phase) * 0.2 + 0.8;
24
+ gl_PointSize = size * twinkle * sizeScale;
25
+
26
+ // Position stars at far depth to appear behind everything
27
+ vec4 pos = projectionMatrix * mvPosition;
28
+ pos.z = pos.w * 0.999999;
29
+ gl_Position = pos;
30
+ }
30
31
  `;
31
32
  // Fragment shader with star glow effect and color transitions
32
- const fragmentShader = /*glsl*/ `
33
- varying vec3 vColor;
34
- varying float vDepth;
35
-
36
- uniform float opacity;
37
- uniform vec3 uColor;
38
- uniform vec3 targetColor;
39
- uniform float colorMix;
40
-
41
- void main() {
42
- // Calculate distance from center of point
43
- vec2 center = gl_PointCoord - vec2(0.5);
44
- float dist = length(center) * 2.0;
45
-
46
- // Core brightness with sharp center
47
- float core = (1.0 - smoothstep(0.0, 0.2, dist)) * 0.8;
48
-
49
- // Soft glow around core
50
- float glow = (1.0 - smoothstep(0.2, 0.5, dist)) * 0.1;
51
-
52
- float brightness = core + glow;
53
-
54
- // Interpolate between base color and target color
55
- vec3 transitionColor = mix(uColor, targetColor, colorMix);
56
-
57
- // Mix white with interpolated color for realistic appearance
58
- vec3 finalColor = mix(vec3(1.0), transitionColor * vColor, 0.8) * 0.6;
59
-
60
- // Apply global opacity for fade in/out transitions
61
- gl_FragColor = vec4(finalColor, brightness * opacity);
62
- }
33
+ const fragmentShader = /*glsl*/ `
34
+ varying vec3 vColor;
35
+ varying float vDepth;
36
+
37
+ uniform float opacity;
38
+ uniform vec3 uColor;
39
+ uniform vec3 targetColor;
40
+ uniform float colorMix;
41
+
42
+ void main() {
43
+ // Calculate distance from center of point
44
+ vec2 center = gl_PointCoord - vec2(0.5);
45
+ float dist = length(center) * 2.0;
46
+
47
+ // Core brightness with sharp center
48
+ float core = (1.0 - smoothstep(0.0, 0.2, dist)) * 0.8;
49
+
50
+ // Soft glow around core
51
+ float glow = (1.0 - smoothstep(0.2, 0.5, dist)) * 0.1;
52
+
53
+ float brightness = core + glow;
54
+
55
+ // Interpolate between base color and target color
56
+ vec3 transitionColor = mix(uColor, targetColor, colorMix);
57
+
58
+ // Mix white with interpolated color for realistic appearance
59
+ vec3 finalColor = mix(vec3(1.0), transitionColor * vColor, 0.8) * 0.6;
60
+
61
+ // Apply global opacity for fade in/out transitions
62
+ gl_FragColor = vec4(finalColor, brightness * opacity);
63
+ }
63
64
  `;
64
65
  // Create the shader material with uniforms
65
66
  const StarsMaterial = shaderMaterial({
@@ -67,7 +68,8 @@ const StarsMaterial = shaderMaterial({
67
68
  opacity: 1.0,
68
69
  uColor: new THREE.Color(1.0, 1.0, 1.0),
69
70
  targetColor: new THREE.Color(1.0, 1.0, 1.0),
70
- colorMix: 0.0
71
+ colorMix: 0.0,
72
+ sizeScale: 1.0
71
73
  }, vertexShader, fragmentShader);
72
74
  // Extend the material for use in React Three Fiber
73
75
  extend({ StarsMaterial });
@@ -0,0 +1,76 @@
1
+ import * as THREE from 'three';
2
+ export interface TruchetGridMaterialUniforms {
3
+ /** elapsed seconds (useGridSurface) */
4
+ u_time: number;
5
+ /** size of one cell, in world units */
6
+ u_cellSize: number;
7
+ /** line thickness, in pixels */
8
+ u_lineWidth: number;
9
+ u_sectionSize: number;
10
+ /** accent 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
+ /** ripple / reveal origin; stays at the origin */
26
+ u_focus: THREE.Vector2;
27
+ u_mouse: THREE.Vector2;
28
+ u_displace: number;
29
+ /** 0..1 assemble / dissolve */
30
+ u_reveal: number;
31
+ /** Chance a tile re-deals its orientation each epoch; 0 freezes the paths */
32
+ u_flip: number;
33
+ /** Balance of the two tile orientations: 0.5 is a maze, the ends are stripes */
34
+ u_bias: number;
35
+ /** Brightness of the comets travelling the loops */
36
+ u_pulse: number;
37
+ /** Fill of one colour of the two-colouring */
38
+ u_regionFill: number;
39
+ }
40
+ declare module '@react-three/fiber' {
41
+ interface ThreeElements {
42
+ truchetGridMaterial: ThreeElements['shaderMaterial'] & Partial<TruchetGridMaterialUniforms>;
43
+ }
44
+ }
45
+ export declare const truchetGridMaterialDefaults: TruchetGridMaterialUniforms;
46
+ export declare const TruchetGridMaterial: import("@react-three/fiber").ConstructorRepresentation<THREE.ShaderMaterial & {
47
+ u_time: number;
48
+ u_cellSize: number;
49
+ u_lineWidth: number;
50
+ u_sectionSize: number;
51
+ u_sectionWidth: number;
52
+ u_lineColor: THREE.Color;
53
+ u_sectionColor: THREE.Color;
54
+ u_cellColor: THREE.Color;
55
+ u_glowColor: THREE.Color;
56
+ u_bgColor: THREE.Color;
57
+ u_bgOpacity: number;
58
+ u_lineMode: number;
59
+ u_cellMode: number;
60
+ u_animSpeed: number;
61
+ u_animScale: number;
62
+ u_animIntensity: number;
63
+ u_fadeDistance: number;
64
+ u_fadeStrength: number;
65
+ u_focus: THREE.Vector2;
66
+ u_mouse: THREE.Vector2;
67
+ u_displace: number;
68
+ u_reveal: number;
69
+ u_flip: number;
70
+ u_bias: number;
71
+ u_pulse: number;
72
+ u_regionFill: number;
73
+ }> & {
74
+ key: string;
75
+ };
76
+ //# sourceMappingURL=TruchetGridMaterial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TruchetGridMaterial.d.ts","sourceRoot":"","sources":["../../src/shaders/TruchetGridMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,WAAW,2BAA2B;IACxC,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,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,kDAAkD;IAClD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC;CACxB;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,2BA2BzC,CAAC;AA0OF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B/B,CAAC"}
@@ -0,0 +1,290 @@
1
+ import * as THREE from 'three';
2
+ import { shaderMaterial } from '@react-three/drei';
3
+ import { extend } from '@react-three/fiber';
4
+ export const truchetGridMaterialDefaults = {
5
+ u_time: 0,
6
+ u_cellSize: 3,
7
+ u_lineWidth: 1.3,
8
+ u_sectionSize: 4,
9
+ u_sectionWidth: 1.2,
10
+ u_lineColor: new THREE.Color('#a052e0'),
11
+ u_sectionColor: new THREE.Color('#4a2a66'),
12
+ u_cellColor: new THREE.Color('#2a0f45'),
13
+ u_glowColor: new THREE.Color('#ff7ad9'),
14
+ u_bgColor: new THREE.Color('#07030d'),
15
+ u_bgOpacity: 0,
16
+ u_lineMode: 0,
17
+ u_cellMode: 0,
18
+ u_animSpeed: 1,
19
+ u_animScale: 0.5,
20
+ u_animIntensity: 0.6,
21
+ u_fadeDistance: 25,
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,
26
+ u_reveal: 1,
27
+ u_flip: 0.25,
28
+ u_bias: 0.5,
29
+ u_pulse: 0.8,
30
+ u_regionFill: 0.8,
31
+ };
32
+ const vertex = /* glsl */ `
33
+ uniform float u_time;
34
+ uniform float u_cellSize;
35
+ uniform float u_displace;
36
+ uniform float u_animSpeed;
37
+ uniform float u_animScale;
38
+
39
+ varying vec2 vGridPos;
40
+
41
+
42
+ const float PI = 3.14159265359;
43
+ const float TAU = 6.28318530718;
44
+
45
+ float hash21(vec2 p){
46
+ p = fract(p * vec2(123.34, 456.21));
47
+ p += dot(p, p + 45.32);
48
+ return fract(p.x * p.y);
49
+ }
50
+
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
+ float d = length(position.xy) / max(u_cellSize, 1e-4);
58
+ pos.z += sin(d * u_animScale - t) * u_displace;
59
+ }
60
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
61
+ }
62
+ `;
63
+ const fragment = /* glsl */ `
64
+ precision highp float;
65
+
66
+ uniform float u_time;
67
+ uniform float u_cellSize;
68
+ uniform float u_lineWidth;
69
+ uniform float u_sectionSize;
70
+ uniform float u_sectionWidth;
71
+ uniform vec3 u_lineColor;
72
+ uniform vec3 u_sectionColor;
73
+ uniform vec3 u_cellColor;
74
+ uniform vec3 u_glowColor;
75
+ uniform vec3 u_bgColor;
76
+ uniform float u_bgOpacity;
77
+ uniform float u_lineMode;
78
+ uniform float u_cellMode;
79
+ uniform float u_animSpeed;
80
+ uniform float u_animScale;
81
+ uniform float u_animIntensity;
82
+ uniform float u_fadeDistance;
83
+ uniform float u_fadeStrength;
84
+ uniform vec2 u_focus;
85
+ uniform float u_reveal;
86
+
87
+ uniform float u_flip;
88
+ uniform float u_bias;
89
+ uniform float u_pulse;
90
+ uniform float u_regionFill;
91
+
92
+ varying vec2 vGridPos;
93
+
94
+
95
+ const float PI = 3.14159265359;
96
+ const float TAU = 6.28318530718;
97
+
98
+ float hash21(vec2 p){
99
+ p = fract(p * vec2(123.34, 456.21));
100
+ p += dot(p, p + 45.32);
101
+ return fract(p.x * p.y);
102
+ }
103
+
104
+
105
+ float lineAt(float c, float width, float fp){
106
+ float d = abs(fract(c - 0.5) - 0.5);
107
+ return 1.0 - clamp(d / max(fp * max(width, 0.05), 1e-6), 0.0, 1.0);
108
+ }
109
+
110
+ // Orientation of a tile in epoch e: its own base orientation, unless this
111
+ // epoch's roll (probability u_flip) re-deals it.
112
+ float truchetOrient(vec2 hid, float e, float oBase){
113
+ float dealt = step(hash21(hid + e * vec2(17.31, 9.17)), u_flip);
114
+ return mix(oBase, step(0.5, hash21(hid * 1.37 + e * vec2(3.7, 11.3))), dealt);
115
+ }
116
+
117
+ // Smith's quarter-circle Truchet tile. Returns
118
+ // x: distance to the nearest arc (tile units)
119
+ // y: position along that arc, 0..1, oriented so the flow is continuous
120
+ // z: the region's colour in the 2-colouring of the plane (0/1)
121
+ vec3 truchetTile(vec2 tc, float t, float salt){
122
+ vec2 id = floor(tc);
123
+ vec2 hid = id + salt;
124
+ // staggered epochs so the tiles never re-deal in unison
125
+ float ep = t * 0.3 + hash21(hid * 0.731 + 1.3);
126
+ float e = floor(ep), f = fract(ep);
127
+ float oBase = step(u_bias, hash21(hid + 0.5));
128
+ float o0 = truchetOrient(hid, e - 1.0, oBase);
129
+ float o1 = truchetOrient(hid, e, oBase);
130
+ // a changed tile turns a quarter turn — the two orientations are one tile
131
+ // rotated by 90 degrees — so paths break and re-join instead of popping
132
+ float k = o0 + abs(o1 - o0) * smoothstep(0.0, 0.4, f);
133
+ float ang = k * PI * 0.5;
134
+ float c = cos(ang), sn = sin(ang);
135
+ vec2 q = mat2(c, sn, -sn, c) * (fract(tc) - 0.5) + 0.5;
136
+
137
+ float r0 = length(q), r1 = length(q - 1.0);
138
+ float d0 = abs(r0 - 0.5), d1 = abs(r1 - 0.5);
139
+
140
+ // The quarter-circle tiling is 2-colourable: the band between the arcs takes
141
+ // the checkerboard parity of the tile (flipped by its orientation), the two
142
+ // corner lobes take the other colour.
143
+ float mid = mod(id.x + id.y + floor(k + 0.5), 2.0);
144
+ float lobe = max(step(r0, 0.5), step(r1, 0.5));
145
+ float region = mix(mid, 1.0 - mid, lobe);
146
+
147
+ // Orient every arc with colour 1 on its left: the arcs then chain into loops
148
+ // with one consistent direction of travel.
149
+ float u = d0 < d1 ? atan(q.y, q.x) : atan(1.0 - q.y, 1.0 - q.x);
150
+ u /= PI * 0.5;
151
+ u = mid < 0.5 ? u : 1.0 - u;
152
+ return vec3(min(d0, d1), u, region);
153
+ }
154
+
155
+ void main(){
156
+ vec2 coord = vGridPos / max(u_cellSize, 1e-4);
157
+ vec2 focus = u_focus / max(u_cellSize, 1e-4);
158
+ float t = u_time * u_animSpeed;
159
+
160
+ // Truchet tiling (Smith's quarter-circle variant): every tile carries two arcs
161
+ // joining the midpoints of adjacent edges, so arcs always meet arcs and the
162
+ // plane fills with endless non-crossing paths. Tiles re-deal their
163
+ // orientation over time by turning a quarter turn, which re-routes the paths.
164
+ vec3 T = truchetTile(coord, t, 0.0);
165
+ vec2 fc = fwidth(coord);
166
+ float fp = max(max(fc.x, fc.y), 1e-6);
167
+ float lines = 1.0 - clamp(T.x / (fp * max(u_lineWidth, 0.05)), 0.0, 1.0);
168
+
169
+ // A second, coarser Truchet layer at sectionSize tiles: the multiscale accent.
170
+ float accent = 0.0;
171
+ if (u_sectionWidth > 0.0 && u_sectionSize >= 2.0){
172
+ vec3 S = truchetTile(coord / u_sectionSize, t * 0.5, 91.7);
173
+ float fs = fp / u_sectionSize;
174
+ accent = 1.0 - clamp(S.x / (fs * max(u_sectionWidth, 0.05)), 0.0, 1.0);
175
+ }
176
+
177
+ // Light travelling along the paths: one comet per arc, sharp head, fading
178
+ // tail, gated by a slow travelling swell so whole stretches light up at once.
179
+ vec2 id = floor(coord);
180
+ float ph = fract(T.y - t * 0.6);
181
+ float head = pow(ph, 3.0);
182
+ float swell = smoothstep(0.35, 0.9, 0.5 + 0.5 * sin(dot(coord, vec2(0.19, 0.13)) - t * 0.35));
183
+ float core = exp(-pow(T.x / (fp * max(u_lineWidth, 0.05) * 1.6), 2.0));
184
+ float bloom = exp(-pow(T.x / 0.06, 2.0)) * 0.3;
185
+ float comet = head * swell * u_pulse;
186
+
187
+ float dmin = T.x;
188
+ float idAcc = id.x + id.y * 7.13;
189
+ vec2 cellPos = id + 0.5;
190
+ float cellH = hash21(id + T.z * 13.1);
191
+ float tone = T.z;
192
+
193
+ // The 2-colouring itself, as a quiet fill: one colour of region is lit.
194
+ float fill = tone * u_regionFill * smoothstep(0.0, 0.08, T.x);
195
+
196
+ vec3 extraCol = u_glowColor * (core + bloom) * comet * 1.6 + u_cellColor * 2.2 * fill;
197
+ float extraA = max((core + bloom * 0.6) * comet, fill * 0.9);
198
+
199
+ // ---- line animation --------------------------------------------------
200
+ float lineAnim = 1.0;
201
+ // Mode 0 is static: the chain starts at 0.5 so 0 never falls into flow.
202
+ if (u_lineMode < 0.5){
203
+ } else if (u_lineMode < 1.5){
204
+ lineAnim = 0.5 + 0.5 * sin(length(cellPos - focus) * u_animScale - t);
205
+ } else if (u_lineMode < 2.5){
206
+ lineAnim = 0.5 + 0.5 * sin(dot(cellPos, vec2(0.5, 0.5)) * u_animScale - t);
207
+ } else if (u_lineMode < 3.5){
208
+ float s = fract((coord.x + coord.y) * 0.05 * u_animScale - t * 0.15);
209
+ lineAnim = 0.25 + smoothstep(0.0, 0.15, s) * (1.0 - smoothstep(0.15, 0.35, s));
210
+ } else if (u_lineMode < 4.5){
211
+ lineAnim = 0.5 + 0.5 * sin(t);
212
+ }
213
+ lineAnim = mix(1.0, lineAnim, u_animIntensity);
214
+
215
+ // ---- cell fill -------------------------------------------------------
216
+ float cell = 0.0;
217
+ if (u_cellMode < 0.5){
218
+ } else if (u_cellMode < 1.5){
219
+ cell = 0.5 + 0.5 * sin(idAcc * 0.05 * u_animScale - t);
220
+ } else if (u_cellMode < 2.5){
221
+ cell = 0.5 + 0.5 * sin(t * (0.6 + cellH) + cellH * TAU);
222
+ } else if (u_cellMode < 3.5){
223
+ cell = smoothstep(0.6, 1.0, sin(length(cellPos - focus) * u_animScale - t));
224
+ } else if (u_cellMode < 4.5){
225
+ cell = step(0.5, cellH) * (0.5 + 0.5 * sin(t));
226
+ }
227
+ cell *= u_animIntensity;
228
+ cell *= smoothstep(0.0, 0.16, dmin); // keep the fill off its own edges
229
+
230
+ float r = length(vGridPos) / max(u_fadeDistance, 1e-4);
231
+ float fade = 1.0 - smoothstep(1.0 - u_fadeStrength, 1.0, r);
232
+
233
+ vec3 col = u_bgColor * u_bgOpacity;
234
+ float a = u_bgOpacity;
235
+
236
+ col += mix(u_cellColor, u_cellColor * 2.2, tone) * cell;
237
+ a = max(a, cell * 0.9);
238
+ float linesI = lines * lineAnim;
239
+ col += u_lineColor * linesI; a = max(a, linesI);
240
+ float accentI = accent * lineAnim;
241
+ col += u_sectionColor * accentI; a = max(a, accentI);
242
+ col += u_glowColor * (linesI * 0.2 + cell * 0.35) * u_animIntensity;
243
+ col += extraCol; a = max(a, extraA);
244
+
245
+ col *= fade;
246
+ a *= fade;
247
+
248
+ // ---- reveal ----------------------------------------------------------
249
+ if (u_reveal < 0.999){
250
+ float rd = length(vGridPos - u_focus) / max(u_fadeDistance, 1e-4);
251
+ float edge = u_reveal * 1.1;
252
+ float mask = 1.0 - smoothstep(edge - 0.05, edge, rd);
253
+ float front = mask * smoothstep(edge - 0.22, edge - 0.05, rd);
254
+ col = col * mask + u_glowColor * front * (a * 1.8 + 0.08);
255
+ a = max(a * mask, front * 0.10);
256
+ }
257
+
258
+ if (a < 0.002) discard;
259
+ gl_FragColor = vec4(col, a);
260
+ }
261
+ `;
262
+ export const TruchetGridMaterial = shaderMaterial({
263
+ u_time: truchetGridMaterialDefaults.u_time,
264
+ u_cellSize: truchetGridMaterialDefaults.u_cellSize,
265
+ u_lineWidth: truchetGridMaterialDefaults.u_lineWidth,
266
+ u_sectionSize: truchetGridMaterialDefaults.u_sectionSize,
267
+ u_sectionWidth: truchetGridMaterialDefaults.u_sectionWidth,
268
+ u_lineColor: truchetGridMaterialDefaults.u_lineColor.clone(),
269
+ u_sectionColor: truchetGridMaterialDefaults.u_sectionColor.clone(),
270
+ u_cellColor: truchetGridMaterialDefaults.u_cellColor.clone(),
271
+ u_glowColor: truchetGridMaterialDefaults.u_glowColor.clone(),
272
+ u_bgColor: truchetGridMaterialDefaults.u_bgColor.clone(),
273
+ u_bgOpacity: truchetGridMaterialDefaults.u_bgOpacity,
274
+ u_lineMode: truchetGridMaterialDefaults.u_lineMode,
275
+ u_cellMode: truchetGridMaterialDefaults.u_cellMode,
276
+ u_animSpeed: truchetGridMaterialDefaults.u_animSpeed,
277
+ u_animScale: truchetGridMaterialDefaults.u_animScale,
278
+ u_animIntensity: truchetGridMaterialDefaults.u_animIntensity,
279
+ u_fadeDistance: truchetGridMaterialDefaults.u_fadeDistance,
280
+ u_fadeStrength: truchetGridMaterialDefaults.u_fadeStrength,
281
+ u_focus: truchetGridMaterialDefaults.u_focus.clone(),
282
+ u_mouse: truchetGridMaterialDefaults.u_mouse.clone(),
283
+ u_displace: truchetGridMaterialDefaults.u_displace,
284
+ u_reveal: truchetGridMaterialDefaults.u_reveal,
285
+ u_flip: truchetGridMaterialDefaults.u_flip,
286
+ u_bias: truchetGridMaterialDefaults.u_bias,
287
+ u_pulse: truchetGridMaterialDefaults.u_pulse,
288
+ u_regionFill: truchetGridMaterialDefaults.u_regionFill,
289
+ }, vertex, fragment);
290
+ extend({ TruchetGridMaterial });
@@ -66,4 +66,11 @@ export * from './GravWaveGridMaterial';
66
66
  export * from './GirihGridMaterial';
67
67
  export * from './WallpaperGridMaterial';
68
68
  export * from './ReactionDiffusionGridMaterial';
69
+ export * from './LensingGridMaterial';
70
+ export * from './ConformalGridMaterial';
71
+ export * from './TruchetGridMaterial';
72
+ export * from './PhyllotaxisGridMaterial';
73
+ export * from './ParastichyGridMaterial';
74
+ export * from './ApollonianGridMaterial';
75
+ export * from './HilbertGridMaterial';
69
76
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAC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tC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
@@ -66,3 +66,10 @@ export * from './GravWaveGridMaterial.js';
66
66
  export * from './GirihGridMaterial.js';
67
67
  export * from './WallpaperGridMaterial.js';
68
68
  export * from './ReactionDiffusionGridMaterial.js';
69
+ export * from './LensingGridMaterial.js';
70
+ export * from './ConformalGridMaterial.js';
71
+ export * from './TruchetGridMaterial.js';
72
+ export * from './PhyllotaxisGridMaterial.js';
73
+ export * from './ParastichyGridMaterial.js';
74
+ export * from './ApollonianGridMaterial.js';
75
+ export * from './HilbertGridMaterial.js';
@@ -1,4 +1,4 @@
1
- import type { OperationEffect } from './objectSettings';
1
+ import type { SceneCommand } from './commands';
2
2
  /**
3
3
  * Action Types
4
4
  * Defines the structure for UI actions that can trigger animations, toggle elements, or load projects
@@ -54,13 +54,14 @@ export interface ActionSequence {
54
54
  */
55
55
  key?: string;
56
56
  description?: string;
57
+ /** The changes (patches): what elements ARE while the action is applied. */
57
58
  targets: ActionTarget[];
58
59
  /**
59
- * Operations run when the action is applied, undone when it is reverted
60
- * (glow, fade, zoom to…). Patches change what elements ARE; effects are what
61
- * HAPPENS to objects. Patches are applied first.
60
+ * What HAPPENS when it is applied, in order (triggers engine): effects, effect clips and
61
+ * other actions are switched on with it and off again on revert; animations run their
62
+ * command on apply and stop on revert. Patches are applied first.
62
63
  */
63
- effects?: OperationEffect[];
64
+ commands: SceneCommand[];
64
65
  assetId?: string | null;
65
66
  /** Runtime only */
66
67
  isDirty?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/types/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD;;;GAGG;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,aAAa,GAAG,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;AAE1L,MAAM,WAAW,MAAM;IACnB,wCAAwC;IACxC,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,wEAAwE;IACxE,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AACF;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAA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M,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AACF;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB;;;;OAIG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,mBAAmB;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AACD,OAAO,EAAE,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { EffectClipUse, OperationEffect } from './objectSettings';
2
+ /** Switch something on / off: an action, an effect clip, a held effect. */
3
+ export type SceneStateCommand = 'apply' | 'revert' | 'toggle';
4
+ /** Drive a timeline: an animation clip or sequence. */
5
+ export type ScenePlaybackCommand = 'play' | 'pause' | 'stop' | 'toggle';
6
+ export interface ScenePlayOptions {
7
+ /** Seconds from the start. */
8
+ from?: number;
9
+ speed?: number;
10
+ reverse?: boolean;
11
+ }
12
+ export type SceneCommand =
13
+ /** `trigger`: toggle when the operation can be undone, else play it (an interaction's click). */
14
+ {
15
+ id: string;
16
+ kind: 'effect';
17
+ effect: OperationEffect;
18
+ command: 'trigger' | SceneStateCommand;
19
+ } | {
20
+ id: string;
21
+ kind: 'effectClip';
22
+ use: EffectClipUse;
23
+ command: SceneStateCommand;
24
+ }
25
+ /** `ref`: ActionSequence id. */
26
+ | {
27
+ id: string;
28
+ kind: 'action';
29
+ ref: string;
30
+ command: SceneStateCommand;
31
+ }
32
+ /** `ref`: AnimationClip id. */
33
+ | {
34
+ id: string;
35
+ kind: 'animationClip';
36
+ ref: string;
37
+ command: ScenePlaybackCommand;
38
+ options?: ScenePlayOptions;
39
+ }
40
+ /** `ref`: AnimationSequence id. */
41
+ | {
42
+ id: string;
43
+ kind: 'animationSequence';
44
+ ref: string;
45
+ command: ScenePlaybackCommand;
46
+ options?: ScenePlayOptions;
47
+ };
48
+ export type SceneCommandKind = SceneCommand['kind'];
49
+ /** A stored list of commands (versioned, so an older viewer can tell it is newer than it knows). */
50
+ export interface SceneCommandList {
51
+ v: 1;
52
+ commands: SceneCommand[];
53
+ }
54
+ /** What fired a command. */
55
+ export type TriggerHost = 'interaction' | 'action' | 'sequence' | 'clip' | 'code' | 'agent' | 'studio';
56
+ export interface TriggerSource {
57
+ host: TriggerHost;
58
+ /** The interaction (`<objectId>:<event>`), action, sequence, clip… id; for code, the caller's name. */
59
+ id: string;
60
+ }
61
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/types/commands.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,2EAA2E;AAC3E,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC9D,uDAAuD;AACvD,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAExE,MAAM,WAAW,gBAAgB;IAC7B,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IAC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