/usr/share/javascript/three/examples/js/nodes/inputs/TextureNode.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 | /**
* @author sunag / http://www.sunag.com.br/
*/
THREE.TextureNode = function( value, coord, bias, project ) {
THREE.InputNode.call( this, 'v4' );
this.value = value;
this.coord = coord || new THREE.UVNode();
this.bias = bias;
this.project = project !== undefined ? project : false;
};
THREE.TextureNode.prototype = Object.create( THREE.InputNode.prototype );
THREE.TextureNode.prototype.constructor = THREE.TextureNode;
THREE.TextureNode.prototype.getTexture = function( builder, output ) {
return THREE.InputNode.prototype.generate.call( this, builder, output, this.value.uuid, 't' );
};
THREE.TextureNode.prototype.generate = function( builder, output ) {
var tex = this.getTexture( builder, output );
var coord = this.coord.build( builder, this.project ? 'v4' : 'v2' );
var bias = this.bias ? this.bias.build( builder, 'fv1' ) : undefined;
if ( bias == undefined && builder.requires.bias ) {
bias = builder.requires.bias.build( builder, 'fv1' );
}
var method, code;
if ( this.project ) method = 'texture2DProj';
else method = bias ? 'tex2DBias' : 'tex2D';
if ( bias ) code = method + '(' + tex + ',' + coord + ',' + bias + ')';
else code = method + '(' + tex + ',' + coord + ')';
return builder.format( code, this.type, output );
};
|