/usr/share/javascript/three/examples/js/nodes/accessors/PositionNode.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 80 81 82 83 84 85 86 87 | /**
* @author sunag / http://www.sunag.com.br/
*/
THREE.PositionNode = function( scope ) {
THREE.TempNode.call( this, 'v3' );
this.scope = scope || THREE.PositionNode.LOCAL;
};
THREE.PositionNode.LOCAL = 'local';
THREE.PositionNode.WORLD = 'world';
THREE.PositionNode.VIEW = 'view';
THREE.PositionNode.PROJECTION = 'projection';
THREE.PositionNode.prototype = Object.create( THREE.TempNode.prototype );
THREE.PositionNode.prototype.constructor = THREE.PositionNode;
THREE.PositionNode.prototype.getType = function( builder ) {
switch ( this.scope ) {
case THREE.PositionNode.PROJECTION:
return 'v4';
}
return this.type;
};
THREE.PositionNode.prototype.isShared = function( builder ) {
switch ( this.scope ) {
case THREE.PositionNode.LOCAL:
case THREE.PositionNode.WORLD:
return false;
}
return true;
};
THREE.PositionNode.prototype.generate = function( builder, output ) {
var material = builder.material;
var result;
switch ( this.scope ) {
case THREE.PositionNode.LOCAL:
material.requestAttrib.position = true;
if ( builder.isShader( 'vertex' ) ) result = 'transformed';
else result = 'vPosition';
break;
case THREE.PositionNode.WORLD:
material.requestAttrib.worldPosition = true;
if ( builder.isShader( 'vertex' ) ) result = 'vWPosition';
else result = 'vWPosition';
break;
case THREE.PositionNode.VIEW:
if ( builder.isShader( 'vertex' ) ) result = '-mvPosition.xyz';
else result = 'vViewPosition';
break;
case THREE.PositionNode.PROJECTION:
if ( builder.isShader( 'vertex' ) ) result = '(projectionMatrix * modelViewMatrix * vec4( position, 1.0 ))';
else result = 'vec4( 0.0 )';
break;
}
return builder.format( result, this.getType( builder ), output );
};
|