Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
51a45080
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,发现更多精彩内容 >>
提交
51a45080
编写于
12月 08, 2016
作者:
K
Kyle Larson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Multi-Animation now works for FBX's exported from Maya.
上级
ed26738c
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
13500 addition
and
25 deletion
+13500
-25
examples/js/loaders/FBXLoader.js
examples/js/loaders/FBXLoader.js
+81
-22
examples/models/fbx/MyMultiTest.fbx
examples/models/fbx/MyMultiTest.fbx
+13412
-0
examples/webgl_loader_fbx.html
examples/webgl_loader_fbx.html
+7
-3
未找到文件。
examples/js/loaders/FBXLoader.js
浏览文件 @
51a45080
...
...
@@ -272,7 +272,7 @@
geometry
.
skinWeights
=
this
.
weights
.
skinWeights
;
var
mesh
=
null
;
if
(
geo
.
bones
===
undefined
||
geo
.
skins
===
undefined
||
this
.
animations
===
undefined
||
this
.
animations
.
length
===
0
)
{
if
(
geo
.
bones
===
undefined
||
geo
.
skins
===
undefined
||
this
.
animations
===
undefined
)
{
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
...
...
@@ -295,7 +295,7 @@
var
animationData
=
{
name
:
animations
.
stacks
[
key
].
name
,
fps
:
30
,
length
:
animations
.
length
,
length
:
animations
.
stacks
[
key
].
length
,
hierarchy
:
[]
};
...
...
@@ -447,7 +447,7 @@
}
var
bones
=
mesh
.
geometry
.
bones
;
for
(
var
frame
=
0
;
frame
<
animations
.
frames
;
frame
++
)
{
for
(
var
frame
=
0
;
frame
<
animations
.
stacks
[
key
].
frames
;
frame
++
)
{
for
(
i
=
0
;
i
<
bones
.
length
;
i
++
)
{
...
...
@@ -2322,14 +2322,12 @@
// third: insert curves into the dict
var
ac
=
[];
var
max
=
0.0
;
for
(
key
in
rawCurves
)
{
if
(
key
.
match
(
/
\d
+/
)
)
{
var
c
=
(
new
AnimationCurve
()
).
fromNode
(
rawCurves
[
key
]
);
ac
.
push
(
c
);
max
=
c
.
getLength
()
?
c
.
getLength
()
:
max
;
var
parentId
=
node
.
searchConnectionParent
(
c
.
id
)[
0
];
var
axis
=
node
.
searchConnectionType
(
c
.
id
,
parentId
);
...
...
@@ -2338,16 +2336,18 @@
axis
=
'
x
'
;
}
if
(
axis
.
match
(
/Y/
)
)
{
}
else
if
(
axis
.
match
(
/Y/
)
)
{
axis
=
'
y
'
;
}
if
(
axis
.
match
(
/Z/
)
)
{
}
else
if
(
axis
.
match
(
/Z/
)
)
{
axis
=
'
z
'
;
}
else
{
continue
;
}
tmp
[
parentId
].
curves
[
axis
]
=
c
;
...
...
@@ -2382,17 +2382,22 @@
var
children
=
node
.
searchConnectionChildren
(
key
);
for
(
var
i
=
0
;
i
<
children
.
length
;
++
i
)
{
if
(
layer
[
tmp
[
children
[
i
]
].
containerBoneId
]
===
undefined
)
{
//Skip lockInfluenceWeights
if
(
tmp
[
children
[
i
]
]
)
{
layer
[
tmp
[
children
[
i
]
].
containerBoneId
]
=
{
T
:
null
,
R
:
null
,
S
:
null
};
if
(
layer
[
tmp
[
children
[
i
]
].
containerBoneId
]
===
undefined
)
{
}
layer
[
tmp
[
children
[
i
]
].
containerBoneId
]
=
{
T
:
null
,
R
:
null
,
S
:
null
};
}
layer
[
tmp
[
children
[
i
]
].
containerBoneId
][
tmp
[
children
[
i
]
].
attr
]
=
tmp
[
children
[
i
]
];
layer
[
tmp
[
children
[
i
]
].
containerBoneId
][
tmp
[
children
[
i
]
].
attr
]
=
tmp
[
children
[
i
]
];
}
}
...
...
@@ -2406,12 +2411,68 @@
var
layers
=
[];
var
children
=
node
.
searchConnectionChildren
(
key
);
var
max
=
0.0
;
var
min
=
Number
.
MAX_VALUE
;
for
(
var
i
=
0
;
i
<
children
.
length
;
++
i
)
{
if
(
children
[
i
]
in
this
.
layers
)
{
layers
.
push
(
this
.
layers
[
children
[
i
]
]
);
for
(
var
j
=
0
;
j
<
this
.
layers
[
children
[
i
]
].
length
;
++
j
)
{
function
getMaxMin
(
layer
)
{
function
_getMaxMin
(
curves
)
{
if
(
curves
.
x
)
{
max
=
curves
.
x
.
getLength
()
>
max
?
curves
.
x
.
getLength
()
:
max
;
min
=
curves
.
x
.
times
[
0
]
<
min
?
curves
.
x
.
times
[
0
]
:
min
;
}
if
(
curves
.
y
)
{
max
=
curves
.
y
.
getLength
()
>
max
?
curves
.
y
.
getLength
()
:
max
;
min
=
curves
.
y
.
times
[
0
]
<
min
?
curves
.
y
.
times
[
0
]
:
min
;
}
if
(
curves
.
z
)
{
max
=
curves
.
z
.
getLength
()
>
max
?
curves
.
z
.
getLength
()
:
max
;
min
=
curves
.
z
.
times
[
0
]
<
min
?
curves
.
z
.
times
[
0
]
:
min
;
}
}
if
(
layer
.
R
)
{
_getMaxMin
(
layer
.
R
.
curves
);
}
if
(
layer
.
S
)
{
_getMaxMin
(
layer
.
S
.
curves
);
}
if
(
layer
.
T
)
{
_getMaxMin
(
layer
.
T
.
curves
);
}
}
var
layer
=
this
.
layers
[
children
[
i
]
][
j
];
if
(
layer
)
{
getMaxMin
(
layer
);
}
}
}
}
...
...
@@ -2419,16 +2480,14 @@
this
.
stacks
[
key
]
=
{
name
:
rawStacks
[
key
].
attrName
,
layers
:
layers
layers
:
layers
,
length
:
max
-
min
,
frames
:
(
max
-
min
)
*
30
,
};
}
this
.
length
=
max
;
this
.
frames
=
this
.
length
*
this
.
fps
;
return
this
;
};
...
...
examples/models/fbx/MyMultiTest.fbx
0 → 100644
浏览文件 @
51a45080
此差异已折叠。
点击以展开。
examples/webgl_loader_fbx.html
浏览文件 @
51a45080
...
...
@@ -61,6 +61,10 @@
scene
=
new
THREE
.
Scene
();
lights
=
new
THREE
.
DirectionalLight
();
lights
.
position
.
set
(
0
,
5
,
0
);
scene
.
add
(
lights
);
// grid
var
gridHelper
=
new
THREE
.
GridHelper
(
14
,
28
,
0x303030
,
0x303030
);
gridHelper
.
position
.
set
(
0
,
-
0.04
,
0
);
...
...
@@ -93,7 +97,7 @@
};
var
loader
=
new
THREE
.
FBXLoader
(
manager
);
loader
.
load
(
'
models/fbx/
xsi_man_skinning
.fbx
'
,
function
(
object
)
{
loader
.
load
(
'
models/fbx/
MyMultiTest
.fbx
'
,
function
(
object
)
{
object
.
traverse
(
function
(
child
)
{
...
...
@@ -110,7 +114,7 @@
child
.
mixer
=
new
THREE
.
AnimationMixer
(
child
);
mixers
.
push
(
child
.
mixer
);
var
action
=
child
.
mixer
.
clipAction
(
child
.
geometry
.
animations
[
0
]
);
var
action
=
child
.
mixer
.
clipAction
(
child
.
geometry
.
animations
[
1
]
);
action
.
play
();
}
...
...
@@ -127,7 +131,7 @@
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setClearColor
(
0x
000000
);
renderer
.
setClearColor
(
0x
ffffff
);
container
.
appendChild
(
renderer
.
domElement
);
// controls, camera
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录