提交 493b6e1a 编写于 作者: M Mugen87

Clean up linter warnings

上级 fd9c6308
......@@ -443,16 +443,16 @@ Object.assign( Matrix3.prototype, {
},
multiplyVector3Array: function ( a ) {
console.error( 'THREE.Matrix3: .multiplyVector3Array() has been removed.' );
console.error( 'THREE.Matrix3: .multiplyVector3Array() has been removed.' );
},
applyToBuffer: function( buffer, offset, length ) {
applyToBuffer: function ( buffer, offset, length ) {
console.warn( 'THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
},
applyToVector3Array: function( array, offset, length ) {
applyToVector3Array: function ( array, offset, length ) {
console.error( 'THREE.Matrix3: .applyToVector3Array() has been removed.' );
......@@ -512,7 +512,7 @@ Object.assign( Matrix4.prototype, {
},
multiplyVector3Array: function ( a ) {
console.error( 'THREE.Matrix4: .multiplyVector3Array() has been removed.' );
console.error( 'THREE.Matrix4: .multiplyVector3Array() has been removed.' );
},
rotateAxis: function ( v ) {
......@@ -552,18 +552,18 @@ Object.assign( Matrix4.prototype, {
console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );
},
applyToBuffer: function( buffer, offset, length ) {
applyToBuffer: function ( buffer, offset, length ) {
console.warn( 'THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
},
applyToVector3Array: function( array, offset, length ) {
applyToVector3Array: function ( array, offset, length ) {
console.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' );
},
makeFrustum: function( left, right, bottom, top, near, far ) {
makeFrustum: function ( left, right, bottom, top, near, far ) {
console.warn( 'THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.' );
return this.makePerspective( left, right, top, bottom, near, far );
......
......@@ -22,8 +22,8 @@ function AnimationAction( mixer, clip, localRoot ) {
interpolants = new Array( nTracks );
var interpolantSettings = {
endingStart: ZeroCurvatureEnding,
endingEnd: ZeroCurvatureEnding
endingStart: ZeroCurvatureEnding,
endingEnd: ZeroCurvatureEnding
};
for ( var i = 0; i !== nTracks; ++ i ) {
......@@ -48,7 +48,7 @@ function AnimationAction( mixer, clip, localRoot ) {
this._weightInterpolant = null;
this.loop = LoopRepeat;
this._loopCount = -1;
this._loopCount = - 1;
// global mixer time when the action is to be started
// it's set back to 'null' upon start of the action
......@@ -80,7 +80,7 @@ Object.assign( AnimationAction.prototype, {
// State & Scheduling
play: function() {
play: function () {
this._mixer._activateAction( this );
......@@ -88,7 +88,7 @@ Object.assign( AnimationAction.prototype, {
},
stop: function() {
stop: function () {
this._mixer._deactivateAction( this );
......@@ -96,20 +96,20 @@ Object.assign( AnimationAction.prototype, {
},
reset: function() {
reset: function () {
this.paused = false;
this.enabled = true;
this.time = 0; // restart clip
this._loopCount = -1; // forget previous loops
this._loopCount = - 1; // forget previous loops
this._startTime = null; // forget scheduling
return this.stopFading().stopWarping();
},
isRunning: function() {
isRunning: function () {
return this.enabled && ! this.paused && this.timeScale !== 0 &&
this._startTime === null && this._mixer._isActiveAction( this );
......@@ -117,13 +117,13 @@ Object.assign( AnimationAction.prototype, {
},
// return true when play has been called
isScheduled: function() {
isScheduled: function () {
return this._mixer._isActiveAction( this );
},
startAt: function( time ) {
startAt: function ( time ) {
this._startTime = time;
......@@ -131,7 +131,7 @@ Object.assign( AnimationAction.prototype, {
},
setLoop: function( mode, repetitions ) {
setLoop: function ( mode, repetitions ) {
this.loop = mode;
this.repetitions = repetitions;
......@@ -145,7 +145,7 @@ Object.assign( AnimationAction.prototype, {
// set the weight stopping any scheduled fading
// although .enabled = false yields an effective weight of zero, this
// method does *not* change .enabled, because it would be confusing
setEffectiveWeight: function( weight ) {
setEffectiveWeight: function ( weight ) {
this.weight = weight;
......@@ -157,30 +157,30 @@ Object.assign( AnimationAction.prototype, {
},
// return the weight considering fading and .enabled
getEffectiveWeight: function() {
getEffectiveWeight: function () {
return this._effectiveWeight;
},
fadeIn: function( duration ) {
fadeIn: function ( duration ) {
return this._scheduleFading( duration, 0, 1 );
},
fadeOut: function( duration ) {
fadeOut: function ( duration ) {
return this._scheduleFading( duration, 1, 0 );
},
crossFadeFrom: function( fadeOutAction, duration, warp ) {
crossFadeFrom: function ( fadeOutAction, duration, warp ) {
fadeOutAction.fadeOut( duration );
this.fadeIn( duration );
if( warp ) {
if ( warp ) {
var fadeInDuration = this._clip.duration,
fadeOutDuration = fadeOutAction._clip.duration,
......@@ -197,13 +197,13 @@ Object.assign( AnimationAction.prototype, {
},
crossFadeTo: function( fadeInAction, duration, warp ) {
crossFadeTo: function ( fadeInAction, duration, warp ) {
return fadeInAction.crossFadeFrom( this, duration, warp );
},
stopFading: function() {
stopFading: function () {
var weightInterpolant = this._weightInterpolant;
......@@ -223,23 +223,23 @@ Object.assign( AnimationAction.prototype, {
// set the time scale stopping any scheduled warping
// although .paused = true yields an effective time scale of zero, this
// method does *not* change .paused, because it would be confusing
setEffectiveTimeScale: function( timeScale ) {
setEffectiveTimeScale: function ( timeScale ) {
this.timeScale = timeScale;
this._effectiveTimeScale = this.paused ? 0 :timeScale;
this._effectiveTimeScale = this.paused ? 0 : timeScale;
return this.stopWarping();
},
// return the time scale considering warping and .paused
getEffectiveTimeScale: function() {
getEffectiveTimeScale: function () {
return this._effectiveTimeScale;
},
setDuration: function( duration ) {
setDuration: function ( duration ) {
this.timeScale = this._clip.duration / duration;
......@@ -247,7 +247,7 @@ Object.assign( AnimationAction.prototype, {
},
syncWith: function( action ) {
syncWith: function ( action ) {
this.time = action.time;
this.timeScale = action.timeScale;
......@@ -256,13 +256,13 @@ Object.assign( AnimationAction.prototype, {
},
halt: function( duration ) {
halt: function ( duration ) {
return this.warp( this._effectiveTimeScale, 0, duration );
},
warp: function( startTimeScale, endTimeScale, duration ) {
warp: function ( startTimeScale, endTimeScale, duration ) {
var mixer = this._mixer, now = mixer.time,
interpolant = this._timeScaleInterpolant,
......@@ -289,7 +289,7 @@ Object.assign( AnimationAction.prototype, {
},
stopWarping: function() {
stopWarping: function () {
var timeScaleInterpolant = this._timeScaleInterpolant;
......@@ -306,19 +306,19 @@ Object.assign( AnimationAction.prototype, {
// Object Accessors
getMixer: function() {
getMixer: function () {
return this._mixer;
},
getClip: function() {
getClip: function () {
return this._clip;
},
getRoot: function() {
getRoot: function () {
return this._localRoot || this._mixer._root;
......@@ -326,7 +326,7 @@ Object.assign( AnimationAction.prototype, {
// Interna
_update: function( time, deltaTime, timeDirection, accuIndex ) {
_update: function ( time, deltaTime, timeDirection, accuIndex ) {
// called by the mixer
......@@ -385,7 +385,7 @@ Object.assign( AnimationAction.prototype, {
},
_updateWeight: function( time ) {
_updateWeight: function ( time ) {
var weight = 0;
......@@ -422,7 +422,7 @@ Object.assign( AnimationAction.prototype, {
},
_updateTimeScale: function( time ) {
_updateTimeScale: function ( time ) {
var timeScale = 0;
......@@ -465,7 +465,7 @@ Object.assign( AnimationAction.prototype, {
},
_updateTime: function( deltaTime ) {
_updateTime: function ( deltaTime ) {
var time = this.time + deltaTime;
......@@ -478,7 +478,7 @@ Object.assign( AnimationAction.prototype, {
if ( loop === LoopOnce ) {
if ( loopCount === -1 ) {
if ( loopCount === - 1 ) {
// just started
this._loopCount = 0;
......@@ -503,7 +503,7 @@ Object.assign( AnimationAction.prototype, {
this._mixer.dispatchEvent( {
type: 'finished', action: this,
direction: deltaTime < 0 ? -1 : 1
direction: deltaTime < 0 ? - 1 : 1
} );
}
......@@ -512,15 +512,14 @@ Object.assign( AnimationAction.prototype, {
var pingPong = ( loop === LoopPingPong );
if ( loopCount === -1 ) {
if ( loopCount === - 1 ) {
// just started
if ( deltaTime >= 0 ) {
loopCount = 0;
this._setEndings(
true, this.repetitions === 0, pingPong );
this._setEndings( true, this.repetitions === 0, pingPong );
} else {
......@@ -528,8 +527,7 @@ Object.assign( AnimationAction.prototype, {
// transition through zero counts as a repetition,
// so leave loopCount at -1
this._setEndings(
this.repetitions === 0, true, pingPong );
this._setEndings( this.repetitions === 0, true, pingPong );
}
......@@ -598,7 +596,7 @@ Object.assign( AnimationAction.prototype, {
},
_setEndings: function( atStart, atEnd, pingPong ) {
_setEndings: function ( atStart, atEnd, pingPong ) {
var settings = this._interpolantSettings;
......@@ -613,8 +611,7 @@ Object.assign( AnimationAction.prototype, {
if ( atStart ) {
settings.endingStart = this.zeroSlopeAtStart ?
ZeroSlopeEnding : ZeroCurvatureEnding;
settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;
} else {
......@@ -624,8 +621,7 @@ Object.assign( AnimationAction.prototype, {
if ( atEnd ) {
settings.endingEnd = this.zeroSlopeAtEnd ?
ZeroSlopeEnding : ZeroCurvatureEnding;
settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;
} else {
......@@ -637,7 +633,7 @@ Object.assign( AnimationAction.prototype, {
},
_scheduleFading: function( duration, weightNow, weightThen ) {
_scheduleFading: function ( duration, weightNow, weightThen ) {
var mixer = this._mixer, now = mixer.time,
interpolant = this._weightInterpolant;
......
......@@ -77,7 +77,7 @@ Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {
}
var path = prototypeAction && prototypeAction.
_propertyBindings[ i ].binding.parsedPath;
_propertyBindings[ i ].binding.parsedPath;
binding = new PropertyMixer(
PropertyBinding.create( root, trackName, path ),
......
......@@ -75,7 +75,7 @@ Object.assign( AnimationObjectGroup.prototype, {
isAnimationObjectGroup: true,
add: function( var_args ) {
add: function ( var_args ) {
var objects = this._objects,
nObjects = objects.length,
......@@ -105,9 +105,7 @@ Object.assign( AnimationObjectGroup.prototype, {
for ( var j = 0, m = nBindings; j !== m; ++ j ) {
bindings[ j ].push(
new PropertyBinding(
object, paths[ j ], parsedPaths[ j ] ) );
bindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );
}
......@@ -142,8 +140,7 @@ Object.assign( AnimationObjectGroup.prototype, {
// for objects that are cached, the binding may
// or may not exist
binding = new PropertyBinding(
object, paths[ j ], parsedPaths[ j ] );
binding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );
}
......@@ -164,7 +161,7 @@ Object.assign( AnimationObjectGroup.prototype, {
},
remove: function( var_args ) {
remove: function ( var_args ) {
var objects = this._objects,
nCachedObjects = this.nCachedObjects_,
......@@ -213,7 +210,7 @@ Object.assign( AnimationObjectGroup.prototype, {
},
// remove & forget
uncache: function( var_args ) {
uncache: function ( var_args ) {
var objects = this._objects,
nObjects = objects.length,
......
......@@ -34,9 +34,9 @@ Object.assign( KeyframeTrack, {
// Serialization (in static context, because of constructor invocation
// and automatic invocation of .toJSON):
parse: function( json ) {
parse: function ( json ) {
if( json.type === undefined ) {
if ( json.type === undefined ) {
throw new Error( "track type undefined, can not parse" );
......@@ -63,14 +63,13 @@ Object.assign( KeyframeTrack, {
} else {
// by default, we assume a constructor compatible with the base
return new trackType(
json.name, json.times, json.values, json.interpolation );
return new trackType( json.name, json.times, json.values, json.interpolation );
}
},
toJSON: function( track ) {
toJSON: function ( track ) {
var trackType = track.constructor;
......@@ -108,9 +107,9 @@ Object.assign( KeyframeTrack, {
},
_getTrackTypeForValueTypeName: function( typeName ) {
_getTrackTypeForValueTypeName: function ( typeName ) {
switch( typeName.toLowerCase() ) {
switch ( typeName.toLowerCase() ) {
case "scalar":
case "double":
......
......@@ -16,22 +16,19 @@ KeyframeTrackPrototype = {
InterpolantFactoryMethodDiscrete: function ( result ) {
return new DiscreteInterpolant(
this.times, this.values, this.getValueSize(), result );
return new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );
},
InterpolantFactoryMethodLinear: function ( result ) {
return new LinearInterpolant(
this.times, this.values, this.getValueSize(), result );
return new LinearInterpolant( this.times, this.values, this.getValueSize(), result );
},
InterpolantFactoryMethodSmooth: function ( result ) {
return new CubicInterpolant(
this.times, this.values, this.getValueSize(), result );
return new CubicInterpolant( this.times, this.values, this.getValueSize(), result );
},
......@@ -175,8 +172,7 @@ KeyframeTrackPrototype = {
var stride = this.getValueSize();
this.times = AnimationUtils.arraySlice( times, from, to );
this.values = AnimationUtils.
arraySlice( this.values, from * stride, to * stride );
this.values = AnimationUtils.arraySlice( this.values, from * stride, to * stride );
}
......
......@@ -102,7 +102,7 @@ function CubeCamera( near, far, cubeResolution ) {
renderer.setRenderTarget( null );
}
};
}
......
......@@ -51,7 +51,7 @@ OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ),
},
setViewOffset: function( fullWidth, fullHeight, x, y, width, height ) {
setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) {
this.view = {
fullWidth: fullWidth,
......@@ -66,7 +66,7 @@ OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ),
},
clearViewOffset: function() {
clearViewOffset: function () {
this.view = null;
this.updateProjectionMatrix();
......
......@@ -91,7 +91,7 @@ PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ),
getEffectiveFOV: function () {
return _Math.RAD2DEG * 2 * Math.atan(
Math.tan( _Math.DEG2RAD * 0.5 * this.fov ) / this.zoom );
Math.tan( _Math.DEG2RAD * 0.5 * this.fov ) / this.zoom );
},
......@@ -172,7 +172,7 @@ PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ),
var near = this.near,
top = near * Math.tan(
_Math.DEG2RAD * 0.5 * this.fov ) / this.zoom,
_Math.DEG2RAD * 0.5 * this.fov ) / this.zoom,
height = 2 * top,
width = this.aspect * height,
left = - 0.5 * width,
......
......@@ -92,6 +92,7 @@ function Object3D() {
this.renderOrder = 0;
this.userData = {};
}
Object3D.DefaultUp = new Vector3( 0, 1, 0 );
......
......@@ -565,7 +565,7 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
function buildLidFaces() {
var start = verticesArray.length/3;
var start = verticesArray.length / 3;
if ( bevelEnabled ) {
......@@ -615,7 +615,7 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
}
scope.addGroup( start, verticesArray.length/3 -start, options.material !== undefined ? options.material : 0);
scope.addGroup( start, verticesArray.length / 3 - start, options.material !== undefined ? options.material : 0 );
}
......@@ -623,7 +623,7 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
function buildSideFaces() {
var start = verticesArray.length/3;
var start = verticesArray.length / 3;
var layeroffset = 0;
sidewalls( contour, layeroffset );
layeroffset += contour.length;
......@@ -639,7 +639,7 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
}
scope.addGroup( start, verticesArray.length/3 -start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1);
scope.addGroup( start, verticesArray.length / 3 - start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1 );
}
......
......@@ -10,7 +10,7 @@ import { PolyhedronBufferGeometry } from './PolyhedronGeometry.js';
function IcosahedronGeometry( radius, detail ) {
Geometry.call( this );
Geometry.call( this );
this.type = 'IcosahedronGeometry';
......
......@@ -22,7 +22,7 @@ import { ExtrudeBufferGeometry } from './ExtrudeGeometry.js';
// TextGeometry
function TextGeometry( text, parameters ) {
function TextGeometry( text, parameters ) {
Geometry.call( this );
......
......@@ -150,7 +150,7 @@ function TubeBufferGeometry( path, tubularSegments, radius, radialSegments, clos
var v = j / radialSegments * Math.PI * 2;
var sin = Math.sin( v );
var sin = Math.sin( v );
var cos = - Math.cos( v );
// normal
......
......@@ -14,7 +14,6 @@
*/
import { LineBasicMaterial } from './LineBasicMaterial.js';
import { Color } from '../math/Color.js';
function LineDashedMaterial( parameters ) {
......
......@@ -413,7 +413,7 @@ Object.assign( Box3.prototype, {
this.max.min( box.max );
// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.
if( this.isEmpty() ) this.makeEmpty();
if ( this.isEmpty() ) this.makeEmpty();
return this;
......@@ -444,7 +444,7 @@ Object.assign( Box3.prototype, {
return function applyMatrix4( matrix ) {
// transform of empty box is an empty box.
if( this.isEmpty() ) return this;
if ( this.isEmpty() ) return this;
// NOTE: I am using a binary pattern to specify all 2^3 combinations below
points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
......
......@@ -440,7 +440,7 @@ Object.assign( Color.prototype, {
},
sub: function( color ) {
sub: function ( color ) {
this.r = Math.max( 0, this.r - color.r );
this.g = Math.max( 0, this.g - color.g );
......
......@@ -43,7 +43,7 @@ Object.assign( Cylindrical.prototype, {
},
setFromVector3: function( vec3 ) {
setFromVector3: function ( vec3 ) {
this.radius = Math.sqrt( vec3.x * vec3.x + vec3.z * vec3.z );
this.theta = Math.atan2( vec3.x, vec3.z );
......
......@@ -26,7 +26,7 @@ function Interpolant( parameterPositions, sampleValues, sampleSize, resultBuffer
this._cachedIndex = 0;
this.resultBuffer = resultBuffer !== undefined ?
resultBuffer : new sampleValues.constructor( sampleSize );
resultBuffer : new sampleValues.constructor( sampleSize );
this.sampleValues = sampleValues;
this.valueSize = sampleSize;
......@@ -34,12 +34,12 @@ function Interpolant( parameterPositions, sampleValues, sampleSize, resultBuffer
Object.assign( Interpolant.prototype, {
evaluate: function( t ) {
evaluate: function ( t ) {
var pp = this.parameterPositions,
i1 = this._cachedIndex,
t1 = pp[ i1 ],
t1 = pp[ i1 ],
t0 = pp[ i1 - 1 ];
validate_interval: {
......@@ -162,7 +162,7 @@ Object.assign( Interpolant.prototype, {
}
t1 = pp[ i1 ];
t1 = pp[ i1 ];
t0 = pp[ i1 - 1 ];
// check boundary cases, again
......@@ -201,13 +201,13 @@ Object.assign( Interpolant.prototype, {
DefaultSettings_: {},
getSettings_: function() {
getSettings_: function () {
return this.settings || this.DefaultSettings_;
},
copySampleValue_: function( index ) {
copySampleValue_: function ( index ) {
// copies a sample value to the result buffer
......@@ -228,14 +228,14 @@ Object.assign( Interpolant.prototype, {
// Template methods for derived classes:
interpolate_: function( i1, t0, t, t1 ) {
interpolate_: function ( i1, t0, t, t1 ) {
throw new Error( "call to abstract method" );
// implementations shall return this.resultBuffer
},
intervalChanged_: function( i1, t0, t1 ) {
intervalChanged_: function ( i1, t0, t1 ) {
// empty
......
......@@ -305,7 +305,7 @@ Object.assign( Ray.prototype, {
// Return if the ray never intersects the plane
return t >= 0 ? t : null;
return t >= 0 ? t : null;
},
......
......@@ -49,7 +49,7 @@ Object.assign( Spherical.prototype, {
},
// restrict phi to be betwee EPS and PI-EPS
makeSafe: function() {
makeSafe: function () {
var EPS = 0.000001;
this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );
......@@ -58,7 +58,7 @@ Object.assign( Spherical.prototype, {
},
setFromVector3: function( vec3 ) {
setFromVector3: function ( vec3 ) {
this.radius = vec3.length();
......
......@@ -208,7 +208,7 @@ Object.assign( Triangle.prototype, {
// check if the projection lies within the triangle
if( this.containsPoint( projectedPoint ) === true ) {
if ( this.containsPoint( projectedPoint ) === true ) {
// if so, this is the closest point
......@@ -222,13 +222,13 @@ Object.assign( Triangle.prototype, {
edgeList[ 1 ].set( this.b, this.c );
edgeList[ 2 ].set( this.c, this.a );
for( var i = 0; i < edgeList.length; i ++ ) {
for ( var i = 0; i < edgeList.length; i ++ ) {
edgeList[ i ].closestPointToPoint( projectedPoint, true, closestPoint );
var distance = projectedPoint.distanceToSquared( closestPoint );
if( distance < minDistance ) {
if ( distance < minDistance ) {
minDistance = distance;
......
......@@ -14,7 +14,7 @@ function Vector2( x, y ) {
Object.defineProperties( Vector2.prototype, {
"width" : {
"width": {
get: function () {
......@@ -30,7 +30,7 @@ Object.defineProperties( Vector2.prototype, {
},
"height" : {
"height": {
get: function () {
......@@ -365,7 +365,7 @@ Object.assign( Vector2.prototype, {
},
lengthManhattan: function() {
lengthManhattan: function () {
return Math.abs( this.x ) + Math.abs( this.y );
......
......@@ -297,9 +297,9 @@ Object.assign( Vector3.prototype, {
// calculate quat * vector
var ix = qw * x + qy * z - qz * y;
var iy = qw * y + qz * x - qx * z;
var iz = qw * z + qx * y - qy * x;
var ix = qw * x + qy * z - qz * y;
var iy = qw * y + qz * x - qx * z;
var iz = qw * z + qx * y - qy * x;
var iw = - qx * x - qy * y - qz * z;
// calculate result * inverse quat
......
......@@ -254,15 +254,15 @@ Object.assign( Vector4.prototype, {
if ( s < 0.0001 ) {
this.x = 1;
this.y = 0;
this.z = 0;
this.x = 1;
this.y = 0;
this.z = 0;
} else {
this.x = q.x / s;
this.y = q.y / s;
this.z = q.z / s;
this.x = q.x / s;
this.y = q.y / s;
this.z = q.z / s;
}
......
......@@ -67,7 +67,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
var vEnd = new Vector3();
var interSegment = new Vector3();
var interRay = new Vector3();
var step = (this && this.isLineSegments) ? 2 : 1;
var step = ( this && this.isLineSegments ) ? 2 : 1;
if ( geometry.isBufferGeometry ) {
......
......@@ -15,14 +15,14 @@ function WebGL2Renderer( parameters ) {
parameters = parameters || {};
var _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' ),
_context = parameters.context !== undefined ? parameters.context : null,
_alpha = parameters.alpha !== undefined ? parameters.alpha : false,
_depth = parameters.depth !== undefined ? parameters.depth : true,
_stencil = parameters.stencil !== undefined ? parameters.stencil : true,
_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
_premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,
_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false;
_context = parameters.context !== undefined ? parameters.context : null,
_alpha = parameters.alpha !== undefined ? parameters.alpha : false,
_depth = parameters.depth !== undefined ? parameters.depth : true,
_stencil = parameters.stencil !== undefined ? parameters.stencil : true,
_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
_premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,
_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false;
// initialize
......
import { REVISION, RGBAFormat, HalfFloatType, FloatType, ByteType, UnsignedByteType, FrontFaceDirectionCW, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, NoColors, LinearToneMapping } from '../constants.js';
import { REVISION, RGBAFormat, HalfFloatType, FloatType, UnsignedByteType, FrontFaceDirectionCW, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, NoColors, LinearToneMapping } from '../constants.js';
import { _Math } from '../math/Math.js';
import { Matrix4 } from '../math/Matrix4.js';
import { DataTexture } from '../textures/DataTexture.js';
......@@ -1991,10 +1991,10 @@ function WebGLRenderer( parameters ) {
if ( uvScaleMap.matrixAutoUpdate === true ) {
var offset = uvScaleMap.offset;
var repeat = uvScaleMap.repeat;
var rotation = uvScaleMap.rotation;
uvScaleMap.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, 0.5, 0.5 );
var offset = uvScaleMap.offset;
var repeat = uvScaleMap.repeat;
var rotation = uvScaleMap.rotation;
uvScaleMap.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, 0.5, 0.5 );
}
......@@ -2032,10 +2032,10 @@ function WebGLRenderer( parameters ) {
if ( material.map.matrixAutoUpdate === true ) {
var offset = material.map.offset;
var repeat = material.map.repeat;
var rotation = material.map.rotation;
material.map.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, 0.5, 0.5 );
var offset = material.map.offset;
var repeat = material.map.repeat;
var rotation = material.map.rotation;
material.map.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, rotation, 0.5, 0.5 );
}
......
......@@ -89,7 +89,7 @@ function WebGLAttributes( gl ) {
gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
array.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );
updateRange.count = -1; // reset range
updateRange.count = - 1; // reset range
}
......@@ -108,7 +108,7 @@ function WebGLAttributes( gl ) {
function remove( attribute ) {
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
var data = buffers[ attribute.uuid ];
if ( data ) {
......
......@@ -4,7 +4,6 @@
import { BackSide } from '../../constants.js';
import { OrthographicCamera } from '../../cameras/OrthographicCamera.js';
import { PerspectiveCamera } from '../../cameras/PerspectiveCamera.js';
import { BoxBufferGeometry } from '../../geometries/BoxGeometry.js';
import { PlaneBufferGeometry } from '../../geometries/PlaneGeometry.js';
import { MeshBasicMaterial } from '../../materials/MeshBasicMaterial.js';
......
......@@ -23,7 +23,7 @@ function WebGLClipping() {
this.numPlanes = 0;
this.numIntersection = 0;
this.init = function( planes, enableLocalClipping, camera ) {
this.init = function ( planes, enableLocalClipping, camera ) {
var enabled =
planes.length !== 0 ||
......@@ -42,21 +42,21 @@ function WebGLClipping() {
};
this.beginShadows = function() {
this.beginShadows = function () {
renderingShadows = true;
projectPlanes( null );
};
this.endShadows = function() {
this.endShadows = function () {
renderingShadows = false;
resetGlobalState();
};
this.setState = function( planes, clipIntersection, clipShadows, camera, cache, fromCache ) {
this.setState = function ( planes, clipIntersection, clipShadows, camera, cache, fromCache ) {
if ( ! localClippingEnabled ||
planes === null || planes.length === 0 ||
......@@ -71,6 +71,7 @@ function WebGLClipping() {
} else {
resetGlobalState();
}
} else {
......@@ -135,11 +136,9 @@ function WebGLClipping() {
}
for ( var i = 0, i4 = dstOffset;
i !== nPlanes; ++ i, i4 += 4 ) {
for ( var i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {
plane.copy( planes[ i ] ).
applyMatrix4( viewMatrix, viewNormalMatrix );
plane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );
plane.normal.toArray( dstArray, i4 );
dstArray[ i4 + 3 ] = plane.constant;
......@@ -154,7 +153,7 @@ function WebGLClipping() {
}
scope.numPlanes = nPlanes;
return dstArray;
}
......
......@@ -322,7 +322,7 @@ function WebGLLights() {
return {
setup: setup,
state: state
}
};
}
......
......@@ -103,7 +103,7 @@ function WebGLMorphtargets( gl ) {
update: update
}
};
}
......
......@@ -14,19 +14,19 @@ function getEncodingComponents( encoding ) {
switch ( encoding ) {
case LinearEncoding:
return [ 'Linear','( value )' ];
return [ 'Linear', '( value )' ];
case sRGBEncoding:
return [ 'sRGB','( value )' ];
return [ 'sRGB', '( value )' ];
case RGBEEncoding:
return [ 'RGBE','( value )' ];
return [ 'RGBE', '( value )' ];
case RGBM7Encoding:
return [ 'RGBM','( value, 7.0 )' ];
return [ 'RGBM', '( value, 7.0 )' ];
case RGBM16Encoding:
return [ 'RGBM','( value, 16.0 )' ];
return [ 'RGBM', '( value, 16.0 )' ];
case RGBDEncoding:
return [ 'RGBD','( value, 256.0 )' ];
return [ 'RGBD', '( value, 256.0 )' ];
case GammaEncoding:
return [ 'Gamma','( value, float( GAMMA_FACTOR ) )' ];
return [ 'Gamma', '( value, float( GAMMA_FACTOR ) )' ];
default:
throw new Error( 'unsupported encoding: ' + encoding );
......@@ -455,7 +455,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
parameters.flipSided ? '#define FLIP_SIDED' : '',
'#define NUM_CLIPPING_PLANES ' + parameters.numClippingPlanes,
'#define UNION_CLIPPING_PLANES ' + (parameters.numClippingPlanes - parameters.numClipIntersection),
'#define UNION_CLIPPING_PLANES ' + ( parameters.numClippingPlanes - parameters.numClipIntersection ),
parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',
parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',
......@@ -624,7 +624,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
// free resource
this.destroy = function() {
this.destroy = function () {
gl.deleteProgram( program );
this.program = undefined;
......@@ -636,7 +636,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
Object.defineProperties( this, {
uniforms: {
get: function() {
get: function () {
console.warn( 'THREE.WebGLProgram: .uniforms is now .getUniforms().' );
return this.getUniforms();
......@@ -645,7 +645,7 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters
},
attributes: {
get: function() {
get: function () {
console.warn( 'THREE.WebGLProgram: .attributes is now .getAttributes().' );
return this.getAttributes();
......
......@@ -5,9 +5,6 @@
import { FrontSide, BackSide, DoubleSide, RGBAFormat, NearestFilter, PCFShadowMap, RGBADepthPacking } from '../../constants.js';
import { WebGLRenderTarget } from '../WebGLRenderTarget.js';
import { ShaderMaterial } from '../../materials/ShaderMaterial.js';
import { UniformsUtils } from '../shaders/UniformsUtils.js';
import { ShaderLib } from '../shaders/ShaderLib.js';
import { MeshDepthMaterial } from '../../materials/MeshDepthMaterial.js';
import { MeshDistanceMaterial } from '../../materials/MeshDistanceMaterial.js';
import { Vector4 } from '../../math/Vector4.js';
......
......@@ -263,9 +263,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
var image = cubeImage[ 0 ],
isPowerOfTwoImage = isPowerOfTwo( image ),
glFormat = utils.convert( texture.format ),
glType = utils.convert( texture.type );
isPowerOfTwoImage = isPowerOfTwo( image ),
glFormat = utils.convert( texture.format ),
glType = utils.convert( texture.type );
setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, isPowerOfTwoImage );
......@@ -425,8 +425,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
var isPowerOfTwoImage = isPowerOfTwo( image ),
glFormat = utils.convert( texture.format ),
glType = utils.convert( texture.type );
glFormat = utils.convert( texture.format ),
glType = utils.convert( texture.type );
setTextureParameters( _gl.TEXTURE_2D, texture, isPowerOfTwoImage );
......@@ -440,7 +440,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
if ( texture.type === FloatType ) {
if ( !_isWebGL2 ) throw new Error('Float Depth Texture only supported in WebGL2.0');
if ( ! _isWebGL2 ) throw new Error( 'Float Depth Texture only supported in WebGL2.0' );
internalFormat = _gl.DEPTH_COMPONENT32F;
} else if ( _isWebGL2 ) {
......@@ -457,7 +457,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );
console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );
texture.type = UnsignedShortType;
glType = utils.convert( texture.type );
......@@ -620,19 +620,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
if ( !( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {
if ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {
throw new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );
}
// upload an empty depth texture with framebuffer size
if ( !properties.get( renderTarget.depthTexture ).__webglTexture ||
if ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||
renderTarget.depthTexture.image.width !== renderTarget.width ||
renderTarget.depthTexture.image.height !== renderTarget.height ) {
renderTarget.depthTexture.image.width = renderTarget.width;
renderTarget.depthTexture.image.height = renderTarget.height;
renderTarget.depthTexture.needsUpdate = true;
}
setTexture2D( renderTarget.depthTexture, 0 );
......
......@@ -454,8 +454,8 @@ function parseUniform( activeInfo, addr, container ) {
// bare name or "pure" bottom-level array "[0]" suffix
addUniform( container, subscript === undefined ?
new SingleUniform( id, activeInfo, addr ) :
new PureArrayUniform( id, activeInfo, addr ) );
new SingleUniform( id, activeInfo, addr ) :
new PureArrayUniform( id, activeInfo, addr ) );
break;
......
......@@ -4,9 +4,9 @@
import { MaxEquation, MinEquation, RGB_ETC1_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, SrcAlphaSaturateFactor, OneMinusDstColorFactor, DstColorFactor, OneMinusDstAlphaFactor, DstAlphaFactor, OneMinusSrcAlphaFactor, SrcAlphaFactor, OneMinusSrcColorFactor, SrcColorFactor, OneFactor, ZeroFactor, ReverseSubtractEquation, SubtractEquation, AddEquation, DepthFormat, DepthStencilFormat, LuminanceAlphaFormat, LuminanceFormat, RGBAFormat, RGBFormat, AlphaFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort565Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestFilter, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping } from '../../constants.js';
function WebGLUtils ( gl, extensions ) {
function WebGLUtils( gl, extensions ) {
function convert ( p ) {
function convert( p ) {
var extension;
......@@ -132,9 +132,9 @@ function WebGLUtils ( gl, extensions ) {
}
return { convert: convert }
return { convert: convert };
};
}
export { WebGLUtils };
......@@ -209,7 +209,7 @@ function WebVRManager( renderer ) {
};
this.dispose = function() {
this.dispose = function () {
window.removeEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange );
......
......@@ -5,7 +5,7 @@ import { Color } from '../math/Color.js';
* @author alteredq / http://alteredqualia.com/
*/
function Fog ( color, near, far ) {
function Fog( color, near, far ) {
this.name = '';
......
......@@ -5,7 +5,7 @@ import { Color } from '../math/Color.js';
* @author alteredq / http://alteredqualia.com/
*/
function FogExp2 ( color, density ) {
function FogExp2( color, density ) {
this.name = '';
......
......@@ -4,7 +4,7 @@ import { Object3D } from '../core/Object3D.js';
* @author mrdoob / http://mrdoob.com/
*/
function Scene () {
function Scene() {
Object3D.call( this );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册