1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 02:39:46 +02:00
Oinktube/node_modules/three/examples/jsm/renderers/nodes/utils/SwitchNode.js
2023-12-11 11:59:56 -03:00

33 lines
573 B
JavaScript

import Node from '../core/Node.js';
class SwitchNode extends Node {
constructor( node, components = 'x' ) {
super();
this.node = node;
this.components = components;
}
getType( builder ) {
return builder.getTypeFromLength( this.components.length );
}
generate( builder, output ) {
const nodeType = this.node.getType( builder );
const nodeSnippet = this.node.build( builder, nodeType );
const snippet = `${nodeSnippet}.${this.components}`;
return builder.format( snippet, this.getType( builder ), output );
}
}
export default SwitchNode;