Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
1b253db6
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
1b253db6
编写于
6月 15, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed Animation relying on object.position = vector pattern. See #4924.
上级
79b3270d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
21 deletion
+24
-21
src/extras/animation/Animation.js
src/extras/animation/Animation.js
+24
-21
未找到文件。
src/extras/animation/Animation.js
浏览文件 @
1b253db6
...
@@ -148,6 +148,7 @@ THREE.Animation.prototype.update = (function(){
...
@@ -148,6 +148,7 @@ THREE.Animation.prototype.update = (function(){
};
};
return
function
(
delta
)
{
return
function
(
delta
)
{
if
(
this
.
isPlaying
===
false
)
return
;
if
(
this
.
isPlaying
===
false
)
return
;
this
.
currentTime
+=
delta
*
this
.
timeScale
;
this
.
currentTime
+=
delta
*
this
.
timeScale
;
...
@@ -157,7 +158,6 @@ THREE.Animation.prototype.update = (function(){
...
@@ -157,7 +158,6 @@ THREE.Animation.prototype.update = (function(){
//
//
var
vector
;
var
duration
=
this
.
data
.
length
;
var
duration
=
this
.
data
.
length
;
if
(
this
.
loop
===
true
&&
this
.
currentTime
>
duration
)
{
if
(
this
.
loop
===
true
&&
this
.
currentTime
>
duration
)
{
...
@@ -219,8 +219,6 @@ THREE.Animation.prototype.update = (function(){
...
@@ -219,8 +219,6 @@ THREE.Animation.prototype.update = (function(){
if
(
type
===
"
pos
"
)
{
if
(
type
===
"
pos
"
)
{
vector
=
object
.
position
;
if
(
this
.
interpolationType
===
THREE
.
AnimationHandler
.
LINEAR
)
{
if
(
this
.
interpolationType
===
THREE
.
AnimationHandler
.
LINEAR
)
{
newVector
.
x
=
prevXYZ
[
0
]
+
(
nextXYZ
[
0
]
-
prevXYZ
[
0
]
)
*
scale
;
newVector
.
x
=
prevXYZ
[
0
]
+
(
nextXYZ
[
0
]
-
prevXYZ
[
0
]
)
*
scale
;
...
@@ -228,17 +226,21 @@ THREE.Animation.prototype.update = (function(){
...
@@ -228,17 +226,21 @@ THREE.Animation.prototype.update = (function(){
newVector
.
z
=
prevXYZ
[
2
]
+
(
nextXYZ
[
2
]
-
prevXYZ
[
2
]
)
*
scale
;
newVector
.
z
=
prevXYZ
[
2
]
+
(
nextXYZ
[
2
]
-
prevXYZ
[
2
]
)
*
scale
;
// blend
// blend
if
(
object
instanceof
THREE
.
Bone
)
{
if
(
object
instanceof
THREE
.
Bone
)
{
var
proportionalWeight
=
this
.
weight
/
(
this
.
weight
+
object
.
accumulatedPosWeight
);
var
proportionalWeight
=
this
.
weight
/
(
this
.
weight
+
object
.
accumulatedPosWeight
);
vector
.
lerp
(
newVector
,
proportionalWeight
);
object
.
position
.
lerp
(
newVector
,
proportionalWeight
);
object
.
accumulatedPosWeight
+=
this
.
weight
;
object
.
accumulatedPosWeight
+=
this
.
weight
;
}
else
}
else
{
vector
=
newVector
;
object
.
position
.
copy
(
newVector
);
}
}
else
if
(
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
}
else
if
(
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
)
{
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
)
{
points
[
0
]
=
this
.
getPrevKeyWith
(
"
pos
"
,
h
,
prevKey
.
index
-
1
)[
"
pos
"
];
points
[
0
]
=
this
.
getPrevKeyWith
(
"
pos
"
,
h
,
prevKey
.
index
-
1
)[
"
pos
"
];
points
[
1
]
=
prevXYZ
;
points
[
1
]
=
prevXYZ
;
...
@@ -248,17 +250,19 @@ THREE.Animation.prototype.update = (function(){
...
@@ -248,17 +250,19 @@ THREE.Animation.prototype.update = (function(){
scale
=
scale
*
0.33
+
0.33
;
scale
=
scale
*
0.33
+
0.33
;
var
currentPoint
=
interpolateCatmullRom
(
points
,
scale
);
var
currentPoint
=
interpolateCatmullRom
(
points
,
scale
);
var
proportionalWeight
=
1
;
if
(
object
instanceof
THREE
.
Bone
)
{
if
(
object
instanceof
THREE
.
Bone
)
{
var
proportionalWeight
=
this
.
weight
/
(
this
.
weight
+
object
.
accumulatedPosWeight
);
proportionalWeight
=
this
.
weight
/
(
this
.
weight
+
object
.
accumulatedPosWeight
);
object
.
accumulatedPosWeight
+=
this
.
weight
;
object
.
accumulatedPosWeight
+=
this
.
weight
;
}
}
else
var
proportionalWeight
=
1
;
// blend
// blend
var
vector
=
object
.
position
;
vector
.
x
=
vector
.
x
+
(
currentPoint
[
0
]
-
vector
.
x
)
*
proportionalWeight
;
vector
.
x
=
vector
.
x
+
(
currentPoint
[
0
]
-
vector
.
x
)
*
proportionalWeight
;
vector
.
y
=
vector
.
y
+
(
currentPoint
[
1
]
-
vector
.
y
)
*
proportionalWeight
;
vector
.
y
=
vector
.
y
+
(
currentPoint
[
1
]
-
vector
.
y
)
*
proportionalWeight
;
vector
.
z
=
vector
.
z
+
(
currentPoint
[
2
]
-
vector
.
z
)
*
proportionalWeight
;
vector
.
z
=
vector
.
z
+
(
currentPoint
[
2
]
-
vector
.
z
)
*
proportionalWeight
;
...
@@ -288,14 +292,12 @@ THREE.Animation.prototype.update = (function(){
...
@@ -288,14 +292,12 @@ THREE.Animation.prototype.update = (function(){
object
.
quaternion
.
copy
(
newQuat
);
object
.
quaternion
.
copy
(
newQuat
);
}
}
else
if
(
object
.
accumulatedRotWeight
===
0
)
{
else
if
(
object
.
accumulatedRotWeight
===
0
)
{
object
.
quaternion
.
copy
(
newQuat
);
object
.
quaternion
.
copy
(
newQuat
);
object
.
accumulatedRotWeight
=
this
.
weight
;
object
.
accumulatedRotWeight
=
this
.
weight
;
}
}
else
{
else
{
var
proportionalWeight
=
this
.
weight
/
(
this
.
weight
+
object
.
accumulatedRotWeight
);
var
proportionalWeight
=
this
.
weight
/
(
this
.
weight
+
object
.
accumulatedRotWeight
);
THREE
.
Quaternion
.
slerp
(
object
.
quaternion
,
newQuat
,
object
.
quaternion
,
proportionalWeight
);
THREE
.
Quaternion
.
slerp
(
object
.
quaternion
,
newQuat
,
object
.
quaternion
,
proportionalWeight
);
...
@@ -305,8 +307,6 @@ THREE.Animation.prototype.update = (function(){
...
@@ -305,8 +307,6 @@ THREE.Animation.prototype.update = (function(){
}
else
if
(
type
===
"
scl
"
)
{
}
else
if
(
type
===
"
scl
"
)
{
vector
=
object
.
scale
;
newVector
.
x
=
prevXYZ
[
0
]
+
(
nextXYZ
[
0
]
-
prevXYZ
[
0
]
)
*
scale
;
newVector
.
x
=
prevXYZ
[
0
]
+
(
nextXYZ
[
0
]
-
prevXYZ
[
0
]
)
*
scale
;
newVector
.
y
=
prevXYZ
[
1
]
+
(
nextXYZ
[
1
]
-
prevXYZ
[
1
]
)
*
scale
;
newVector
.
y
=
prevXYZ
[
1
]
+
(
nextXYZ
[
1
]
-
prevXYZ
[
1
]
)
*
scale
;
newVector
.
z
=
prevXYZ
[
2
]
+
(
nextXYZ
[
2
]
-
prevXYZ
[
2
]
)
*
scale
;
newVector
.
z
=
prevXYZ
[
2
]
+
(
nextXYZ
[
2
]
-
prevXYZ
[
2
]
)
*
scale
;
...
@@ -314,11 +314,14 @@ THREE.Animation.prototype.update = (function(){
...
@@ -314,11 +314,14 @@ THREE.Animation.prototype.update = (function(){
if
(
object
instanceof
THREE
.
Bone
)
{
if
(
object
instanceof
THREE
.
Bone
)
{
var
proportionalWeight
=
this
.
weight
/
(
this
.
weight
+
object
.
accumulatedSclWeight
);
var
proportionalWeight
=
this
.
weight
/
(
this
.
weight
+
object
.
accumulatedSclWeight
);
vector
.
lerp
(
newVector
,
proportionalWeight
);
object
.
scale
.
lerp
(
newVector
,
proportionalWeight
);
object
.
accumulatedSclWeight
+=
this
.
weight
;
object
.
accumulatedSclWeight
+=
this
.
weight
;
}
else
}
else
{
vector
=
newVector
;
object
.
scale
.
copy
(
newVector
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录