/usr/share/javascript/three/examples/js/nodes/utils/JoinNode.js is in libjs-three 80+dfsg2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | /**
* @author sunag / http://www.sunag.com.br/
*/
THREE.JoinNode = function( x, y, z, w ) {
THREE.TempNode.call( this, 'fv1' );
this.x = x;
this.y = y;
this.z = z;
this.w = w;
};
THREE.JoinNode.inputs = [ 'x', 'y', 'z', 'w' ];
THREE.JoinNode.prototype = Object.create( THREE.TempNode.prototype );
THREE.JoinNode.prototype.constructor = THREE.JoinNode;
THREE.JoinNode.prototype.getNumElements = function() {
var inputs = THREE.JoinNode.inputs;
var i = inputs.length;
while ( i -- ) {
if ( this[ inputs[ i ] ] !== undefined ) {
++ i;
break;
}
}
return Math.max( i, 2 );
};
THREE.JoinNode.prototype.getType = function( builder ) {
return builder.getFormatByLength( this.getNumElements() );
};
THREE.JoinNode.prototype.generate = function( builder, output ) {
var material = builder.material;
var type = this.getType( builder );
var length = this.getNumElements();
var inputs = THREE.JoinNode.inputs;
var outputs = [];
for ( var i = 0; i < length; i ++ ) {
var elm = this[ inputs[ i ]];
outputs.push( elm ? elm.build( builder, 'fv1' ) : '0.' );
}
var code = builder.getFormatConstructor( length ) + '(' + outputs.join( ',' ) + ')';
return builder.format( code, type, output );
};
|