提交 0225f7ff 编写于 作者: K Kyle Larson

Merge commit 'd047a711' into dev

此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -52,12 +52,12 @@ scene.add(rectLight)
<h2>Constructor</h2>
<h3>[name]( [page:Integer color], [page:Float intensity], [page:Float distance], [page:Radians angle], [page:Float penumbra], [page:Float decay] )</h3>
<h3>[name]( [page:Integer color], [page:Float intensity], [page:Float width], [page:Float height] )</h3>
<div>
[page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).<br />
[page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.<br /><br />
[page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.<br />
[page:Float width] - (optional) width of the light. Default is 10.<br />
[page:Float height] - (optional) height of the light. Default is 10.
[page:Float height] - (optional) height of the light. Default is 10.<br /><br />
Creates a new [name].
</div>
......
......@@ -862,10 +862,10 @@ UI.Integer.prototype.setValue = function ( value ) {
};
UI.Number.prototype.setStep = function ( step ) {
this.step = step;
UI.Integer.prototype.setStep = function ( step ) {
this.step = parseInt( step );
return this;
};
......
......@@ -10,7 +10,7 @@ THREE.CSS3DObject = function ( element ) {
this.element = element;
this.element.style.position = 'absolute';
this.addEventListener( 'removed', function ( event ) {
this.addEventListener( 'removed', function () {
if ( this.element.parentNode !== null ) {
......@@ -41,7 +41,6 @@ THREE.CSS3DRenderer = function () {
console.log( 'THREE.CSS3DRenderer', THREE.REVISION );
var _width, _height;
var _widthHalf, _heightHalf;
var matrix = new THREE.Matrix4();
......@@ -62,6 +61,10 @@ THREE.CSS3DRenderer = function () {
var cameraElement = document.createElement( 'div' );
cameraElement.style.position = 'absolute';
cameraElement.style.left = '50%';
cameraElement.style.top = '50%';
cameraElement.style.WebkitTransformStyle = 'preserve-3d';
cameraElement.style.MozTransformStyle = 'preserve-3d';
cameraElement.style.oTransformStyle = 'preserve-3d';
......@@ -71,7 +74,7 @@ THREE.CSS3DRenderer = function () {
this.setClearColor = function () {};
this.getSize = function() {
this.getSize = function () {
return {
width: _width,
......@@ -85,24 +88,18 @@ THREE.CSS3DRenderer = function () {
_width = width;
_height = height;
_widthHalf = _width / 2;
_heightHalf = _height / 2;
domElement.style.width = width + 'px';
domElement.style.height = height + 'px';
cameraElement.style.width = width + 'px';
cameraElement.style.height = height + 'px';
};
var epsilon = function ( value ) {
function epsilon( value ) {
return Math.abs( value ) < Number.EPSILON ? 0 : value;
};
}
var getCameraCSSMatrix = function ( matrix ) {
function getCameraCSSMatrix( matrix ) {
var elements = matrix.elements;
......@@ -125,9 +122,9 @@ THREE.CSS3DRenderer = function () {
epsilon( elements[ 15 ] ) +
')';
};
}
var getObjectCSSMatrix = function ( matrix ) {
function getObjectCSSMatrix( matrix ) {
var elements = matrix.elements;
......@@ -150,9 +147,9 @@ THREE.CSS3DRenderer = function () {
epsilon( elements[ 15 ] ) +
')';
};
}
var renderObject = function ( object, camera ) {
function renderObject( object, camera ) {
if ( object instanceof THREE.CSS3DObject ) {
......@@ -208,7 +205,7 @@ THREE.CSS3DRenderer = function () {
}
};
}
this.render = function ( scene, camera ) {
......@@ -231,8 +228,7 @@ THREE.CSS3DRenderer = function () {
camera.matrixWorldInverse.getInverse( camera.matrixWorld );
var style = "translate3d(0,0," + fov + "px)" + getCameraCSSMatrix( camera.matrixWorldInverse ) +
" translate3d(" + _widthHalf + "px," + _heightHalf + "px, 0)";
var style = 'translateZ(' + fov + 'px)' + getCameraCSSMatrix( camera.matrixWorldInverse );
if ( cache.camera.style !== style ) {
......
......@@ -25,17 +25,18 @@ THREE.PaintViveController = function ( id ) {
var context = canvas.getContext( '2d' );
var imageData = context.getImageData( 0, 0, 256, 256 );
var data = imageData.data;
var swatchColor = new THREE.Color();
for ( var i = 0, j = 0; i < data.length; i += 4, j ++ ) {
var x = ( ( j % 256 ) / 256 ) - 0.5;
var y = ( Math.floor( j / 256 ) / 256 ) - 0.5;
color.setHSL( Math.atan2( y, x ) / PI2, 1,( 0.5 - Math.sqrt( x * x + y * y ) ) * 2.0 );
swatchColor.setHSL( Math.atan2( y, x ) / PI2, 1,( 0.5 - Math.sqrt( x * x + y * y ) ) * 2.0 );
data[ i + 0 ] = color.r * 256;
data[ i + 1 ] = color.g * 256;
data[ i + 2 ] = color.b * 256;
data[ i + 0 ] = swatchColor.r * 256;
data[ i + 1 ] = swatchColor.g * 256;
data[ i + 2 ] = swatchColor.b * 256;
data[ i + 3 ] = 256;
}
......@@ -46,19 +47,53 @@ THREE.PaintViveController = function ( id ) {
}
// COLOR UI
var geometry = new THREE.CircleGeometry( 1, 32 );
var material = new THREE.MeshBasicMaterial( { map: generateHueTexture() } );
var mesh = new THREE.Mesh( geometry, material );
mesh.position.set( 0, 0.005, 0.0495 );
mesh.rotation.x = - 1.45;
mesh.scale.setScalar( 0.02 );
this.add( mesh );
var colorUI = new THREE.Mesh( geometry, material );
colorUI.position.set( 0, 0.005, 0.0495 );
colorUI.rotation.x = - 1.45;
colorUI.scale.setScalar( 0.02 );
this.add( colorUI );
var geometry = new THREE.IcosahedronGeometry( 0.1, 2 );
var material = new THREE.MeshBasicMaterial();
material.color = color;
var ball = new THREE.Mesh( geometry, material );
mesh.add( ball );
colorUI.add( ball );
// SIZE UI
var sizeUI = new THREE.Group();
sizeUI.position.set( 0, 0.005, 0.0495 );
sizeUI.rotation.x = - 1.45;
sizeUI.scale.setScalar( 0.02 );
this.add( sizeUI );
var triangleShape = new THREE.Shape();
triangleShape.moveTo( 0, -1 );
triangleShape.lineTo( 1, 1 );
triangleShape.lineTo( -1, 1 );
var geometry = new THREE.ShapeGeometry( triangleShape );
var material = new THREE.MeshBasicMaterial( { color: 0x222222, wireframe:true } );
var sizeUIOutline = new THREE.Mesh( geometry, material ) ;
sizeUIOutline.position.z = 0.001;
resizeTriangleGeometry(sizeUIOutline.geometry, 1.0);
sizeUI.add( sizeUIOutline );
var geometry = new THREE.ShapeGeometry( triangleShape );
var material = new THREE.MeshBasicMaterial( {side: THREE.DoubleSide } );
material.color = color;
var sizeUIFill = new THREE.Mesh( geometry, material ) ;
sizeUIFill.position.z = 0.0011;
resizeTriangleGeometry(sizeUIFill.geometry, 0.5);
sizeUI.add( sizeUIFill );
sizeUI.visible = false;
function onAxisChanged( event ) {
......@@ -69,27 +104,52 @@ THREE.PaintViveController = function ( id ) {
if ( mode === MODES.COLOR ) {
color.setHSL( Math.atan2( y, x ) / PI2, 1, ( 0.5 - Math.sqrt( x * x + y * y ) ) * 2.0 );
ball.position.x = event.axes[ 0 ];
ball.position.y = event.axes[ 1 ];
ball.position.set(event.axes[ 0 ], event.axes[ 1 ], 0);
}
if ( mode === MODES.SIZE ) {
size = y + 1;
var ratio = (0.5 - y);
size = ratio * 2;
resizeTriangleGeometry(sizeUIFill.geometry, ratio);
}
}
function resizeTriangleGeometry(geometry, ratio) {
var x = 0, y =0;
var fullWidth = 0.75; fullHeight = 1.5;
var angle = Math.atan((fullWidth/2)/fullHeight);
var bottomY = y - fullHeight/2;
var height = fullHeight * ratio;
var width = (Math.tan(angle) * height) * 2;
geometry.vertices[0].set( x, bottomY, 0);
geometry.vertices[1].set( x + width/2, bottomY + height, 0 );
geometry.vertices[2].set( x - width/2, bottomY + height, 0 );
geometry.verticesNeedUpdate = true;
}
function onGripsDown( event ) {
if ( mode === MODES.COLOR ) {
mode = MODES.SIZE;
mesh.visible = false;
colorUI.visible = false;
sizeUI.visible = true;
return;
}
if ( mode === MODES.SIZE ) {
mode = MODES.COLOR;
mesh.visible = true;
colorUI.visible = true;
sizeUI.visible = false;
return;
}
......
......@@ -174,7 +174,7 @@
// var pivot = new THREE.Group();
// var pivot = new THREE.Mesh( new THREE.BoxGeometry( 0.01, 0.01, 0.01 ) );
var pivot = new THREE.Mesh( new THREE.IcosahedronGeometry( 0.002, 2 ) );
var pivot = new THREE.Mesh( new THREE.IcosahedronGeometry( 0.01, 2 ) );
pivot.name = 'pivot';
pivot.position.y = -0.016;
pivot.position.z = -0.043;
......@@ -249,28 +249,31 @@
scene.add( line );
// Shapes
shapes[ 'tube' ] = getTubeShapes(1.0);
}
function getTubeShapes(size) {
var PI2 = Math.PI * 2;
var sides = 10;
var array = [];
for ( var i = 0; i < sides; i ++ ) {
var radius = 0.01 * size;
for( var i = 0; i < sides; i ++ ){
var angle = ( i / sides ) * PI2;
array.push( new THREE.Vector3( Math.sin( angle ) * 0.01, Math.cos( angle ) * 0.01, 0 ) );
array.push( new THREE.Vector3( Math.sin( angle ) * radius, Math.cos( angle ) * radius, 0 ) );
}
shapes[ 'tube' ] = array;
return array;
}
function stroke( controller, point1, point2, matrix1, matrix2 ) {
var color = controller.getColor();
var shape = shapes[ 'tube' ];
var shapes = getTubeShapes( controller.getSize() );
var geometry = line.geometry;
var attributes = geometry.attributes;
......@@ -280,10 +283,10 @@
var normals = attributes.normal.array;
var colors = attributes.color.array;
for ( var j = 0, jl = shape.length; j < jl; j ++ ) {
for ( var j = 0, jl = shapes.length; j < jl; j ++ ) {
var vertex1 = shape[ j ];
var vertex2 = shape[ ( j + 1 ) % jl ];
var vertex1 = shapes[ j ];
var vertex2 = shapes[ ( j + 1 ) % jl ];
// positions
......@@ -406,6 +409,7 @@
if ( pivot ) {
pivot.material.color.copy( controller.getColor() );
pivot.scale.setScalar(controller.getSize());
var matrix = pivot.matrixWorld;
......
......@@ -76,9 +76,7 @@ function AnimationAction( mixer, clip, localRoot ) {
}
AnimationAction.prototype = {
constructor: AnimationAction,
Object.assign( AnimationAction.prototype, {
// State & Scheduling
......@@ -651,7 +649,7 @@ AnimationAction.prototype = {
}
};
} );
export { AnimationAction };
......@@ -32,55 +32,6 @@ function AnimationClip( name, duration, tracks ) {
}
AnimationClip.prototype = {
constructor: AnimationClip,
resetDuration: function() {
var tracks = this.tracks,
duration = 0;
for ( var i = 0, n = tracks.length; i !== n; ++ i ) {
var track = this.tracks[ i ];
duration = Math.max( duration, track.times[ track.times.length - 1 ] );
}
this.duration = duration;
},
trim: function() {
for ( var i = 0; i < this.tracks.length; i ++ ) {
this.tracks[ i ].trim( 0, this.duration );
}
return this;
},
optimize: function() {
for ( var i = 0; i < this.tracks.length; i ++ ) {
this.tracks[ i ].optimize();
}
return this;
}
};
// Static methods:
Object.assign( AnimationClip, {
parse: function( json ) {
......@@ -98,8 +49,7 @@ Object.assign( AnimationClip, {
return new AnimationClip( json.name, json.duration, tracks );
},
toJSON: function( clip ) {
var tracks = [],
......@@ -122,8 +72,7 @@ Object.assign( AnimationClip, {
return json;
},
CreateFromMorphTargetSequence: function( name, morphTargetSequence, fps, noLoop ) {
var numMorphTargets = morphTargetSequence.length;
......@@ -359,5 +308,50 @@ Object.assign( AnimationClip, {
} );
Object.assign( AnimationClip.prototype, {
resetDuration: function() {
var tracks = this.tracks,
duration = 0;
for ( var i = 0, n = tracks.length; i !== n; ++ i ) {
var track = this.tracks[ i ];
duration = Math.max( duration, track.times[ track.times.length - 1 ] );
}
this.duration = duration;
},
trim: function() {
for ( var i = 0; i < this.tracks.length; i ++ ) {
this.tracks[ i ].trim( 0, this.duration );
}
return this;
},
optimize: function() {
for ( var i = 0; i < this.tracks.length; i ++ ) {
this.tracks[ i ].optimize();
}
return this;
}
} );
export { AnimationClip };
......@@ -27,259 +27,7 @@ function AnimationMixer( root ) {
}
AnimationMixer.prototype = {
constructor: AnimationMixer,
// return an action for a clip optionally using a custom root target
// object (this method allocates a lot of dynamic memory in case a
// previously unknown clip/root combination is specified)
clipAction: function ( clip, optionalRoot ) {
var root = optionalRoot || this._root,
rootUuid = root.uuid,
clipObject = typeof clip === 'string' ?
AnimationClip.findByName( root, clip ) : clip,
clipUuid = clipObject !== null ? clipObject.uuid : clip,
actionsForClip = this._actionsByClip[ clipUuid ],
prototypeAction = null;
if ( actionsForClip !== undefined ) {
var existingAction =
actionsForClip.actionByRoot[ rootUuid ];
if ( existingAction !== undefined ) {
return existingAction;
}
// we know the clip, so we don't have to parse all
// the bindings again but can just copy
prototypeAction = actionsForClip.knownActions[ 0 ];
// also, take the clip from the prototype action
if ( clipObject === null )
clipObject = prototypeAction._clip;
}
// clip must be known when specified via string
if ( clipObject === null ) return null;
// allocate all resources required to run it
var newAction = new AnimationAction( this, clipObject, optionalRoot );
this._bindAction( newAction, prototypeAction );
// and make the action known to the memory manager
this._addInactiveAction( newAction, clipUuid, rootUuid );
return newAction;
},
// get an existing action
existingAction: function ( clip, optionalRoot ) {
var root = optionalRoot || this._root,
rootUuid = root.uuid,
clipObject = typeof clip === 'string' ?
AnimationClip.findByName( root, clip ) : clip,
clipUuid = clipObject ? clipObject.uuid : clip,
actionsForClip = this._actionsByClip[ clipUuid ];
if ( actionsForClip !== undefined ) {
return actionsForClip.actionByRoot[ rootUuid ] || null;
}
return null;
},
// deactivates all previously scheduled actions
stopAllAction: function () {
var actions = this._actions,
nActions = this._nActiveActions,
bindings = this._bindings,
nBindings = this._nActiveBindings;
this._nActiveActions = 0;
this._nActiveBindings = 0;
for ( var i = 0; i !== nActions; ++ i ) {
actions[ i ].reset();
}
for ( var i = 0; i !== nBindings; ++ i ) {
bindings[ i ].useCount = 0;
}
return this;
},
// advance the time and update apply the animation
update: function ( deltaTime ) {
deltaTime *= this.timeScale;
var actions = this._actions,
nActions = this._nActiveActions,
time = this.time += deltaTime,
timeDirection = Math.sign( deltaTime ),
accuIndex = this._accuIndex ^= 1;
// run active actions
for ( var i = 0; i !== nActions; ++ i ) {
var action = actions[ i ];
if ( action.enabled ) {
action._update( time, deltaTime, timeDirection, accuIndex );
}
}
// update scene graph
var bindings = this._bindings,
nBindings = this._nActiveBindings;
for ( var i = 0; i !== nBindings; ++ i ) {
bindings[ i ].apply( accuIndex );
}
return this;
},
// return this mixer's root target object
getRoot: function () {
return this._root;
},
// free all resources specific to a particular clip
uncacheClip: function ( clip ) {
var actions = this._actions,
clipUuid = clip.uuid,
actionsByClip = this._actionsByClip,
actionsForClip = actionsByClip[ clipUuid ];
if ( actionsForClip !== undefined ) {
// note: just calling _removeInactiveAction would mess up the
// iteration state and also require updating the state we can
// just throw away
var actionsToRemove = actionsForClip.knownActions;
for ( var i = 0, n = actionsToRemove.length; i !== n; ++ i ) {
var action = actionsToRemove[ i ];
this._deactivateAction( action );
var cacheIndex = action._cacheIndex,
lastInactiveAction = actions[ actions.length - 1 ];
action._cacheIndex = null;
action._byClipCacheIndex = null;
lastInactiveAction._cacheIndex = cacheIndex;
actions[ cacheIndex ] = lastInactiveAction;
actions.pop();
this._removeInactiveBindingsForAction( action );
}
delete actionsByClip[ clipUuid ];
}
},
// free all resources specific to a particular root target object
uncacheRoot: function ( root ) {
var rootUuid = root.uuid,
actionsByClip = this._actionsByClip;
for ( var clipUuid in actionsByClip ) {
var actionByRoot = actionsByClip[ clipUuid ].actionByRoot,
action = actionByRoot[ rootUuid ];
if ( action !== undefined ) {
this._deactivateAction( action );
this._removeInactiveAction( action );
}
}
var bindingsByRoot = this._bindingsByRootAndName,
bindingByName = bindingsByRoot[ rootUuid ];
if ( bindingByName !== undefined ) {
for ( var trackName in bindingByName ) {
var binding = bindingByName[ trackName ];
binding.restoreOriginalState();
this._removeInactiveBinding( binding );
}
}
},
// remove a targeted clip from the cache
uncacheAction: function ( clip, optionalRoot ) {
var action = this.existingAction( clip, optionalRoot );
if ( action !== null ) {
this._deactivateAction( action );
this._removeInactiveAction( action );
}
}
};
// Implementation details:
Object.assign( AnimationMixer.prototype, {
Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {
_bindAction: function ( action, prototypeAction ) {
......@@ -332,8 +80,8 @@ Object.assign( AnimationMixer.prototype, {
_propertyBindings[ i ].binding.parsedPath;
binding = new PropertyMixer(
PropertyBinding.create( root, trackName, path ),
track.ValueTypeName, track.getValueSize() );
PropertyBinding.create( root, trackName, path ),
track.ValueTypeName, track.getValueSize() );
++ binding.referenceCount;
this._addInactiveBinding( binding, rootUuid, trackName );
......@@ -362,7 +110,7 @@ Object.assign( AnimationMixer.prototype, {
actionsForClip = this._actionsByClip[ clipUuid ];
this._bindAction( action,
actionsForClip && actionsForClip.knownActions[ 0 ] );
actionsForClip && actionsForClip.knownActions[ 0 ] );
this._addInactiveAction( action, clipUuid, rootUuid );
......@@ -710,8 +458,8 @@ Object.assign( AnimationMixer.prototype, {
if ( interpolant === undefined ) {
interpolant = new LinearInterpolant(
new Float32Array( 2 ), new Float32Array( 2 ),
1, this._controlInterpolantsResultBuffer );
new Float32Array( 2 ), new Float32Array( 2 ),
1, this._controlInterpolantsResultBuffer );
interpolant.__cacheIndex = lastActiveIndex;
interpolants[ lastActiveIndex ] = interpolant;
......@@ -739,10 +487,253 @@ Object.assign( AnimationMixer.prototype, {
},
_controlInterpolantsResultBuffer: new Float32Array( 1 )
_controlInterpolantsResultBuffer: new Float32Array( 1 ),
// return an action for a clip optionally using a custom root target
// object (this method allocates a lot of dynamic memory in case a
// previously unknown clip/root combination is specified)
clipAction: function ( clip, optionalRoot ) {
var root = optionalRoot || this._root,
rootUuid = root.uuid,
clipObject = typeof clip === 'string' ?
AnimationClip.findByName( root, clip ) : clip,
clipUuid = clipObject !== null ? clipObject.uuid : clip,
actionsForClip = this._actionsByClip[ clipUuid ],
prototypeAction = null;
if ( actionsForClip !== undefined ) {
var existingAction =
actionsForClip.actionByRoot[ rootUuid ];
if ( existingAction !== undefined ) {
return existingAction;
}
// we know the clip, so we don't have to parse all
// the bindings again but can just copy
prototypeAction = actionsForClip.knownActions[ 0 ];
// also, take the clip from the prototype action
if ( clipObject === null )
clipObject = prototypeAction._clip;
}
// clip must be known when specified via string
if ( clipObject === null ) return null;
// allocate all resources required to run it
var newAction = new AnimationAction( this, clipObject, optionalRoot );
this._bindAction( newAction, prototypeAction );
// and make the action known to the memory manager
this._addInactiveAction( newAction, clipUuid, rootUuid );
return newAction;
},
// get an existing action
existingAction: function ( clip, optionalRoot ) {
var root = optionalRoot || this._root,
rootUuid = root.uuid,
clipObject = typeof clip === 'string' ?
AnimationClip.findByName( root, clip ) : clip,
clipUuid = clipObject ? clipObject.uuid : clip,
actionsForClip = this._actionsByClip[ clipUuid ];
if ( actionsForClip !== undefined ) {
return actionsForClip.actionByRoot[ rootUuid ] || null;
}
return null;
},
// deactivates all previously scheduled actions
stopAllAction: function () {
var actions = this._actions,
nActions = this._nActiveActions,
bindings = this._bindings,
nBindings = this._nActiveBindings;
this._nActiveActions = 0;
this._nActiveBindings = 0;
for ( var i = 0; i !== nActions; ++ i ) {
actions[ i ].reset();
}
for ( var i = 0; i !== nBindings; ++ i ) {
bindings[ i ].useCount = 0;
}
return this;
},
// advance the time and update apply the animation
update: function ( deltaTime ) {
deltaTime *= this.timeScale;
var actions = this._actions,
nActions = this._nActiveActions,
time = this.time += deltaTime,
timeDirection = Math.sign( deltaTime ),
accuIndex = this._accuIndex ^= 1;
// run active actions
for ( var i = 0; i !== nActions; ++ i ) {
var action = actions[ i ];
if ( action.enabled ) {
action._update( time, deltaTime, timeDirection, accuIndex );
}
}
// update scene graph
var bindings = this._bindings,
nBindings = this._nActiveBindings;
for ( var i = 0; i !== nBindings; ++ i ) {
bindings[ i ].apply( accuIndex );
}
return this;
},
// return this mixer's root target object
getRoot: function () {
return this._root;
},
// free all resources specific to a particular clip
uncacheClip: function ( clip ) {
var actions = this._actions,
clipUuid = clip.uuid,
actionsByClip = this._actionsByClip,
actionsForClip = actionsByClip[ clipUuid ];
if ( actionsForClip !== undefined ) {
// note: just calling _removeInactiveAction would mess up the
// iteration state and also require updating the state we can
// just throw away
var actionsToRemove = actionsForClip.knownActions;
for ( var i = 0, n = actionsToRemove.length; i !== n; ++ i ) {
var action = actionsToRemove[ i ];
this._deactivateAction( action );
var cacheIndex = action._cacheIndex,
lastInactiveAction = actions[ actions.length - 1 ];
action._cacheIndex = null;
action._byClipCacheIndex = null;
lastInactiveAction._cacheIndex = cacheIndex;
actions[ cacheIndex ] = lastInactiveAction;
actions.pop();
this._removeInactiveBindingsForAction( action );
}
delete actionsByClip[ clipUuid ];
}
},
// free all resources specific to a particular root target object
uncacheRoot: function ( root ) {
var rootUuid = root.uuid,
actionsByClip = this._actionsByClip;
for ( var clipUuid in actionsByClip ) {
var actionByRoot = actionsByClip[ clipUuid ].actionByRoot,
action = actionByRoot[ rootUuid ];
if ( action !== undefined ) {
this._deactivateAction( action );
this._removeInactiveAction( action );
}
}
var bindingsByRoot = this._bindingsByRootAndName,
bindingByName = bindingsByRoot[ rootUuid ];
if ( bindingByName !== undefined ) {
for ( var trackName in bindingByName ) {
var binding = bindingByName[ trackName ];
binding.restoreOriginalState();
this._removeInactiveBinding( binding );
}
}
},
// remove a targeted clip from the cache
uncacheAction: function ( clip, optionalRoot ) {
var action = this.existingAction( clip, optionalRoot );
if ( action !== null ) {
this._deactivateAction( action );
this._removeInactiveAction( action );
}
}
} );
Object.assign( AnimationMixer.prototype, EventDispatcher.prototype );
export { AnimationMixer };
......@@ -71,9 +71,7 @@ function AnimationObjectGroup( var_args ) {
}
AnimationObjectGroup.prototype = {
constructor: AnimationObjectGroup,
Object.assign( AnimationObjectGroup.prototype, {
isAnimationObjectGroup: true,
......@@ -371,8 +369,7 @@ AnimationObjectGroup.prototype = {
}
};
} );
export { AnimationObjectGroup };
此差异已折叠。
......@@ -56,9 +56,7 @@ function PropertyMixer( binding, typeName, valueSize ) {
}
PropertyMixer.prototype = {
constructor: PropertyMixer,
Object.assign( PropertyMixer.prototype, {
// accumulate data in the 'incoming' region into 'accu<i>'
accumulate: function( accuIndex, weight ) {
......@@ -118,7 +116,7 @@ PropertyMixer.prototype = {
var originalValueOffset = stride * 3;
this._mixBufferRegion(
buffer, offset, originalValueOffset, 1 - weight, stride );
buffer, offset, originalValueOffset, 1 - weight, stride );
}
......@@ -188,7 +186,7 @@ PropertyMixer.prototype = {
_slerp: function( buffer, dstOffset, srcOffset, t, stride ) {
Quaternion.slerpFlat( buffer, dstOffset,
buffer, dstOffset, buffer, srcOffset, t );
buffer, dstOffset, buffer, srcOffset, t );
},
......@@ -206,7 +204,7 @@ PropertyMixer.prototype = {
}
};
} );
export { PropertyMixer };
......@@ -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;
......
......@@ -32,17 +32,19 @@ function BufferAttribute( array, itemSize, normalized ) {
}
BufferAttribute.prototype = {
Object.defineProperty( BufferAttribute.prototype, "needsUpdate", {
constructor: BufferAttribute,
isBufferAttribute: true,
set: function(value) {
if ( value === true ) this.version ++;
}
set needsUpdate( value ) {
});
if ( value === true ) this.version ++;
Object.assign( BufferAttribute.prototype, {
},
isBufferAttribute: true,
setArray: function ( array ) {
......@@ -335,7 +337,7 @@ BufferAttribute.prototype = {
}
};
} );
//
......
......@@ -39,9 +39,9 @@ function BufferGeometry() {
}
BufferGeometry.prototype = {
BufferGeometry.MaxIndex = 65535;
constructor: BufferGeometry,
Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
isBufferGeometry: true,
......@@ -173,12 +173,10 @@ BufferGeometry.prototype = {
// rotate geometry around world x-axis
var m1;
var m1 = new Matrix4();
return function rotateX( angle ) {
if ( m1 === undefined ) m1 = new Matrix4();
m1.makeRotationX( angle );
this.applyMatrix( m1 );
......@@ -193,12 +191,10 @@ BufferGeometry.prototype = {
// rotate geometry around world y-axis
var m1;
var m1 = new Matrix4();
return function rotateY( angle ) {
if ( m1 === undefined ) m1 = new Matrix4();
m1.makeRotationY( angle );
this.applyMatrix( m1 );
......@@ -213,12 +209,10 @@ BufferGeometry.prototype = {
// rotate geometry around world z-axis
var m1;
var m1 = new Matrix4();
return function rotateZ( angle ) {
if ( m1 === undefined ) m1 = new Matrix4();
m1.makeRotationZ( angle );
this.applyMatrix( m1 );
......@@ -233,12 +227,10 @@ BufferGeometry.prototype = {
// translate geometry
var m1;
var m1 = new Matrix4();
return function translate( x, y, z ) {
if ( m1 === undefined ) m1 = new Matrix4();
m1.makeTranslation( x, y, z );
this.applyMatrix( m1 );
......@@ -253,12 +245,10 @@ BufferGeometry.prototype = {
// scale geometry
var m1;
var m1 = new Matrix4();
return function scale( x, y, z ) {
if ( m1 === undefined ) m1 = new Matrix4();
m1.makeScale( x, y, z );
this.applyMatrix( m1 );
......@@ -271,12 +261,10 @@ BufferGeometry.prototype = {
lookAt: function () {
var obj;
var obj = new Object3D();
return function lookAt( vector ) {
if ( obj === undefined ) obj = new Object3D();
obj.lookAt( vector );
obj.updateMatrix();
......@@ -979,28 +967,28 @@ BufferGeometry.prototype = {
clone: function () {
/*
// Handle primitives
// Handle primitives
var parameters = this.parameters;
var parameters = this.parameters;
if ( parameters !== undefined ) {
if ( parameters !== undefined ) {
var values = [];
var values = [];
for ( var key in parameters ) {
for ( var key in parameters ) {
values.push( parameters[ key ] );
values.push( parameters[ key ] );
}
}
var geometry = Object.create( this.constructor.prototype );
this.constructor.apply( geometry, values );
return geometry;
var geometry = Object.create( this.constructor.prototype );
this.constructor.apply( geometry, values );
return geometry;
}
}
return new this.constructor().copy( this );
*/
return new this.constructor().copy( this );
*/
return new BufferGeometry().copy( this );
......@@ -1109,10 +1097,7 @@ BufferGeometry.prototype = {
}
};
BufferGeometry.MaxIndex = 65535;
} );
Object.assign( BufferGeometry.prototype, EventDispatcher.prototype );
export { BufferGeometry };
......@@ -14,9 +14,7 @@ function Clock( autoStart ) {
}
Clock.prototype = {
constructor: Clock,
Object.assign( Clock.prototype, {
start: function () {
......@@ -67,7 +65,7 @@ Clock.prototype = {
}
};
} );
export { Clock };
......@@ -4,7 +4,7 @@
function EventDispatcher() {}
EventDispatcher.prototype = {
Object.assign( EventDispatcher.prototype, {
addEventListener: function ( type, listener ) {
......@@ -87,7 +87,7 @@ EventDispatcher.prototype = {
}
};
} );
export { EventDispatcher };
......@@ -22,9 +22,7 @@ function Face3( a, b, c, normal, color, materialIndex ) {
}
Face3.prototype = {
constructor: Face3,
Object.assign( Face3.prototype, {
clone: function () {
......@@ -59,7 +57,7 @@ Face3.prototype = {
}
};
} );
export { Face3 };
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册