Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
f4c960c6
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,发现更多精彩内容 >>
未验证
提交
f4c960c6
编写于
9月 13, 2019
作者:
M
Mr.doob
提交者:
GitHub
9月 13, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16991 from looeee/fbxloader_morphtargets_fix
FBXLoader: load multiple morph targets
上级
792388a2
3a7b5d06
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
32 deletion
+44
-32
examples/js/loaders/FBXLoader.js
examples/js/loaders/FBXLoader.js
+22
-16
examples/jsm/loaders/FBXLoader.js
examples/jsm/loaders/FBXLoader.js
+22
-16
未找到文件。
examples/js/loaders/FBXLoader.js
浏览文件 @
f4c960c6
...
...
@@ -1529,7 +1529,7 @@ THREE.FBXLoader = ( function () {
parseMeshGeometry
:
function
(
relationships
,
geoNode
,
deformers
)
{
var
skeletons
=
deformers
.
skeletons
;
var
morphTargets
=
deformers
.
morphTargets
;
var
morphTargets
=
[]
;
var
modelNodes
=
relationships
.
parents
.
map
(
function
(
parent
)
{
...
...
@@ -1548,13 +1548,15 @@ THREE.FBXLoader = ( function () {
},
null
);
var
morphTarget
=
relationships
.
children
.
reduce
(
function
(
morphTarget
,
child
)
{
relationships
.
children
.
forEach
(
function
(
child
)
{
if
(
morphTargets
[
child
.
ID
]
!==
undefined
)
morphTarget
=
morphTargets
[
child
.
ID
];
if
(
deformers
.
morphTargets
[
child
.
ID
]
!==
undefined
)
{
return
morphTarget
;
morphTargets
.
push
(
deformers
.
morphTargets
[
child
.
ID
]
)
;
},
null
);
}
}
);
// Assume one model and get the preRotation from that
// if there is more than one model associated with the geometry this may cause problems
...
...
@@ -1571,12 +1573,12 @@ THREE.FBXLoader = ( function () {
var
transform
=
generateTransform
(
transformData
);
return
this
.
genGeometry
(
geoNode
,
skeleton
,
morphTarget
,
transform
);
return
this
.
genGeometry
(
geoNode
,
skeleton
,
morphTarget
s
,
transform
);
},
// Generate a THREE.BufferGeometry from a node in FBXTree.Objects.Geometry
genGeometry
:
function
(
geoNode
,
skeleton
,
morphTarget
,
preTransform
)
{
genGeometry
:
function
(
geoNode
,
skeleton
,
morphTarget
s
,
preTransform
)
{
var
geo
=
new
THREE
.
BufferGeometry
();
if
(
geoNode
.
attrName
)
geo
.
name
=
geoNode
.
attrName
;
...
...
@@ -1677,7 +1679,7 @@ THREE.FBXLoader = ( function () {
}
this
.
addMorphTargets
(
geo
,
geoNode
,
morphTarget
,
preTransform
);
this
.
addMorphTargets
(
geo
,
geoNode
,
morphTarget
s
,
preTransform
);
return
geo
;
...
...
@@ -2050,23 +2052,27 @@ THREE.FBXLoader = ( function () {
},
addMorphTargets
:
function
(
parentGeo
,
parentGeoNode
,
morphTarget
,
preTransform
)
{
addMorphTargets
:
function
(
parentGeo
,
parentGeoNode
,
morphTarget
s
,
preTransform
)
{
if
(
morphTarget
===
null
)
return
;
if
(
morphTarget
s
.
length
===
0
)
return
;
parentGeo
.
morphAttributes
.
position
=
[];
// parentGeo.morphAttributes.normal = []; // not implemented
var
self
=
this
;
morphTarget
.
rawTargets
.
forEach
(
function
(
raw
Target
)
{
var
self
=
this
;
morphTarget
s
.
forEach
(
function
(
morph
Target
)
{
var
morphGeoNode
=
fbxTree
.
Objects
.
Geometry
[
rawTarget
.
geoID
];
morphTarget
.
rawTargets
.
forEach
(
function
(
rawTarget
)
{
if
(
morphGeoNode
!==
undefined
)
{
var
morphGeoNode
=
fbxTree
.
Objects
.
Geometry
[
rawTarget
.
geoID
];
self
.
genMorphGeometry
(
parentGeo
,
parentGeoNode
,
morphGeoNode
,
preTransform
,
rawTarget
.
name
);
if
(
morphGeoNode
!==
undefined
)
{
}
self
.
genMorphGeometry
(
parentGeo
,
parentGeoNode
,
morphGeoNode
,
preTransform
,
rawTarget
.
name
);
}
}
);
}
);
...
...
examples/jsm/loaders/FBXLoader.js
浏览文件 @
f4c960c6
...
...
@@ -1577,7 +1577,7 @@ var FBXLoader = ( function () {
parseMeshGeometry
:
function
(
relationships
,
geoNode
,
deformers
)
{
var
skeletons
=
deformers
.
skeletons
;
var
morphTargets
=
deformers
.
morphTargets
;
var
morphTargets
=
[]
;
var
modelNodes
=
relationships
.
parents
.
map
(
function
(
parent
)
{
...
...
@@ -1596,13 +1596,15 @@ var FBXLoader = ( function () {
},
null
);
var
morphTarget
=
relationships
.
children
.
reduce
(
function
(
morphTarget
,
child
)
{
relationships
.
children
.
forEach
(
function
(
child
)
{
if
(
morphTargets
[
child
.
ID
]
!==
undefined
)
morphTarget
=
morphTargets
[
child
.
ID
];
if
(
deformers
.
morphTargets
[
child
.
ID
]
!==
undefined
)
{
return
morphTarget
;
morphTargets
.
push
(
deformers
.
morphTargets
[
child
.
ID
]
)
;
},
null
);
}
}
);
// Assume one model and get the preRotation from that
// if there is more than one model associated with the geometry this may cause problems
...
...
@@ -1619,12 +1621,12 @@ var FBXLoader = ( function () {
var
transform
=
generateTransform
(
transformData
);
return
this
.
genGeometry
(
geoNode
,
skeleton
,
morphTarget
,
transform
);
return
this
.
genGeometry
(
geoNode
,
skeleton
,
morphTarget
s
,
transform
);
},
// Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
genGeometry
:
function
(
geoNode
,
skeleton
,
morphTarget
,
preTransform
)
{
genGeometry
:
function
(
geoNode
,
skeleton
,
morphTarget
s
,
preTransform
)
{
var
geo
=
new
BufferGeometry
();
if
(
geoNode
.
attrName
)
geo
.
name
=
geoNode
.
attrName
;
...
...
@@ -1725,7 +1727,7 @@ var FBXLoader = ( function () {
}
this
.
addMorphTargets
(
geo
,
geoNode
,
morphTarget
,
preTransform
);
this
.
addMorphTargets
(
geo
,
geoNode
,
morphTarget
s
,
preTransform
);
return
geo
;
...
...
@@ -2098,23 +2100,27 @@ var FBXLoader = ( function () {
},
addMorphTargets
:
function
(
parentGeo
,
parentGeoNode
,
morphTarget
,
preTransform
)
{
addMorphTargets
:
function
(
parentGeo
,
parentGeoNode
,
morphTarget
s
,
preTransform
)
{
if
(
morphTarget
===
null
)
return
;
if
(
morphTarget
s
.
length
===
0
)
return
;
parentGeo
.
morphAttributes
.
position
=
[];
// parentGeo.morphAttributes.normal = []; // not implemented
var
self
=
this
;
morphTarget
.
rawTargets
.
forEach
(
function
(
raw
Target
)
{
var
self
=
this
;
morphTarget
s
.
forEach
(
function
(
morph
Target
)
{
var
morphGeoNode
=
fbxTree
.
Objects
.
Geometry
[
rawTarget
.
geoID
];
morphTarget
.
rawTargets
.
forEach
(
function
(
rawTarget
)
{
if
(
morphGeoNode
!==
undefined
)
{
var
morphGeoNode
=
fbxTree
.
Objects
.
Geometry
[
rawTarget
.
geoID
];
self
.
genMorphGeometry
(
parentGeo
,
parentGeoNode
,
morphGeoNode
,
preTransform
,
rawTarget
.
name
);
if
(
morphGeoNode
!==
undefined
)
{
}
self
.
genMorphGeometry
(
parentGeo
,
parentGeoNode
,
morphGeoNode
,
preTransform
,
rawTarget
.
name
);
}
}
);
}
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录