const sendFrame = (data, seqId, writeCallback) => { const frameBuffer = Buffer.alloc(4 + data.length); frameBuffer.writeUInt32BE(data.length, 0); data.copy(frameBuffer, 4, 0, data.length); writeCallback(frameBuffer, seqId); }
function () { var v1 = new THREE.Vector3(); return function ( point ) { var directionDistance = v1.subVectors( point, this.origin ).dot( this.direction ); // point behind the ray if ( directionDistance < 0 ) { return this.origin.distanceTo( point ); } v1.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); return v1.distanceTo( point ); }; }()
ensureAvailable(length) { if (this.offset + length > this.buf.length) { const newLength = Encoder.nextPowerOfTwo(this.offset + length) const newBuffer = Buffer.alloc(newLength) this.buf.copy(newBuffer, 0, 0, this.offset) this.buf = newBuffer } }
function () { // translate object by distance along axis in object space // axis is assumed to be normalized var v1 = new THREE.Vector3(); return function ( axis, distance ) { v1.copy( axis ); v1.applyQuaternion( this.quaternion ); this.position.add( v1.multiplyScalar( distance ) ); return this; } }()
/** * @param {Buffer} buffer */ writeBufferInternal(buffer) { const bufferLength = buffer.length this.ensureAvailable(bufferLength) buffer.copy(this.buf, this.offset, 0) this.offset += bufferLength }
async function processFiles (files) { const timer = hirestime() const totalFiles = files.queue.length for (const file of files.queue) { await fs.copy(file.filePath, file.destPath) } info(`Process files (${totalFiles} files) - ${timer(hirestime.S)}s`) }
function () { // reflect incident vector off plane orthogonal to normal // normal is assumed to have unit length var v1; return function ( normal ) { if ( v1 === undefined ) v1 = new THREE.Vector3(); return this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) ); } }()
function () { var vector = new THREE.Vector3(); return function () { this.colors[ 0 ].copy( this.light.color ).multiplyScalar( this.light.intensity ); this.colors[ 1 ].copy( this.light.groundColor ).multiplyScalar( this.light.intensity ); this.lightSphere.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() ); this.lightSphere.geometry.colorsNeedUpdate = true; } }()
function () { var v1 = new THREE.Vector2(); return function ( point ) { var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); return clampedPoint.sub( point ).length(); }; }()
function() { var v1 = new THREE.Vector3(); return function ( point ) { var clampedPoint = v1.copy( point ).clamp( this.min, this.max ); return clampedPoint.sub( point ).length(); }; }()