最新代码
This commit is contained in:
35
public/sdk/three/jsm/nodes/utils/ArrayElementNode.js
Normal file
35
public/sdk/three/jsm/nodes/utils/ArrayElementNode.js
Normal file
@ -0,0 +1,35 @@
|
||||
import Node, { addNodeClass } from '../core/Node.js';
|
||||
|
||||
class ArrayElementNode extends Node { // @TODO: If extending from TempNode it breaks webgpu_compute
|
||||
|
||||
constructor( node, indexNode ) {
|
||||
|
||||
super();
|
||||
|
||||
this.node = node;
|
||||
this.indexNode = indexNode;
|
||||
|
||||
this.isArrayElementNode = true;
|
||||
|
||||
}
|
||||
|
||||
getNodeType( builder ) {
|
||||
|
||||
return this.node.getNodeType( builder );
|
||||
|
||||
}
|
||||
|
||||
generate( builder ) {
|
||||
|
||||
const nodeSnippet = this.node.build( builder );
|
||||
const indexSnippet = this.indexNode.build( builder, 'uint' );
|
||||
|
||||
return `${nodeSnippet}[ ${indexSnippet} ]`;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default ArrayElementNode;
|
||||
|
||||
addNodeClass( 'ArrayElementNode', ArrayElementNode );
|
Reference in New Issue
Block a user