| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/3dweb/src/core/ |
Upload File : |
import { Vector3 } from '../math/Vector3.js';
/**
* @author benaadams / https://twitter.com/ben_a_adams
*/
var _vector = new Vector3();
function InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, normalized ) {
this.data = interleavedBuffer;
this.itemSize = itemSize;
this.offset = offset;
this.normalized = normalized === true;
}
Object.defineProperties( InterleavedBufferAttribute.prototype, {
count: {
get: function () {
return this.data.count;
}
},
array: {
get: function () {
return this.data.array;
}
}
} );
Object.assign( InterleavedBufferAttribute.prototype, {
isInterleavedBufferAttribute: true,
applyMatrix4: function ( m ) {
for ( var i = 0, l = this.data.count; i < l; i ++ ) {
_vector.x = this.getX( i );
_vector.y = this.getY( i );
_vector.z = this.getZ( i );
_vector.applyMatrix4( m );
this.setXYZ( i, _vector.x, _vector.y, _vector.z );
}
return this;
},
setX: function ( index, x ) {
this.data.array[ index * this.data.stride + this.offset ] = x;
return this;
},
setY: function ( index, y ) {
this.data.array[ index * this.data.stride + this.offset + 1 ] = y;
return this;
},
setZ: function ( index, z ) {
this.data.array[ index * this.data.stride + this.offset + 2 ] = z;
return this;
},
setW: function ( index, w ) {
this.data.array[ index * this.data.stride + this.offset + 3 ] = w;
return this;
},
getX: function ( index ) {
return this.data.array[ index * this.data.stride + this.offset ];
},
getY: function ( index ) {
return this.data.array[ index * this.data.stride + this.offset + 1 ];
},
getZ: function ( index ) {
return this.data.array[ index * this.data.stride + this.offset + 2 ];
},
getW: function ( index ) {
return this.data.array[ index * this.data.stride + this.offset + 3 ];
},
setXY: function ( index, x, y ) {
index = index * this.data.stride + this.offset;
this.data.array[ index + 0 ] = x;
this.data.array[ index + 1 ] = y;
return this;
},
setXYZ: function ( index, x, y, z ) {
index = index * this.data.stride + this.offset;
this.data.array[ index + 0 ] = x;
this.data.array[ index + 1 ] = y;
this.data.array[ index + 2 ] = z;
return this;
},
setXYZW: function ( index, x, y, z, w ) {
index = index * this.data.stride + this.offset;
this.data.array[ index + 0 ] = x;
this.data.array[ index + 1 ] = y;
this.data.array[ index + 2 ] = z;
this.data.array[ index + 3 ] = w;
return this;
}
} );
export { InterleavedBufferAttribute };