@woosh/meep-engine 3.72.0 → 3.73.0

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 (69) hide show
  1. package/package.json +1 -1
  2. package/src/engine/graphics/ecs/text/Text.d.ts +21 -2
  3. package/src/engine/graphics/ecs/text/Text.d.ts.map +1 -1
  4. package/src/engine/graphics/ecs/text/Text.js +24 -3
  5. package/src/engine/graphics3/TextSystem.d.ts +9 -8
  6. package/src/engine/graphics3/TextSystem.d.ts.map +1 -1
  7. package/src/engine/graphics3/TextSystem.js +65 -134
  8. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  9. package/src/shade/device/pipeline/PipelineEnquiry.d.ts +11 -5
  10. package/src/shade/device/pipeline/PipelineEnquiry.d.ts.map +1 -1
  11. package/src/shade/device/pipeline/PipelineEnquiry.js +7 -0
  12. package/src/shade/playground/text/main.js +4 -1
  13. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  14. package/src/shade/renderer/Renderer.js +10 -1
  15. package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.d.ts +8 -0
  16. package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.d.ts.map +1 -1
  17. package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.js +18 -0
  18. package/src/shade/renderer/extension/PresentTarget.d.ts +10 -0
  19. package/src/shade/renderer/extension/PresentTarget.d.ts.map +1 -1
  20. package/src/shade/renderer/extension/PresentTarget.js +17 -0
  21. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  22. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  23. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
  24. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  25. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  26. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
  27. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  28. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  29. package/src/shade/renderer/text/GPUTextAVBOITChannel.d.ts.map +1 -1
  30. package/src/shade/renderer/text/GPUTextAVBOITChannel.js +67 -37
  31. package/src/shade/renderer/text/GPUTextSystem.d.ts +7 -0
  32. package/src/shade/renderer/text/GPUTextSystem.d.ts.map +1 -1
  33. package/src/shade/renderer/text/GPUTextSystem.js +40 -0
  34. package/src/shade/renderer/text/data/TEXT_RECORD.d.ts +1 -1
  35. package/src/shade/renderer/text/data/TEXT_RECORD.d.ts.map +1 -1
  36. package/src/shade/renderer/text/data/TEXT_RECORD.js +9 -4
  37. package/src/shade/renderer/text/graph_text.d.ts +14 -94
  38. package/src/shade/renderer/text/graph_text.d.ts.map +1 -1
  39. package/src/shade/renderer/text/graph_text.js +83 -106
  40. package/src/shade/renderer/text/graph_text_avboit.d.ts +1 -1
  41. package/src/shade/renderer/text/graph_text_avboit.js +1 -1
  42. package/src/shade/renderer/text/runtime/TextParameters.d.ts +11 -0
  43. package/src/shade/renderer/text/runtime/TextParameters.d.ts.map +1 -1
  44. package/src/shade/renderer/text/runtime/TextParameters.js +23 -1
  45. package/src/shade/renderer/text/shaders/TEXT_VIEW_STRUCT.d.ts +3 -1
  46. package/src/shade/renderer/text/shaders/TEXT_VIEW_STRUCT.d.ts.map +1 -1
  47. package/src/shade/renderer/text/shaders/TEXT_VIEW_STRUCT.js +20 -2
  48. package/src/shade/renderer/text/shaders/chunk_text_canvas_color.d.ts +15 -0
  49. package/src/shade/renderer/text/shaders/chunk_text_canvas_color.d.ts.map +1 -0
  50. package/src/shade/renderer/text/shaders/chunk_text_canvas_color.js +29 -0
  51. package/src/shade/renderer/text/shaders/chunk_text_facing.d.ts +7 -2
  52. package/src/shade/renderer/text/shaders/chunk_text_facing.d.ts.map +1 -1
  53. package/src/shade/renderer/text/shaders/chunk_text_facing.js +19 -2
  54. package/src/shade/renderer/text/shaders/shader_text_count.d.ts +4 -4
  55. package/src/shade/renderer/text/shaders/shader_text_count.d.ts.map +1 -1
  56. package/src/shade/renderer/text/shaders/shader_text_count.js +15 -8
  57. package/src/shade/renderer/text/shaders/shader_text_count_scene.d.ts +2 -2
  58. package/src/shade/renderer/text/shaders/shader_text_count_scene.d.ts.map +1 -1
  59. package/src/shade/renderer/text/shaders/shader_text_count_scene.js +4 -5
  60. package/src/shade/renderer/text/shaders/shader_text_facing_draw.d.ts +2 -2
  61. package/src/shade/renderer/text/shaders/shader_text_facing_draw.d.ts.map +1 -1
  62. package/src/shade/renderer/text/shaders/shader_text_facing_draw.js +6 -3
  63. package/src/shade/renderer/text/shaders/shader_text_facing_draw_shadow.d.ts +19 -0
  64. package/src/shade/renderer/text/shaders/shader_text_facing_draw_shadow.d.ts.map +1 -0
  65. package/src/shade/renderer/text/shaders/shader_text_facing_draw_shadow.js +156 -0
  66. package/src/shade/renderer/text/shaders/shader_text_facing_draw_stroked.d.ts +2 -1
  67. package/src/shade/renderer/text/shaders/shader_text_facing_draw_stroked.d.ts.map +1 -1
  68. package/src/shade/renderer/text/shaders/shader_text_facing_draw_stroked.js +7 -3
  69. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
@@ -1223,6 +1223,8 @@ export class Renderer {
1223
1223
  ) {
1224
1224
  const enquiry = PipelineEnquiry.from(this.device);
1225
1225
 
1226
+ enquiry.presentation_format = this.#presentation_format;
1227
+
1226
1228
  extension.enquirePipelines(enquiry);
1227
1229
 
1228
1230
  const render = enquiry.render;
@@ -2248,6 +2250,8 @@ export class Renderer {
2248
2250
 
2249
2251
  const core_enquiry = PipelineEnquiry.from(this.device);
2250
2252
 
2253
+ core_enquiry.presentation_format = this.#presentation_format;
2254
+
2251
2255
  this.#enquire_core_pipelines(core_enquiry);
2252
2256
 
2253
2257
  for (let i = 0; i < core_enquiry.render.length; i++) {
@@ -2270,6 +2274,8 @@ export class Renderer {
2270
2274
 
2271
2275
  const ext_enquiry = PipelineEnquiry.from(this.device);
2272
2276
 
2277
+ ext_enquiry.presentation_format = this.#presentation_format;
2278
+
2273
2279
  extension.enquirePipelines(ext_enquiry);
2274
2280
 
2275
2281
  const render = ext_enquiry.render;
@@ -3906,7 +3912,10 @@ export class Renderer {
3906
3912
  */
3907
3913
  frame.phase = FramePhase.Overlay;
3908
3914
 
3909
- frame.create(PresentTarget).canvas = current_color_out;
3915
+ const present = frame.create(PresentTarget);
3916
+
3917
+ present.canvas = current_color_out;
3918
+ present.display_from_rec709 = this.tone_mapper.display.display_from_rec709;
3910
3919
 
3911
3920
  this.#extensions.run(frame, extension_filter);
3912
3921
 
@@ -11,6 +11,13 @@ export class TonemapDisplaySettings {
11
11
  display_from_rec2020_c0: Float32Array;
12
12
  display_from_rec2020_c1: Float32Array;
13
13
  display_from_rec2020_c2: Float32Array;
14
+ /**
15
+ * The matrix from linear Rec. 709, the space colours are authored in, to the canvas's linear primaries: nine
16
+ * floats, a column after a column. What is drawn straight onto the canvas goes through it and then the sRGB
17
+ * transfer function.
18
+ * @type {Float32Array}
19
+ */
20
+ display_from_rec709: Float32Array;
14
21
  /**
15
22
  * The display's peak, cd/m². An HDR LUT is baked for it.
16
23
  * @type {number}
@@ -23,6 +30,7 @@ export class TonemapDisplaySettings {
23
30
  * `"display-p3"`
24
31
  */
25
32
  set_canvas_color_space(color_space: PredefinedColorSpace | string): void;
33
+ #private;
26
34
  }
27
35
  /**
28
36
  * Immediate data of the tone mapper's apply passes. Filled by {@link TonemapDisplaySettings}.
@@ -1 +1 @@
1
- {"version":3,"file":"TonemapDisplaySettings.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.js"],"names":[],"mappings":"AAiDA;;;;;;;;GAQG;AACH;IACI,sCAA8C;IAC9C,sCAA8C;IAC9C,sCAA8C;IAE9C;;;OAGG;IACH,WAFU,MAAM,CAEC;IAMjB;;;;;OAKG;IACH,oCAHW,oBAAoB,GAAC,MAAM,QAcrC;CACJ;AAED;;GAEG;AACH,4CAKG;6BAjG0B,mCAAmC"}
1
+ {"version":3,"file":"TonemapDisplaySettings.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.js"],"names":[],"mappings":"AAiDA;;;;;;;;GAQG;AACH;IACI,sCAA8C;IAC9C,sCAA8C;IAC9C,sCAA8C;IAE9C;;;;;OAKG;IACH,qBAFU,YAAY,CAEoB;IAQ1C;;;OAGG;IACH,WAFU,MAAM,CAEC;IAMjB;;;;;OAKG;IACH,oCAHW,oBAAoB,GAAC,MAAM,QAkBrC;;CACJ;AAED;;GAEG;AACH,4CAKG;6BAnH0B,mCAAmC"}
@@ -61,6 +61,20 @@ export class TonemapDisplaySettings {
61
61
  display_from_rec2020_c1 = new Float32Array(3);
62
62
  display_from_rec2020_c2 = new Float32Array(3);
63
63
 
64
+ /**
65
+ * The matrix from linear Rec. 709, the space colours are authored in, to the canvas's linear primaries: nine
66
+ * floats, a column after a column. What is drawn straight onto the canvas goes through it and then the sRGB
67
+ * transfer function.
68
+ * @type {Float32Array}
69
+ */
70
+ display_from_rec709 = new Float32Array(9);
71
+
72
+ #display_from_rec709_columns = [
73
+ this.display_from_rec709.subarray(0, 3),
74
+ this.display_from_rec709.subarray(3, 6),
75
+ this.display_from_rec709.subarray(6, 9),
76
+ ];
77
+
64
78
  /**
65
79
  * The display's peak, cd/m². An HDR LUT is baked for it.
66
80
  * @type {number}
@@ -88,6 +102,10 @@ export class TonemapDisplaySettings {
88
102
  this.display_from_rec2020_c0, this.display_from_rec2020_c1, this.display_from_rec2020_c2,
89
103
  PRIMARIES_REC2020, display
90
104
  );
105
+
106
+ const columns = this.#display_from_rec709_columns;
107
+
108
+ write_columns(columns[0], columns[1], columns[2], PRIMARIES_REC709, display);
91
109
  }
92
110
  }
93
111
 
@@ -13,6 +13,16 @@
13
13
  */
14
14
  export class PresentTarget extends FrameRecord {
15
15
  static is_present_at(phase: any): boolean;
16
+ /**
17
+ * How a colour is written onto the canvas. The canvas holds display values: a linear Rec. 709 colour goes
18
+ * through this matrix, to the canvas's own linear primaries, and then through the sRGB transfer function. Nine
19
+ * floats, a column after a column. The renderer's own, not to be written.
20
+ *
21
+ * What is blended onto the canvas is blended in those display values, as a page's content is.
22
+ *
23
+ * @type {Float32Array}
24
+ */
25
+ display_from_rec709: Float32Array;
16
26
  set canvas(handle: number);
17
27
  /**
18
28
  * @returns {number}
@@ -1 +1 @@
1
- {"version":3,"file":"PresentTarget.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/extension/PresentTarget.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH;IAGI,0CAEC;IASD,2BAEC;IATD;;OAEG;IACH,qBAEC;;CAKJ;4BAhC2B,kBAAkB"}
1
+ {"version":3,"file":"PresentTarget.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/extension/PresentTarget.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;GAYG;AACH;IAcI,0CAEC;IAbD;;;;;;;;OAQG;IACH,qBAFU,YAAY,CAES;IAa/B,2BAEC;IATD;;OAEG;IACH,qBAEC;;CAKJ;4BAjD2B,kBAAkB"}
@@ -1,6 +1,12 @@
1
1
  import { FramePhase } from "./FramePhase.js";
2
2
  import { FrameRecord } from "./FrameRecord.js";
3
3
 
4
+ /**
5
+ * What a canvas in the sRGB colour space takes a linear Rec. 709 colour through.
6
+ * @type {Float32Array}
7
+ */
8
+ const IDENTITY = new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
9
+
4
10
  /**
5
11
  * The canvas the tonemapped frame has been written to, carried at {@link FramePhase.Overlay} and
6
12
  * nowhere else.
@@ -17,6 +23,17 @@ import { FrameRecord } from "./FrameRecord.js";
17
23
  export class PresentTarget extends FrameRecord {
18
24
  #canvas = -1;
19
25
 
26
+ /**
27
+ * How a colour is written onto the canvas. The canvas holds display values: a linear Rec. 709 colour goes
28
+ * through this matrix, to the canvas's own linear primaries, and then through the sRGB transfer function. Nine
29
+ * floats, a column after a column. The renderer's own, not to be written.
30
+ *
31
+ * What is blended onto the canvas is blended in those display values, as a page's content is.
32
+ *
33
+ * @type {Float32Array}
34
+ */
35
+ display_from_rec709 = IDENTITY;
36
+
20
37
  static is_present_at(phase) {
21
38
  return phase === FramePhase.Overlay;
22
39
  }
@@ -145,7 +145,7 @@ export class GPUFluidCascade {
145
145
  * @param {*} _resources
146
146
  * @param {{encoder: ShadeGPUCommandContext}} context
147
147
  */
148
- static "__#286@#execute_restrict"(record: object, _resources: any, context: {
148
+ static "__#287@#execute_restrict"(record: object, _resources: any, context: {
149
149
  encoder: ShadeGPUCommandContext;
150
150
  }): void;
151
151
  /**
@@ -153,7 +153,7 @@ export class GPUFluidCascade {
153
153
  * @param {*} _resources
154
154
  * @param {{encoder: ShadeGPUCommandContext}} context
155
155
  */
156
- static "__#286@#execute_fill"(record: object, _resources: any, context: {
156
+ static "__#287@#execute_fill"(record: object, _resources: any, context: {
157
157
  encoder: ShadeGPUCommandContext;
158
158
  }): void;
159
159
  /**
@@ -161,7 +161,7 @@ export class GPUFluidCascade {
161
161
  * @param {import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources} resources
162
162
  * @param {{encoder: ShadeGPUCommandContext}} context
163
163
  */
164
- static "__#286@#execute"(record: object, resources: import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
164
+ static "__#287@#execute"(record: object, resources: import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
165
165
  encoder: ShadeGPUCommandContext;
166
166
  }): void;
167
167
  /**
@@ -65,7 +65,7 @@ export class GPUFluidCascadeStack {
65
65
  * @param {*} _resources
66
66
  * @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
67
67
  */
68
- static "__#288@#execute_publish"(pass: object, _resources: any, context: {
68
+ static "__#289@#execute_publish"(pass: object, _resources: any, context: {
69
69
  encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
70
70
  }): void;
71
71
  /**
@@ -86,7 +86,7 @@ export class GPUFluidForcing {
86
86
  * @param {FluidObstacleRecord} record
87
87
  * @returns {number} metres
88
88
  */
89
- static "__#289@#resolved_extent"(record: FluidObstacleRecord): number;
89
+ static "__#290@#resolved_extent"(record: FluidObstacleRecord): number;
90
90
  /**
91
91
  * The descriptor of a transient of `role`, `size` bytes, from `kept` (by role): the one kept for
92
92
  * the role while its size holds, a new one when it moves. A role's usage and clear range never
@@ -99,19 +99,19 @@ export class GPUFluidForcing {
99
99
  * @param {number} clear_size bytes cleared from 0 when the pool reuses the buffer
100
100
  * @returns {BufferResourceDescriptor}
101
101
  */
102
- static "__#289@#descriptor"(kept: BufferResourceDescriptor[], role: number, size: number, usage: number, clear_size: number): BufferResourceDescriptor;
102
+ static "__#290@#descriptor"(kept: BufferResourceDescriptor[], role: number, size: number, usage: number, clear_size: number): BufferResourceDescriptor;
103
103
  /**
104
104
  * @param {object} record
105
105
  * @param {FramePassResources} resources
106
106
  * @param {{encoder: ShadeGPUCommandContext}} context
107
107
  */
108
- static "__#289@#execute_extract"(record: object, resources: FramePassResources, context: {
108
+ static "__#290@#execute_extract"(record: object, resources: FramePassResources, context: {
109
109
  encoder: ShadeGPUCommandContext;
110
110
  }): void;
111
- static "__#289@#execute_clear"(record: any, _resources: any, context: any): void;
112
- static "__#289@#execute_query"(record: any, resources: any, context: any): void;
113
- static "__#289@#execute_command"(record: any, resources: any, context: any): void;
114
- static "__#289@#execute_apply"(record: any, resources: any, context: any): void;
111
+ static "__#290@#execute_clear"(record: any, _resources: any, context: any): void;
112
+ static "__#290@#execute_query"(record: any, resources: any, context: any): void;
113
+ static "__#290@#execute_command"(record: any, resources: any, context: any): void;
114
+ static "__#290@#execute_apply"(record: any, resources: any, context: any): void;
115
115
  /**
116
116
  * @param {object} options
117
117
  * @param {GPUDevice} options.device
@@ -41,7 +41,7 @@ export class GPUFluidPressureSolve {
41
41
  * @param {*} _resources
42
42
  * @param {{encoder: ShadeGPUCommandContext}} context
43
43
  */
44
- static "__#285@#execute"(data: {
44
+ static "__#286@#execute"(data: {
45
45
  solve: GPUFluidPressureSolve;
46
46
  arm: number;
47
47
  count: number;
@@ -49,7 +49,7 @@ export class GPUFluidQueries {
49
49
  * @param {import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources} resources
50
50
  * @param {{encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
51
51
  */
52
- static "__#290@#execute"(pass: object, resources: import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
52
+ static "__#291@#execute"(pass: object, resources: import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
53
53
  encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
54
54
  }): void;
55
55
  /**
@@ -34,7 +34,7 @@ export class GPUProbeClipmapGI {
34
34
  * @param {ProbeClipmapSettings} settings
35
35
  * @returns {boolean} whether it is what the settings' world cache describes, in their frustum's windows
36
36
  */
37
- static "__#209@#world_cache_built_for"(world_cache: GPUProbeClipmap, settings: ProbeClipmapSettings): boolean;
37
+ static "__#210@#world_cache_built_for"(world_cache: GPUProbeClipmap, settings: ProbeClipmapSettings): boolean;
38
38
  /**
39
39
  * @param {GraphicsContext} graphics
40
40
  */
@@ -13,7 +13,7 @@ export class TinyGltf {
13
13
  * @readonly
14
14
  * @type {TextureFormat}
15
15
  */
16
- static readonly "__#309@#UNCOMPRESSED_TARGET": TextureFormat;
16
+ static readonly "__#310@#UNCOMPRESSED_TARGET": TextureFormat;
17
17
  /**
18
18
  * @param {AssetManager} assetManager
19
19
  * @param {AssetRequestScope} [scope]
@@ -51,7 +51,7 @@ export class NSS {
51
51
  * @returns {number}
52
52
  */
53
53
  static recommended_jitter_sequence_size(upscale_ratio: number): number;
54
- static "__#217@#preprocess_tensor_descriptor"(render_w: any, render_h: any): TextureResourceDescriptor;
54
+ static "__#218@#preprocess_tensor_descriptor"(render_w: any, render_h: any): TextureResourceDescriptor;
55
55
  /**
56
56
  * @param {GraphicsContext} graphics
57
57
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GPUTextAVBOITChannel.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/text/GPUTextAVBOITChannel.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH;IAMI;;;;;;;;;OASG;IACH,mBAPW,MAAM,YACN,OAAO,2BAA2B,EAAE,cAAc,WAClD,OAAO,oBAAoB,EAAE,aAAa,QAC1C,YAAY,kBACZ,MAAM,2BAKhB;IAED;;OAEG;IACH,kBAEC;IAED;;;OAGG;IACH,0BAHW,OAAO,2BAA2B,EAAE,cAAc,GAChD,OAAO,CAQnB;IAED;;;;;eAcC;IAED;;;;;;;;;;MAgBC;IAED;;;;;;;;;;;;;;;MAiCC;;CAYJ"}
1
+ {"version":3,"file":"GPUTextAVBOITChannel.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/text/GPUTextAVBOITChannel.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH;IA4BI;;;;;;;;;OASG;IACH,mBAPW,MAAM,YACN,OAAO,2BAA2B,EAAE,cAAc,WAClD,OAAO,oBAAoB,EAAE,aAAa,QAC1C,YAAY,kBACZ,MAAM,2BAWhB;IAED;;OAEG;IACH,kBAQC;IAED;;;OAGG;IACH,0BAHW,OAAO,2BAA2B,EAAE,cAAc,GAChD,OAAO,CAMnB;IAED;;;;;eAcC;IAED;;;;;;;;;;MAgBC;IAED;;;;;;;;;;;;;;;MAmCC;;CAQJ"}
@@ -21,9 +21,31 @@ import { graph_text_avboit_draw, graph_text_avboit_gather, graph_text_avboit_spl
21
21
  */
22
22
  export class GPUTextAVBOITChannel {
23
23
  /**
24
- * @type {{graph: object, view_ctx: object, runtime: import("./GPUTextSystem.js").GPUTextSystem, view: Float32Array, scene_database: number, shapes: GPUBuffer, gather: import("./graph_text_avboit.js").TextAVBOITHandles|null}|null}
24
+ * The graph of the frame handed over, or null between frames: what the other fields are of.
25
+ * @type {object|null}
25
26
  */
26
- #frame = null;
27
+ #graph = null;
28
+
29
+ /** @type {import("../view/GPUViewContext.js").GPUViewContext|null} */
30
+ #view_ctx = null;
31
+
32
+ /** @type {import("./GPUTextSystem.js").GPUTextSystem|null} */
33
+ #runtime = null;
34
+
35
+ /** @type {Float32Array|null} */
36
+ #view = null;
37
+
38
+ /** @type {number} */
39
+ #scene_database = -1;
40
+
41
+ /** @type {GPUBuffer|null} */
42
+ #shapes = null;
43
+
44
+ /**
45
+ * The frame's glyph list, once the occupancy is recorded.
46
+ * @type {import("./graph_text_avboit.js").TextAVBOITHandles|null}
47
+ */
48
+ #gather = null;
27
49
 
28
50
  /**
29
51
  * The frame the site's texts are drawn in. The runtime's records and shapes are on the device already.
@@ -36,14 +58,26 @@ export class GPUTextAVBOITChannel {
36
58
  * @param {GPUBuffer} shapes the shape buffer, as {@link GPUTextSystem#upload} returned it
37
59
  */
38
60
  begin_frame(graph, view_ctx, runtime, view, scene_database, shapes) {
39
- this.#frame = { graph, view_ctx, runtime, view, scene_database, shapes, gather: null };
61
+ this.#graph = graph;
62
+ this.#view_ctx = view_ctx;
63
+ this.#runtime = runtime;
64
+ this.#view = view;
65
+ this.#scene_database = scene_database;
66
+ this.#shapes = shapes;
67
+ this.#gather = null;
40
68
  }
41
69
 
42
70
  /**
43
71
  * Forget the frame: the passes carry their own references to what they read.
44
72
  */
45
73
  end_frame() {
46
- this.#frame = null;
74
+ this.#graph = null;
75
+ this.#view_ctx = null;
76
+ this.#runtime = null;
77
+ this.#view = null;
78
+ this.#scene_database = -1;
79
+ this.#shapes = null;
80
+ this.#gather = null;
47
81
  }
48
82
 
49
83
  /**
@@ -51,41 +85,39 @@ export class GPUTextAVBOITChannel {
51
85
  * @returns {boolean}
52
86
  */
53
87
  avboit_is_empty(view_ctx) {
54
- const frame = this.#frame;
55
-
56
- return frame === null
57
- || frame.view_ctx !== view_ctx
58
- || text_site_glyph_count(frame.runtime, TextSite.Transparency) === 0;
88
+ // between frames there is no view: nothing is of any view then
89
+ return this.#view_ctx !== view_ctx
90
+ || text_site_glyph_count(this.#runtime, TextSite.Transparency) === 0;
59
91
  }
60
92
 
61
93
  avboit_occupancy({ graph, camera, cluster_parameters, occupancy }) {
62
- const frame = this.#frame_for(graph);
94
+ this.#expect_frame(graph);
63
95
 
64
- frame.gather = graph_text_avboit_gather({
96
+ this.#gather = graph_text_avboit_gather({
65
97
  graph,
66
- runtime: frame.runtime,
67
- scene_database: frame.scene_database,
98
+ runtime: this.#runtime,
99
+ scene_database: this.#scene_database,
68
100
  camera,
69
- view: frame.view,
101
+ view: this.#view,
70
102
  cluster_parameters,
71
103
  occupancy,
72
104
  });
73
105
 
74
- return frame.gather.occupancy;
106
+ return this.#gather.occupancy;
75
107
  }
76
108
 
77
109
  avboit_splat({ graph, camera, warp, voxel_resolution, volume }) {
78
- const frame = this.#frame_for(graph);
110
+ this.#expect_frame(graph);
79
111
 
80
- assert.notNull(frame.gather, "the occupancy was not recorded into this graph");
112
+ assert.notNull(this.#gather, "the occupancy was not recorded into this graph");
81
113
 
82
114
  return graph_text_avboit_splat({
83
115
  graph,
84
- runtime: frame.runtime,
85
- scene_database: frame.scene_database,
116
+ runtime: this.#runtime,
117
+ scene_database: this.#scene_database,
86
118
  camera,
87
- gather: frame.gather,
88
- shapes: frame.shapes,
119
+ gather: this.#gather,
120
+ shapes: this.#shapes,
89
121
  warp,
90
122
  voxel_resolution,
91
123
  volume,
@@ -103,21 +135,18 @@ export class GPUTextAVBOITChannel {
103
135
  volumetrics_metadata,
104
136
  accumulators
105
137
  }) {
106
- const frame = this.#frame_for(graph);
107
-
108
- assert.notNull(frame.gather, "the occupancy was not recorded into this graph");
138
+ this.#expect_frame(graph);
109
139
 
110
- // the last of the three: what is left is the passes'
111
- this.#frame = null;
140
+ assert.notNull(this.#gather, "the occupancy was not recorded into this graph");
112
141
 
113
- return graph_text_avboit_draw({
142
+ const drawn = graph_text_avboit_draw({
114
143
  graph,
115
- runtime: frame.runtime,
116
- scene_database: frame.scene_database,
144
+ runtime: this.#runtime,
145
+ scene_database: this.#scene_database,
117
146
  view_ctx,
118
147
  camera,
119
- gather: frame.gather,
120
- shapes: frame.shapes,
148
+ gather: this.#gather,
149
+ shapes: this.#shapes,
121
150
  depth_texture,
122
151
  warp,
123
152
  integral,
@@ -125,16 +154,17 @@ export class GPUTextAVBOITChannel {
125
154
  volumetrics_metadata,
126
155
  accumulators,
127
156
  });
157
+
158
+ // the last of the three: what is left is the passes'
159
+ this.end_frame();
160
+
161
+ return drawn;
128
162
  }
129
163
 
130
164
  /**
131
165
  * @param {object} graph
132
166
  */
133
- #frame_for(graph) {
134
- const frame = this.#frame;
135
-
136
- assert.ok(frame !== null && frame.graph === graph, "the frame's text was not handed over for this graph");
137
-
138
- return frame;
167
+ #expect_frame(graph) {
168
+ assert.ok(this.#graph !== null && this.#graph === graph, "the frame's text was not handed over for this graph");
139
169
  }
140
170
  }
@@ -58,6 +58,13 @@ export class GPUTextSystem {
58
58
  * @returns {Uint32Array} the runtime's own, not to be written
59
59
  */
60
60
  get class_glyph_counts(): Uint32Array;
61
+ /**
62
+ * Of {@link class_glyph_counts}, the glyphs of texts that have a shadow to show, by draw class: one of some
63
+ * offset and some opacity. A class at zero has no shadow for a frame to record.
64
+ *
65
+ * @returns {Uint32Array} the runtime's own, not to be written
66
+ */
67
+ get class_shadow_glyph_counts(): Uint32Array;
61
68
  /**
62
69
  * Register a text that sits at `node`.
63
70
  *
@@ -1 +1 @@
1
- {"version":3,"file":"GPUTextSystem.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/text/GPUTextSystem.js"],"names":[],"mappings":"AA+DA;;;GAGG;AACH;IACI,2CAA2C;IAC3C,KADW,MAAM,CACR;IAET,2DAA2D;IAC3D,MADW,MAAM,CACR;IAET;;;OAGG;IACH,QAFU,OAAO,mDAAmD,EAAE,UAAU,GAAC,IAAI,CAEvE;IAEd;;;OAGG;IACH,QAFU,OAAO,6BAA6B,EAAE,SAAS,EAAE,CAE/C;IAEZ,2GAA2G;IAC3G,QADW,YAAY,CACM;IAE7B,+DAA+D;IAC/D,YADW,MAAM,CACD;IAEhB,kDAAkD;IAClD,QADW,cAAc,CACK;CACjC;AAqCD;;;;;;;;GAQG;AACH;IAqCI;;OAEG;IACH,sBAFW,OAAO,uBAAuB,EAAE,eAAe,EAgBzD;IAED,iEAAiE;IACjE,gEAEC;IAED,4CAA4C;IAC5C,4BAEC;IAED,0EAA0E;IAC1E,2EAEC;IAED,8DAA8D;IAC9D,yBAEC;IAED,gCAAgC;IAChC,6BAEC;IAED,yCAAyC;IACzC,oBAEC;IAED;;;;;;OAMG;IACH,sCAEC;IAED;;;;;;OAMG;IACH,gBAJW,cAAc,QACd,MAAM,GACJ,cAAc,GAAC,IAAI,CA+B/B;IAED;;;;;;;OAOG;IACH,eAJW,cAAc,cACd,cAAc,GACZ,OAAO,CAyCnB;IAED;;;;;OAKG;IACH,kBAHW,cAAc,QACd,MAAM,QAYhB;IAED;;OAEG;IACH,gBAFW,cAAc,QAexB;IAED;;;;;OAKG;IACH,oBAYC;IAED,gBAOC;;CAwLJ;+BA1iB8B,6BAA6B;4BAXhC,gCAAgC;2BAFjC,yBAAyB;+BAcW,6BAA6B"}
1
+ {"version":3,"file":"GPUTextSystem.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/text/GPUTextSystem.js"],"names":[],"mappings":"AA+DA;;;GAGG;AACH;IACI,2CAA2C;IAC3C,KADW,MAAM,CACR;IAET,2DAA2D;IAC3D,MADW,MAAM,CACR;IAET;;;OAGG;IACH,QAFU,OAAO,mDAAmD,EAAE,UAAU,GAAC,IAAI,CAEvE;IAEd;;;OAGG;IACH,QAFU,OAAO,6BAA6B,EAAE,SAAS,EAAE,CAE/C;IAEZ,2GAA2G;IAC3G,QADW,YAAY,CACM;IAE7B,+DAA+D;IAC/D,YADW,MAAM,CACD;IAEhB,kDAAkD;IAClD,QADW,cAAc,CACK;CACjC;AAoDD;;;;;;;;GAQG;AACH;IA2CI;;OAEG;IACH,sBAFW,OAAO,uBAAuB,EAAE,eAAe,EAgBzD;IAED,iEAAiE;IACjE,gEAEC;IAED,4CAA4C;IAC5C,4BAEC;IAED,0EAA0E;IAC1E,2EAEC;IAED,8DAA8D;IAC9D,yBAEC;IAED,gCAAgC;IAChC,6BAEC;IAED,yCAAyC;IACzC,oBAEC;IAED;;;;;;OAMG;IACH,sCAEC;IAED;;;;;OAKG;IACH,6CAEC;IAED;;;;;;OAMG;IACH,gBAJW,cAAc,QACd,MAAM,GACJ,cAAc,GAAC,IAAI,CAgC/B;IAED;;;;;;;OAOG;IACH,eAJW,cAAc,cACd,cAAc,GACZ,OAAO,CA4CnB;IAED;;;;;OAKG;IACH,kBAHW,cAAc,QACd,MAAM,QAYhB;IAED;;OAEG;IACH,gBAFW,cAAc,QAgBxB;IAED;;;;;OAKG;IACH,oBAYC;IAED,gBAQC;;CA2LJ;+BAllB8B,6BAA6B;4BAXhC,gCAAgC;2BAFjC,yBAAyB;+BAcW,6BAA6B"}
@@ -111,6 +111,8 @@ class TextRecord {
111
111
  color = new Float32Array(4);
112
112
  stroke_color = new Float32Array(4);
113
113
  stroke_width = 0;
114
+ shadow_offset = new Float32Array(2);
115
+ shadow_color = new Float32Array(4);
114
116
  }
115
117
 
116
118
  /**
@@ -129,6 +131,19 @@ function is_stroked(parameters) {
129
131
  return parameters.stroke_width > 0 && parameters.stroke_color[3] > 0;
130
132
  }
131
133
 
134
+ /**
135
+ * @param {GPUTextContext} context
136
+ * @returns {number} glyphs of the text whose shadow a frame can draw: none while the shadow is where the text is or
137
+ * is wholly transparent, and none while the text itself is
138
+ */
139
+ function shadowed_glyphs(context) {
140
+ const staged = context.staged;
141
+
142
+ const shows = staged.shadow_color[3] > 0 && (staged.shadow_offset[0] !== 0 || staged.shadow_offset[1] !== 0);
143
+
144
+ return shows ? drawn_glyphs(context) : 0;
145
+ }
146
+
132
147
  /**
133
148
  * The GPU texts of one scene context: the text table, the glyph pool and the shapes the glyphs draw.
134
149
  *
@@ -170,6 +185,12 @@ export class GPUTextSystem {
170
185
  */
171
186
  #class_glyph_counts = new Uint32Array(TEXT_DRAW_CLASS_COUNT);
172
187
 
188
+ /**
189
+ * Of those, the glyphs of texts with a shadow that shows, by draw class.
190
+ * @type {Uint32Array}
191
+ */
192
+ #class_shadow_glyph_counts = new Uint32Array(TEXT_DRAW_CLASS_COUNT);
193
+
173
194
  /**
174
195
  * @type {TextRecord}
175
196
  */
@@ -235,6 +256,16 @@ export class GPUTextSystem {
235
256
  return this.#class_glyph_counts;
236
257
  }
237
258
 
259
+ /**
260
+ * Of {@link class_glyph_counts}, the glyphs of texts that have a shadow to show, by draw class: one of some
261
+ * offset and some opacity. A class at zero has no shadow for a frame to record.
262
+ *
263
+ * @returns {Uint32Array} the runtime's own, not to be written
264
+ */
265
+ get class_shadow_glyph_counts() {
266
+ return this.#class_shadow_glyph_counts;
267
+ }
268
+
238
269
  /**
239
270
  * Register a text that sits at `node`.
240
271
  *
@@ -262,6 +293,7 @@ export class GPUTextSystem {
262
293
  context.draw_class = text_draw_class(parameters.placement, parameters.site, is_stroked(parameters));
263
294
 
264
295
  this.#class_glyph_counts[context.draw_class] += drawn_glyphs(context);
296
+ this.#class_shadow_glyph_counts[context.draw_class] += shadowed_glyphs(context);
265
297
 
266
298
  context.row = this.table.add_record(this.#write_record(context, parameters), TEXT_RECORD_WRITER);
267
299
 
@@ -292,6 +324,7 @@ export class GPUTextSystem {
292
324
  const staged = context.staged;
293
325
 
294
326
  const glyphs_before = drawn_glyphs(context);
327
+ const shadowed_before = shadowed_glyphs(context);
295
328
 
296
329
  let laid_out = false;
297
330
 
@@ -306,12 +339,14 @@ export class GPUTextSystem {
306
339
  const draw_class = text_draw_class(parameters.placement, parameters.site, is_stroked(parameters));
307
340
 
308
341
  this.#class_glyph_counts[context.draw_class] -= glyphs_before;
342
+ this.#class_shadow_glyph_counts[context.draw_class] -= shadowed_before;
309
343
 
310
344
  context.draw_class = draw_class;
311
345
 
312
346
  staged.copy(parameters);
313
347
 
314
348
  this.#class_glyph_counts[draw_class] += drawn_glyphs(context);
349
+ this.#class_shadow_glyph_counts[draw_class] += shadowed_glyphs(context);
315
350
 
316
351
  this.table.set_record(context.row, this.#write_record(context, parameters), TEXT_RECORD_WRITER);
317
352
 
@@ -349,6 +384,7 @@ export class GPUTextSystem {
349
384
  this.table.remove(context.row);
350
385
 
351
386
  this.#class_glyph_counts[context.draw_class] -= drawn_glyphs(context);
387
+ this.#class_shadow_glyph_counts[context.draw_class] -= shadowed_glyphs(context);
352
388
 
353
389
  this.#release_layout(context);
354
390
 
@@ -385,6 +421,7 @@ export class GPUTextSystem {
385
421
 
386
422
  this.#texts.clear();
387
423
  this.#class_glyph_counts.fill(0);
424
+ this.#class_shadow_glyph_counts.fill(0);
388
425
  }
389
426
 
390
427
  /**
@@ -566,6 +603,9 @@ export class GPUTextSystem {
566
603
  record.color.set(parameters.color);
567
604
  record.stroke_color.set(parameters.stroke_color);
568
605
  record.stroke_width = parameters.stroke_width;
606
+ record.shadow_offset[0] = parameters.shadow_offset[0];
607
+ record.shadow_offset[1] = parameters.shadow_offset[1];
608
+ record.shadow_color.set(parameters.shadow_color);
569
609
 
570
610
  return record;
571
611
  }
@@ -34,7 +34,7 @@ export type TextSite = number;
34
34
  export namespace TextSite {
35
35
  let GBuffer: number;
36
36
  let Transparency: number;
37
- let AfterUpscale: number;
37
+ let Overlay: number;
38
38
  }
39
39
  /**
40
40
  * Where a text's origin is on its block of lines, top to bottom. Along the line it is {@link TextParametersalign }.
@@ -1 +1 @@
1
- {"version":3,"file":"TEXT_RECORD.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/text/data/TEXT_RECORD.js"],"names":[],"mappings":"AAwEA;;;;;;;;;;;GAWG;AACH,2CALW,aAAa,QACb,QAAQ,WACR,OAAO,GACL,MAAM,CAIlB;;;;4BA/ES,MAAM;;;;;;;;2BAaN,MAAM;;;;;;;;uBAaN,MAAM;;;;;;;;;;2BAoBN,MAAM;;;;;;;AAahB;;;GAGG;AACH,oCAFU,MAAM,CAEwB;AAkBxC;;;GAGG;AACH,uCA8BwB;6BAzHK,mCAAmC"}
1
+ {"version":3,"file":"TEXT_RECORD.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/text/data/TEXT_RECORD.js"],"names":[],"mappings":"AAyEA;;;;;;;;;;;GAWG;AACH,2CALW,aAAa,QACb,QAAQ,WACR,OAAO,GACL,MAAM,CAIlB;;;;4BAhFS,MAAM;;;;;;;;2BAaN,MAAM;;;;;;;;uBAaN,MAAM;;;;;;;;;;2BAqBN,MAAM;;;;;;;AAahB;;;GAGG;AACH,oCAFU,MAAM,CAEwB;AAkBxC;;;GAGG;AACH,uCAkCwB;6BA9HK,mCAAmC"}
@@ -39,11 +39,12 @@ export const TextSite = {
39
39
  /** Drawn among the transparent things, in their order. */
40
40
  Transparency: 1,
41
41
  /**
42
- * Drawn over the finished scene once it is at the output resolution, before it is tone mapped: sharp whatever
43
- * the internal resolution is, and untouched by the temporal resolve, which smears text that moves against what
44
- * is behind it. Nothing hides it: the scene's depth is not tested here.
42
+ * Drawn over the finished frame, onto the canvas, after the tone mapper: the colour the text is given is the
43
+ * colour it shows, whatever the exposure and the grade, and it fades as a page's text does. Sharp whatever the
44
+ * internal resolution is, and untouched by the temporal resolve, which smears text that moves against what is
45
+ * behind it. Nothing hides it: the scene's depth is not tested here.
45
46
  */
46
- AfterUpscale: 2,
47
+ Overlay: 2,
47
48
  };
48
49
 
49
50
  /**
@@ -120,4 +121,8 @@ export const TEXT_STRUCT = WebGPUStruct.from({
120
121
  stroke_color: vec4f,
121
122
  /** how far the stroke shows past the outline, in ems; no stroke at 0 */
122
123
  stroke_width: f32,
124
+ /** how far the text's shadow is from the text, right and up on the screen, in the text's size unit */
125
+ shadow_offset: vec2f,
126
+ /** the shadow's linear RGB, unbounded, and how opaque it is under a text of full opacity */
127
+ shadow_color: vec4f,
123
128
  }, "TextRecord").pack();