You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
652 B
44 lines
652 B
import Node from '../core/Node.js';
|
|
import LightNode from './LightNode.js';
|
|
|
|
class LightsNode extends Node {
|
|
|
|
constructor( lightNodes = [] ) {
|
|
|
|
super( 'vec3' );
|
|
|
|
this.lightNodes = lightNodes;
|
|
|
|
}
|
|
|
|
generate( builder, output ) {
|
|
|
|
const lightNodes = this.lightNodes;
|
|
|
|
for ( const lightNode of lightNodes ) {
|
|
|
|
lightNode.build( builder );
|
|
|
|
}
|
|
|
|
return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );
|
|
|
|
}
|
|
|
|
static fromLights( lights ) {
|
|
|
|
const lightNodes = [];
|
|
|
|
for ( const light of lights ) {
|
|
|
|
lightNodes.push( new LightNode( light ) );
|
|
|
|
}
|
|
|
|
return new LightsNode( lightNodes );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export default LightsNode;
|
|
|