提交 bf754133 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #10648 from TristanVALCKE/NormalizeObjectAssign

Normalize object assign
......@@ -78,8 +78,6 @@ function AnimationAction( mixer, clip, localRoot ) {
Object.assign( AnimationAction.prototype, {
constructor: AnimationAction,
// State & Scheduling
play: function() {
......
......@@ -310,8 +310,6 @@ Object.assign( AnimationClip, {
Object.assign( AnimationClip.prototype, {
constructor: AnimationClip,
resetDuration: function() {
var tracks = this.tracks,
......
......@@ -29,8 +29,6 @@ function AnimationMixer( root ) {
Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {
constructor: AnimationMixer,
_bindAction: function ( action, prototypeAction ) {
var root = action._localRoot || this._root,
......
......@@ -73,8 +73,6 @@ function AnimationObjectGroup( var_args ) {
Object.assign( AnimationObjectGroup.prototype, {
constructor: AnimationObjectGroup,
isAnimationObjectGroup: true,
add: function( var_args ) {
......
......@@ -19,8 +19,6 @@ function Composite ( targetGroup, path, optionalParsedPath ) {
Object.assign( Composite.prototype, {
constructor: Composite,
getValue: function( array, offset ) {
this.bind(); // bind all binding
......@@ -226,8 +224,6 @@ Object.assign( PropertyBinding, {
Object.assign( PropertyBinding.prototype, { // prototype, continued
constructor: PropertyBinding,
// these are used to "bind" a nonexistent property
_getValue_unavailable: function() {},
_setValue_unavailable: function() {},
......
......@@ -58,8 +58,6 @@ function PropertyMixer( binding, typeName, valueSize ) {
Object.assign( PropertyMixer.prototype, {
constructor: PropertyMixer,
// accumulate data in the 'incoming' region into 'accu<i>'
accumulate: function( accuIndex, weight ) {
......
......@@ -286,8 +286,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
return this.gain.gain.value;
},
setVolume: function ( value ) {
this.gain.gain.value = value;
......
......@@ -44,16 +44,8 @@ Object.defineProperty( BufferAttribute.prototype, "needsUpdate", {
Object.assign( BufferAttribute.prototype, {
constructor: BufferAttribute,
isBufferAttribute: true,
set needsUpdate( value ) {
if ( value === true ) this.version ++;
},
setArray: function ( array ) {
if ( Array.isArray( array ) ) {
......
......@@ -43,8 +43,6 @@ BufferGeometry.MaxIndex = 65535;
Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
constructor: BufferGeometry,
isBufferGeometry: true,
getIndex: function () {
......
......@@ -16,8 +16,6 @@ function Clock( autoStart ) {
Object.assign( Clock.prototype, {
constructor: Clock,
start: function () {
this.startTime = ( performance || Date ).now();
......
......@@ -24,8 +24,6 @@ function Face3( a, b, c, normal, color, materialIndex ) {
Object.assign( Face3.prototype, {
constructor: Face3,
clone: function () {
return new this.constructor().copy( this );
......
......@@ -61,8 +61,6 @@ function Geometry() {
Object.assign( Geometry.prototype, EventDispatcher.prototype, {
constructor: Geometry,
isGeometry: true,
applyMatrix: function ( matrix ) {
......
......@@ -33,8 +33,6 @@ Object.defineProperty( InterleavedBuffer.prototype, "needsUpdate", {
Object.assign( InterleavedBuffer.prototype, {
constructor: InterleavedBuffer,
isInterleavedBuffer: true,
setArray: function ( array ) {
......
......@@ -42,8 +42,6 @@ Object.defineProperties( InterleavedBufferAttribute.prototype, {
Object.assign( InterleavedBufferAttribute.prototype, {
constructor: InterleavedBufferAttribute,
isInterleavedBufferAttribute: true,
setX: function ( index, x ) {
......
......@@ -10,8 +10,6 @@ function Layers() {
Object.assign( Layers.prototype, {
constructor: Layers,
set: function ( channel ) {
this.mask = 1 << channel;
......
......@@ -103,8 +103,6 @@ Object3D.DefaultMatrixAutoUpdate = true;
Object.assign( Object3D.prototype, EventDispatcher.prototype, {
constructor: Object3D,
isObject3D: true,
applyMatrix: function ( matrix ) {
......
......@@ -61,8 +61,6 @@ function intersectObject( object, raycaster, intersects, recursive ) {
Object.assign( Raycaster.prototype, {
constructor: Raycaster,
linePrecision: 1,
set: function ( origin, direction ) {
......
......@@ -41,8 +41,6 @@ function Curve() {}
Object.assign( Curve.prototype, {
constructor: Curve,
// Virtual base class method to overwrite and implement in subclasses
// - t [0 .. 1]
......
......@@ -67,8 +67,6 @@ Loader.Handlers = {
Object.assign( Loader.prototype, {
constructor: Loader,
crossOrigin: undefined,
extractUrlBase: function ( url ) {
......
......@@ -82,8 +82,6 @@ Object.defineProperty( Material.prototype, "needsUpdate", {
Object.assign( Material.prototype, EventDispatcher.prototype, {
constructor: Material,
isMaterial: true,
setValues: function ( values ) {
......
......@@ -18,8 +18,6 @@ function MultiMaterial( materials ) {
Object.assign( MultiMaterial.prototype, {
constructor: MultiMaterial,
isMultiMaterial: true,
toJSON: function ( meta ) {
......
......@@ -13,8 +13,6 @@ function Box2( min, max ) {
Object.assign( Box2.prototype, {
constructor: Box2,
set: function ( min, max ) {
this.min.copy( min );
......
......@@ -15,8 +15,6 @@ function Box3( min, max ) {
Object.assign( Box3.prototype, {
constructor: Box3,
isBox3: true,
set: function ( min, max ) {
......
......@@ -44,8 +44,6 @@ function Color( r, g, b ) {
Object.assign( Color.prototype, {
constructor: Color,
isColor: true,
r: 1, g: 1, b: 1,
......
......@@ -17,8 +17,6 @@ function Cylindrical( radius, theta, y ) {
Object.assign( Cylindrical.prototype, {
constructor: Cylindrical,
set: function ( radius, theta, y ) {
this.radius = radius;
......
......@@ -96,8 +96,6 @@ Object.defineProperties( Euler.prototype, {
Object.assign( Euler.prototype, {
constructor: Euler,
isEuler: true,
set: function ( x, y, z, order ) {
......
......@@ -25,8 +25,6 @@ function Frustum( p0, p1, p2, p3, p4, p5 ) {
Object.assign( Frustum.prototype, {
constructor: Frustum,
set: function ( p0, p1, p2, p3, p4, p5 ) {
var planes = this.planes;
......
......@@ -34,8 +34,6 @@ function Interpolant( parameterPositions, sampleValues, sampleSize, resultBuffer
Object.assign( Interpolant.prototype, {
constructor: Interpolant,
evaluate: function( t ) {
var pp = this.parameterPositions,
......
......@@ -14,8 +14,6 @@ function Line3( start, end ) {
Object.assign( Line3.prototype, {
constructor: Line3,
set: function ( start, end ) {
this.start.copy( start );
......
......@@ -27,8 +27,6 @@ function Matrix3() {
Object.assign( Matrix3.prototype, {
constructor: Matrix3,
isMatrix3: true,
set: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
......
......@@ -35,8 +35,6 @@ function Matrix4() {
Object.assign( Matrix4.prototype, {
constructor: Matrix4,
isMatrix4: true,
set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
......
......@@ -14,8 +14,6 @@ function Plane( normal, constant ) {
Object.assign( Plane.prototype, {
constructor: Plane,
set: function ( normal, constant ) {
this.normal.copy( normal );
......
......@@ -163,8 +163,6 @@ Object.defineProperties( Quaternion.prototype, {
Object.assign( Quaternion.prototype, {
constructor: Quaternion,
set: function ( x, y, z, w ) {
this._x = x;
......
......@@ -13,8 +13,6 @@ function Ray( origin, direction ) {
Object.assign( Ray.prototype, {
constructor: Ray,
set: function ( origin, direction ) {
this.origin.copy( origin );
......
......@@ -15,8 +15,6 @@ function Sphere( center, radius ) {
Object.assign( Sphere.prototype, {
constructor: Sphere,
set: function ( center, radius ) {
this.center.copy( center );
......
......@@ -22,8 +22,6 @@ function Spherical( radius, phi, theta ) {
Object.assign( Spherical.prototype, {
constructor: Spherical,
set: function ( radius, phi, theta ) {
this.radius = radius;
......
......@@ -104,8 +104,6 @@ Object.assign( Triangle, {
Object.assign( Triangle.prototype, {
constructor: Triangle,
set: function ( a, b, c ) {
this.a.copy( a );
......
......@@ -50,8 +50,6 @@ Object.defineProperties( Vector2.prototype, {
Object.assign( Vector2.prototype, {
constructor: Vector2,
isVector2: true,
set: function ( x, y ) {
......
......@@ -21,8 +21,6 @@ function Vector3( x, y, z ) {
Object.assign( Vector3.prototype, {
constructor: Vector3,
isVector3: true,
set: function ( x, y, z ) {
......
......@@ -17,8 +17,6 @@ function Vector4( x, y, z, w ) {
Object.assign( Vector4.prototype, {
constructor: Vector4,
isVector4: true,
set: function ( x, y, z, w ) {
......
......@@ -12,8 +12,7 @@ import { WrapAroundEnding, ZeroSlopeEnding } from '../../constants';
* @author tschw
*/
function CubicInterpolant(
parameterPositions, sampleValues, sampleSize, resultBuffer ) {
function CubicInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call(
this, parameterPositions, sampleValues, sampleSize, resultBuffer );
......@@ -25,8 +24,7 @@ function CubicInterpolant(
}
CubicInterpolant.prototype =
Object.assign( Object.create( Interpolant.prototype ), {
CubicInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {
constructor: CubicInterpolant,
......
......@@ -8,16 +8,13 @@ import { Interpolant } from '../Interpolant';
* @author tschw
*/
function DiscreteInterpolant(
parameterPositions, sampleValues, sampleSize, resultBuffer ) {
function DiscreteInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call(
this, parameterPositions, sampleValues, sampleSize, resultBuffer );
Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
}
DiscreteInterpolant.prototype =
Object.assign( Object.create( Interpolant.prototype ), {
DiscreteInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {
constructor: DiscreteInterpolant,
......
......@@ -4,16 +4,13 @@ import { Interpolant } from '../Interpolant';
* @author tschw
*/
function LinearInterpolant(
parameterPositions, sampleValues, sampleSize, resultBuffer ) {
function LinearInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call(
this, parameterPositions, sampleValues, sampleSize, resultBuffer );
Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
}
LinearInterpolant.prototype =
Object.assign( Object.create( Interpolant.prototype ), {
LinearInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {
constructor: LinearInterpolant,
......
......@@ -7,16 +7,13 @@ import { Quaternion } from '../Quaternion';
* @author tschw
*/
function QuaternionLinearInterpolant(
parameterPositions, sampleValues, sampleSize, resultBuffer ) {
function QuaternionLinearInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call(
this, parameterPositions, sampleValues, sampleSize, resultBuffer );
Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
}
QuaternionLinearInterpolant.prototype =
Object.assign( Object.create( Interpolant.prototype ), {
QuaternionLinearInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {
constructor: QuaternionLinearInterpolant,
......
......@@ -22,7 +22,6 @@ function LOD() {
}
LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
constructor: LOD,
......
......@@ -71,7 +71,6 @@ function SkinnedMesh( geometry, material, useVertexTexture ) {
}
SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
constructor: SkinnedMesh,
......
......@@ -182,4 +182,5 @@ function WebGL2Renderer( parameters ) {
}
export { WebGL2Renderer };
......@@ -41,8 +41,6 @@ function WebGLRenderTarget( width, height, options ) {
Object.assign( WebGLRenderTarget.prototype, EventDispatcher.prototype, {
constructor: WebGLRenderTarget,
isWebGLRenderTarget: true,
setSize: function ( width, height ) {
......
......@@ -2884,4 +2884,5 @@ function WebGLRenderer( parameters ) {
}
export { WebGLRenderer };
......@@ -161,4 +161,5 @@ function WebGLClipping() {
}
export { WebGLClipping };
......@@ -40,4 +40,5 @@ function WebGLProperties() {
}
export { WebGLProperties };
......@@ -42,4 +42,5 @@ function WebGLShader( gl, type, string ) {
}
export { WebGLShader };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册