添加关照、全局等高线、修改图层问题
This commit is contained in:
37
static/sdk/three/jsm/nodes/code/ExpressionNode.js
Normal file
37
static/sdk/three/jsm/nodes/code/ExpressionNode.js
Normal file
@ -0,0 +1,37 @@
|
||||
import Node, { addNodeClass } from '../core/Node.js';
|
||||
import { nodeProxy } from '../shadernode/ShaderNode.js';
|
||||
|
||||
class ExpressionNode extends Node {
|
||||
|
||||
constructor( snippet = '', nodeType = 'void' ) {
|
||||
|
||||
super( nodeType );
|
||||
|
||||
this.snippet = snippet;
|
||||
|
||||
}
|
||||
|
||||
generate( builder, output ) {
|
||||
|
||||
const type = this.getNodeType( builder );
|
||||
const snippet = this.snippet;
|
||||
|
||||
if ( type === 'void' ) {
|
||||
|
||||
builder.addLineFlowCode( snippet );
|
||||
|
||||
} else {
|
||||
|
||||
return builder.format( `( ${ snippet } )`, type, output );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default ExpressionNode;
|
||||
|
||||
export const expression = nodeProxy( ExpressionNode );
|
||||
|
||||
addNodeClass( 'ExpressionNode', ExpressionNode );
|
Reference in New Issue
Block a user