123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /**
- * @author sunag / http://www.sunag.com.br/
- */
- THREE.FunctionCallNode = function( value ) {
- THREE.TempNode.call( this );
- this.setFunction( value );
- };
- THREE.FunctionCallNode.prototype = Object.create( THREE.TempNode.prototype );
- THREE.FunctionCallNode.prototype.constructor = THREE.FunctionCallNode;
- THREE.FunctionCallNode.prototype.setFunction = function( val ) {
- this.input = [];
- this.value = val;
- };
- THREE.FunctionCallNode.prototype.getFunction = function() {
- return this.value;
- };
- THREE.FunctionCallNode.prototype.getType = function( builder ) {
- return this.value.getType( builder );
- };
- THREE.FunctionCallNode.prototype.generate = function( builder, output ) {
- var material = builder.material;
- var type = this.getType( builder );
- var func = this.value;
- builder.include( func );
- var code = func.name + '(';
- var params = [];
- for ( var i = 0; i < func.input.length; i ++ ) {
- var inpt = func.input[ i ];
- var param = this.input[ i ] || this.input[ inpt.name ];
- params.push( param.build( builder, builder.getType( inpt.type ) ) );
- }
- code += params.join( ',' ) + ')';
- return builder.format( code, type, output );
- };
|