@kitware/vtk.js 22.2.2 → 22.4.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 (33) hide show
  1. package/Rendering/Core/ScalarBarActor.js +196 -143
  2. package/Rendering/OpenGL/Profiles/All.js +1 -0
  3. package/Rendering/OpenGL/Profiles/Geometry.js +1 -0
  4. package/Rendering/OpenGL/ScalarBarActor.js +61 -0
  5. package/Rendering/Profiles/All.js +2 -0
  6. package/Rendering/Profiles/Geometry.js +2 -0
  7. package/Rendering/WebGPU/BindGroup.js +5 -4
  8. package/Rendering/WebGPU/Buffer.js +6 -3
  9. package/Rendering/WebGPU/BufferManager.js +3 -1
  10. package/Rendering/WebGPU/Device.js +1 -1
  11. package/Rendering/WebGPU/Glyph3DMapper.js +3 -2
  12. package/Rendering/WebGPU/HardwareSelectionPass.js +11 -7
  13. package/Rendering/WebGPU/HardwareSelector.js +6 -2
  14. package/Rendering/WebGPU/ImageMapper.js +14 -12
  15. package/Rendering/WebGPU/MapperHelper.js +3 -2
  16. package/Rendering/WebGPU/OpaquePass.js +11 -7
  17. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +14 -8
  18. package/Rendering/WebGPU/Pipeline.js +6 -5
  19. package/Rendering/WebGPU/PolyDataMapper.js +7 -5
  20. package/Rendering/WebGPU/Profiles/All.js +1 -0
  21. package/Rendering/WebGPU/Profiles/Geometry.js +1 -0
  22. package/Rendering/WebGPU/RenderEncoder.js +12 -3
  23. package/Rendering/WebGPU/Renderer.js +9 -6
  24. package/Rendering/WebGPU/Sampler.js +4 -3
  25. package/Rendering/WebGPU/ScalarBarActor.js +61 -0
  26. package/Rendering/WebGPU/StorageBuffer.js +6 -5
  27. package/Rendering/WebGPU/Texture.js +13 -7
  28. package/Rendering/WebGPU/TextureView.js +10 -21
  29. package/Rendering/WebGPU/UniformBuffer.js +6 -5
  30. package/Rendering/WebGPU/VolumePass.js +42 -28
  31. package/Rendering/WebGPU/VolumePassFSQ.js +32 -16
  32. package/Widgets/Widgets3D/SplineWidget/behavior.js +9 -6
  33. package/package.json +5 -6
@@ -4,6 +4,7 @@ import '../OpenGL/Actor.js';
4
4
  import '../OpenGL/Actor2D.js';
5
5
  import '../OpenGL/PolyDataMapper.js';
6
6
  import '../OpenGL/PolyDataMapper2D.js';
7
+ import '../OpenGL/ScalarBarActor.js';
7
8
  import '../OpenGL/Skybox.js';
8
9
  import '../OpenGL/Texture.js';
9
10
  import '../OpenGL/PixelSpaceCallbackMapper.js';
@@ -11,5 +12,6 @@ import '../WebGPU/Camera.js';
11
12
  import '../WebGPU/Renderer.js';
12
13
  import '../WebGPU/Actor.js';
13
14
  import '../WebGPU/PolyDataMapper.js';
15
+ import '../WebGPU/ScalarBarActor.js';
14
16
  import '../WebGPU/Texture.js';
15
17
  import '../WebGPU/PixelSpaceCallbackMapper.js';
@@ -66,7 +66,8 @@ function vtkWebGPUBindGroup(publicAPI, model) {
66
66
 
67
67
  model.bindGroup = device.getHandle().createBindGroup({
68
68
  layout: publicAPI.getBindGroupLayout(device),
69
- entries: entries
69
+ entries: entries,
70
+ label: model.label
70
71
  });
71
72
  model.bindGroupTime.modified();
72
73
  return model.bindGroup;
@@ -74,7 +75,7 @@ function vtkWebGPUBindGroup(publicAPI, model) {
74
75
 
75
76
  publicAPI.getShaderCode = function (pipeline) {
76
77
  var lines = [];
77
- var bgroup = pipeline.getBindGroupLayoutCount(model.name);
78
+ var bgroup = pipeline.getBindGroupLayoutCount(model.label);
78
79
 
79
80
  for (var i = 0; i < model.bindables.length; i++) {
80
81
  lines.push(model.bindables[i].getShaderCode(i, bgroup));
@@ -90,7 +91,7 @@ function vtkWebGPUBindGroup(publicAPI, model) {
90
91
  var DEFAULT_VALUES = {
91
92
  device: null,
92
93
  handle: null,
93
- name: null
94
+ label: null
94
95
  }; // ----------------------------------------------------------------------------
95
96
 
96
97
  function extend(publicAPI, model) {
@@ -104,7 +105,7 @@ function extend(publicAPI, model) {
104
105
  mtime: 0
105
106
  });
106
107
  macro.get(publicAPI, model, ['bindGroupTime', 'handle', 'sizeInBytes', 'usage']);
107
- macro.setGet(publicAPI, model, ['name', 'device', 'arrayInformation', 'sourceTime']);
108
+ macro.setGet(publicAPI, model, ['label', 'device', 'arrayInformation', 'sourceTime']);
108
109
  vtkWebGPUBindGroup(publicAPI, model);
109
110
  } // ----------------------------------------------------------------------------
110
111
 
@@ -41,7 +41,8 @@ function vtkWebGPUBuffer(publicAPI, model) {
41
41
  publicAPI.create = function (sizeInBytes, usage) {
42
42
  model.handle = model.device.getHandle().createBuffer({
43
43
  size: sizeInBytes,
44
- usage: usage
44
+ usage: usage,
45
+ label: model.label
45
46
  });
46
47
  model.sizeInBytes = sizeInBytes;
47
48
  model.usage = usage;
@@ -55,7 +56,8 @@ function vtkWebGPUBuffer(publicAPI, model) {
55
56
  model.handle = model.device.getHandle().createBuffer({
56
57
  size: data.byteLength,
57
58
  usage: usage,
58
- mappedAtCreation: true
59
+ mappedAtCreation: true,
60
+ label: model.label
59
61
  });
60
62
  model.sizeInBytes = data.byteLength;
61
63
  model.usage = usage;
@@ -88,6 +90,7 @@ var DEFAULT_VALUES = {
88
90
  strideInBytes: 0,
89
91
  arrayInformation: null,
90
92
  usage: null,
93
+ label: null,
91
94
  sourceTime: null
92
95
  }; // ----------------------------------------------------------------------------
93
96
 
@@ -97,7 +100,7 @@ function extend(publicAPI, model) {
97
100
 
98
101
  macro.obj(publicAPI, model);
99
102
  macro.get(publicAPI, model, ['handle', 'sizeInBytes', 'usage']);
100
- macro.setGet(publicAPI, model, ['strideInBytes', 'device', 'arrayInformation', 'sourceTime']);
103
+ macro.setGet(publicAPI, model, ['strideInBytes', 'device', 'arrayInformation', 'label', 'sourceTime']);
101
104
  vtkWebGPUBuffer(publicAPI, model);
102
105
  } // ----------------------------------------------------------------------------
103
106
 
@@ -406,7 +406,9 @@ function vtkWebGPUBufferManager(publicAPI, model) {
406
406
  } // create one
407
407
 
408
408
 
409
- var buffer = vtkWebGPUBuffer.newInstance();
409
+ var buffer = vtkWebGPUBuffer.newInstance({
410
+ label: req.label
411
+ });
410
412
  buffer.setDevice(model.device);
411
413
  var gpuUsage = null; // handle uniform buffers
412
414
 
@@ -83,7 +83,7 @@ function vtkWebGPUDevice(publicAPI, model) {
83
83
  };
84
84
 
85
85
  publicAPI.createPipeline = function (hash, pipeline) {
86
- pipeline.initialize(publicAPI);
86
+ pipeline.initialize(publicAPI, hash);
87
87
  model.pipelines[hash] = pipeline;
88
88
  };
89
89
 
@@ -126,8 +126,9 @@ function extend(publicAPI, model) {
126
126
  obj(model.glyphBOBuildTime, {
127
127
  mtime: 0
128
128
  });
129
- model.SSBO = vtkWebGPUStorageBuffer.newInstance();
130
- model.SSBO.setName('glyphSSBO'); // Object methods
129
+ model.SSBO = vtkWebGPUStorageBuffer.newInstance({
130
+ label: 'glyphSSBO'
131
+ }); // Object methods
131
132
 
132
133
  vtkWebGPUGlyph3DMapper(publicAPI, model);
133
134
 
@@ -25,7 +25,9 @@ function vtkWebGPUHardwareSelectionPass(publicAPI, model) {
25
25
  if (!model.selectionRenderEncoder) {
26
26
  publicAPI.createRenderEncoder(); // create color texture
27
27
 
28
- model.colorTexture = vtkWebGPUTexture.newInstance();
28
+ model.colorTexture = vtkWebGPUTexture.newInstance({
29
+ label: 'hardwareSelectorColor'
30
+ });
29
31
  model.colorTexture.create(device, {
30
32
  width: viewNode.getCanvas().width,
31
33
  height: viewNode.getCanvas().height,
@@ -36,11 +38,12 @@ function vtkWebGPUHardwareSelectionPass(publicAPI, model) {
36
38
  /* eslint-disable no-bitwise */
37
39
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC
38
40
  });
39
- var v1 = model.colorTexture.createView();
40
- v1.setName('hardwareSelectColorTexture');
41
+ var v1 = model.colorTexture.createView('hardwareSelectColorTexture');
41
42
  model.selectionRenderEncoder.setColorTextureView(0, v1); // create depth texture
42
43
 
43
- model.depthTexture = vtkWebGPUTexture.newInstance();
44
+ model.depthTexture = vtkWebGPUTexture.newInstance({
45
+ label: 'hardwareSelectorDepth'
46
+ });
44
47
  model.depthTexture.create(device, {
45
48
  width: viewNode.getCanvas().width,
46
49
  height: viewNode.getCanvas().height,
@@ -51,8 +54,7 @@ function vtkWebGPUHardwareSelectionPass(publicAPI, model) {
51
54
  /* eslint-disable no-bitwise */
52
55
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC
53
56
  });
54
- var v2 = model.depthTexture.createView();
55
- v2.setName('hardwareSelectDepthTexture');
57
+ var v2 = model.depthTexture.createView('hardwareSelectDepthTexture');
56
58
  model.selectionRenderEncoder.setDepthTextureView(v2);
57
59
  } else {
58
60
  model.colorTexture.resize(viewNode.getCanvas().width, viewNode.getCanvas().height);
@@ -69,7 +71,9 @@ function vtkWebGPUHardwareSelectionPass(publicAPI, model) {
69
71
  };
70
72
 
71
73
  publicAPI.createRenderEncoder = function () {
72
- model.selectionRenderEncoder = vtkWebGPURenderEncoder.newInstance(); // default settings are fine for this
74
+ model.selectionRenderEncoder = vtkWebGPURenderEncoder.newInstance({
75
+ label: 'HardwareSelectionPass'
76
+ }); // default settings are fine for this
73
77
 
74
78
  model.selectionRenderEncoder.setPipelineHash('sel');
75
79
  model.selectionRenderEncoder.setReplaceShaderCodeFunction(function (pipeline) {
@@ -290,7 +290,9 @@ function vtkWebGPUHardwareSelector(publicAPI, model) {
290
290
 
291
291
  result.colorBufferWidth = 16 * Math.floor((result.width + 15) / 16);
292
292
  result.colorBufferSizeInBytes = result.colorBufferWidth * result.height * 4 * 4;
293
- colorBuffer = vtkWebGPUBuffer.newInstance();
293
+ colorBuffer = vtkWebGPUBuffer.newInstance({
294
+ label: 'hardwareSelectColorBuffer'
295
+ });
294
296
  colorBuffer.setDevice(device);
295
297
  /* eslint-disable no-bitwise */
296
298
 
@@ -316,7 +318,9 @@ function vtkWebGPUHardwareSelector(publicAPI, model) {
316
318
 
317
319
  if (model.captureZValues) {
318
320
  result.zbufferBufferWidth = 64 * Math.floor((result.width + 63) / 64);
319
- zbuffer = vtkWebGPUBuffer.newInstance();
321
+ zbuffer = vtkWebGPUBuffer.newInstance({
322
+ label: 'hardwareSelectDepthBuffer'
323
+ });
320
324
  zbuffer.setDevice(device);
321
325
  result.zbufferSizeInBytes = result.height * result.zbufferBufferWidth * 4;
322
326
  /* eslint-disable no-bitwise */
@@ -258,8 +258,7 @@ function vtkWebGPUImageMapper(publicAPI, model) {
258
258
  format: 'rgba8unorm'
259
259
  };
260
260
  var newTex = device.getTextureManager().getTexture(treq);
261
- var tview = newTex.createView();
262
- tview.setName('tfunTexture');
261
+ var tview = newTex.createView('tfunTexture');
263
262
  var tViews = model.helper.getTextureViews();
264
263
  tViews[1] = tview;
265
264
  }
@@ -276,8 +275,7 @@ function vtkWebGPUImageMapper(publicAPI, model) {
276
275
  var tViews = model.helper.getTextureViews();
277
276
 
278
277
  if (!tViews[0] || tViews[0].getTexture() !== newTex) {
279
- var tview = newTex.createView();
280
- tview.setName("imgTexture");
278
+ var tview = newTex.createView('imgTexture');
281
279
  tViews[0] = tview;
282
280
  }
283
281
 
@@ -293,8 +291,9 @@ function vtkWebGPUImageMapper(publicAPI, model) {
293
291
  var iType = actorProperty.getInterpolationType() === InterpolationType.NEAREST ? 'nearest' : 'linear';
294
292
 
295
293
  if (!model.clampSampler || iType !== model.clampSampler.getOptions().minFilter) {
296
- model.clampSampler = vtkWebGPUSampler.newInstance();
297
- model.clampSampler.setName('clampSampler');
294
+ model.clampSampler = vtkWebGPUSampler.newInstance({
295
+ label: 'clampSampler'
296
+ });
298
297
  model.clampSampler.create(device, {
299
298
  minFilter: iType,
300
299
  magFilter: iType
@@ -389,8 +388,9 @@ function extend(publicAPI, model) {
389
388
  vtkViewNode.extend(publicAPI, model, initialValues);
390
389
  model.helper = vtkWebGPUFullScreenQuad.newInstance();
391
390
  model.helper.setFragmentShaderTemplate(imgFragTemplate);
392
- model.UBO = vtkWebGPUUniformBuffer.newInstance();
393
- model.UBO.setName('mapperUBO');
391
+ model.UBO = vtkWebGPUUniformBuffer.newInstance({
392
+ label: 'mapperUBO'
393
+ });
394
394
  model.UBO.addEntry('SCTCMatrix', 'mat4x4<f32>');
395
395
  model.UBO.addEntry('Origin', 'vec4<f32>');
396
396
  model.UBO.addEntry('Axis2', 'vec4<f32>');
@@ -398,10 +398,12 @@ function extend(publicAPI, model) {
398
398
  model.UBO.addEntry('cScale', 'vec4<f32>');
399
399
  model.UBO.addEntry('cShift', 'vec4<f32>');
400
400
  model.helper.setUBO(model.UBO);
401
- model.SSBO = vtkWebGPUStorageBuffer.newInstance();
402
- model.SSBO.setName('volumeSSBO');
403
- model.componentSSBO = vtkWebGPUStorageBuffer.newInstance();
404
- model.componentSSBO.setName('componentSSBO');
401
+ model.SSBO = vtkWebGPUStorageBuffer.newInstance({
402
+ label: 'volumeSSBO'
403
+ });
404
+ model.componentSSBO = vtkWebGPUStorageBuffer.newInstance({
405
+ label: 'componentSSBO'
406
+ });
405
407
  model.lutBuildTime = {};
406
408
  obj(model.lutBuildTime, {
407
409
  mtime: 0
@@ -230,8 +230,9 @@ function extend(publicAPI, model) {
230
230
  macro.obj(publicAPI, model);
231
231
  model.textureViews = [];
232
232
  model.vertexInput = vtkWebGPUVertexInput.newInstance();
233
- model.bindGroup = vtkWebGPUBindGroup.newInstance();
234
- model.bindGroup.setName('mapperBG');
233
+ model.bindGroup = vtkWebGPUBindGroup.newInstance({
234
+ label: 'mapperBG'
235
+ });
235
236
  model.additionalBindables = [];
236
237
  model.fragmentShaderTemplate = model.fragmentShaderTemplate || vtkWebGPUMapperHelperFS;
237
238
  model.vertexShaderTemplate = model.vertexShaderTemplate || vtkWebGPUMapperHelperVS;
@@ -21,7 +21,9 @@ function vtkWebGPUOpaquePass(publicAPI, model) {
21
21
 
22
22
  if (!model.renderEncoder) {
23
23
  publicAPI.createRenderEncoder();
24
- model.colorTexture = vtkWebGPUTexture.newInstance();
24
+ model.colorTexture = vtkWebGPUTexture.newInstance({
25
+ label: 'opaquePassColor'
26
+ });
25
27
  model.colorTexture.create(device, {
26
28
  width: viewNode.getCanvas().width,
27
29
  height: viewNode.getCanvas().height,
@@ -32,19 +34,19 @@ function vtkWebGPUOpaquePass(publicAPI, model) {
32
34
  /* eslint-disable no-bitwise */
33
35
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC
34
36
  });
35
- var ctView = model.colorTexture.createView();
36
- ctView.setName('opaquePassColorTexture');
37
+ var ctView = model.colorTexture.createView('opaquePassColorTexture');
37
38
  model.renderEncoder.setColorTextureView(0, ctView);
38
39
  model.depthFormat = 'depth32float';
39
- model.depthTexture = vtkWebGPUTexture.newInstance();
40
+ model.depthTexture = vtkWebGPUTexture.newInstance({
41
+ label: 'opaquePassDepth'
42
+ });
40
43
  model.depthTexture.create(device, {
41
44
  width: viewNode.getCanvas().width,
42
45
  height: viewNode.getCanvas().height,
43
46
  format: model.depthFormat,
44
47
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC
45
48
  });
46
- var dView = model.depthTexture.createView();
47
- dView.setName('opaquePassDepthTexture');
49
+ var dView = model.depthTexture.createView('opaquePassDepthTexture');
48
50
  model.renderEncoder.setDepthTextureView(dView);
49
51
  } else {
50
52
  model.colorTexture.resize(viewNode.getCanvas().width, viewNode.getCanvas().height);
@@ -66,7 +68,9 @@ function vtkWebGPUOpaquePass(publicAPI, model) {
66
68
  };
67
69
 
68
70
  publicAPI.createRenderEncoder = function () {
69
- model.renderEncoder = vtkWebGPURenderEncoder.newInstance(); // default settings are fine for this
71
+ model.renderEncoder = vtkWebGPURenderEncoder.newInstance({
72
+ label: 'OpaquePass'
73
+ }); // default settings are fine for this
70
74
 
71
75
  model.renderEncoder.setPipelineHash('op');
72
76
  };
@@ -26,7 +26,9 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
26
26
  if (!model.translucentRenderEncoder) {
27
27
  publicAPI.createRenderEncoder();
28
28
  publicAPI.createFinalEncoder();
29
- model.translucentColorTexture = vtkWebGPUTexture.newInstance();
29
+ model.translucentColorTexture = vtkWebGPUTexture.newInstance({
30
+ label: 'translucentPassColor'
31
+ });
30
32
  model.translucentColorTexture.create(device, {
31
33
  width: viewNode.getCanvas().width,
32
34
  height: viewNode.getCanvas().height,
@@ -37,10 +39,11 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
37
39
  /* eslint-disable no-bitwise */
38
40
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
39
41
  });
40
- var v1 = model.translucentColorTexture.createView();
41
- v1.setName('oitpColorTexture');
42
+ var v1 = model.translucentColorTexture.createView('oitpColorTexture');
42
43
  model.translucentRenderEncoder.setColorTextureView(0, v1);
43
- model.translucentAccumulateTexture = vtkWebGPUTexture.newInstance();
44
+ model.translucentAccumulateTexture = vtkWebGPUTexture.newInstance({
45
+ label: 'translucentPassAccumulate'
46
+ });
44
47
  model.translucentAccumulateTexture.create(device, {
45
48
  width: viewNode.getCanvas().width,
46
49
  height: viewNode.getCanvas().height,
@@ -51,8 +54,7 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
51
54
  /* eslint-disable no-bitwise */
52
55
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
53
56
  });
54
- var v2 = model.translucentAccumulateTexture.createView();
55
- v2.setName('oitpAccumTexture');
57
+ var v2 = model.translucentAccumulateTexture.createView('oitpAccumTexture');
56
58
  model.translucentRenderEncoder.setColorTextureView(1, v2);
57
59
  model.fullScreenQuad = vtkWebGPUFullScreenQuad.newInstance();
58
60
  model.fullScreenQuad.setDevice(viewNode.getDevice());
@@ -88,7 +90,9 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
88
90
  };
89
91
 
90
92
  publicAPI.createRenderEncoder = function () {
91
- model.translucentRenderEncoder = vtkWebGPURenderEncoder.newInstance();
93
+ model.translucentRenderEncoder = vtkWebGPURenderEncoder.newInstance({
94
+ label: 'translucentRender'
95
+ });
92
96
  var rDesc = model.translucentRenderEncoder.getDescription();
93
97
  rDesc.colorAttachments = [{
94
98
  view: undefined,
@@ -157,7 +161,9 @@ function vtkWebGPUOrderIndependentTranslucentPass(publicAPI, model) {
157
161
  };
158
162
 
159
163
  publicAPI.createFinalEncoder = function () {
160
- model.translucentFinalEncoder = vtkWebGPURenderEncoder.newInstance();
164
+ model.translucentFinalEncoder = vtkWebGPURenderEncoder.newInstance({
165
+ label: 'translucentFinal'
166
+ });
161
167
  model.translucentFinalEncoder.setDescription({
162
168
  colorAttachments: [{
163
169
  view: null,
@@ -11,11 +11,12 @@ function vtkWebGPUPipeline(publicAPI, model) {
11
11
  return model.shaderDescriptions;
12
12
  };
13
13
 
14
- publicAPI.initialize = function (device) {
14
+ publicAPI.initialize = function (device, hash) {
15
15
  // start with the renderencoder settings
16
16
  model.pipelineDescription = model.renderEncoder.getPipelineSettings();
17
17
  model.pipelineDescription.primitive.topology = model.topology;
18
- model.pipelineDescription.vertex = model.vertexState; // add in bind group layouts
18
+ model.pipelineDescription.vertex = model.vertexState;
19
+ model.pipelineDescription.label = hash; // add in bind group layouts
19
20
 
20
21
  var bindGroupLayouts = [];
21
22
 
@@ -61,7 +62,7 @@ function vtkWebGPUPipeline(publicAPI, model) {
61
62
 
62
63
  model.layouts.push({
63
64
  layout: bindGroup.getBindGroupLayout(model.device),
64
- name: bindGroup.getName()
65
+ label: bindGroup.getLabel()
65
66
  });
66
67
  };
67
68
 
@@ -69,9 +70,9 @@ function vtkWebGPUPipeline(publicAPI, model) {
69
70
  return model.layouts[idx].layout;
70
71
  };
71
72
 
72
- publicAPI.getBindGroupLayoutCount = function (lname) {
73
+ publicAPI.getBindGroupLayoutCount = function (llabel) {
73
74
  for (var i = 0; i < model.layouts.length; i++) {
74
- if (model.layouts[i].name === lname) {
75
+ if (model.layouts[i].label === llabel) {
75
76
  return i;
76
77
  }
77
78
  }
@@ -419,7 +419,9 @@ function vtkWebGPUPolyDataMapper(publicAPI, model) {
419
419
 
420
420
  if (idata) {
421
421
  if (!model.colorTexture) {
422
- model.colorTexture = vtkTexture.newInstance();
422
+ model.colorTexture = vtkTexture.newInstance({
423
+ label: 'polyDataColor'
424
+ });
423
425
  }
424
426
 
425
427
  model.colorTexture.setInputData(idata);
@@ -470,8 +472,7 @@ function vtkWebGPUPolyDataMapper(publicAPI, model) {
470
472
 
471
473
  if (!found) {
472
474
  usedTextures[model.textures.length] = true;
473
- var tview = newTex.createView();
474
- tview.setName("Texture".concat(usedCount++));
475
+ var tview = newTex.createView("Texture".concat(usedCount++));
475
476
  model.textures.push(newTex);
476
477
  model.textureViews.push(tview);
477
478
  var interpolate = srcTexture.getInterpolate() ? 'linear' : 'nearest';
@@ -631,8 +632,9 @@ function extend(publicAPI, model) {
631
632
  model.tmpMat4 = mat4.identity(new Float64Array(16));
632
633
  model.fragmentShaderTemplate = model.fragmentShaderTemplate || vtkWebGPUPolyDataFS;
633
634
  model.vertexShaderTemplate = model.vertexShaderTemplate || vtkWebGPUPolyDataVS;
634
- model.UBO = vtkWebGPUUniformBuffer.newInstance();
635
- model.UBO.setName('mapperUBO');
635
+ model.UBO = vtkWebGPUUniformBuffer.newInstance({
636
+ label: 'mapperUBO'
637
+ });
636
638
  model.UBO.addEntry('BCWCMatrix', 'mat4x4<f32>');
637
639
  model.UBO.addEntry('BCSCMatrix', 'mat4x4<f32>');
638
640
  model.UBO.addEntry('MCWCNormals', 'mat4x4<f32>');
@@ -2,6 +2,7 @@ import '../Camera.js';
2
2
  import '../Renderer.js';
3
3
  import '../Actor.js';
4
4
  import '../PolyDataMapper.js';
5
+ import '../ScalarBarActor.js';
5
6
  import '../Texture.js';
6
7
  import '../Glyph3DMapper.js';
7
8
  import '../ImageMapper.js';
@@ -2,5 +2,6 @@ import '../Camera.js';
2
2
  import '../Renderer.js';
3
3
  import '../Actor.js';
4
4
  import '../PolyDataMapper.js';
5
+ import '../ScalarBarActor.js';
5
6
  import '../Texture.js';
6
7
  import '../PixelSpaceCallbackMapper.js';
@@ -11,9 +11,17 @@ function vtkWebGPURenderEncoder(publicAPI, model) {
11
11
 
12
12
  publicAPI.begin = function (encoder) {
13
13
  model.handle = encoder.beginRenderPass(model.description);
14
+
15
+ if (model.label) {
16
+ model.handle.pushDebugGroup(model.label);
17
+ }
14
18
  };
15
19
 
16
20
  publicAPI.end = function () {
21
+ if (model.label) {
22
+ model.handle.popDebugGroup();
23
+ }
24
+
17
25
  model.handle.endPass();
18
26
  };
19
27
 
@@ -65,7 +73,7 @@ function vtkWebGPURenderEncoder(publicAPI, model) {
65
73
 
66
74
  publicAPI.activateBindGroup = function (bg) {
67
75
  var device = model.boundPipeline.getDevice();
68
- var midx = model.boundPipeline.getBindGroupLayoutCount(bg.getName());
76
+ var midx = model.boundPipeline.getBindGroupLayoutCount(bg.getLabel());
69
77
  model.handle.setBindGroup(midx, bg.getBindGroup(device)); // verify bind group layout matches
70
78
 
71
79
  var bgl1 = device.getBindGroupLayoutDescription(bg.getBindGroupLayout(device));
@@ -118,7 +126,8 @@ var DEFAULT_VALUES = {
118
126
  pipelineHash: null,
119
127
  pipelineSettings: null,
120
128
  replaceShaderCodeFunction: null,
121
- depthTextureView: null
129
+ depthTextureView: null,
130
+ label: null
122
131
  }; // ----------------------------------------------------------------------------
123
132
 
124
133
  function extend(publicAPI, model) {
@@ -177,7 +186,7 @@ function extend(publicAPI, model) {
177
186
  };
178
187
  model.colorTextureViews = [];
179
188
  get(publicAPI, model, ['boundPipeline', 'colorTextureViews']);
180
- setGet(publicAPI, model, ['depthTextureView', 'description', 'handle', 'pipelineHash', 'pipelineSettings', 'replaceShaderCodeFunction']); // For more macro methods, see "Sources/macros.js"
189
+ setGet(publicAPI, model, ['depthTextureView', 'description', 'handle', 'label', 'pipelineHash', 'pipelineSettings', 'replaceShaderCodeFunction']); // For more macro methods, see "Sources/macros.js"
181
190
  // Object specific methods
182
191
 
183
192
  vtkWebGPURenderEncoder(publicAPI, model);
@@ -181,8 +181,9 @@ function vtkWebGPURenderer(publicAPI, model) {
181
181
  model.clearFSQ.setDevice(device);
182
182
  model.clearFSQ.setPipelineHash('clearfsq');
183
183
  model.clearFSQ.setFragmentShaderTemplate(clearFragTemplate);
184
- var ubo = vtkWebGPUUniformBuffer.newInstance();
185
- ubo.setName('mapperUBO');
184
+ var ubo = vtkWebGPUUniformBuffer.newInstance({
185
+ label: 'mapperUBO'
186
+ });
186
187
  ubo.addEntry('BackgroundColor', 'vec4<f32>');
187
188
  model.clearFSQ.setUBO(ubo);
188
189
  }
@@ -334,8 +335,9 @@ function extend(publicAPI, model) {
334
335
  Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
335
336
 
336
337
  vtkViewNode.extend(publicAPI, model, initialValues);
337
- model.UBO = vtkWebGPUUniformBuffer.newInstance();
338
- model.UBO.setName('rendererUBO');
338
+ model.UBO = vtkWebGPUUniformBuffer.newInstance({
339
+ label: 'rendererUBO'
340
+ });
339
341
  model.UBO.addEntry('WCVCMatrix', 'mat4x4<f32>');
340
342
  model.UBO.addEntry('SCPCMatrix', 'mat4x4<f32>');
341
343
  model.UBO.addEntry('PCSCMatrix', 'mat4x4<f32>');
@@ -344,8 +346,9 @@ function extend(publicAPI, model) {
344
346
  model.UBO.addEntry('WCVCNormals', 'mat4x4<f32>');
345
347
  model.UBO.addEntry('viewportSize', 'vec2<f32>');
346
348
  model.UBO.addEntry('cameraParallel', 'u32');
347
- model.bindGroup = vtkWebGPUBindGroup.newInstance();
348
- model.bindGroup.setName('rendererBG');
349
+ model.bindGroup = vtkWebGPUBindGroup.newInstance({
350
+ label: 'rendererBG'
351
+ });
349
352
  model.bindGroup.setBindables([model.UBO]);
350
353
  model.tmpMat4 = mat4.identity(new Float64Array(16));
351
354
  model.stabilizedTime = {};
@@ -14,12 +14,13 @@ function vtkWebGPUSampler(publicAPI, model) {
14
14
  model.device = device;
15
15
  model.options.magFilter = options.magFilter ? options.magFilter : 'nearest';
16
16
  model.options.minFilter = options.minFilter ? options.minFilter : 'nearest';
17
+ model.options.label = model.label;
17
18
  model.handle = model.device.getHandle().createSampler(model.options);
18
19
  model.bindGroupTime.modified();
19
20
  };
20
21
 
21
22
  publicAPI.getShaderCode = function (binding, group) {
22
- var result = "@binding(".concat(binding, ") @group(").concat(group, ") var ").concat(model.name, ": sampler;");
23
+ var result = "@binding(".concat(binding, ") @group(").concat(group, ") var ").concat(model.label, ": sampler;");
23
24
  return result;
24
25
  };
25
26
 
@@ -37,7 +38,7 @@ function vtkWebGPUSampler(publicAPI, model) {
37
38
  var DEFAULT_VALUES = {
38
39
  device: null,
39
40
  handle: null,
40
- name: null,
41
+ label: null,
41
42
  options: null
42
43
  }; // ----------------------------------------------------------------------------
43
44
 
@@ -60,7 +61,7 @@ function extend(publicAPI, model) {
60
61
  mtime: 0
61
62
  });
62
63
  macro.get(publicAPI, model, ['bindGroupTime', 'handle', 'options']);
63
- macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'device', 'name']);
64
+ macro.setGet(publicAPI, model, ['bindGroupLayoutEntry', 'device', 'label']);
64
65
  vtkWebGPUSampler(publicAPI, model);
65
66
  } // ----------------------------------------------------------------------------
66
67
 
@@ -0,0 +1,61 @@
1
+ import { newInstance as newInstance$1 } from '../../macros.js';
2
+ import vtkScalarBarActor from '../Core/ScalarBarActor.js';
3
+ import vtkViewNode from '../SceneGraph/ViewNode.js';
4
+ import { registerOverride } from './ViewNodeFactory.js';
5
+
6
+ // vtkWebGPUScalarBarActor methods
7
+ // ----------------------------------------------------------------------------
8
+
9
+ function vtkWebGPUScalarBarActor(publicAPI, model) {
10
+ model.classHierarchy.push('vtkWebGPUScalarBarActor'); // Builds myself.
11
+
12
+ publicAPI.buildPass = function (prepass) {
13
+ if (prepass) {
14
+ model.WebGPURenderer = publicAPI.getFirstAncestorOfType('vtkWebGPURenderer');
15
+ model.WebGPURenderWindow = model.WebGPURenderer.getParent();
16
+
17
+ if (!model.scalarBarActorHelper.getRenderable()) {
18
+ model.scalarBarActorHelper.setRenderable(model.renderable);
19
+ }
20
+
21
+ publicAPI.prepareNodes();
22
+ publicAPI.addMissingNode(model.scalarBarActorHelper.getBarActor());
23
+ publicAPI.addMissingNode(model.scalarBarActorHelper.getTmActor());
24
+ publicAPI.removeUnusedNodes();
25
+ }
26
+ };
27
+
28
+ publicAPI.opaquePass = function (prepass, renderPass) {
29
+ if (prepass) {
30
+ var camera = model.WebGPURenderer ? model.WebGPURenderer.getRenderable().getActiveCamera() : null;
31
+ var tsize = model.WebGPURenderer.getTiledSizeAndOrigin();
32
+ model.scalarBarActorHelper.updateAPISpecificData([tsize.usize, tsize.vsize], camera, model.WebGPURenderWindow.getRenderable());
33
+ }
34
+ };
35
+ } // ----------------------------------------------------------------------------
36
+ // Object factory
37
+ // ----------------------------------------------------------------------------
38
+
39
+
40
+ var DEFAULT_VALUES = {}; // ----------------------------------------------------------------------------
41
+
42
+ function extend(publicAPI, model) {
43
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
44
+ Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
45
+
46
+ vtkViewNode.extend(publicAPI, model, initialValues);
47
+ model.scalarBarActorHelper = vtkScalarBarActor.newScalarBarActorHelper(); // Object methods
48
+
49
+ vtkWebGPUScalarBarActor(publicAPI, model);
50
+ } // ----------------------------------------------------------------------------
51
+
52
+ var newInstance = newInstance$1(extend, 'vtkWebGPUScalarBarActor'); // ----------------------------------------------------------------------------
53
+
54
+ var index = {
55
+ newInstance: newInstance,
56
+ extend: extend
57
+ }; // Register ourself to WebGPU backend if imported
58
+
59
+ registerOverride('vtkScalarBarActor', newInstance);
60
+
61
+ export { index as default, extend, newInstance };