@treasuryspatial/viewer-kit 0.2.31

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 (80) hide show
  1. package/README.md +5 -0
  2. package/dist/camera.d.ts +28 -0
  3. package/dist/camera.d.ts.map +1 -0
  4. package/dist/camera.js +63 -0
  5. package/dist/engine/ViewerEngine.d.ts +41 -0
  6. package/dist/engine/ViewerEngine.d.ts.map +1 -0
  7. package/dist/engine/ViewerEngine.js +344 -0
  8. package/dist/engine/createViewer.d.ts +3 -0
  9. package/dist/engine/createViewer.d.ts.map +1 -0
  10. package/dist/engine/createViewer.js +7 -0
  11. package/dist/engine/types.d.ts +284 -0
  12. package/dist/engine/types.d.ts.map +1 -0
  13. package/dist/engine/types.js +1 -0
  14. package/dist/exports/download.d.ts +2 -0
  15. package/dist/exports/download.d.ts.map +1 -0
  16. package/dist/exports/download.js +10 -0
  17. package/dist/exports/three-export.d.ts +4 -0
  18. package/dist/exports/three-export.d.ts.map +1 -0
  19. package/dist/exports/three-export.js +25 -0
  20. package/dist/index.d.ts +18 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +12 -0
  23. package/dist/materials/architectural.d.ts +7 -0
  24. package/dist/materials/architectural.d.ts.map +1 -0
  25. package/dist/materials/architectural.js +187 -0
  26. package/dist/materials/catalogue-data.d.ts +149 -0
  27. package/dist/materials/catalogue-data.d.ts.map +1 -0
  28. package/dist/materials/catalogue-data.js +158 -0
  29. package/dist/materials/catalogue.d.ts +5 -0
  30. package/dist/materials/catalogue.d.ts.map +1 -0
  31. package/dist/materials/catalogue.js +23 -0
  32. package/dist/materials/presets.d.ts +21 -0
  33. package/dist/materials/presets.d.ts.map +1 -0
  34. package/dist/materials/presets.js +217 -0
  35. package/dist/materials/renderMetadata.d.ts +15 -0
  36. package/dist/materials/renderMetadata.d.ts.map +1 -0
  37. package/dist/materials/renderMetadata.js +64 -0
  38. package/dist/materials/types.d.ts +50 -0
  39. package/dist/materials/types.d.ts.map +1 -0
  40. package/dist/materials/types.js +1 -0
  41. package/dist/presets/defaults.d.ts +4 -0
  42. package/dist/presets/defaults.d.ts.map +1 -0
  43. package/dist/presets/defaults.js +45 -0
  44. package/dist/presets/sciencePresets.d.ts +7 -0
  45. package/dist/presets/sciencePresets.d.ts.map +1 -0
  46. package/dist/presets/sciencePresets.js +478 -0
  47. package/dist/sky/scienceSky.d.ts +10 -0
  48. package/dist/sky/scienceSky.d.ts.map +1 -0
  49. package/dist/sky/scienceSky.js +85 -0
  50. package/dist/systems/debugSystem.d.ts +12 -0
  51. package/dist/systems/debugSystem.d.ts.map +1 -0
  52. package/dist/systems/debugSystem.js +283 -0
  53. package/dist/systems/environmentSystem.d.ts +31 -0
  54. package/dist/systems/environmentSystem.d.ts.map +1 -0
  55. package/dist/systems/environmentSystem.js +277 -0
  56. package/dist/systems/lightingSystem.d.ts +15 -0
  57. package/dist/systems/lightingSystem.d.ts.map +1 -0
  58. package/dist/systems/lightingSystem.js +100 -0
  59. package/dist/systems/postfxSystem.d.ts +31 -0
  60. package/dist/systems/postfxSystem.d.ts.map +1 -0
  61. package/dist/systems/postfxSystem.js +220 -0
  62. package/dist/systems/rendererSystem.d.ts +4 -0
  63. package/dist/systems/rendererSystem.d.ts.map +1 -0
  64. package/dist/systems/rendererSystem.js +42 -0
  65. package/dist/uploads/grasshopper.d.ts +13 -0
  66. package/dist/uploads/grasshopper.d.ts.map +1 -0
  67. package/dist/uploads/grasshopper.js +182 -0
  68. package/dist/uploads/index.d.ts +8 -0
  69. package/dist/uploads/index.d.ts.map +1 -0
  70. package/dist/uploads/index.js +29 -0
  71. package/dist/uploads/mesh.d.ts +8 -0
  72. package/dist/uploads/mesh.d.ts.map +1 -0
  73. package/dist/uploads/mesh.js +109 -0
  74. package/dist/uploads/rhino3dm.d.ts +7 -0
  75. package/dist/uploads/rhino3dm.d.ts.map +1 -0
  76. package/dist/uploads/rhino3dm.js +33 -0
  77. package/dist/uploads/types.d.ts +68 -0
  78. package/dist/uploads/types.d.ts.map +1 -0
  79. package/dist/uploads/types.js +1 -0
  80. package/package.json +38 -0
@@ -0,0 +1,50 @@
1
+ export type MaterialTextureConfig = {
2
+ type: string;
3
+ scale?: number;
4
+ };
5
+ export type MaterialPbrConfig = {
6
+ baseColor: string;
7
+ roughness: number;
8
+ metalness: number;
9
+ emissive: string;
10
+ emissiveIntensity: number;
11
+ texture?: MaterialTextureConfig;
12
+ transparent?: boolean;
13
+ opacity?: number;
14
+ ior?: number;
15
+ };
16
+ export type MaterialBaselineConfig = {
17
+ color: string;
18
+ finish: string;
19
+ };
20
+ export type MaterialDefinition = {
21
+ materialId: string;
22
+ label: string;
23
+ category: string;
24
+ baseline: MaterialBaselineConfig;
25
+ pbr: MaterialPbrConfig;
26
+ };
27
+ export type MaterialCatalogue = {
28
+ version: number;
29
+ materials: ReadonlyArray<MaterialDefinition>;
30
+ };
31
+ export type MaterialId = MaterialDefinition["materialId"];
32
+ export type MaterialColor = {
33
+ r: number;
34
+ g: number;
35
+ b: number;
36
+ };
37
+ export type SurfaceMaterialConfig = {
38
+ type: MaterialId | "custom";
39
+ color: MaterialColor;
40
+ reflectance: number;
41
+ roughness: number;
42
+ pattern?: string;
43
+ patternScale?: number;
44
+ };
45
+ export type MaterialsConfig = {
46
+ walls: SurfaceMaterialConfig;
47
+ floor: SurfaceMaterialConfig;
48
+ ceiling: SurfaceMaterialConfig;
49
+ };
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/materials/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,GAAG,EAAE,iBAAiB,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,KAAK,EAAE,aAAa,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,OAAO,EAAE,qBAAqB,CAAC;CAChC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { PresetCatalog } from "../engine/types";
2
+ export declare const DEFAULT_PRESET_ID = "default-studio";
3
+ export declare const DEFAULT_PRESETS: PresetCatalog;
4
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/presets/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAElD,eAAO,MAAM,eAAe,EAAE,aA2C7B,CAAC"}
@@ -0,0 +1,45 @@
1
+ export const DEFAULT_PRESET_ID = "default-studio";
2
+ export const DEFAULT_PRESETS = {
3
+ [DEFAULT_PRESET_ID]: {
4
+ id: DEFAULT_PRESET_ID,
5
+ label: "Default Studio",
6
+ renderer: {
7
+ toneMapping: "neutral",
8
+ toneMappingExposure: 1.0,
9
+ outputColorSpace: "srgb",
10
+ maxPixelRatio: 1.75,
11
+ antialias: true,
12
+ alpha: true,
13
+ shadowMap: {
14
+ enabled: true,
15
+ type: "pcfsoft",
16
+ },
17
+ },
18
+ sky: {
19
+ mode: "gradient",
20
+ gradient: {
21
+ topColor: "#ffffff",
22
+ horizonColor: "#d8d8d8",
23
+ sunPosition: [0.3, 0.8, 0.4],
24
+ sunIntensity: 0.15,
25
+ sunSize: 0.08,
26
+ },
27
+ },
28
+ lighting: {
29
+ rig: "studio",
30
+ ambient: { color: "#ffffff", intensity: 1.0 },
31
+ hemisphere: { skyColor: "#ffffff", groundColor: "#f4f4f4", intensity: 1.2 },
32
+ key: { color: "#ffffff", intensity: 1.6, position: [10, 15, 5], castShadow: true },
33
+ fill: { color: "#ffffff", intensity: 0.6, position: [-10, 10, -5] },
34
+ },
35
+ postfx: {
36
+ ao: { enabled: false, intensity: 1.0, radius: 2.0, distanceFalloff: 1.0, halfRes: false },
37
+ },
38
+ sceneExtras: {
39
+ grid: true,
40
+ ground: true,
41
+ axes: false,
42
+ origin: true,
43
+ },
44
+ },
45
+ };
@@ -0,0 +1,7 @@
1
+ import type { PresetCatalog } from "../engine/types";
2
+ export declare const SCIENCE_PRESET_SUMMARIES: Record<string, string>;
3
+ export declare const SCIENCE_DEFAULT_PRESET_ID = "architectural";
4
+ export declare function buildViewerPresets(): PresetCatalog;
5
+ export declare const buildSciencePresets: typeof buildViewerPresets;
6
+ export declare const SCIENCE_PRESETS: PresetCatalog;
7
+ //# sourceMappingURL=sciencePresets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sciencePresets.d.ts","sourceRoot":"","sources":["../../src/presets/sciencePresets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAOd,MAAM,iBAAiB,CAAC;AAkgBzB,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAE3D,CAAC;AAEF,eAAO,MAAM,yBAAyB,kBAA6B,CAAC;AAEpE,wBAAgB,kBAAkB,IAAI,aAAa,CA6BlD;AAGD,eAAO,MAAM,mBAAmB,2BAAqB,CAAC;AAEtD,eAAO,MAAM,eAAe,eAAuB,CAAC"}
@@ -0,0 +1,478 @@
1
+ import { BASELINE_MATERIAL_PRESET_ID } from "../materials/presets";
2
+ const DEFAULT_LIGHTING_PRESET_ID = "architectural";
3
+ const DEFAULT_ENVIRONMENT_PRESET_ID = "architectural";
4
+ const DEFAULT_SCENE_EXTRAS = {
5
+ ground: true,
6
+ grid: true,
7
+ axes: true,
8
+ origin: true,
9
+ gridOpacity: 0.12,
10
+ gridDivisions: 80,
11
+ gridSize: 80,
12
+ groundRoughness: 0.8,
13
+ groundMetalness: 0.05,
14
+ lightTarget: [0, 1.5, 0],
15
+ originHighlight: true,
16
+ originLineColor: 0x94a3b8,
17
+ originLineLength: 40,
18
+ originLineThickness: 0.06,
19
+ axisLabelScale: 0.35,
20
+ axesLabels: {
21
+ lowerCase: true,
22
+ upperCase: true,
23
+ offset: 0.4,
24
+ secondaryOffset: 0.5,
25
+ },
26
+ };
27
+ const PRESET_SCENE_EXTRAS = {
28
+ architectural: {
29
+ ground: true,
30
+ grid: true,
31
+ axes: true,
32
+ origin: true,
33
+ groundColor: 0xf5f5f5,
34
+ groundRoughness: 0.75,
35
+ groundMetalness: 0.0,
36
+ gridColor: 0xdedede,
37
+ gridColorSecondary: 0xeaeaea,
38
+ gridOpacity: 0.12,
39
+ gridDivisions: 100,
40
+ gridSize: 100,
41
+ gridHeightOffset: 0.09,
42
+ },
43
+ studio: {
44
+ ground: true,
45
+ grid: true,
46
+ axes: true,
47
+ origin: false,
48
+ groundColor: 0x1f2024,
49
+ groundRoughness: 0.9,
50
+ groundMetalness: 0.08,
51
+ gridColor: 0x353840,
52
+ gridOpacity: 0.12,
53
+ },
54
+ daylight: {
55
+ ground: true,
56
+ grid: true,
57
+ axes: true,
58
+ origin: true,
59
+ groundColor: 0xe2d5c2,
60
+ groundRoughness: 0.7,
61
+ groundMetalness: 0.04,
62
+ gridColor: 0xf6ead7,
63
+ gridOpacity: 0.2,
64
+ },
65
+ "gallery-spot": {
66
+ ground: true,
67
+ grid: true,
68
+ axes: true,
69
+ origin: false,
70
+ groundColor: 0x131419,
71
+ groundRoughness: 0.85,
72
+ groundMetalness: 0.02,
73
+ gridColor: 0x2c3242,
74
+ gridOpacity: 0.1,
75
+ lightTarget: [0, 1.2, 0],
76
+ },
77
+ "lab-neutral": {
78
+ ground: true,
79
+ grid: true,
80
+ axes: true,
81
+ origin: true,
82
+ groundColor: 0xf4f5f7,
83
+ groundRoughness: 0.78,
84
+ groundMetalness: 0.03,
85
+ gridColor: 0xd0d6de,
86
+ gridOpacity: 0.16,
87
+ },
88
+ "atrium-suntrack": {
89
+ ground: true,
90
+ grid: true,
91
+ axes: true,
92
+ origin: false,
93
+ groundColor: 0xe3c7a4,
94
+ groundRoughness: 0.72,
95
+ groundMetalness: 0.05,
96
+ gridColor: 0xf4dfc2,
97
+ gridOpacity: 0.18,
98
+ },
99
+ "flow-horizon": {
100
+ ground: true,
101
+ grid: true,
102
+ axes: true,
103
+ origin: false,
104
+ groundColor: 0x1c212f,
105
+ groundRoughness: 0.82,
106
+ groundMetalness: 0.03,
107
+ gridColor: 0xffa66a,
108
+ gridOpacity: 0.22,
109
+ gridDivisions: 120,
110
+ gridSize: 200,
111
+ },
112
+ "biophilic-soft": {
113
+ ground: true,
114
+ grid: true,
115
+ axes: true,
116
+ origin: true,
117
+ groundColor: 0xcad8c9,
118
+ groundRoughness: 0.78,
119
+ groundMetalness: 0.02,
120
+ gridColor: 0xe2efe0,
121
+ gridOpacity: 0.18,
122
+ lightTarget: [0, 1.6, 0],
123
+ },
124
+ };
125
+ const PRESET_SKY_OVERRIDES = {
126
+ architectural: { mode: "gradient" },
127
+ studio: { mode: "gradient" },
128
+ daylight: { mode: "gradient" },
129
+ "gallery-spot": { mode: "gradient" },
130
+ "lab-neutral": { mode: "gradient" },
131
+ "atrium-suntrack": { mode: "gradient" },
132
+ "flow-horizon": { mode: "gradient" },
133
+ "biophilic-soft": { mode: "gradient" },
134
+ };
135
+ const COOL_WHITE = 0xf6fbff;
136
+ const DEFAULT_INTERIOR_LIGHTS = [
137
+ { position: [0, 2.5, 0], intensity: 1.15, distance: 40, color: COOL_WHITE },
138
+ { position: [4, 2.5, 4], intensity: 0.55, distance: 25, color: COOL_WHITE },
139
+ { position: [-4, 2.5, -4], intensity: 0.55, distance: 25, color: COOL_WHITE },
140
+ ];
141
+ const PRESET_MATERIAL_OVERRIDES = {
142
+ architectural: BASELINE_MATERIAL_PRESET_ID,
143
+ studio: "studio",
144
+ daylight: "daylight",
145
+ "gallery-spot": "gallery-spot",
146
+ "lab-neutral": "lab-neutral",
147
+ "atrium-suntrack": "atrium-suntrack",
148
+ "flow-horizon": "flow-horizon",
149
+ "biophilic-soft": "biophilic-soft",
150
+ };
151
+ const LIGHTING_PRESET_DATA = {
152
+ architectural: {
153
+ id: "architectural",
154
+ label: "architectural white",
155
+ description: "bright diffuse envelope with matte walls and calibrated AO",
156
+ includeInteriorLights: true,
157
+ config: {
158
+ background: 0xffffff,
159
+ ambient: { color: 0xf5fbff, intensity: 1.0 },
160
+ hemisphere: { sky: 0xf8fbff, ground: 0xf1f4f8, intensity: 1.3 },
161
+ key: { color: 0xf8fcff, intensity: 2.0, position: [10, 15, 5] },
162
+ fill: { color: 0xeaf2ff, intensity: 0.85, position: [-10, 10, -5] },
163
+ shadows: true,
164
+ shadow: { cameraSize: 28, near: 0.5, far: 80, bias: -0.00008, radius: 2.5 },
165
+ ao: { enabled: true, intensity: 2.5, radius: 4.0, distanceFalloff: 1.0, halfRes: false },
166
+ toneMappingExposure: 1.05,
167
+ },
168
+ },
169
+ studio: {
170
+ id: "studio",
171
+ label: "studio lighting",
172
+ description: "three-point rig with dramatic contrast and deep background",
173
+ includeInteriorLights: false,
174
+ config: {
175
+ background: 0x1a1a1a,
176
+ ambient: { color: 0xffffff, intensity: 0.6 },
177
+ hemisphere: { sky: 0xffffff, ground: 0x1a1a1a, intensity: 0.6 },
178
+ key: { color: 0xffffff, intensity: 1.8, position: [12, 14, 8] },
179
+ fill: { color: 0xffffff, intensity: 0.9, position: [-8, 6, -6] },
180
+ shadows: true,
181
+ shadow: { cameraSize: 24, near: 0.4, far: 70, bias: -0.00006, radius: 2 },
182
+ ao: { enabled: true, intensity: 3.0, radius: 3.0, distanceFalloff: 1.2, halfRes: false },
183
+ toneMappingExposure: 1.1,
184
+ },
185
+ },
186
+ daylight: {
187
+ id: "daylight",
188
+ label: "natural daylight",
189
+ description: "outdoor sun and sky gradient for aperture studies",
190
+ includeInteriorLights: false,
191
+ config: {
192
+ background: 0x87ceeb,
193
+ ambient: { color: 0xffffff, intensity: 0.8 },
194
+ hemisphere: { sky: 0x87ceeb, ground: 0x8b7355, intensity: 1.0 },
195
+ key: { color: 0xfff5e1, intensity: 2.0, position: [20, 30, 15] },
196
+ fill: { color: 0xadd8e6, intensity: 0.3, position: [-5, 5, -10] },
197
+ shadows: true,
198
+ shadow: { cameraSize: 32, near: 0.5, far: 90, bias: -0.00008, radius: 2.8 },
199
+ ao: { enabled: true, intensity: 1.8, radius: 3.5, distanceFalloff: 1.0, halfRes: true },
200
+ toneMappingExposure: 1.2,
201
+ },
202
+ },
203
+ "gallery-spot": {
204
+ id: "gallery-spot",
205
+ label: "gallery spot",
206
+ description: "high contrast exhibit lighting with focused key beams",
207
+ includeInteriorLights: false,
208
+ config: {
209
+ background: 0x101012,
210
+ ambient: { color: 0x262626, intensity: 0.4 },
211
+ hemisphere: { sky: 0x2d2f38, ground: 0x131315, intensity: 0.5 },
212
+ key: { color: 0xfff1d6, intensity: 2.6, position: [6, 7, 2] },
213
+ fill: { color: 0x4f5a6a, intensity: 0.9, position: [-4, 5, -3] },
214
+ shadows: true,
215
+ shadow: { cameraSize: 18, near: 0.3, far: 45, bias: -0.00002, radius: 1.5 },
216
+ ao: { enabled: true, intensity: 3.2, radius: 3.2, distanceFalloff: 1.4, halfRes: false },
217
+ toneMappingExposure: 1.15,
218
+ },
219
+ },
220
+ "lab-neutral": {
221
+ id: "lab-neutral",
222
+ label: "lab neutral",
223
+ description: "low contrast neutral lab benchmark for sensory baselines",
224
+ includeInteriorLights: false,
225
+ config: {
226
+ background: 0xf5f6f8,
227
+ ambient: { color: 0xffffff, intensity: 1.1 },
228
+ hemisphere: { sky: 0xf0f4f9, ground: 0xdfe2e6, intensity: 1.0 },
229
+ key: { color: 0xf8fbff, intensity: 1.2, position: [8, 6, 4] },
230
+ fill: { color: 0xebeff5, intensity: 0.9, position: [-6, 5, -4] },
231
+ shadows: false,
232
+ shadow: { cameraSize: 24, near: 0.5, far: 60, bias: -0.00005, radius: 2 },
233
+ ao: { enabled: true, intensity: 1.2, radius: 2.5, distanceFalloff: 0.9, halfRes: true },
234
+ toneMappingExposure: 0.95,
235
+ },
236
+ },
237
+ "atrium-suntrack": {
238
+ id: "atrium-suntrack",
239
+ label: "atrium suntrack",
240
+ description: "zenith-focused atrium lighting with animated sun sweep",
241
+ includeInteriorLights: true,
242
+ config: {
243
+ background: 0xfdfcf8,
244
+ ambient: { color: 0xfff8ef, intensity: 0.9 },
245
+ hemisphere: { sky: 0xfff4d6, ground: 0xf3f0e6, intensity: 0.85 },
246
+ key: { color: 0xfff1cc, intensity: 2.4, position: [0, 18, 0] },
247
+ fill: { color: 0xd6e4f7, intensity: 0.6, position: [-10, 8, -5] },
248
+ shadows: true,
249
+ shadow: { cameraSize: 26, near: 0.4, far: 75, bias: -0.00004, radius: 2.3 },
250
+ ao: { enabled: true, intensity: 2.2, radius: 3.8, distanceFalloff: 1.1, halfRes: false },
251
+ toneMappingExposure: 1.08,
252
+ },
253
+ },
254
+ "flow-horizon": {
255
+ id: "flow-horizon",
256
+ label: "flow horizon",
257
+ description: "warm optic-flow horizon line for evening sequences",
258
+ includeInteriorLights: false,
259
+ config: {
260
+ background: 0x1a1f28,
261
+ ambient: { color: 0x3a3d44, intensity: 0.5 },
262
+ hemisphere: { sky: 0x2a3342, ground: 0x14181f, intensity: 0.6 },
263
+ key: { color: 0xffcba8, intensity: 2.2, position: [15, 6, -4] },
264
+ fill: { color: 0x93b6ff, intensity: 0.7, position: [-10, 4, 6] },
265
+ shadows: true,
266
+ shadow: { cameraSize: 18, near: 0.3, far: 45, bias: -0.00002, radius: 1.4 },
267
+ ao: { enabled: true, intensity: 2.6, radius: 3.0, distanceFalloff: 1.3, halfRes: false },
268
+ toneMappingExposure: 1.05,
269
+ },
270
+ },
271
+ "biophilic-soft": {
272
+ id: "biophilic-soft",
273
+ label: "biophilic soft",
274
+ description: "diffuse daylight with green bounce for recovery zones",
275
+ includeInteriorLights: true,
276
+ config: {
277
+ background: 0xeaf3ec,
278
+ ambient: { color: 0xf7fff2, intensity: 1.05 },
279
+ hemisphere: { sky: 0xe1f1e4, ground: 0xcad7c4, intensity: 0.9 },
280
+ key: { color: 0xffefd6, intensity: 1.9, position: [8, 9, 5] },
281
+ fill: { color: 0xb7d7ff, intensity: 0.7, position: [-6, 6, -4] },
282
+ shadows: true,
283
+ shadow: { cameraSize: 24, near: 0.4, far: 65, bias: -0.00005, radius: 2.2 },
284
+ ao: { enabled: true, intensity: 2.1, radius: 3.5, distanceFalloff: 1.05, halfRes: false },
285
+ toneMappingExposure: 1.03,
286
+ },
287
+ },
288
+ };
289
+ const ENVIRONMENT_PRESET_DATA = {
290
+ architectural: {
291
+ id: "architectural",
292
+ label: "architectural horizon",
293
+ topColor: 0xffffff,
294
+ horizonColor: 0xd8d8d8,
295
+ sunPosition: [0.3, 0.8, 0.4],
296
+ sunIntensity: 0.15,
297
+ sunSize: 0.08,
298
+ groundColor: 0xf5f5f5,
299
+ },
300
+ studio: {
301
+ id: "studio",
302
+ label: "studio dusk",
303
+ topColor: 0x111218,
304
+ horizonColor: 0x050608,
305
+ sunPosition: [0.2, 0.7, 0.4],
306
+ sunIntensity: 0.12,
307
+ sunSize: 0.05,
308
+ groundColor: 0x1a1a1d,
309
+ },
310
+ daylight: {
311
+ id: "daylight",
312
+ label: "daylight gradient",
313
+ topColor: 0xcfe7ff,
314
+ horizonColor: 0xf5d7ae,
315
+ sunPosition: [0.4, 0.85, 0.25],
316
+ sunIntensity: 0.22,
317
+ sunSize: 0.07,
318
+ groundColor: 0xe8ded0,
319
+ },
320
+ "gallery-spot": {
321
+ id: "gallery-spot",
322
+ label: "gallery noir",
323
+ topColor: 0x1b1d24,
324
+ horizonColor: 0x0c0d10,
325
+ sunPosition: [0.25, 0.75, 0.1],
326
+ sunIntensity: 0.14,
327
+ sunSize: 0.04,
328
+ groundColor: 0x0b0d12,
329
+ },
330
+ "lab-neutral": {
331
+ id: "lab-neutral",
332
+ label: "lab overcast",
333
+ topColor: 0xf0f2f5,
334
+ horizonColor: 0xe4e7eb,
335
+ sunPosition: [0.3, 0.8, 0.3],
336
+ sunIntensity: 0.16,
337
+ sunSize: 0.06,
338
+ groundColor: 0xf5f6f8,
339
+ },
340
+ "atrium-suntrack": {
341
+ id: "atrium-suntrack",
342
+ label: "atrium sun bloom",
343
+ topColor: 0xfff4d6,
344
+ horizonColor: 0xffd9a6,
345
+ sunPosition: [0.05, 0.95, 0.05],
346
+ sunIntensity: 0.28,
347
+ sunSize: 0.09,
348
+ groundColor: 0xe4c7a1,
349
+ },
350
+ "flow-horizon": {
351
+ id: "flow-horizon",
352
+ label: "flow horizon",
353
+ topColor: 0x0f1a2c,
354
+ horizonColor: 0xff8c4c,
355
+ sunPosition: [0.25, 0.6, -0.15],
356
+ sunIntensity: 0.32,
357
+ sunSize: 0.08,
358
+ groundColor: 0x0b0f19,
359
+ },
360
+ "biophilic-soft": {
361
+ id: "biophilic-soft",
362
+ label: "biophilic haze",
363
+ topColor: 0xdceedf,
364
+ horizonColor: 0xb6d3cc,
365
+ sunPosition: [0.3, 0.75, 0.2],
366
+ sunIntensity: 0.2,
367
+ sunSize: 0.07,
368
+ groundColor: 0xcadccf,
369
+ },
370
+ };
371
+ const colorToHex = (value) => `#${value.toString(16).padStart(6, "0")}`;
372
+ const buildSky = (environment, override) => {
373
+ if (override?.mode === "hdr" && "hdr" in override) {
374
+ return { mode: "hdr", hdr: override.hdr };
375
+ }
376
+ if (override?.mode === "cube" && "cube" in override) {
377
+ return { mode: "cube", cube: override.cube };
378
+ }
379
+ return {
380
+ mode: "gradient",
381
+ gradient: {
382
+ topColor: colorToHex(environment.topColor),
383
+ horizonColor: colorToHex(environment.horizonColor),
384
+ sunPosition: environment.sunPosition,
385
+ sunIntensity: environment.sunIntensity,
386
+ sunSize: environment.sunSize,
387
+ },
388
+ };
389
+ };
390
+ const buildLightingRig = (preset) => ({
391
+ rig: preset.id === "studio"
392
+ ? "studio"
393
+ : preset.id === "gallery-spot"
394
+ ? "gallery"
395
+ : preset.id === "lab-neutral"
396
+ ? "neutral"
397
+ : undefined,
398
+ ambient: { color: colorToHex(preset.config.ambient.color), intensity: preset.config.ambient.intensity },
399
+ hemisphere: preset.config.hemisphere
400
+ ? {
401
+ skyColor: colorToHex(preset.config.hemisphere.sky),
402
+ groundColor: colorToHex(preset.config.hemisphere.ground),
403
+ intensity: preset.config.hemisphere.intensity,
404
+ }
405
+ : undefined,
406
+ key: {
407
+ color: colorToHex(preset.config.key.color),
408
+ intensity: preset.config.key.intensity,
409
+ position: preset.config.key.position,
410
+ castShadow: preset.config.shadows,
411
+ },
412
+ fill: {
413
+ color: colorToHex(preset.config.fill.color),
414
+ intensity: preset.config.fill.intensity,
415
+ position: preset.config.fill.position,
416
+ },
417
+ shadow: preset.config.shadow,
418
+ });
419
+ const buildRendererConfig = (preset) => ({
420
+ toneMapping: "neutral",
421
+ toneMappingExposure: preset.config.toneMappingExposure,
422
+ outputColorSpace: "srgb",
423
+ maxPixelRatio: 1.75,
424
+ antialias: true,
425
+ shadowMap: {
426
+ enabled: preset.config.shadows,
427
+ type: "pcfsoft",
428
+ },
429
+ });
430
+ const DEFAULT_AO_COLOR = "#000000";
431
+ const DEFAULT_AO_QUALITY = "high";
432
+ const buildPostFxConfig = (preset) => ({
433
+ ao: preset.config.ao
434
+ ? {
435
+ enabled: preset.config.ao.enabled,
436
+ intensity: preset.config.ao.intensity,
437
+ radius: preset.config.ao.radius,
438
+ distanceFalloff: preset.config.ao.distanceFalloff,
439
+ halfRes: preset.config.ao.halfRes,
440
+ quality: DEFAULT_AO_QUALITY,
441
+ color: DEFAULT_AO_COLOR,
442
+ }
443
+ : { enabled: false },
444
+ });
445
+ export const SCIENCE_PRESET_SUMMARIES = Object.fromEntries(Object.entries(LIGHTING_PRESET_DATA).map(([id, preset]) => [id, preset.description]));
446
+ export const SCIENCE_DEFAULT_PRESET_ID = DEFAULT_LIGHTING_PRESET_ID;
447
+ export function buildViewerPresets() {
448
+ const presets = {};
449
+ Object.entries(LIGHTING_PRESET_DATA).forEach(([id, lighting]) => {
450
+ const environment = ENVIRONMENT_PRESET_DATA[id] ?? ENVIRONMENT_PRESET_DATA[DEFAULT_ENVIRONMENT_PRESET_ID];
451
+ const sceneExtrasSource = PRESET_SCENE_EXTRAS[id] ?? DEFAULT_SCENE_EXTRAS;
452
+ const sceneExtras = { ...DEFAULT_SCENE_EXTRAS, ...sceneExtrasSource };
453
+ const includeInteriorLights = lighting.includeInteriorLights !== false;
454
+ const skyOverride = PRESET_SKY_OVERRIDES[id];
455
+ presets[id] = {
456
+ id,
457
+ label: lighting.label,
458
+ renderer: buildRendererConfig(lighting),
459
+ sky: buildSky(environment, skyOverride),
460
+ lighting: buildLightingRig(lighting),
461
+ postfx: buildPostFxConfig(lighting),
462
+ sceneExtras,
463
+ interiorLights: includeInteriorLights
464
+ ? DEFAULT_INTERIOR_LIGHTS.map((light) => ({
465
+ position: light.position,
466
+ intensity: light.intensity,
467
+ distance: light.distance,
468
+ color: colorToHex(light.color ?? 0xffffff),
469
+ }))
470
+ : undefined,
471
+ materialsPresetId: PRESET_MATERIAL_OVERRIDES[id] ?? BASELINE_MATERIAL_PRESET_ID,
472
+ };
473
+ });
474
+ return presets;
475
+ }
476
+ // Legacy alias kept for existing consumers; use buildViewerPresets instead.
477
+ export const buildSciencePresets = buildViewerPresets;
478
+ export const SCIENCE_PRESETS = buildViewerPresets();
@@ -0,0 +1,10 @@
1
+ import type { RenderPresetDefinition } from "../engine/types";
2
+ export type ScienceSkyOption = {
3
+ id: string;
4
+ label: string;
5
+ description?: string;
6
+ sky?: RenderPresetDefinition["sky"];
7
+ };
8
+ export declare function listScienceSkyOptions(): ScienceSkyOption[];
9
+ export declare function getScienceSkyOption(id: string): ScienceSkyOption | undefined;
10
+ //# sourceMappingURL=scienceSky.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scienceSky.d.ts","sourceRoot":"","sources":["../../src/sky/scienceSky.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;CACrC,CAAC;AAmFF,wBAAgB,qBAAqB,IAAI,gBAAgB,EAAE,CAE1D;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE5E"}