RenderPass

Introduction

vtkRenderPass is a deferred class with a simple deferred method Render.

Methods

extend

Method used to decorate a given object (publicAPI+model) with vtkRenderPass characteristics.

Argument Type Required Description
publicAPI Yes object on which methods will be bounds (public)
model Yes object on which data structure will be bounds (protected)
initialValues IRenderPassInitialValues No (default: {})

getCurrentOperation

getCurrentParent

getDelegates

getOperation

getPostDelegateOperations

getPreDelegateOperations

getTraverseOperation

newInstance

Method used to create a new instance of vtkRenderPass.

Argument Type Required Description
initialValues IRenderPassInitialValues No for pre-setting some of its content

setCurrentOperation

Argument Type Required Description
val String Yes

setCurrentParent

Argument Type Required Description
currentParent Yes

setDelegates

Argument Type Required Description
delegates Yes

setPostDelegateOperations

Argument Type Required Description
postDelegateOperations Yes

setPreDelegateOperations

Argument Type Required Description
preDelegateOperations Yes

traverse

by default this class will traverse all of its
preDelegateOperations, then call its delegate render passes
the traverse all of its postDelegateOperations
any of those three arrays can be empty

Argument Type Required Description
viewNode Yes
parent Yes

Source

index.d.ts
import { vtkObject } from "../../../interfaces";
import vtkViewNode from "../ViewNode";

/**
*
*/
export interface IRenderPassInitialValues {
delegates: Array<any>;
preDelegateOperations: Array<any>;
postDelegateOperations: Array<any>;
}

export interface vtkRenderPass extends vtkObject {

/**
*
*/
getCurrentOperation(): string;

/**
*
*/
getCurrentParent(): any;

/**
*
*/
getDelegates(): any;

/**
*
*/
getOperation(): void;

/**
*
*/
getPostDelegateOperations(): any;

/**
*
*/
getPreDelegateOperations(): any;

/**
*
*/
getTraverseOperation(): string;

/**
*
* @param {String} val
*/
setCurrentOperation(val: string): void;

/**
*
* @param currentParent
*/
setCurrentParent(currentParent: any): boolean;

/**
*
* @param delegates
*/
setDelegates(delegates: any): boolean;

/**
*
* @param postDelegateOperations
*/
setPostDelegateOperations(postDelegateOperations: any): boolean;

/**
*
* @param preDelegateOperations
*/
setPreDelegateOperations(preDelegateOperations: any): boolean;

/**
* by default this class will traverse all of its
* preDelegateOperations, then call its delegate render passes
* the traverse all of its postDelegateOperations
* any of those three arrays can be empty
* @param viewNode
* @param parent
*/
traverse(viewNode: vtkViewNode, parent: any): void;
}

/**
* Method used to decorate a given object (publicAPI+model) with vtkRenderPass characteristics.
*
* @param publicAPI object on which methods will be bounds (public)
* @param model object on which data structure will be bounds (protected)
* @param {IRenderPassInitialValues} [initialValues] (default: {})
*/
export function extend(publicAPI: object, model: object, initialValues?: IRenderPassInitialValues): void;

/**
* Method used to create a new instance of vtkRenderPass.
* @param {IRenderPassInitialValues} [initialValues] for pre-setting some of its content
*/
export function newInstance(initialValues?: IRenderPassInitialValues): vtkRenderPass;

/**
* vtkRenderPass is a deferred class with a simple deferred method Render.
*/
export declare const vtkRenderPass: {
newInstance: typeof newInstance,
extend: typeof extend,
};
export default vtkRenderPass;
index.js
import macro from 'vtk.js/Sources/macros';

// ----------------------------------------------------------------------------

function vtkRenderPass(publicAPI, model) {
// Set our className
model.classHierarchy.push('vtkRenderPass');

publicAPI.getOperation = () => model.currentOperation;

publicAPI.setCurrentOperation = (val) => {
model.currentOperation = val;
model.currentTraverseOperation = `traverse${macro.capitalize(
model.currentOperation
)}`;
};

publicAPI.getTraverseOperation = () => model.currentTraverseOperation;

// by default this class will traverse all of its
// preDelegateOperations, then call its delegate render passes
// the traverse all of its postDelegateOperations
// any of those three arrays can be empty
publicAPI.traverse = (viewNode, parent = null) => {
if (model.deleted) {
return;
}

// we just render our delegates in order
model._currentParent = parent;

model.preDelegateOperations.forEach((val) => {
publicAPI.setCurrentOperation(val);
viewNode.traverse(publicAPI);
});
model.delegates.forEach((val) => {
val.traverse(viewNode, publicAPI);
});
model.postDelegateOperations.forEach((val) => {
publicAPI.setCurrentOperation(val);
viewNode.traverse(publicAPI);
});
};
}

// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------

const DEFAULT_VALUES = {
delegates: [],
currentOperation: null,
preDelegateOperations: [],
postDelegateOperations: [],
currentParent: null,
};

// ----------------------------------------------------------------------------

export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);

// Build VTK API
macro.obj(publicAPI, model);
macro.get(publicAPI, model, ['currentOperation']);
macro.setGet(publicAPI, model, [
'delegates',
'_currentParent',
'preDelegateOperations',
'postDelegateOperations',
]);
macro.moveToProtected(publicAPI, model, ['currentParent']);

// Object methods
vtkRenderPass(publicAPI, model);
}

// ----------------------------------------------------------------------------

export const newInstance = macro.newInstance(extend, 'vtkRenderPass');

// ----------------------------------------------------------------------------

export default { newInstance, extend };