/usr/share/javascript/three/examples/js/nodes/math/Math1Node.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 70 71 72 73 74 75 76 77 78 79 | /**
* @author sunag / http://www.sunag.com.br/
*/
THREE.Math1Node = function( a, method ) {
THREE.TempNode.call( this );
this.a = a;
this.method = method || THREE.Math1Node.SIN;
};
THREE.Math1Node.RAD = 'radians';
THREE.Math1Node.DEG = 'degrees';
THREE.Math1Node.EXP = 'exp';
THREE.Math1Node.EXP2 = 'exp2';
THREE.Math1Node.LOG = 'log';
THREE.Math1Node.LOG2 = 'log2';
THREE.Math1Node.SQRT = 'sqrt';
THREE.Math1Node.INV_SQRT = 'inversesqrt';
THREE.Math1Node.FLOOR = 'floor';
THREE.Math1Node.CEIL = 'ceil';
THREE.Math1Node.NORMALIZE = 'normalize';
THREE.Math1Node.FRACT = 'fract';
THREE.Math1Node.SAT = 'saturate';
THREE.Math1Node.SIN = 'sin';
THREE.Math1Node.COS = 'cos';
THREE.Math1Node.TAN = 'tan';
THREE.Math1Node.ASIN = 'asin';
THREE.Math1Node.ACOS = 'acos';
THREE.Math1Node.ARCTAN = 'atan';
THREE.Math1Node.ABS = 'abs';
THREE.Math1Node.SIGN = 'sign';
THREE.Math1Node.LENGTH = 'length';
THREE.Math1Node.NEGATE = 'negate';
THREE.Math1Node.INVERT = 'invert';
THREE.Math1Node.prototype = Object.create( THREE.TempNode.prototype );
THREE.Math1Node.prototype.constructor = THREE.Math1Node;
THREE.Math1Node.prototype.getType = function( builder ) {
switch ( this.method ) {
case THREE.Math1Node.LENGTH:
return 'fv1';
}
return this.a.getType( builder );
};
THREE.Math1Node.prototype.generate = function( builder, output ) {
var material = builder.material;
var type = this.getType( builder );
var result = this.a.build( builder, type );
switch ( this.method ) {
case THREE.Math1Node.NEGATE:
result = '(-' + result + ')';
break;
case THREE.Math1Node.INVERT:
result = '(1.0-' + result + ')';
break;
default:
result = this.method + '(' + result + ')';
break;
}
return builder.format( result, type, output );
};
|