UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

33 lines (28 loc) 1.1 kB
/** * utility node that helps you organise your shaders * * * */ import {BaseNodeGlMathFunctionArg1GlNode} from './_BaseMathFunction'; // import {ParamType} from '../../../Engine/Param/_Module'; // import {TypedConnectionFloat} from './GlData' import {ThreeToGl} from '../../../core/ThreeToGl'; import {ShadersCollectionController} from './code/utils/ShadersCollectionController'; export class NullGlNode extends BaseNodeGlMathFunctionArg1GlNode { static override type() { return 'null'; } override setLines(shaders_collection_controller: ShadersCollectionController) { const namedOutputConnectionPoints = this.io.outputs.namedOutputConnectionPoints(); if (!namedOutputConnectionPoints) { return; } const in_value = ThreeToGl.any(this.variableForInput(this._gl_input_name(0))); const out_connection_point = namedOutputConnectionPoints[0]; const gl_type = out_connection_point.type(); const out = this.glVarName(out_connection_point.name()); const body_line = `${gl_type} ${out} = ${in_value}`; shaders_collection_controller.addBodyLines(this, [body_line]); } }