@carbonenginejs/runtime 0.1.0-alpha.6 → 0.1.0-alpha.7

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.

Potentially problematic release.


This version of @carbonenginejs/runtime might be problematic. Click here for more details.

Files changed (92) hide show
  1. package/dist/global/consts/effectPaths.js +4 -1
  2. package/dist/global/consts/effectPaths.js.map +1 -1
  3. package/dist/global/consts/index.js +1 -1
  4. package/dist/global/index.js +1 -1
  5. package/dist/index.js +3 -3
  6. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js +19 -2
  7. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  8. package/dist/resource/format/index.js +1 -1
  9. package/dist/resource/formats/hlsl/core/carbonTypedViews.js +121 -65
  10. package/dist/resource/formats/hlsl/core/carbonTypedViews.js.map +1 -1
  11. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +10 -7
  12. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  13. package/dist/resource/formats/webgpu/core/effectBackendBodySet.js +3 -1
  14. package/dist/resource/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
  15. package/dist/resource/formats/webgpu/core/packageEffect.js +5 -0
  16. package/dist/resource/formats/webgpu/core/packageEffect.js.map +1 -1
  17. package/dist/resource/formats/webgpu/core/wgsl/emitWgsl.js +20 -0
  18. package/dist/resource/formats/webgpu/core/wgsl/emitWgsl.js.map +1 -1
  19. package/dist/resource/formats/webgpu/core/wgsl/emulatedAddressing.js +93 -4
  20. package/dist/resource/formats/webgpu/core/wgsl/emulatedAddressing.js.map +1 -1
  21. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js +74 -64
  22. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -1
  23. package/dist/resource/formats/webgpu/core/wgsl/lowerFragmentProgram.js +16 -7
  24. package/dist/resource/formats/webgpu/core/wgsl/lowerFragmentProgram.js.map +1 -1
  25. package/dist/resource/formats/webgpu/core/wgsl/wgslTypedViews.js +69 -27
  26. package/dist/resource/formats/webgpu/core/wgsl/wgslTypedViews.js.map +1 -1
  27. package/dist/resource/geometry/registerGeometryResources.js +10 -1
  28. package/dist/resource/geometry/registerGeometryResources.js.map +1 -1
  29. package/dist/sof/EveSOFDNA.js +4 -2
  30. package/dist/sof/EveSOFDNA.js.map +1 -1
  31. package/dist/sof/EveSOFDataMgr.js +83 -69
  32. package/dist/sof/EveSOFDataMgr.js.map +1 -1
  33. package/dist/trinity/core/Tr2Denoiser.js +6 -1
  34. package/dist/trinity/core/Tr2Denoiser.js.map +1 -1
  35. package/dist/trinity/core/Tr2ShadowMap.js +7 -2
  36. package/dist/trinity/core/Tr2ShadowMap.js.map +1 -1
  37. package/dist/trinity/core/context/Tr2RenderContext.js +43 -0
  38. package/dist/trinity/core/context/Tr2RenderContext.js.map +1 -1
  39. package/dist/trinity/core/device/Tr2GpuStructuredBuffer.js +134 -0
  40. package/dist/trinity/core/device/Tr2GpuStructuredBuffer.js.map +1 -0
  41. package/dist/trinity/core/index.js +1 -0
  42. package/dist/trinity/core/index.js.map +1 -1
  43. package/dist/trinity/core/lighting/Tr2LightManager.js +410 -124
  44. package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
  45. package/dist/trinity/eve/effect/lensflare/EveLensflare.js +303 -312
  46. package/dist/trinity/eve/effect/lensflare/EveLensflare.js.map +1 -1
  47. package/dist/trinity/eve/effect/lensflare/EveOccluder.js +117 -0
  48. package/dist/trinity/eve/effect/lensflare/EveOccluder.js.map +1 -0
  49. package/dist/trinity/eve/index.js +1 -0
  50. package/dist/trinity/eve/index.js.map +1 -1
  51. package/dist/trinity/eve/scene/EveSpaceScene.js +286 -6
  52. package/dist/trinity/eve/scene/EveSpaceScene.js.map +1 -1
  53. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js +212 -32
  54. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js.map +1 -1
  55. package/dist/trinity/generated/eve/effect/index.js +0 -1
  56. package/dist/trinity/generated/eve/effect/index.js.map +1 -1
  57. package/dist/trinity/generated/eve/index.js +0 -1
  58. package/dist/trinity/generated/eve/index.js.map +1 -1
  59. package/dist/trinity/generated/index.js +0 -2
  60. package/dist/trinity/generated/index.js.map +1 -1
  61. package/dist/trinity/generated/trinityCore/index.js +0 -1
  62. package/dist/trinity/generated/trinityCore/index.js.map +1 -1
  63. package/dist/trinity/index.js +2 -2
  64. package/dist/trinity/postProcess/Tr2PostProcessRenderer.js +4 -1
  65. package/dist/trinity/postProcess/Tr2PostProcessRenderer.js.map +1 -1
  66. package/dist/trinity/postProcess/Tr2SSAO.js +282 -21
  67. package/dist/trinity/postProcess/Tr2SSAO.js.map +1 -1
  68. package/dist/trinity/shader/parameter/Tr2RuntimeTextureParameter.js +71 -53
  69. package/dist/trinity/shader/parameter/Tr2RuntimeTextureParameter.js.map +1 -1
  70. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +81 -18
  71. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
  72. package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js +46 -4
  73. package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js.map +1 -1
  74. package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js +32 -1
  75. package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js.map +1 -1
  76. package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js +27 -0
  77. package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js.map +1 -1
  78. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +29 -4
  79. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
  80. package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js +32 -2
  81. package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js.map +1 -1
  82. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js +57 -5
  83. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js.map +1 -1
  84. package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js +111 -5
  85. package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js.map +1 -1
  86. package/docs/trinity/reference/classes/generated.md +20 -20
  87. package/docs/trinity/reference/classes/post-process.md +1 -1
  88. package/package.json +1 -1
  89. package/dist/trinity/generated/eve/effect/EveOccluder.js +0 -38
  90. package/dist/trinity/generated/eve/effect/EveOccluder.js.map +0 -1
  91. package/dist/trinity/generated/trinityCore/Tr2GpuStructuredBuffer.js +0 -48
  92. package/dist/trinity/generated/trinityCore/Tr2GpuStructuredBuffer.js.map +0 -1
@@ -4,15 +4,29 @@ import { CjsModel } from '#model';
4
4
  import { carbon, impl, type, CjsSchema } from '#schema';
5
5
  import { mat4 } from '#math/mat4';
6
6
  import { vec3 } from '#math/vec3';
7
+ import { EveSOFDataFactionColorSet as _EveSOFDataFactionCol } from './faction/EveSOFDataFactionColorSet.js';
7
8
 
8
9
  let _initProto, _initClass;
10
+
11
+ // CARBON'S DEFAULTS FOR ABSENT COLOUR TYPES. A .black record stores only the
12
+ // fields that differ from the class default, so a missing colour type means
13
+ // the constructor's value, never 0 (Primary): EveSOFDataAreaMaterial's glow
14
+ // is Hull (EveSOFData.cpp:32), EveSOFDataRace's heat glows Booster and
15
+ // Reactor (EveSOFData.cpp:356-357). Falling back to 0 gave every hull area
16
+ // the faction's Primary colour as its glow - an ordinary colour where an HDR
17
+ // glow belongs, about ten times too dark.
18
+ const {
19
+ TYPE_HULL,
20
+ TYPE_BOOSTER,
21
+ TYPE_REACTOR
22
+ } = _EveSOFDataFactionCol.ColorType;
9
23
  const LOGO_KEYS = Object.freeze(["Primary", "Secondary", "Tertiary", "Marking_01", "Marking_02"]);
10
24
 
11
- /**
12
- * Owns the CPU-side SOF lookup tables consumed by EveSOFDNA and EveSOF.
13
- *
14
- * Carbon declares its many projection records as nested C++ structs. They are
15
- * plain JavaScript records here; they are not persisted fields on the manager.
25
+ /**
26
+ * Owns the CPU-side SOF lookup tables consumed by EveSOFDNA and EveSOF.
27
+ *
28
+ * Carbon declares its many projection records as nested C++ structs. They are
29
+ * plain JavaScript records here; they are not persisted fields on the manager.
16
30
  */
17
31
  let _EveSOFDataMgr;
18
32
  new class extends _identity {
@@ -93,9 +107,9 @@ new class extends _identity {
93
107
  return this.#hullData.has(String(name));
94
108
  }
95
109
 
96
- /**
97
- * Returns the normalized hull projection for an exact key, or null when
98
- * absent.
110
+ /**
111
+ * Returns the normalized hull projection for an exact key, or null when
112
+ * absent.
99
113
  */
100
114
  GetHullData(name) {
101
115
  return this.#hullData.get(String(name)) ?? null;
@@ -106,9 +120,9 @@ new class extends _identity {
106
120
  return this.#factionData.has(String(name));
107
121
  }
108
122
 
109
- /**
110
- * Returns the normalized faction projection for an exact key, or null when
111
- * absent.
123
+ /**
124
+ * Returns the normalized faction projection for an exact key, or null when
125
+ * absent.
112
126
  */
113
127
  GetFactionData(name) {
114
128
  return this.#factionData.get(String(name)) ?? null;
@@ -119,9 +133,9 @@ new class extends _identity {
119
133
  return this.#raceData.has(String(name));
120
134
  }
121
135
 
122
- /**
123
- * Returns the normalized race projection for an exact key, or null when
124
- * absent.
136
+ /**
137
+ * Returns the normalized race projection for an exact key, or null when
138
+ * absent.
125
139
  */
126
140
  GetRaceData(name) {
127
141
  return this.#raceData.get(String(name)) ?? null;
@@ -132,9 +146,9 @@ new class extends _identity {
132
146
  return this.#materialData.has(String(name));
133
147
  }
134
148
 
135
- /**
136
- * Returns the normalized material projection for an exact key, or null when
137
- * absent.
149
+ /**
150
+ * Returns the normalized material projection for an exact key, or null when
151
+ * absent.
138
152
  */
139
153
  GetMaterialData(name) {
140
154
  return this.#materialData.get(String(name)) ?? null;
@@ -145,9 +159,9 @@ new class extends _identity {
145
159
  return this.#patternData.has(String(name));
146
160
  }
147
161
 
148
- /**
149
- * Returns the normalized pattern projection for an exact key, or null when
150
- * absent.
162
+ /**
163
+ * Returns the normalized pattern projection for an exact key, or null when
164
+ * absent.
151
165
  */
152
166
  GetPatternData(name) {
153
167
  return this.#patternData.get(String(name)) ?? null;
@@ -171,9 +185,9 @@ new class extends _identity {
171
185
  return this.#layoutData.get(String(nameOrNames)) ?? null;
172
186
  }
173
187
 
174
- /**
175
- * Exposes the current normalized generic projection used by DNA and SOF
176
- * assembly.
188
+ /**
189
+ * Exposes the current normalized generic projection used by DNA and SOF
190
+ * assembly.
177
191
  */
178
192
  GetGenericData() {
179
193
  return this.#genericData;
@@ -259,59 +273,59 @@ new class extends _identity {
259
273
  return application ? projectJsonValue(application) : null;
260
274
  }
261
275
 
262
- /**
263
- * Normalizes a supplied hull graph and stores its projection under the
264
- * requested key.
276
+ /**
277
+ * Normalizes a supplied hull graph and stores its projection under the
278
+ * requested key.
265
279
  */
266
280
  UpdateHull(name, value) {
267
281
  return updateNamed(this.#hullData, name, value, projectHull);
268
282
  }
269
283
 
270
- /**
271
- * Normalizes a supplied faction graph and stores its projection under the
272
- * requested key.
284
+ /**
285
+ * Normalizes a supplied faction graph and stores its projection under the
286
+ * requested key.
273
287
  */
274
288
  UpdateFaction(name, value) {
275
289
  return updateNamed(this.#factionData, name, value, projectFaction);
276
290
  }
277
291
 
278
- /**
279
- * Normalizes a supplied race graph and stores its projection under the
280
- * requested key.
292
+ /**
293
+ * Normalizes a supplied race graph and stores its projection under the
294
+ * requested key.
281
295
  */
282
296
  UpdateRace(name, value) {
283
297
  return updateNamed(this.#raceData, name, value, projectRace);
284
298
  }
285
299
 
286
- /**
287
- * Normalizes a supplied material graph and stores its projection under the
288
- * requested key.
300
+ /**
301
+ * Normalizes a supplied material graph and stores its projection under the
302
+ * requested key.
289
303
  */
290
304
  UpdateMaterial(name, value) {
291
305
  return updateNamed(this.#materialData, name, value, projectMaterial);
292
306
  }
293
307
 
294
- /**
295
- * Rejects a missing value, otherwise normalizes and replaces the keyed pattern
296
- * projection.
308
+ /**
309
+ * Rejects a missing value, otherwise normalizes and replaces the keyed pattern
310
+ * projection.
297
311
  */
298
312
  UpdatePattern(name, value) {
299
313
  if (!value) return false;
300
314
  return updateNamed(this.#patternData, name, value, projectPattern);
301
315
  }
302
316
 
303
- /**
304
- * Rejects a missing value, otherwise normalizes and replaces the keyed layout
305
- * projection.
317
+ /**
318
+ * Rejects a missing value, otherwise normalizes and replaces the keyed layout
319
+ * projection.
306
320
  */
307
321
  UpdateLayout(name, value) {
308
322
  if (!value) return false;
309
323
  return updateNamed(this.#layoutData, name, value, projectLayout);
310
324
  }
311
325
 
312
- /**
313
- * Rejects a missing value, otherwise replaces the manager's normalized generic
314
- * projection.
326
+ /**
327
+ * Rejects a missing value, otherwise replaces the manager's normalized generic
328
+ * projection.
315
329
  */
316
330
  UpdateGeneric(value) {
317
331
  if (!value) return false;
@@ -320,9 +334,9 @@ new class extends _identity {
320
334
  return true;
321
335
  }
322
336
 
323
- /**
324
- * Empties every named projection table and restores an empty normalized
325
- * generic record.
337
+ /**
338
+ * Empties every named projection table and restores an empty normalized
339
+ * generic record.
326
340
  */
327
341
  #clear() {
328
342
  this.#hullData.clear();
@@ -1025,8 +1039,8 @@ function projectFaction(value) {
1025
1039
  }
1026
1040
  function projectRace(value) {
1027
1041
  const areaMaterials = createAreaMaterialData();
1028
- areaMaterials.glowColor.set("0:GeneralHeatGlowColor", Number(value.hullPrimaryHeatColorType ?? 0));
1029
- areaMaterials.glowColor.set("3:GeneralHeatGlowColor", Number(value.hullReactorHeatColorType ?? 0));
1042
+ areaMaterials.glowColor.set("0:GeneralHeatGlowColor", Number(value.hullPrimaryHeatColorType ?? TYPE_BOOSTER));
1043
+ areaMaterials.glowColor.set("3:GeneralHeatGlowColor", Number(value.hullReactorHeatColorType ?? TYPE_REACTOR));
1030
1044
  return {
1031
1045
  ...value,
1032
1046
  areaMaterials,
@@ -1533,13 +1547,13 @@ function selectAreaMaterial(areaTypes, key) {
1533
1547
  return selectNamedSlot(areaTypes, key, "materials");
1534
1548
  }
1535
1549
 
1536
- /**
1537
- * Carbon's generated records declare one property per slot (EveSOFDataArea's
1538
- * AreaType properties, EveSOFDataFactionColorSet's ColorType properties), but
1539
- * the decoded data.black record carries those slots as a lowercase-keyed child
1540
- * map instead. Both shapes reach these projections, and reading only the
1541
- * declared property names silently produced empty area materials and
1542
- * all-black faction colors.
1550
+ /**
1551
+ * Carbon's generated records declare one property per slot (EveSOFDataArea's
1552
+ * AreaType properties, EveSOFDataFactionColorSet's ColorType properties), but
1553
+ * the decoded data.black record carries those slots as a lowercase-keyed child
1554
+ * map instead. Both shapes reach these projections, and reading only the
1555
+ * declared property names silently produced empty area materials and
1556
+ * all-black faction colors.
1543
1557
  */
1544
1558
  function selectNamedSlot(container, key, mapName) {
1545
1559
  if (!container) return null;
@@ -1572,14 +1586,14 @@ function mergeAreaMaterial(result, value, areaType) {
1572
1586
  [areaMaterialName(value.material1, "material1"), areaMaterialName(value.material2, "material2"), areaMaterialName(value.material3, "material3"), areaMaterialName(value.material4, "material4")].forEach((name, materialIndex) => {
1573
1587
  if (name) result.materialNames.set(`${areaType}:${materialIndex}`, name);
1574
1588
  });
1575
- result.glowColor.set(`${areaType}:GeneralGlowColor`, Number(value.colorType ?? 0));
1589
+ result.glowColor.set(`${areaType}:GeneralGlowColor`, Number(value.colorType ?? TYPE_HULL));
1576
1590
  }
1577
1591
 
1578
- /**
1579
- * Carbon's m_material[N] is a plain string, but the decoded data.black record
1580
- * wraps each slot in its own single-key object ({ material1: "name" }).
1581
- * Stringifying that wrapper produced "[object Object]" material names, so no
1582
- * material record was ever found.
1592
+ /**
1593
+ * Carbon's m_material[N] is a plain string, but the decoded data.black record
1594
+ * wraps each slot in its own single-key object ({ material1: "name" }).
1595
+ * Stringifying that wrapper produced "[object Object]" material names, so no
1596
+ * material record was ever found.
1583
1597
  */
1584
1598
  function areaMaterialName(value, key) {
1585
1599
  if (!value) return "";
@@ -1593,13 +1607,13 @@ function copyVector(value) {
1593
1607
  return value ? Array.from(value) : [0, 0, 0, 0];
1594
1608
  }
1595
1609
 
1596
- /**
1597
- * Flattens one authored parameter record to a shader vec4 the way Carbon's
1598
- * virtual EveSOFDataParameter::GetValue does (EveSOFData.cpp:85-102): typed
1599
- * records answer through GetValue when they are live class instances, and
1600
- * plain data flattens by value shape - booleans and numbers broadcast to all
1601
- * four components, two-component values zero-pad z and w, three-component
1602
- * values zero-pad w (0, not 1), four-component values copy through.
1610
+ /**
1611
+ * Flattens one authored parameter record to a shader vec4 the way Carbon's
1612
+ * virtual EveSOFDataParameter::GetValue does (EveSOFData.cpp:85-102): typed
1613
+ * records answer through GetValue when they are live class instances, and
1614
+ * plain data flattens by value shape - booleans and numbers broadcast to all
1615
+ * four components, two-component values zero-pad z and w, three-component
1616
+ * values zero-pad w (0, not 1), four-component values copy through.
1603
1617
  */
1604
1618
  function flattenParameterValue(parameter) {
1605
1619
  if (typeof parameter?.GetValue === "function") return Array.from(parameter.GetValue());