mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
30 lines
605 B
JavaScript
30 lines
605 B
JavaScript
import InputNode from '../core/InputNode.js';
|
|
import UVNode from '../accessors/UVNode.js';
|
|
|
|
class TextureNode extends InputNode {
|
|
|
|
constructor( value, uv = new UVNode() ) {
|
|
|
|
super( 'texture' );
|
|
|
|
this.value = value;
|
|
this.uv = uv;
|
|
|
|
}
|
|
|
|
generate( builder, output ) {
|
|
|
|
const type = this.getType( builder );
|
|
|
|
const textureProperty = super.generate( builder, type );
|
|
const uvSnippet = this.uv.build( builder, 'vec2' );
|
|
|
|
const textureCallSnippet = builder.getTexture( textureProperty, uvSnippet );
|
|
|
|
return builder.format( textureCallSnippet, type, output );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export default TextureNode;
|