提交 1c52d2a2 编写于 作者: M Mr.doob

Updated builds.

上级 091b1f79
......@@ -17563,7 +17563,7 @@ THREE.MorphAnimMesh = function ( geometry, material ) {
this.direction = 1;
this.directionBackwards = false;
this.setFrameRange( 0, this.geometry.morphTargets.length - 1 );
this.setFrameRange( 0, geometry.morphTargets.length - 1 );
};
......@@ -17693,12 +17693,13 @@ THREE.MorphAnimMesh.prototype.updateAnimation = function ( delta ) {
var keyframe = this.startKeyframe + THREE.Math.clamp( Math.floor( this.time / frameTime ), 0, this.length - 1 );
if ( keyframe !== this.currentKeyframe ) {
var influences = this.morphTargetInfluences;
this.morphTargetInfluences[ this.lastKeyframe ] = 0;
this.morphTargetInfluences[ this.currentKeyframe ] = 1;
if ( keyframe !== this.currentKeyframe ) {
this.morphTargetInfluences[ keyframe ] = 0;
influences[ this.lastKeyframe ] = 0;
influences[ this.currentKeyframe ] = 1;
influences[ keyframe ] = 0;
this.lastKeyframe = this.currentKeyframe;
this.currentKeyframe = keyframe;
......@@ -17713,8 +17714,8 @@ THREE.MorphAnimMesh.prototype.updateAnimation = function ( delta ) {
}
this.morphTargetInfluences[ this.currentKeyframe ] = mix;
this.morphTargetInfluences[ this.lastKeyframe ] = 1 - mix;
influences[ this.currentKeyframe ] = mix;
influences[ this.lastKeyframe ] = 1 - mix;
};
......@@ -19516,6 +19517,8 @@ THREE.WebGLRenderer = function ( parameters ) {
var opaqueImmediateObjects = [];
var transparentImmediateObjects = [];
var morphInfluences = new Float32Array( 8 );
var sprites = [];
var lensFlares = [];
......@@ -19857,6 +19860,12 @@ THREE.WebGLRenderer = function ( parameters ) {
};
this.getContextAttributes = function () {
return _gl.getContextAttributes();
};
this.forceContextLoss = function () {
extensions.get( 'WEBGL_lose_context' ).loseContext();
......@@ -20491,6 +20500,51 @@ THREE.WebGLRenderer = function ( parameters ) {
}
// morph targets
if ( object.morphTargetInfluences !== undefined ) {
var activeInfluences = [];
var morphTargetInfluences = object.morphTargetInfluences;
for ( var i = 0, l = morphTargetInfluences.length; i < l; i ++ ) {
var influence = morphTargetInfluences[ i ];
activeInfluences.push( [ influence, i ] );
}
activeInfluences.sort( numericalSort );
if ( activeInfluences.length > 8 ) {
activeInfluences.length = 8;
}
for ( var i = 0, l = activeInfluences.length; i < l; i ++ ) {
var influence = activeInfluences[ i ];
morphInfluences[ i ] = influence[ 0 ];
var attribute = geometry.morphAttributes[ influence[ 1 ] ];
objects.updateAttribute( attribute );
geometry.addAttribute( 'morphTarget' + i, attribute );
}
var uniforms = program.getUniforms();
if ( uniforms.morphTargetInfluences !== null ) {
_gl.uniform1fv( uniforms.morphTargetInfluences, morphInfluences );
}
}
if ( object instanceof THREE.Mesh ) {
renderMesh( material, geometry, object, program, updateBuffers );
......@@ -20940,6 +20994,12 @@ THREE.WebGLRenderer = function ( parameters ) {
// Sorting
function numericalSort ( a, b ) {
return b[ 0 ] - a[ 0 ];
}
function painterSortStable ( a, b ) {
if ( a.object.renderOrder !== b.object.renderOrder ) {
......@@ -23789,8 +23849,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
var objects = {};
var morphInfluences = new Float32Array( 8 );
var geometries = new THREE.WebGLGeometries( gl, properties, info );
//
......@@ -23862,12 +23920,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
};
function numericalSort ( a, b ) {
return b[ 0 ] - a[ 0 ];
}
function updateObject( object ) {
var geometry = geometries.get( object );
......@@ -23878,57 +23930,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
}
// morph targets
if ( object.morphTargetInfluences !== undefined ) {
var activeInfluences = [];
var morphTargetInfluences = object.morphTargetInfluences;
for ( var i = 0, l = morphTargetInfluences.length; i < l; i ++ ) {
var influence = morphTargetInfluences[ i ];
activeInfluences.push( [ influence, i ] );
}
activeInfluences.sort( numericalSort );
if ( activeInfluences.length > 8 ) {
activeInfluences.length = 8;
}
for ( var i = 0, l = activeInfluences.length; i < l; i ++ ) {
morphInfluences[ i ] = activeInfluences[ i ][ 0 ];
var attribute = geometry.morphAttributes[ activeInfluences[ i ][ 1 ] ];
geometry.addAttribute( 'morphTarget' + i, attribute );
}
var material = object.material;
if ( material.program !== undefined ) {
var uniforms = material.program.getUniforms();
if ( uniforms.morphTargetInfluences !== null ) {
gl.uniform1fv( uniforms.morphTargetInfluences, morphInfluences );
}
} else {
console.warn( 'TOFIX: material.program is undefined' );
}
}
//
var attributes = geometry.attributes;
......@@ -23941,7 +23942,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
}
function updateAttribute ( attribute, name ) {
function updateAttribute( attribute, name ) {
var bufferType = ( name === 'index' ) ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;
......@@ -23961,7 +23962,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
}
function createBuffer ( attributeProperties, data, bufferType ) {
function createBuffer( attributeProperties, data, bufferType ) {
attributeProperties.__webglBuffer = gl.createBuffer();
gl.bindBuffer( bufferType, attributeProperties.__webglBuffer );
......@@ -23982,7 +23983,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
}
function updateBuffer ( attributeProperties, data, bufferType ) {
function updateBuffer( attributeProperties, data, bufferType ) {
gl.bindBuffer( bufferType, attributeProperties.__webglBuffer );
......@@ -24022,9 +24023,9 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
this.update = function ( renderList ) {
for ( var i = 0, ul = renderList.length; i < ul; i++ ) {
for ( var i = 0, ul = renderList.length; i < ul; i ++ ) {
var object = renderList[i].object;
var object = renderList[ i ].object;
if ( object.material.visible !== false ) {
......@@ -24036,6 +24037,8 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
};
this.updateAttribute = updateAttribute;
this.clear = function () {
objects = {};
......@@ -24949,7 +24952,6 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
}
_renderer.setMaterialFaces( objectMaterial );
_renderer.renderBufferDirect( shadowCamera, _lights, fog, material, object );
}
......@@ -30902,8 +30904,8 @@ THREE.MorphAnimation.prototype = {
this.currentTime = Math.min( this.currentTime, this.duration );
var interpolation = this.duration / this.frames;
var frame = Math.floor( this.currentTime / interpolation );
var frameTime = this.duration / this.frames;
var frame = Math.floor( this.currentTime / frameTime );
var influences = this.mesh.morphTargetInfluences;
......@@ -30918,8 +30920,10 @@ THREE.MorphAnimation.prototype = {
}
influences[ frame ] = ( this.currentTime % interpolation ) / interpolation;
influences[ this.lastFrame ] = 1 - influences[ frame ];
var mix = ( this.currentTime % frameTime ) / frameTime;
influences[ frame ] = mix;
influences[ this.lastFrame ] = 1 - mix;
}
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册