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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | 38x 38x 174x 174x 87x 87x 87x 87x 87x 87x 87x 38x 2x 2x 2x 2x 2x 38x 5x 38x 92x 8x 84x 84x 84x 84x 38x 5x 1x 4x 4x 4x 4x 38x 174x 87x 87x 83x 4x 38x 4x 38x 2x 38x 172x 86x 38x 8x 38x 83x 52x 52x 52x 83x 1x 38x 38x 38x 38x 38x 38x 38x 1x 1x | import { mat4 } from 'gl-matrix'; import * as macro from 'vtk.js/Sources/macros'; import vtkViewNode from 'vtk.js/Sources/Rendering/SceneGraph/ViewNode'; import { registerOverride } from 'vtk.js/Sources/Rendering/OpenGL/ViewNodeFactory'; // ---------------------------------------------------------------------------- // vtkOpenGLImageSlice methods // ---------------------------------------------------------------------------- function vtkOpenGLImageSlice(publicAPI, model) { // Set our className model.classHierarchy.push('vtkOpenGLImageSlice'); // Builds myself. publicAPI.buildPass = (prepass) => { Iif (!model.renderable || !model.renderable.getVisibility()) { return; } if (prepass) { Iif (!model.renderable) { return; } model._openGLRenderWindow = publicAPI.getFirstAncestorOfType( 'vtkOpenGLRenderWindow' ); model._openGLRenderer = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderer'); model.context = model._openGLRenderWindow.getContext(); publicAPI.prepareNodes(); publicAPI.addMissingNode(model.renderable.getMapper()); publicAPI.removeUnusedNodes(); } }; publicAPI.traverseZBufferPass = (renderPass) => { Iif ( !model.renderable || !model.renderable.getNestedVisibility() || (model._openGLRenderer.getSelector() && !model.renderable.getNestedPickable()) ) { return; } publicAPI.apply(renderPass, true); model.children.forEach((child) => { child.traverse(renderPass); }); publicAPI.apply(renderPass, false); }; publicAPI.traverseOpaqueZBufferPass = (renderPass) => publicAPI.traverseOpaquePass(renderPass); // we draw textures, then mapper, then post pass textures publicAPI.traverseOpaquePass = (renderPass) => { if ( !model.renderable || !model.renderable.getNestedVisibility() || !model.renderable.getIsOpaque() || (model._openGLRenderer.getSelector() && !model.renderable.getNestedPickable()) ) { return; } publicAPI.apply(renderPass, true); model.children.forEach((child) => { child.traverse(renderPass); }); publicAPI.apply(renderPass, false); }; // we draw textures, then mapper, then post pass textures publicAPI.traverseTranslucentPass = (renderPass) => { if ( !model.renderable || !model.renderable.getNestedVisibility() || model.renderable.getIsOpaque() || (model._openGLRenderer.getSelector() && !model.renderable.getNestedPickable()) ) { return; } publicAPI.apply(renderPass, true); model.children.forEach((child) => { child.traverse(renderPass); }); publicAPI.apply(renderPass, false); }; publicAPI.queryPass = (prepass, renderPass) => { if (prepass) { Iif (!model.renderable || !model.renderable.getVisibility()) { return; } if (model.renderable.getIsOpaque()) { renderPass.incrementOpaqueActorCount(); } else { renderPass.incrementTranslucentActorCount(); } } }; publicAPI.zBufferPass = (prepass, renderPass) => publicAPI.opaquePass(prepass, renderPass); publicAPI.opaqueZBufferPass = (prepass, renderPass) => publicAPI.opaquePass(prepass, renderPass); // Renders myself publicAPI.opaquePass = (prepass, renderPass) => { if (prepass) { model.context.depthMask(true); } }; // Renders myself publicAPI.translucentPass = (prepass, renderPass) => { model.context.depthMask(!prepass); }; publicAPI.getKeyMatrices = () => { // has the actor changed? if (model.renderable.getMTime() > model.keyMatrixTime.getMTime()) { mat4.copy(model.keyMatrices.mcwc, model.renderable.getMatrix()); mat4.transpose(model.keyMatrices.mcwc, model.keyMatrices.mcwc); model.keyMatrixTime.modified(); } return model.keyMatrices; }; } // ---------------------------------------------------------------------------- // Object factory // ---------------------------------------------------------------------------- const DEFAULT_VALUES = { context: null, keyMatrixTime: null, keyMatrices: null, }; // ---------------------------------------------------------------------------- export function extend(publicAPI, model, initialValues = {}) { Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance vtkViewNode.extend(publicAPI, model, initialValues); model.keyMatrixTime = {}; macro.obj(model.keyMatrixTime, { mtime: 0 }); model.keyMatrices = { mcwc: mat4.identity(new Float64Array(16)), }; // Build VTK API macro.setGet(publicAPI, model, ['context']); // Object methods vtkOpenGLImageSlice(publicAPI, model); } // ---------------------------------------------------------------------------- export const newInstance = macro.newInstance(extend, 'vtkOpenGLImageSlice'); // ---------------------------------------------------------------------------- export default { newInstance, extend }; // Register ourself to OpenGL backend if imported registerOverride('vtkImageSlice', newInstance); |