@woosh/meep-engine 3.61.0 → 3.61.1

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 (61) hide show
  1. package/package.json +1 -1
  2. package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
  3. package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +4 -0
  4. package/src/engine/graphics/ecs/decal/v2/Decal.d.ts +46 -2
  5. package/src/engine/graphics/ecs/decal/v2/Decal.d.ts.map +1 -1
  6. package/src/engine/graphics/ecs/decal/v2/Decal.js +74 -5
  7. package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.d.ts.map +1 -1
  8. package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.js +13 -1
  9. package/src/engine/graphics/ecs/decal/v2/DecalSerializationUpgrader_1_2.d.ts +9 -0
  10. package/src/engine/graphics/ecs/decal/v2/DecalSerializationUpgrader_1_2.d.ts.map +1 -0
  11. package/src/engine/graphics/ecs/decal/v2/DecalSerializationUpgrader_1_2.js +37 -0
  12. package/src/engine/graphics3/DecalSystem.d.ts.map +1 -1
  13. package/src/engine/graphics3/DecalSystem.js +462 -447
  14. package/src/engine/graphics3/decal/DECAL_GPU_RECORD.d.ts +14 -0
  15. package/src/engine/graphics3/decal/DECAL_GPU_RECORD.d.ts.map +1 -1
  16. package/src/engine/graphics3/decal/DECAL_GPU_RECORD.js +53 -13
  17. package/src/engine/graphics3/decal/chunk_decal_record.d.ts +6 -1
  18. package/src/engine/graphics3/decal/chunk_decal_record.d.ts.map +1 -1
  19. package/src/engine/graphics3/decal/chunk_decal_record.js +28 -9
  20. package/src/engine/graphics3/decal/decal_gpu_records.d.ts +2 -1
  21. package/src/engine/graphics3/decal/decal_gpu_records.d.ts.map +1 -1
  22. package/src/engine/graphics3/decal/decal_gpu_records.js +26 -5
  23. package/src/engine/graphics3/decal/decal_material_samplers.d.ts +6 -0
  24. package/src/engine/graphics3/decal/decal_material_samplers.d.ts.map +1 -1
  25. package/src/engine/graphics3/decal/decal_material_samplers.js +13 -0
  26. package/src/engine/graphics3/decal/shader_cluster_assign_decals.js +1 -1
  27. package/src/engine/graphics3/decal/shader_cull_decals_frustum.js +1 -1
  28. package/src/engine/graphics3/decal/shader_decal_composite.d.ts +5 -0
  29. package/src/engine/graphics3/decal/shader_decal_composite.d.ts.map +1 -1
  30. package/src/engine/graphics3/decal/shader_decal_composite.js +69 -28
  31. package/src/generation/foliage/skeleton/ShootWoodHash.d.ts +3 -2
  32. package/src/generation/foliage/skeleton/ShootWoodHash.d.ts.map +1 -1
  33. package/src/generation/foliage/skeleton/ShootWoodHash.js +25 -2
  34. package/src/shade/renderer/buffer/graph_read_buffer.d.ts +3 -1
  35. package/src/shade/renderer/buffer/graph_read_buffer.d.ts.map +1 -1
  36. package/src/shade/renderer/buffer/graph_read_buffer.js +9 -6
  37. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  38. package/src/shade/renderer/particles/GPUParticleSystem.js +1 -7
  39. package/src/shade/renderer/restir/di/chunk_restir_resolve.d.ts.map +1 -1
  40. package/src/shade/renderer/restir/di/chunk_restir_resolve.js +91 -94
  41. package/src/shade/renderer/restir/reservoir/chunk_rtxdi_stream_sample.js +1 -1
  42. package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.d.ts +14 -0
  43. package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.d.ts.map +1 -1
  44. package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_decode.js +36 -21
  45. package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_sample_gather.d.ts +22 -0
  46. package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_sample_gather.d.ts.map +1 -0
  47. package/src/shade/renderer/shader/chunk/color/rgbe9995/chunk_rgbe9995_sample_gather.js +64 -0
  48. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_vertex_normal.d.ts.map +1 -1
  49. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_decode_vertex_normal.js +13 -18
  50. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_vertex_normal.d.ts.map +1 -1
  51. package/src/shade/renderer/shader/chunk/geometry/normal/chunk_encode_vertex_normal.js +28 -30
  52. package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_u32_to_vec2.d.ts.map +1 -1
  53. package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_u32_to_vec2.js +15 -16
  54. package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_vec2_to_u32.d.ts +0 -1
  55. package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_vec2_to_u32.d.ts.map +1 -1
  56. package/src/shade/renderer/shader/chunk/geometry/vec2/chunk_unit_vec2_to_u32.js +15 -18
  57. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +8 -1
  58. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +3 -3
  59. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_sh3_color_encode.d.ts +0 -2
  60. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_sh3_color_encode.d.ts.map +0 -1
  61. package/src/shade/renderer/global_illumination/brick4/cpu/brick4_sh3_color_encode.js +0 -6
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Advanced 3D game engine",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "3.61.0",
9
+ "version": "3.61.1",
10
10
  "exports": {
11
11
  "./build/*": "./build/*",
12
12
  "./src/*": "./src/*",
@@ -1 +1 @@
1
- {"version":3,"file":"populateEngineSerializationRegistry.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/populateEngineSerializationRegistry.js"],"names":[],"mappings":"AA0MA;;;;;;;;GAQG;AACH,iGA0HC"}
1
+ {"version":3,"file":"populateEngineSerializationRegistry.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/populateEngineSerializationRegistry.js"],"names":[],"mappings":"AA6MA;;;;;;;;GAQG;AACH,iGA2HC"}
@@ -85,6 +85,9 @@ import { DecalSerializationAdapter } from "../../graphics/ecs/decal/v2/DecalSeri
85
85
  import {
86
86
  DecalSerializationUpgrader_0_1
87
87
  } from "../../graphics/ecs/decal/v2/DecalSerializationUpgrader_0_1.js";
88
+ import {
89
+ DecalSerializationUpgrader_1_2
90
+ } from "../../graphics/ecs/decal/v2/DecalSerializationUpgrader_1_2.js";
88
91
  import Highlight from "../../graphics/ecs/highlight/Highlight.js";
89
92
  import { HighlightSerializationAdapter } from "../../graphics/ecs/highlight/HighlightSerializationAdapter.js";
90
93
  import {
@@ -291,6 +294,7 @@ export function populateEngineSerializationRegistry(registry) {
291
294
  registry.registerUpgrader(Tag.typeName, new TagSerializationUpgrader_0_1());
292
295
  registry.registerUpgrader(ParticipatingMedia.typeName, new ParticipatingMediaSerializationUpgrader_0_1());
293
296
  registry.registerUpgrader(Decal.typeName, new DecalSerializationUpgrader_0_1());
297
+ registry.registerUpgrader(Decal.typeName, new DecalSerializationUpgrader_1_2());
294
298
 
295
299
  registry.registerUpgrader(FogOfWar.typeName, new FogOfWarSerializationUpdater_0_1());
296
300
 
@@ -36,7 +36,12 @@ export class Decal {
36
36
  */
37
37
  uri: string;
38
38
  /**
39
- * Base colour and coverage. Its alpha is what the decal's coverage means.
39
+ * Base colour and the decal's mask. Its alpha is the coverage every channel blends by, scaled
40
+ * per channel by the `*_weight` fields — so a decal that writes only normals still takes its
41
+ * shape from this alpha, with {@link albedo_weight} at zero.
42
+ *
43
+ * Optional: with none, the mask is one across the whole projection volume and the colour is
44
+ * {@link color}.
40
45
  * @type {string}
41
46
  */
42
47
  uri_albedo: string;
@@ -87,6 +92,35 @@ export class Decal {
87
92
  * @type {number}
88
93
  */
89
94
  emissive_intensity: number;
95
+ /**
96
+ * How much of this decal's albedo is written, in [0, 1]. It scales the coverage this one channel
97
+ * blends by: zero leaves the surface's albedo exactly as it was, one writes it at the full
98
+ * coverage of the mask. Carried to the GPU as a 16-bit unorm.
99
+ * @type {number}
100
+ */
101
+ albedo_weight: number;
102
+ /**
103
+ * How much of this decal's normal is written, in [0, 1]. As {@link albedo_weight}.
104
+ * @type {number}
105
+ */
106
+ normal_weight: number;
107
+ /**
108
+ * How much of this decal's roughness is written, in [0, 1]. As {@link albedo_weight}.
109
+ * @type {number}
110
+ */
111
+ roughness_weight: number;
112
+ /**
113
+ * How much of this decal's metalness is written, in [0, 1]. As {@link albedo_weight}.
114
+ * @type {number}
115
+ */
116
+ metalness_weight: number;
117
+ /**
118
+ * How much of this decal's emission is written, in [0, 1]. As {@link albedo_weight} — and since a
119
+ * decal's emission replaces what is beneath it rather than adding to it, zero is also what keeps
120
+ * an emitting surface emitting under a decal.
121
+ * @type {number}
122
+ */
123
+ emissive_weight: number;
90
124
  /**
91
125
  * Internal transient reference to loaded asset
92
126
  * @type {Sampler2D|null}
@@ -119,8 +153,13 @@ export class Decal {
119
153
  metalness: number;
120
154
  emissive_color: string;
121
155
  emissive_intensity: number;
156
+ albedo_weight: number;
157
+ normal_weight: number;
158
+ roughness_weight: number;
159
+ metalness_weight: number;
160
+ emissive_weight: number;
122
161
  };
123
- fromJSON({ uri, uri_albedo, uri_normal, uri_orm, uri_emissive, priority, color, roughness, metalness, emissive_color, emissive_intensity }: {
162
+ fromJSON({ uri, uri_albedo, uri_normal, uri_orm, uri_emissive, priority, color, roughness, metalness, emissive_color, emissive_intensity, albedo_weight, normal_weight, roughness_weight, metalness_weight, emissive_weight }: {
124
163
  uri?: string;
125
164
  uri_albedo?: string;
126
165
  uri_normal?: string;
@@ -132,6 +171,11 @@ export class Decal {
132
171
  metalness?: number;
133
172
  emissive_color?: string;
134
173
  emissive_intensity?: number;
174
+ albedo_weight?: number;
175
+ normal_weight?: number;
176
+ roughness_weight?: number;
177
+ metalness_weight?: number;
178
+ emissive_weight?: number;
135
179
  }): void;
136
180
  hash(): number;
137
181
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Decal.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/decal/v2/Decal.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IAmGI,+BAMC;IAvGD;;;;;;;OAOG;IACH,KAFU,MAAM,CAEP;IAET;;;OAGG;IACH,YAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,YAFU,MAAM,CAEA;IAEhB;;;;;OAKG;IACH,SAFU,MAAM,CAEH;IAEb;;;;OAIG;IACH,cAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,UAFU,MAAM,CAEH;IAEb;;;OAGG;IACH,OAFU,KAAK,CAEe;IAE9B;;;OAGG;IACH,WAFU,MAAM,CAEF;IAEd;;OAEG;IACH,WAFU,MAAM,CAEF;IAEd;;OAEG;IACH,gBAFU,KAAK,CAEwB;IAEvC;;;;OAIG;IACH,oBAFU,MAAM,CAEO;IAEvB;;;;OAIG;IACH,yBAAwB;IAExB;;;;OAIG;IACH,qBAAoB;IAEpB;;;;;;OAMG;IACH,yBAEC;IAUD;;;;;;;;;;;;MAcC;IAED;;;;;;;;;;;;aA+CC;IAED,eAkBC;IAED;;;;OAIG;IACH,cAHW,KAAK,GACH,OAAO,CAenB;CACJ;;;;sBApPqB,oCAAoC"}
1
+ {"version":3,"file":"Decal.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/decal/v2/Decal.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IA0II,+BAMC;IA9ID;;;;;;;OAOG;IACH,KAFU,MAAM,CAEP;IAET;;;;;;;;OAQG;IACH,YAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,YAFU,MAAM,CAEA;IAEhB;;;;;OAKG;IACH,SAFU,MAAM,CAEH;IAEb;;;;OAIG;IACH,cAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,UAFU,MAAM,CAEH;IAEb;;;OAGG;IACH,OAFU,KAAK,CAEe;IAE9B;;;OAGG;IACH,WAFU,MAAM,CAEF;IAEd;;OAEG;IACH,WAFU,MAAM,CAEF;IAEd;;OAEG;IACH,gBAFU,KAAK,CAEwB;IAEvC;;;;OAIG;IACH,oBAFU,MAAM,CAEO;IAEvB;;;;;OAKG;IACH,eAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,eAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,kBAFU,MAAM,CAEK;IAErB;;;OAGG;IACH,kBAFU,MAAM,CAEK;IAErB;;;;;OAKG;IACH,iBAFU,MAAM,CAEI;IAEpB;;;;OAIG;IACH,yBAAwB;IAExB;;;;OAIG;IACH,qBAAoB;IAEpB;;;;;;OAMG;IACH,yBAEC;IAUD;;;;;;;;;;;;;;;;;MAmBC;IAED;;;;;;;;;;;;;;;;;aA+DC;IAED,eAsBC;IAED;;;;OAIG;IACH,cAHW,KAAK,GACH,OAAO,CAoBnB;CACJ;;;;sBAzTqB,oCAAoC"}
@@ -44,7 +44,12 @@ export class Decal {
44
44
  uri = "";
45
45
 
46
46
  /**
47
- * Base colour and coverage. Its alpha is what the decal's coverage means.
47
+ * Base colour and the decal's mask. Its alpha is the coverage every channel blends by, scaled
48
+ * per channel by the `*_weight` fields — so a decal that writes only normals still takes its
49
+ * shape from this alpha, with {@link albedo_weight} at zero.
50
+ *
51
+ * Optional: with none, the mask is one across the whole projection volume and the colour is
52
+ * {@link color}.
48
53
  * @type {string}
49
54
  */
50
55
  uri_albedo = "";
@@ -105,6 +110,40 @@ export class Decal {
105
110
  */
106
111
  emissive_intensity = 0;
107
112
 
113
+ /**
114
+ * How much of this decal's albedo is written, in [0, 1]. It scales the coverage this one channel
115
+ * blends by: zero leaves the surface's albedo exactly as it was, one writes it at the full
116
+ * coverage of the mask. Carried to the GPU as a 16-bit unorm.
117
+ * @type {number}
118
+ */
119
+ albedo_weight = 1;
120
+
121
+ /**
122
+ * How much of this decal's normal is written, in [0, 1]. As {@link albedo_weight}.
123
+ * @type {number}
124
+ */
125
+ normal_weight = 1;
126
+
127
+ /**
128
+ * How much of this decal's roughness is written, in [0, 1]. As {@link albedo_weight}.
129
+ * @type {number}
130
+ */
131
+ roughness_weight = 1;
132
+
133
+ /**
134
+ * How much of this decal's metalness is written, in [0, 1]. As {@link albedo_weight}.
135
+ * @type {number}
136
+ */
137
+ metalness_weight = 1;
138
+
139
+ /**
140
+ * How much of this decal's emission is written, in [0, 1]. As {@link albedo_weight} — and since a
141
+ * decal's emission replaces what is beneath it rather than adding to it, zero is also what keeps
142
+ * an emitting surface emitting under a decal.
143
+ * @type {number}
144
+ */
145
+ emissive_weight = 1;
146
+
108
147
  /**
109
148
  * Internal transient reference to loaded asset
110
149
  * @type {Sampler2D|null}
@@ -150,7 +189,12 @@ export class Decal {
150
189
  roughness: this.roughness,
151
190
  metalness: this.metalness,
152
191
  emissive_color: this.emissive_color.toCssRGBAString(),
153
- emissive_intensity: this.emissive_intensity
192
+ emissive_intensity: this.emissive_intensity,
193
+ albedo_weight: this.albedo_weight,
194
+ normal_weight: this.normal_weight,
195
+ roughness_weight: this.roughness_weight,
196
+ metalness_weight: this.metalness_weight,
197
+ emissive_weight: this.emissive_weight
154
198
  };
155
199
  }
156
200
 
@@ -165,7 +209,12 @@ export class Decal {
165
209
  roughness = 1,
166
210
  metalness = 0,
167
211
  emissive_color = '#FFFFFF',
168
- emissive_intensity = 0
212
+ emissive_intensity = 0,
213
+ albedo_weight = 1,
214
+ normal_weight = 1,
215
+ roughness_weight = 1,
216
+ metalness_weight = 1,
217
+ emissive_weight = 1
169
218
  }) {
170
219
 
171
220
  assert.isString(uri, 'uri');
@@ -178,6 +227,11 @@ export class Decal {
178
227
  assert.isNumber(roughness, 'roughness');
179
228
  assert.isNumber(metalness, 'metalness');
180
229
  assert.isNumber(emissive_intensity, 'emissive_intensity');
230
+ assert.isNumber(albedo_weight, 'albedo_weight');
231
+ assert.isNumber(normal_weight, 'normal_weight');
232
+ assert.isNumber(roughness_weight, 'roughness_weight');
233
+ assert.isNumber(metalness_weight, 'metalness_weight');
234
+ assert.isNumber(emissive_weight, 'emissive_weight');
181
235
 
182
236
  const albedo_before = this.albedo_uri;
183
237
 
@@ -199,12 +253,18 @@ export class Decal {
199
253
  this.metalness = metalness;
200
254
  this.emissive_intensity = emissive_intensity;
201
255
 
256
+ this.albedo_weight = albedo_weight;
257
+ this.normal_weight = normal_weight;
258
+ this.roughness_weight = roughness_weight;
259
+ this.metalness_weight = metalness_weight;
260
+ this.emissive_weight = emissive_weight;
261
+
202
262
  this.color.parse(color);
203
263
  this.emissive_color.parse(emissive_color);
204
264
  }
205
265
 
206
266
  hash() {
207
- return hash_mix3(
267
+ return hash_mix2(hash_mix3(
208
268
  computeStringHash(this.uri) ^ this.color.hash(),
209
269
  hash_mix2(
210
270
  hash_mix2(
@@ -220,7 +280,11 @@ export class Decal {
220
280
  hash_mix2(computeHashFloat(this.roughness), computeHashFloat(this.metalness)),
221
281
  hash_mix2(this.emissive_color.hash(), computeHashFloat(this.emissive_intensity))
222
282
  )
223
- );
283
+ ), hash_mix3(
284
+ hash_mix2(computeHashFloat(this.albedo_weight), computeHashFloat(this.normal_weight)),
285
+ hash_mix2(computeHashFloat(this.roughness_weight), computeHashFloat(this.metalness_weight)),
286
+ computeHashFloat(this.emissive_weight)
287
+ ));
224
288
  }
225
289
 
226
290
  /**
@@ -240,6 +304,11 @@ export class Decal {
240
304
  && this.metalness === other.metalness
241
305
  && this.emissive_color.equals(other.emissive_color)
242
306
  && this.emissive_intensity === other.emissive_intensity
307
+ && this.albedo_weight === other.albedo_weight
308
+ && this.normal_weight === other.normal_weight
309
+ && this.roughness_weight === other.roughness_weight
310
+ && this.metalness_weight === other.metalness_weight
311
+ && this.emissive_weight === other.emissive_weight
243
312
  ;
244
313
  }
245
314
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DecalSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.js"],"names":[],"mappings":"AAGA;;IAEI,oBAAc;IAGd;;;;OAIG;IACH,uCAFW,KAAK,QAmBf;IAED;;;;OAIG;IACH,yCAFW,KAAK,QAmBf;CACJ;gDAvD+C,mEAAmE;sBAC7F,YAAY"}
1
+ {"version":3,"file":"DecalSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.js"],"names":[],"mappings":"AAGA;;IAEI,oBAAc;IAGd;;;;OAIG;IACH,uCAFW,KAAK,QAyBf;IAED;;;;OAIG;IACH,yCAFW,KAAK,QAyBf;CACJ;gDAnE+C,mEAAmE;sBAC7F,YAAY"}
@@ -4,7 +4,7 @@ import { Decal } from "./Decal.js";
4
4
  export class DecalSerializationAdapter extends BinaryClassSerializationAdapter {
5
5
 
6
6
  klass = Decal;
7
- version = 1;
7
+ version = 2;
8
8
 
9
9
  /**
10
10
  *
@@ -28,6 +28,12 @@ export class DecalSerializationAdapter extends BinaryClassSerializationAdapter {
28
28
  buffer.writeFloat32Array(value.emissive_color, 0, 4);
29
29
  buffer.writeFloat32(value.emissive_intensity);
30
30
 
31
+ buffer.writeFloat32(value.albedo_weight);
32
+ buffer.writeFloat32(value.normal_weight);
33
+ buffer.writeFloat32(value.roughness_weight);
34
+ buffer.writeFloat32(value.metalness_weight);
35
+ buffer.writeFloat32(value.emissive_weight);
36
+
31
37
  }
32
38
 
33
39
  /**
@@ -52,5 +58,11 @@ export class DecalSerializationAdapter extends BinaryClassSerializationAdapter {
52
58
  buffer.readFloat32Array(value.emissive_color, 0, 4);
53
59
  value.emissive_intensity = buffer.readFloat32();
54
60
 
61
+ value.albedo_weight = buffer.readFloat32();
62
+ value.normal_weight = buffer.readFloat32();
63
+ value.roughness_weight = buffer.readFloat32();
64
+ value.metalness_weight = buffer.readFloat32();
65
+ value.emissive_weight = buffer.readFloat32();
66
+
55
67
  }
56
68
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A v1 decal wrote every channel it carries. v2 adds a weight per channel, and a v1 decal comes
3
+ * back with all five at one — which is what writing every channel means.
4
+ */
5
+ export class DecalSerializationUpgrader_1_2 extends BinaryClassUpgrader {
6
+ upgrade(source: any, target: any): void;
7
+ }
8
+ import { BinaryClassUpgrader } from "../../../../ecs/storage/binary/BinaryClassUpgrader.js";
9
+ //# sourceMappingURL=DecalSerializationUpgrader_1_2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DecalSerializationUpgrader_1_2.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/decal/v2/DecalSerializationUpgrader_1_2.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH;IAII,wCAyBC;CACJ;oCApCmC,uDAAuD"}
@@ -0,0 +1,37 @@
1
+ import { BinaryClassUpgrader } from "../../../../ecs/storage/binary/BinaryClassUpgrader.js";
2
+
3
+ /**
4
+ * A v1 decal wrote every channel it carries. v2 adds a weight per channel, and a v1 decal comes
5
+ * back with all five at one — which is what writing every channel means.
6
+ */
7
+ export class DecalSerializationUpgrader_1_2 extends BinaryClassUpgrader {
8
+ __startVersion = 1;
9
+ __targetVersion = 2;
10
+
11
+ upgrade(source, target) {
12
+ // uri, uri_albedo, uri_normal, uri_orm, uri_emissive
13
+ for (let i = 0; i < 5; i++) {
14
+ target.writeUTF8String(source.readUTF8String());
15
+ }
16
+
17
+ const scratch = [0, 0, 0, 0];
18
+
19
+ target.writeFloat32(source.readFloat32()); // priority
20
+
21
+ source.readFloat32Array(scratch, 0, 4);
22
+ target.writeFloat32Array(scratch, 0, 4); // color
23
+
24
+ target.writeFloat32(source.readFloat32()); // roughness
25
+ target.writeFloat32(source.readFloat32()); // metalness
26
+
27
+ source.readFloat32Array(scratch, 0, 4);
28
+ target.writeFloat32Array(scratch, 0, 4); // emissive_color
29
+
30
+ target.writeFloat32(source.readFloat32()); // emissive_intensity
31
+
32
+ // albedo, normal, roughness, metalness, emissive weights
33
+ for (let i = 0; i < 5; i++) {
34
+ target.writeFloat32(1);
35
+ }
36
+ }
37
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"DecalSystem.d.ts","sourceRoot":"","sources":["../../../../src/engine/graphics3/DecalSystem.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;GAgBG;AACH;IAmHI;;;OAGG;IACH,4DAkCC;IAxJD,oDAAoC;IAyFpC;;;;OAIG;IACH,oBAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;OAIG;IACH,4BAEC;IAoDD,2CAUC;IAED,4CAgBC;IAED;;;;;;;;;;;;OAYG;IACH,YAJW,KAAK,aACL,WAAW,UACX,MAAM,QAmBhB;IAED;;;;OAIG;IACH,cAJW,KAAK,aACL,WAAW,UACX,MAAM,QAkBhB;IAqDD,6BAiDC;IAED;;OAEG;IACH,kCAkBC;;CACJ;AAED;;;;;;GAMG;AACH;IAYI;;OAEG;IACH,oBAFW,WAAW,EAMrB;IAED,yBAEC;;CACJ;uBAzbsB,kBAAkB;4BACb,iCAAiC;sBACvC,mCAAmC;gCALzB,mDAAmD"}
1
+ {"version":3,"file":"DecalSystem.d.ts","sourceRoot":"","sources":["../../../../src/engine/graphics3/DecalSystem.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;GAgBG;AACH;IA+HI;;;OAGG;IACH,4DAkCC;IApKD,oDAAoC;IAqGpC;;;;OAIG;IACH,oBAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;OAIG;IACH,4BAEC;IAoDD,2CAUC;IAED,4CAgBC;IAED;;;;;;;;;;;;OAYG;IACH,YAJW,KAAK,aACL,WAAW,UACX,MAAM,QAoBhB;IAED;;;;OAIG;IACH,cAJW,KAAK,aACL,WAAW,UACX,MAAM,QAkBhB;IAoDD,6BAmDC;IAED;;OAEG;IACH,kCAkBC;;CACJ;AAED;;;;;;GAMG;AACH;IAYI;;OAEG;IACH,oBAFW,WAAW,EAMrB;IAED,yBAEC;;CACJ;uBAxcsB,kBAAkB;4BACb,iCAAiC;sBACvC,mCAAmC;gCALzB,mDAAmD"}