Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ac5cfd16
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,发现更多精彩内容 >>
提交
ac5cfd16
编写于
4月 13, 2018
作者:
L
Lewy Blue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added empty genMorphGeo function
上级
75a6e2da
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
14 deletion
+47
-14
examples/js/loaders/FBXLoader.js
examples/js/loaders/FBXLoader.js
+47
-14
未找到文件。
examples/js/loaders/FBXLoader.js
浏览文件 @
ac5cfd16
...
...
@@ -104,7 +104,6 @@
var
textures
=
parseTextures
(
FBXTree
,
new
THREE
.
TextureLoader
(
this
.
manager
).
setPath
(
resourceDirectory
),
images
,
connections
);
var
materials
=
parseMaterials
(
FBXTree
,
textures
,
connections
);
var
deformers
=
parseDeformers
(
FBXTree
,
connections
);
console
.
log
(
'
deformers
'
,
deformers
);
var
geometryMap
=
parseGeometries
(
FBXTree
,
connections
,
deformers
);
var
sceneGraph
=
parseScene
(
FBXTree
,
connections
,
deformers
.
skeletons
,
geometryMap
,
materials
);
...
...
@@ -595,11 +594,15 @@
}
else
if
(
deformerNode
.
attrType
===
'
BlendShape
'
)
{
var
morphTarget
=
parseMorphTargets
(
relationships
,
deformerNode
,
DeformerNodes
,
connections
,
FBXTree
);
var
morphTarget
=
{
id
:
nodeID
,
};
morphTarget
.
rawTargets
=
parseMorphTargets
(
relationships
,
deformerNode
,
DeformerNodes
,
connections
,
FBXTree
);
morphTarget
.
id
=
nodeID
;
if
(
relationships
.
parents
.
length
>
1
)
console
.
warn
(
'
THREE.FBXLoader: morph target attached to more than one geometry is not supported.
'
);
morphTarget
.
parentID
=
relationships
.
parents
[
0
].
ID
;
morphTarget
.
parent
Geo
ID
=
relationships
.
parents
[
0
].
ID
;
morphTargets
[
nodeID
]
=
morphTarget
;
...
...
@@ -709,7 +712,6 @@
}
// Parse nodes in FBXTree.Objects.Geometry
function
parseGeometries
(
FBXTree
,
connections
,
deformers
)
{
...
...
@@ -719,8 +721,6 @@
var
geometryNodes
=
FBXTree
.
Objects
.
Geometry
;
for
(
var
nodeID
in
geometryNodes
)
{
var
relationships
=
connections
.
get
(
parseInt
(
nodeID
)
);
...
...
@@ -753,7 +753,6 @@
}
// Parse single node mesh geometry in FBXTree.Objects.Geometry
function
parseMeshGeometry
(
FBXTree
,
relationships
,
geometryNode
,
deformers
)
{
...
...
@@ -819,11 +818,47 @@
}
function
addMorphTargets
(
FBXTree
,
parentGeo
,
morphTarget
,
preTransform
)
{
if
(
morphTarget
===
null
)
return
;
parentGeo
.
morphAttributes
.
position
=
[];
parentGeo
.
morphAttributes
.
normal
=
[];
morphTarget
.
rawTargets
.
forEach
(
function
(
rawTarget
,
index
)
{
var
geoNode
=
FBXTree
.
Objects
.
Geometry
[
rawTarget
.
geoID
];
if
(
geoNode
!==
undefined
)
{
genMorphGeometry
(
parentGeo
,
geoNode
,
preTransform
,
index
);
}
}
);
}
// a morph geometry is similar to a normal geometry, and the node is also included
// in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
// and a special attribute Index defining which vertices of the original geometry
// it controls
function
genMorphGeometry
(
parentGeo
,
geoNode
,
preTransform
)
{
var
vertexPositions
=
(
geoNode
.
Vertices
!==
undefined
)
?
geoNode
.
Vertices
.
a
:
[];
var
normalsPositions
=
(
geoNode
.
Normals
!==
undefined
)
?
geoNode
.
Normals
.
a
:
[];
var
indices
=
(
geoNode
.
Indexes
!==
undefined
)
?
geoNode
.
Indexes
.
a
:
[];
}
// Generate a THREE.BufferGeometry from a node in FBXTree.Objects.Geometry
function
genGeometry
(
FBXTree
,
geometryNode
,
skeleton
,
morphTarget
,
preTransform
)
{
function
genGeometry
(
FBXTree
,
geometryNode
,
skeleton
,
morphTarget
,
preTransform
,
calledFrom
)
{
var
geo
=
new
THREE
.
BufferGeometry
();
if
(
geometryNode
.
attrName
)
geo
.
name
=
geometryNode
.
attrName
;
var
vertexPositions
=
geometryNode
.
Vertices
.
a
;
var
vertexIndices
=
geometryNode
.
PolygonVertexIndex
.
a
;
var
vertexPositions
=
(
geometryNode
.
Vertices
!==
undefined
)
?
geometryNode
.
Vertices
.
a
:
[]
;
var
vertexIndices
=
(
geometryNode
.
PolygonVertexIndex
!==
undefined
)
?
geometryNode
.
PolygonVertexIndex
.
a
:
[]
;
// create arrays to hold the final data used to build the buffergeometry
var
vertexBuffer
=
[];
...
...
@@ -1166,9 +1201,6 @@
}
);
var
geo
=
new
THREE
.
BufferGeometry
();
geo
.
name
=
geometryNode
.
name
;
var
positionAttribute
=
new
THREE
.
Float32BufferAttribute
(
vertexBuffer
,
3
);
preTransform
.
applyToBufferAttribute
(
positionAttribute
);
...
...
@@ -1262,11 +1294,12 @@
}
addMorphTargets
(
FBXTree
,
geo
,
morphTarget
,
preTransform
);
return
geo
;
}
// Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
function
getNormals
(
NormalNode
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录