All files / packages/core/src/RenderingEngine/vtkClasses vtkSharedVolumeMapper.js

81.81% Statements 9/11
0% Branches 0/1
66.66% Functions 2/3
81.81% Lines 9/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53                              91x   91x 91x                       1x         91x   91x   91x     91x         1x          
import macro from '@kitware/vtk.js/macros';
import vtkVolumeMapper from '@kitware/vtk.js/Rendering/Core/VolumeMapper';
 
/**
 * vtkSharedVolumeMapper - A derived class of the core vtkVolumeMapper class
 * the scalar texture in as an argument. This is so we can share the same texture
 * memory across different mappers/actors, so we don't duplicate memory usage.
 *
 *
 *
 * @param {*} publicAPI The public API to extend
 * @param {*} model The private model to extend.
 * @hidden
 */
function vtkSharedVolumeMapper(publicAPI, model) {
  model.classHierarchy.push('vtkSharedVolumeMapper');
 
  const superDelete = publicAPI.delete;
  publicAPI.delete = () => {
    model.scalarTexture = null;
    superDelete();
  };
}
 
// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------
 
// ----------------------------------------------------------------------------
 
const DEFAULT_VALUES = {
  scalarTexture: null,
};
 
export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);
 
  vtkVolumeMapper.extend(publicAPI, model, initialValues);
 
  macro.setGet(publicAPI, model, ['scalarTexture']);
 
  // Object methods
  vtkSharedVolumeMapper(publicAPI, model);
}
 
// ----------------------------------------------------------------------------
 
export const newInstance = macro.newInstance(extend, 'vtkSharedVolumeMapper');
 
// ----------------------------------------------------------------------------
 
export default { newInstance, extend };