Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
e13c6978
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e13c6978
编写于
7月 23, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
58f5fb54
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
78 addition
and
91 deletion
+78
-91
build/three.js
build/three.js
+51
-63
build/three.min.js
build/three.min.js
+27
-28
未找到文件。
build/three.js
浏览文件 @
e13c6978
...
...
@@ -14919,26 +14919,10 @@ THREE.Bone = function ( belongsToSkin ) {
this.skin = belongsToSkin;
this.accumulatedRotWeight = 0;
this.accumulatedPosWeight = 0;
this.accumulatedSclWeight = 0;
};
THREE.Bone.prototype = Object.create( THREE.Object3D.prototype );
THREE.Bone.prototype.updateMatrixWorld = function ( force ) {
THREE.Object3D.prototype.updateMatrixWorld.call( this, force );
// Reset weights to be re-accumulated in the next frame
this.accumulatedRotWeight = 0;
this.accumulatedPosWeight = 0;
this.accumulatedSclWeight = 0;
};
// File:src/objects/Skeleton.js
...
...
@@ -28910,6 +28894,12 @@ THREE.AnimationHandler = {
update: function ( deltaTimeMS ) {
for ( var i = 0; i < this.animations.length; i ++ ) {
this.animations[ i ].resetBlendWeights( );
}
for ( var i = 0; i < this.animations.length; i ++ ) {
this.animations[ i ].update( deltaTimeMS );
...
...
@@ -28981,20 +28971,26 @@ THREE.Animation.prototype.reset = function () {
if ( object.animationCache === undefined ) {
object.animationCache = {};
object.animationCache = {
animations: {},
blending: {
positionWeight: 0.0,
quaternionWeight: 0.0,
scaleWeight: 0.0
}
};
}
if ( object.animationCache[this.data.name] === undefined ) {
if ( object.animationCache
.animations
[this.data.name] === undefined ) {
object.animationCache[this.data.name] = {};
object.animationCache[this.data.name].prevKey = { pos: 0, rot: 0, scl: 0 };
object.animationCache[this.data.name].nextKey = { pos: 0, rot: 0, scl: 0 };
object.animationCache[this.data.name].originalMatrix = object.matrix;
object.animationCache
.animations
[this.data.name] = {};
object.animationCache
.animations
[this.data.name].prevKey = { pos: 0, rot: 0, scl: 0 };
object.animationCache
.animations
[this.data.name].nextKey = { pos: 0, rot: 0, scl: 0 };
object.animationCache
.animations
[this.data.name].originalMatrix = object.matrix;
}
var animationCache = object.animationCache[this.data.name];
var animationCache = object.animationCache
.animations
[this.data.name];
// Get keys to match our current time
...
...
@@ -29021,6 +29017,23 @@ THREE.Animation.prototype.reset = function () {
};
THREE.Animation.prototype.resetBlendWeights = function () {
for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
var object = this.hierarchy[ h ];
if ( object.animationCache !== undefined ) {
object.animationCache.blending.positionWeight = 0.0;
object.animationCache.blending.quaternionWeight = 0.0;
object.animationCache.blending.scaleWeight = 0.0;
}
}
};
THREE.Animation.prototype.update = (function(){
...
...
@@ -29099,7 +29112,8 @@ THREE.Animation.prototype.update = (function(){
for ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {
var object = this.hierarchy[ h ];
var animationCache = object.animationCache[this.data.name];
var animationCache = object.animationCache.animations[this.data.name];
var blending = object.animationCache.blending;
// loop through pos/rot/scl
...
...
@@ -29150,17 +29164,9 @@ THREE.Animation.prototype.update = (function(){
newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
// blend
if ( object instanceof THREE.Bone ) {
var proportionalWeight = this.weight / ( this.weight + object.accumulatedPosWeight );
object.position.lerp( newVector, proportionalWeight );
object.accumulatedPosWeight += this.weight;
} else {
object.position.copy( newVector );
}
var proportionalWeight = this.weight / ( this.weight + blending.positionWeight );
object.position.lerp( newVector, proportionalWeight );
blending.positionWeight += this.weight;
} else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
...
...
@@ -29173,14 +29179,8 @@ THREE.Animation.prototype.update = (function(){
scale = scale * 0.33 + 0.33;
var currentPoint = interpolateCatmullRom( points, scale );
var proportionalWeight = 1;
if ( object instanceof THREE.Bone ) {
proportionalWeight = this.weight / ( this.weight + object.accumulatedPosWeight );
object.accumulatedPosWeight += this.weight;
}
var proportionalWeight = this.weight / ( this.weight + blending.positionWeight );
blending.positionWeight += this.weight;
// blend
...
...
@@ -29211,20 +29211,16 @@ THREE.Animation.prototype.update = (function(){
THREE.Quaternion.slerp( prevXYZ, nextXYZ, newQuat, scale );
// Avoid paying the cost of an additional slerp if we don't have to
if ( ! ( object instanceof THREE.Bone ) ) {
object.quaternion.copy(newQuat);
} else if ( object.accumulatedRotWeight === 0 ) {
if ( blending.quaternionWeight === 0 ) {
object.quaternion.copy(newQuat);
object.accumulatedRot
Weight = this.weight;
blending.quaternion
Weight = this.weight;
} else {
var proportionalWeight = this.weight / ( this.weight +
object.accumulatedRot
Weight );
var proportionalWeight = this.weight / ( this.weight +
blending.quaternion
Weight );
THREE.Quaternion.slerp( object.quaternion, newQuat, object.quaternion, proportionalWeight );
object.accumulatedRot
Weight += this.weight;
blending.quaternion
Weight += this.weight;
}
...
...
@@ -29234,17 +29230,9 @@ THREE.Animation.prototype.update = (function(){
newVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
newVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
if ( object instanceof THREE.Bone ) {
var proportionalWeight = this.weight / ( this.weight + object.accumulatedSclWeight);
object.scale.lerp( newVector, proportionalWeight );
object.accumulatedSclWeight += this.weight;
} else {
object.scale.copy( newVector );
}
var proportionalWeight = this.weight / ( this.weight + blending.scaleWeight );
object.scale.lerp( newVector, proportionalWeight );
blending.scaleWeight += this.weight;
}
...
...
build/three.min.js
浏览文件 @
e13c6978
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录