@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,149 @@
1
+ export declare const MATERIAL_CATALOGUE: {
2
+ readonly version: 1;
3
+ readonly materials: readonly [{
4
+ readonly materialId: "white_wall";
5
+ readonly label: "white plaster wall";
6
+ readonly category: "walls";
7
+ readonly baseline: {
8
+ readonly color: "#F5F5F5";
9
+ readonly finish: "matte";
10
+ };
11
+ readonly pbr: {
12
+ readonly baseColor: "#FFFFFF";
13
+ readonly roughness: 0.65;
14
+ readonly metalness: 0;
15
+ readonly emissive: "#FFFFFF";
16
+ readonly emissiveIntensity: 0.05;
17
+ };
18
+ }, {
19
+ readonly materialId: "acoustic_ceiling_white";
20
+ readonly label: "acoustic ceiling tile";
21
+ readonly category: "ceiling";
22
+ readonly baseline: {
23
+ readonly color: "#FAFAFA";
24
+ readonly finish: "matte";
25
+ };
26
+ readonly pbr: {
27
+ readonly baseColor: "#F8F8F8";
28
+ readonly roughness: 0.7;
29
+ readonly metalness: 0;
30
+ readonly emissive: "#FFFFFF";
31
+ readonly emissiveIntensity: 0.04;
32
+ };
33
+ }, {
34
+ readonly materialId: "timber_floor_warm";
35
+ readonly label: "warm timber floor";
36
+ readonly category: "floor";
37
+ readonly baseline: {
38
+ readonly color: "#B9854A";
39
+ readonly finish: "semi_gloss";
40
+ };
41
+ readonly pbr: {
42
+ readonly baseColor: "#B27943";
43
+ readonly roughness: 0.45;
44
+ readonly metalness: 0;
45
+ readonly emissive: "#000000";
46
+ readonly emissiveIntensity: 0;
47
+ readonly texture: {
48
+ readonly type: "wood";
49
+ readonly scale: 1;
50
+ };
51
+ };
52
+ }, {
53
+ readonly materialId: "glazing_clear";
54
+ readonly label: "clear glazing";
55
+ readonly category: "apertures";
56
+ readonly baseline: {
57
+ readonly color: "#D8F0FF";
58
+ readonly finish: "glass";
59
+ };
60
+ readonly pbr: {
61
+ readonly baseColor: "#E0F5FF";
62
+ readonly roughness: 0.05;
63
+ readonly metalness: 0;
64
+ readonly opacity: 0.25;
65
+ readonly transparent: true;
66
+ readonly ior: 1.5;
67
+ readonly emissive: "#000000";
68
+ readonly emissiveIntensity: 0;
69
+ };
70
+ }, {
71
+ readonly materialId: "metal_trim_brushed";
72
+ readonly label: "brushed metal trim";
73
+ readonly category: "trim";
74
+ readonly baseline: {
75
+ readonly color: "#A0A5AE";
76
+ readonly finish: "metal";
77
+ };
78
+ readonly pbr: {
79
+ readonly baseColor: "#9DA3AE";
80
+ readonly roughness: 0.35;
81
+ readonly metalness: 0.9;
82
+ readonly emissive: "#000000";
83
+ readonly emissiveIntensity: 0;
84
+ };
85
+ }, {
86
+ readonly materialId: "concrete_charcoal";
87
+ readonly label: "charcoal architectural concrete";
88
+ readonly category: "walls";
89
+ readonly baseline: {
90
+ readonly color: "#30343A";
91
+ readonly finish: "matte";
92
+ };
93
+ readonly pbr: {
94
+ readonly baseColor: "#30343A";
95
+ readonly roughness: 0.5;
96
+ readonly metalness: 0.05;
97
+ readonly emissive: "#000000";
98
+ readonly emissiveIntensity: 0;
99
+ };
100
+ }, {
101
+ readonly materialId: "stone_dark";
102
+ readonly label: "dark graphite stone";
103
+ readonly category: "floor";
104
+ readonly baseline: {
105
+ readonly color: "#1C1F26";
106
+ readonly finish: "matte";
107
+ };
108
+ readonly pbr: {
109
+ readonly baseColor: "#1C1F26";
110
+ readonly roughness: 0.65;
111
+ readonly metalness: 0.02;
112
+ readonly emissive: "#000000";
113
+ readonly emissiveIntensity: 0;
114
+ };
115
+ }, {
116
+ readonly materialId: "stone_light";
117
+ readonly label: "light limestone";
118
+ readonly category: "floor";
119
+ readonly baseline: {
120
+ readonly color: "#D1C9BB";
121
+ readonly finish: "matte";
122
+ };
123
+ readonly pbr: {
124
+ readonly baseColor: "#D1C9BB";
125
+ readonly roughness: 0.6;
126
+ readonly metalness: 0.02;
127
+ readonly emissive: "#000000";
128
+ readonly emissiveIntensity: 0;
129
+ };
130
+ }, {
131
+ readonly materialId: "glass_structural_clear";
132
+ readonly label: "structural clear glass";
133
+ readonly category: "ceiling";
134
+ readonly baseline: {
135
+ readonly color: "#E6EEF5";
136
+ readonly finish: "gloss";
137
+ };
138
+ readonly pbr: {
139
+ readonly baseColor: "#E6EEF5";
140
+ readonly roughness: 0.05;
141
+ readonly metalness: 0;
142
+ readonly transparent: true;
143
+ readonly opacity: 0.22;
144
+ readonly emissive: "#000000";
145
+ readonly emissiveIntensity: 0;
146
+ };
147
+ }];
148
+ };
149
+ //# sourceMappingURL=catalogue-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogue-data.d.ts","sourceRoot":"","sources":["../../src/materials/catalogue-data.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6JrB,CAAC"}
@@ -0,0 +1,158 @@
1
+ export const MATERIAL_CATALOGUE = {
2
+ "version": 1,
3
+ "materials": [
4
+ {
5
+ "materialId": "white_wall",
6
+ "label": "white plaster wall",
7
+ "category": "walls",
8
+ "baseline": {
9
+ "color": "#F5F5F5",
10
+ "finish": "matte"
11
+ },
12
+ "pbr": {
13
+ "baseColor": "#FFFFFF",
14
+ "roughness": 0.65,
15
+ "metalness": 0.0,
16
+ "emissive": "#FFFFFF",
17
+ "emissiveIntensity": 0.05
18
+ }
19
+ },
20
+ {
21
+ "materialId": "acoustic_ceiling_white",
22
+ "label": "acoustic ceiling tile",
23
+ "category": "ceiling",
24
+ "baseline": {
25
+ "color": "#FAFAFA",
26
+ "finish": "matte"
27
+ },
28
+ "pbr": {
29
+ "baseColor": "#F8F8F8",
30
+ "roughness": 0.7,
31
+ "metalness": 0.0,
32
+ "emissive": "#FFFFFF",
33
+ "emissiveIntensity": 0.04
34
+ }
35
+ },
36
+ {
37
+ "materialId": "timber_floor_warm",
38
+ "label": "warm timber floor",
39
+ "category": "floor",
40
+ "baseline": {
41
+ "color": "#B9854A",
42
+ "finish": "semi_gloss"
43
+ },
44
+ "pbr": {
45
+ "baseColor": "#B27943",
46
+ "roughness": 0.45,
47
+ "metalness": 0.0,
48
+ "emissive": "#000000",
49
+ "emissiveIntensity": 0.0,
50
+ "texture": {
51
+ "type": "wood",
52
+ "scale": 1.0
53
+ }
54
+ }
55
+ },
56
+ {
57
+ "materialId": "glazing_clear",
58
+ "label": "clear glazing",
59
+ "category": "apertures",
60
+ "baseline": {
61
+ "color": "#D8F0FF",
62
+ "finish": "glass"
63
+ },
64
+ "pbr": {
65
+ "baseColor": "#E0F5FF",
66
+ "roughness": 0.05,
67
+ "metalness": 0.0,
68
+ "opacity": 0.25,
69
+ "transparent": true,
70
+ "ior": 1.5,
71
+ "emissive": "#000000",
72
+ "emissiveIntensity": 0.0
73
+ }
74
+ },
75
+ {
76
+ "materialId": "metal_trim_brushed",
77
+ "label": "brushed metal trim",
78
+ "category": "trim",
79
+ "baseline": {
80
+ "color": "#A0A5AE",
81
+ "finish": "metal"
82
+ },
83
+ "pbr": {
84
+ "baseColor": "#9DA3AE",
85
+ "roughness": 0.35,
86
+ "metalness": 0.9,
87
+ "emissive": "#000000",
88
+ "emissiveIntensity": 0.0
89
+ }
90
+ },
91
+ {
92
+ "materialId": "concrete_charcoal",
93
+ "label": "charcoal architectural concrete",
94
+ "category": "walls",
95
+ "baseline": {
96
+ "color": "#30343A",
97
+ "finish": "matte"
98
+ },
99
+ "pbr": {
100
+ "baseColor": "#30343A",
101
+ "roughness": 0.5,
102
+ "metalness": 0.05,
103
+ "emissive": "#000000",
104
+ "emissiveIntensity": 0.0
105
+ }
106
+ },
107
+ {
108
+ "materialId": "stone_dark",
109
+ "label": "dark graphite stone",
110
+ "category": "floor",
111
+ "baseline": {
112
+ "color": "#1C1F26",
113
+ "finish": "matte"
114
+ },
115
+ "pbr": {
116
+ "baseColor": "#1C1F26",
117
+ "roughness": 0.65,
118
+ "metalness": 0.02,
119
+ "emissive": "#000000",
120
+ "emissiveIntensity": 0.0
121
+ }
122
+ },
123
+ {
124
+ "materialId": "stone_light",
125
+ "label": "light limestone",
126
+ "category": "floor",
127
+ "baseline": {
128
+ "color": "#D1C9BB",
129
+ "finish": "matte"
130
+ },
131
+ "pbr": {
132
+ "baseColor": "#D1C9BB",
133
+ "roughness": 0.6,
134
+ "metalness": 0.02,
135
+ "emissive": "#000000",
136
+ "emissiveIntensity": 0.0
137
+ }
138
+ },
139
+ {
140
+ "materialId": "glass_structural_clear",
141
+ "label": "structural clear glass",
142
+ "category": "ceiling",
143
+ "baseline": {
144
+ "color": "#E6EEF5",
145
+ "finish": "gloss"
146
+ },
147
+ "pbr": {
148
+ "baseColor": "#E6EEF5",
149
+ "roughness": 0.05,
150
+ "metalness": 0.0,
151
+ "transparent": true,
152
+ "opacity": 0.22,
153
+ "emissive": "#000000",
154
+ "emissiveIntensity": 0.0
155
+ }
156
+ }
157
+ ]
158
+ };
@@ -0,0 +1,5 @@
1
+ import type { MaterialCatalogue, MaterialDefinition, MaterialId } from "./types";
2
+ export declare function getMaterialCatalogue(): MaterialCatalogue;
3
+ export declare function findMaterial(materialId: MaterialId): MaterialDefinition | undefined;
4
+ export declare function listMaterialsByCategory(category: string): MaterialDefinition[];
5
+ //# sourceMappingURL=catalogue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../../src/materials/catalogue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKjF,wBAAgB,oBAAoB,IAAI,iBAAiB,CAUxD;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,GAAG,kBAAkB,GAAG,SAAS,CAGnF;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAG9E"}
@@ -0,0 +1,23 @@
1
+ import { MATERIAL_CATALOGUE } from "./catalogue-data";
2
+ let cachedCatalogue = null;
3
+ let logged = false;
4
+ export function getMaterialCatalogue() {
5
+ if (!cachedCatalogue) {
6
+ cachedCatalogue = MATERIAL_CATALOGUE;
7
+ if (process.env.NODE_ENV !== "production" && !logged) {
8
+ const count = cachedCatalogue.materials.length;
9
+ console.log(`[MaterialCatalogue] loaded ${count} calibrated materials (v${cachedCatalogue.version}).`);
10
+ logged = true;
11
+ }
12
+ }
13
+ return cachedCatalogue;
14
+ }
15
+ export function findMaterial(materialId) {
16
+ const catalogue = getMaterialCatalogue();
17
+ return catalogue.materials.find((material) => material.materialId === materialId);
18
+ }
19
+ export function listMaterialsByCategory(category) {
20
+ const catalogue = getMaterialCatalogue();
21
+ return catalogue.materials.filter((material) => material.category === category);
22
+ }
23
+ getMaterialCatalogue();
@@ -0,0 +1,21 @@
1
+ import type { MaterialId, MaterialsConfig, SurfaceMaterialConfig } from "./types";
2
+ export type MaterialSlotReference = {
3
+ catalogId: MaterialId;
4
+ overrides?: Partial<SurfaceMaterialConfig>;
5
+ };
6
+ export type MaterialPresetDefinition = {
7
+ id: string;
8
+ label: string;
9
+ materials: {
10
+ walls: MaterialSlotReference;
11
+ floor: MaterialSlotReference;
12
+ ceiling: MaterialSlotReference;
13
+ };
14
+ };
15
+ export declare const BASELINE_MATERIAL_PRESET_ID = "calenv-baseline";
16
+ export declare const MATERIAL_PRESET_DATA: Record<string, MaterialPresetDefinition>;
17
+ export declare function resolveMaterialSlot(slot: MaterialSlotReference): SurfaceMaterialConfig;
18
+ export declare function resolveMaterialPresetMaterials(preset: MaterialPresetDefinition): MaterialsConfig;
19
+ export declare function listMaterialPresets(): MaterialPresetDefinition[];
20
+ export declare function getMaterialPreset(id: string): MaterialPresetDefinition;
21
+ //# sourceMappingURL=presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/materials/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGlF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE;QACT,KAAK,EAAE,qBAAqB,CAAC;QAC7B,KAAK,EAAE,qBAAqB,CAAC;QAC7B,OAAO,EAAE,qBAAqB,CAAC;KAChC,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAO7D,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAuKzE,CAAC;AA+BF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,qBAAqB,CAGtF;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,wBAAwB,GAAG,eAAe,CAMhG;AAED,wBAAgB,mBAAmB,IAAI,wBAAwB,EAAE,CAEhE;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,wBAAwB,CAMtE"}
@@ -0,0 +1,217 @@
1
+ import { findMaterial } from "./catalogue";
2
+ export const BASELINE_MATERIAL_PRESET_ID = "calenv-baseline";
3
+ const materialSlot = (catalogId, overrides) => ({
4
+ catalogId,
5
+ overrides,
6
+ });
7
+ export const MATERIAL_PRESET_DATA = {
8
+ [BASELINE_MATERIAL_PRESET_ID]: {
9
+ id: BASELINE_MATERIAL_PRESET_ID,
10
+ label: "calenv baseline surfaces",
11
+ materials: {
12
+ walls: materialSlot("white_wall", { reflectance: 0.7, roughness: 0.3 }),
13
+ floor: materialSlot("stone_light", {
14
+ color: { r: 232, g: 234, b: 240 },
15
+ reflectance: 0.52,
16
+ roughness: 0.4,
17
+ }),
18
+ ceiling: materialSlot("acoustic_ceiling_white", { reflectance: 0.7, roughness: 0.3 }),
19
+ },
20
+ },
21
+ studio: {
22
+ id: "studio",
23
+ label: "studio high-contrast surfaces",
24
+ materials: {
25
+ walls: materialSlot("concrete_charcoal", {
26
+ color: { r: 48, g: 52, b: 58 },
27
+ reflectance: 0.22,
28
+ roughness: 0.45,
29
+ }),
30
+ floor: materialSlot("stone_dark", {
31
+ color: { r: 28, g: 30, b: 34 },
32
+ reflectance: 0.18,
33
+ roughness: 0.4,
34
+ }),
35
+ ceiling: materialSlot("white_wall", {
36
+ color: { r: 220, g: 222, b: 228 },
37
+ reflectance: 0.58,
38
+ roughness: 0.25,
39
+ }),
40
+ },
41
+ },
42
+ daylight: {
43
+ id: "daylight",
44
+ label: "daylight pavilion surfaces",
45
+ materials: {
46
+ walls: materialSlot("white_wall", {
47
+ color: { r: 240, g: 242, b: 248 },
48
+ reflectance: 0.68,
49
+ roughness: 0.35,
50
+ }),
51
+ floor: materialSlot("stone_light", {
52
+ color: { r: 214, g: 206, b: 190 },
53
+ reflectance: 0.45,
54
+ roughness: 0.5,
55
+ }),
56
+ ceiling: materialSlot("acoustic_ceiling_white", {
57
+ color: { r: 252, g: 252, b: 248 },
58
+ reflectance: 0.78,
59
+ roughness: 0.22,
60
+ }),
61
+ },
62
+ },
63
+ "gallery-spot": {
64
+ id: "gallery-spot",
65
+ label: "immersive gallery surfaces",
66
+ materials: {
67
+ walls: materialSlot("white_wall", {
68
+ color: { r: 246, g: 237, b: 225 },
69
+ reflectance: 0.6,
70
+ roughness: 0.25,
71
+ }),
72
+ floor: materialSlot("stone_dark", {
73
+ color: { r: 90, g: 88, b: 83 },
74
+ reflectance: 0.32,
75
+ roughness: 0.6,
76
+ pattern: "grid",
77
+ patternScale: 0.4,
78
+ }),
79
+ ceiling: materialSlot("acoustic_ceiling_white", {
80
+ color: { r: 255, g: 250, b: 245 },
81
+ reflectance: 0.75,
82
+ roughness: 0.2,
83
+ }),
84
+ },
85
+ },
86
+ "lab-neutral": {
87
+ id: "lab-neutral",
88
+ label: "neutral lab surfaces",
89
+ materials: {
90
+ walls: materialSlot("white_wall", {
91
+ color: { r: 240, g: 240, b: 246 },
92
+ reflectance: 0.82,
93
+ roughness: 0.3,
94
+ }),
95
+ floor: materialSlot("timber_floor_warm", {
96
+ color: { r: 172, g: 168, b: 160 },
97
+ reflectance: 0.35,
98
+ roughness: 0.55,
99
+ }),
100
+ ceiling: materialSlot("acoustic_ceiling_white", {
101
+ color: { r: 233, g: 235, b: 239 },
102
+ reflectance: 0.88,
103
+ roughness: 0.25,
104
+ }),
105
+ },
106
+ },
107
+ "atrium-suntrack": {
108
+ id: "atrium-suntrack",
109
+ label: "atrium daylight surfaces",
110
+ materials: {
111
+ walls: materialSlot("stone_light", {
112
+ color: { r: 210, g: 210, b: 205 },
113
+ reflectance: 0.55,
114
+ roughness: 0.4,
115
+ }),
116
+ floor: materialSlot("stone_light", {
117
+ color: { r: 190, g: 190, b: 183 },
118
+ reflectance: 0.4,
119
+ roughness: 0.6,
120
+ pattern: "grid",
121
+ patternScale: 0.5,
122
+ }),
123
+ ceiling: materialSlot("glass_structural_clear", {
124
+ color: { r: 230, g: 238, b: 245 },
125
+ reflectance: 0.65,
126
+ roughness: 0.15,
127
+ }),
128
+ },
129
+ },
130
+ "flow-horizon": {
131
+ id: "flow-horizon",
132
+ label: "flow horizon surfaces",
133
+ materials: {
134
+ walls: materialSlot("glass_structural_clear", {
135
+ color: { r: 210, g: 225, b: 235 },
136
+ reflectance: 0.4,
137
+ roughness: 0.2,
138
+ }),
139
+ floor: materialSlot("timber_floor_warm", {
140
+ color: { r: 140, g: 110, b: 85 },
141
+ reflectance: 0.28,
142
+ roughness: 0.6,
143
+ pattern: "herringbone",
144
+ patternScale: 0.4,
145
+ }),
146
+ ceiling: materialSlot("timber_floor_warm", {
147
+ color: { r: 210, g: 200, b: 185 },
148
+ reflectance: 0.5,
149
+ roughness: 0.35,
150
+ }),
151
+ },
152
+ },
153
+ "biophilic-soft": {
154
+ id: "biophilic-soft",
155
+ label: "biophilic loft surfaces",
156
+ materials: {
157
+ walls: materialSlot("white_wall", {
158
+ color: { r: 214, g: 224, b: 214 },
159
+ reflectance: 0.58,
160
+ roughness: 0.35,
161
+ }),
162
+ floor: materialSlot("timber_floor_warm", {
163
+ color: { r: 170, g: 142, b: 110 },
164
+ reflectance: 0.32,
165
+ roughness: 0.55,
166
+ }),
167
+ ceiling: materialSlot("acoustic_ceiling_white", {
168
+ color: { r: 250, g: 248, b: 240 },
169
+ reflectance: 0.78,
170
+ roughness: 0.25,
171
+ }),
172
+ },
173
+ },
174
+ };
175
+ const DEFAULT_REFLECTANCE = 0.5;
176
+ const hexToRgb = (hex) => {
177
+ const normalized = hex.replace("#", "");
178
+ const value = parseInt(normalized, 16);
179
+ return {
180
+ r: (value >> 16) & 0xff,
181
+ g: (value >> 8) & 0xff,
182
+ b: value & 0xff,
183
+ };
184
+ };
185
+ const resolveMaterialConfig = (definition, catalogId, overrides) => {
186
+ const baselineColor = definition?.baseline?.color ?? "#ffffff";
187
+ const baseColor = overrides?.color ?? hexToRgb(baselineColor);
188
+ return {
189
+ type: catalogId,
190
+ color: baseColor,
191
+ reflectance: overrides?.reflectance ?? DEFAULT_REFLECTANCE,
192
+ roughness: overrides?.roughness ?? definition?.pbr?.roughness ?? 0.6,
193
+ pattern: overrides?.pattern ?? "none",
194
+ patternScale: overrides?.patternScale ?? 0.5,
195
+ };
196
+ };
197
+ export function resolveMaterialSlot(slot) {
198
+ const definition = findMaterial(slot.catalogId);
199
+ return resolveMaterialConfig(definition, slot.catalogId, slot.overrides);
200
+ }
201
+ export function resolveMaterialPresetMaterials(preset) {
202
+ return {
203
+ walls: resolveMaterialSlot(preset.materials.walls),
204
+ floor: resolveMaterialSlot(preset.materials.floor),
205
+ ceiling: resolveMaterialSlot(preset.materials.ceiling),
206
+ };
207
+ }
208
+ export function listMaterialPresets() {
209
+ return Object.values(MATERIAL_PRESET_DATA);
210
+ }
211
+ export function getMaterialPreset(id) {
212
+ const preset = MATERIAL_PRESET_DATA[id];
213
+ if (!preset) {
214
+ throw new Error(`Material preset '${id}' not found.`);
215
+ }
216
+ return preset;
217
+ }
@@ -0,0 +1,15 @@
1
+ import type { MaterialId } from "./types";
2
+ export type TextureMap = {
3
+ albedo?: string;
4
+ normal?: string;
5
+ roughness?: string;
6
+ ao?: string;
7
+ scale?: [number, number];
8
+ };
9
+ export type RenderMaterialMetadata = {
10
+ materialId: MaterialId;
11
+ doubleSided?: boolean;
12
+ textures?: TextureMap;
13
+ };
14
+ export declare function getRenderMaterialMetadata(materialId: MaterialId): RenderMaterialMetadata | undefined;
15
+ //# sourceMappingURL=renderMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderMetadata.d.ts","sourceRoot":"","sources":["../../src/materials/renderMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB,CAAC;AAgEF,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,sBAAsB,GAAG,SAAS,CAEpG"}
@@ -0,0 +1,64 @@
1
+ const RENDER_MATERIAL_METADATA = {
2
+ white_wall: {
3
+ materialId: "white_wall",
4
+ doubleSided: true,
5
+ textures: {
6
+ normal: "/textures/plaster/normal.png",
7
+ ao: "/textures/stone/roughness.png",
8
+ scale: [4, 4],
9
+ },
10
+ },
11
+ acoustic_ceiling_white: {
12
+ materialId: "acoustic_ceiling_white",
13
+ doubleSided: true,
14
+ textures: {
15
+ normal: "/textures/plaster/normal.png",
16
+ ao: "/textures/stone/roughness.png",
17
+ scale: [2, 2],
18
+ },
19
+ },
20
+ timber_floor_warm: {
21
+ materialId: "timber_floor_warm",
22
+ doubleSided: false,
23
+ textures: {
24
+ albedo: "/textures/wood/albedo.png",
25
+ normal: "/textures/wood/normal.png",
26
+ roughness: "/textures/stone/roughness.png",
27
+ scale: [6, 6],
28
+ },
29
+ },
30
+ stone_dark: {
31
+ materialId: "stone_dark",
32
+ doubleSided: false,
33
+ textures: {
34
+ roughness: "/textures/stone/roughness.png",
35
+ ao: "/textures/stone/roughness.png",
36
+ scale: [3, 3],
37
+ },
38
+ },
39
+ stone_light: {
40
+ materialId: "stone_light",
41
+ doubleSided: false,
42
+ textures: {
43
+ roughness: "/textures/stone/roughness.png",
44
+ ao: "/textures/stone/roughness.png",
45
+ scale: [3, 3],
46
+ },
47
+ },
48
+ concrete_charcoal: {
49
+ materialId: "concrete_charcoal",
50
+ doubleSided: true,
51
+ textures: {
52
+ normal: "/textures/plaster/normal.png",
53
+ roughness: "/textures/stone/roughness.png",
54
+ scale: [2, 2],
55
+ },
56
+ },
57
+ glass_structural_clear: {
58
+ materialId: "glass_structural_clear",
59
+ doubleSided: false,
60
+ },
61
+ };
62
+ export function getRenderMaterialMetadata(materialId) {
63
+ return RENDER_MATERIAL_METADATA[materialId];
64
+ }