Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
1ffaa41a
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,发现更多精彩内容 >>
未验证
提交
1ffaa41a
编写于
8月 01, 2018
作者:
M
Mr.doob
提交者:
GitHub
8月 01, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14607 from gavrilovmiroslav/dev
FBXTree overshadowing
上级
f3017972
f2076124
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
38 deletion
+37
-38
examples/js/loaders/FBXLoader.js
examples/js/loaders/FBXLoader.js
+37
-38
未找到文件。
examples/js/loaders/FBXLoader.js
浏览文件 @
1ffaa41a
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
THREE
.
FBXLoader
=
(
function
()
{
THREE
.
FBXLoader
=
(
function
()
{
var
FBX
Tree
;
var
fbx
Tree
;
var
connections
;
var
connections
;
var
sceneGraph
;
var
sceneGraph
;
...
@@ -38,7 +38,6 @@ THREE.FBXLoader = ( function () {
...
@@ -38,7 +38,6 @@ THREE.FBXLoader = ( function () {
crossOrigin
:
'
anonymous
'
,
crossOrigin
:
'
anonymous
'
,
load
:
function
(
url
,
onLoad
,
onProgress
,
onError
)
{
load
:
function
(
url
,
onLoad
,
onProgress
,
onError
)
{
var
self
=
this
;
var
self
=
this
;
var
resourceDirectory
=
THREE
.
LoaderUtils
.
extractUrlBase
(
url
);
var
resourceDirectory
=
THREE
.
LoaderUtils
.
extractUrlBase
(
url
);
...
@@ -65,7 +64,6 @@ THREE.FBXLoader = ( function () {
...
@@ -65,7 +64,6 @@ THREE.FBXLoader = ( function () {
}
}
},
onProgress
,
onError
);
},
onProgress
,
onError
);
},
},
setCrossOrigin
:
function
(
value
)
{
setCrossOrigin
:
function
(
value
)
{
...
@@ -79,7 +77,7 @@ THREE.FBXLoader = ( function () {
...
@@ -79,7 +77,7 @@ THREE.FBXLoader = ( function () {
if
(
isFbxFormatBinary
(
FBXBuffer
)
)
{
if
(
isFbxFormatBinary
(
FBXBuffer
)
)
{
FBX
Tree
=
new
BinaryParser
().
parse
(
FBXBuffer
);
fbx
Tree
=
new
BinaryParser
().
parse
(
FBXBuffer
);
}
else
{
}
else
{
...
@@ -97,7 +95,7 @@ THREE.FBXLoader = ( function () {
...
@@ -97,7 +95,7 @@ THREE.FBXLoader = ( function () {
}
}
FBX
Tree
=
new
TextParser
().
parse
(
FBXText
);
fbx
Tree
=
new
TextParser
().
parse
(
FBXText
);
}
}
...
@@ -105,7 +103,7 @@ THREE.FBXLoader = ( function () {
...
@@ -105,7 +103,7 @@ THREE.FBXLoader = ( function () {
var
textureLoader
=
new
THREE
.
TextureLoader
(
this
.
manager
).
setPath
(
resourceDirectory
).
setCrossOrigin
(
this
.
crossOrigin
);
var
textureLoader
=
new
THREE
.
TextureLoader
(
this
.
manager
).
setPath
(
resourceDirectory
).
setCrossOrigin
(
this
.
crossOrigin
);
return
new
FBXTreeParser
(
textureLoader
).
parse
(
FBX
Tree
);
return
new
FBXTreeParser
(
textureLoader
).
parse
(
fbx
Tree
);
}
}
...
@@ -144,9 +142,9 @@ THREE.FBXLoader = ( function () {
...
@@ -144,9 +142,9 @@ THREE.FBXLoader = ( function () {
var
connectionMap
=
new
Map
();
var
connectionMap
=
new
Map
();
if
(
'
Connections
'
in
FBX
Tree
)
{
if
(
'
Connections
'
in
fbx
Tree
)
{
var
rawConnections
=
FBX
Tree
.
Connections
.
connections
;
var
rawConnections
=
fbx
Tree
.
Connections
.
connections
;
rawConnections
.
forEach
(
function
(
rawConnection
)
{
rawConnections
.
forEach
(
function
(
rawConnection
)
{
...
@@ -194,9 +192,9 @@ THREE.FBXLoader = ( function () {
...
@@ -194,9 +192,9 @@ THREE.FBXLoader = ( function () {
var
images
=
{};
var
images
=
{};
var
blobs
=
{};
var
blobs
=
{};
if
(
'
Video
'
in
FBX
Tree
.
Objects
)
{
if
(
'
Video
'
in
fbx
Tree
.
Objects
)
{
var
videoNodes
=
FBX
Tree
.
Objects
.
Video
;
var
videoNodes
=
fbx
Tree
.
Objects
.
Video
;
for
(
var
nodeID
in
videoNodes
)
{
for
(
var
nodeID
in
videoNodes
)
{
...
@@ -318,9 +316,9 @@ THREE.FBXLoader = ( function () {
...
@@ -318,9 +316,9 @@ THREE.FBXLoader = ( function () {
var
textureMap
=
new
Map
();
var
textureMap
=
new
Map
();
if
(
'
Texture
'
in
FBX
Tree
.
Objects
)
{
if
(
'
Texture
'
in
fbx
Tree
.
Objects
)
{
var
textureNodes
=
FBX
Tree
.
Objects
.
Texture
;
var
textureNodes
=
fbx
Tree
.
Objects
.
Texture
;
for
(
var
nodeID
in
textureNodes
)
{
for
(
var
nodeID
in
textureNodes
)
{
var
texture
=
this
.
parseTexture
(
textureNodes
[
nodeID
],
images
);
var
texture
=
this
.
parseTexture
(
textureNodes
[
nodeID
],
images
);
...
@@ -412,9 +410,9 @@ THREE.FBXLoader = ( function () {
...
@@ -412,9 +410,9 @@ THREE.FBXLoader = ( function () {
var
materialMap
=
new
Map
();
var
materialMap
=
new
Map
();
if
(
'
Material
'
in
FBX
Tree
.
Objects
)
{
if
(
'
Material
'
in
fbx
Tree
.
Objects
)
{
var
materialNodes
=
FBX
Tree
.
Objects
.
Material
;
var
materialNodes
=
fbx
Tree
.
Objects
.
Material
;
for
(
var
nodeID
in
materialNodes
)
{
for
(
var
nodeID
in
materialNodes
)
{
...
@@ -609,7 +607,7 @@ THREE.FBXLoader = ( function () {
...
@@ -609,7 +607,7 @@ THREE.FBXLoader = ( function () {
getTexture
:
function
(
textureMap
,
id
)
{
getTexture
:
function
(
textureMap
,
id
)
{
// if the texture is a layered texture, just use the first layer and issue a warning
// if the texture is a layered texture, just use the first layer and issue a warning
if
(
'
LayeredTexture
'
in
FBXTree
.
Objects
&&
id
in
FBX
Tree
.
Objects
.
LayeredTexture
)
{
if
(
'
LayeredTexture
'
in
fbxTree
.
Objects
&&
id
in
fbx
Tree
.
Objects
.
LayeredTexture
)
{
console
.
warn
(
'
THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.
'
);
console
.
warn
(
'
THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.
'
);
id
=
connections
.
get
(
id
).
children
[
0
].
ID
;
id
=
connections
.
get
(
id
).
children
[
0
].
ID
;
...
@@ -628,9 +626,9 @@ THREE.FBXLoader = ( function () {
...
@@ -628,9 +626,9 @@ THREE.FBXLoader = ( function () {
var
skeletons
=
{};
var
skeletons
=
{};
var
morphTargets
=
{};
var
morphTargets
=
{};
if
(
'
Deformer
'
in
FBX
Tree
.
Objects
)
{
if
(
'
Deformer
'
in
fbx
Tree
.
Objects
)
{
var
DeformerNodes
=
FBX
Tree
.
Objects
.
Deformer
;
var
DeformerNodes
=
fbx
Tree
.
Objects
.
Deformer
;
for
(
var
nodeID
in
DeformerNodes
)
{
for
(
var
nodeID
in
DeformerNodes
)
{
...
@@ -773,7 +771,7 @@ THREE.FBXLoader = ( function () {
...
@@ -773,7 +771,7 @@ THREE.FBXLoader = ( function () {
var
modelMap
=
this
.
parseModels
(
deformers
.
skeletons
,
geometryMap
,
materialMap
);
var
modelMap
=
this
.
parseModels
(
deformers
.
skeletons
,
geometryMap
,
materialMap
);
var
modelNodes
=
FBX
Tree
.
Objects
.
Model
;
var
modelNodes
=
fbx
Tree
.
Objects
.
Model
;
var
self
=
this
;
var
self
=
this
;
modelMap
.
forEach
(
function
(
model
)
{
modelMap
.
forEach
(
function
(
model
)
{
...
@@ -823,7 +821,7 @@ THREE.FBXLoader = ( function () {
...
@@ -823,7 +821,7 @@ THREE.FBXLoader = ( function () {
parseModels
:
function
(
skeletons
,
geometryMap
,
materialMap
)
{
parseModels
:
function
(
skeletons
,
geometryMap
,
materialMap
)
{
var
modelMap
=
new
Map
();
var
modelMap
=
new
Map
();
var
modelNodes
=
FBX
Tree
.
Objects
.
Model
;
var
modelNodes
=
fbx
Tree
.
Objects
.
Model
;
for
(
var
nodeID
in
modelNodes
)
{
for
(
var
nodeID
in
modelNodes
)
{
...
@@ -923,7 +921,7 @@ THREE.FBXLoader = ( function () {
...
@@ -923,7 +921,7 @@ THREE.FBXLoader = ( function () {
relationships
.
children
.
forEach
(
function
(
child
)
{
relationships
.
children
.
forEach
(
function
(
child
)
{
var
attr
=
FBX
Tree
.
Objects
.
NodeAttribute
[
child
.
ID
];
var
attr
=
fbx
Tree
.
Objects
.
NodeAttribute
[
child
.
ID
];
if
(
attr
!==
undefined
)
{
if
(
attr
!==
undefined
)
{
...
@@ -1014,7 +1012,7 @@ THREE.FBXLoader = ( function () {
...
@@ -1014,7 +1012,7 @@ THREE.FBXLoader = ( function () {
relationships
.
children
.
forEach
(
function
(
child
)
{
relationships
.
children
.
forEach
(
function
(
child
)
{
var
attr
=
FBX
Tree
.
Objects
.
NodeAttribute
[
child
.
ID
];
var
attr
=
fbx
Tree
.
Objects
.
NodeAttribute
[
child
.
ID
];
if
(
attr
!==
undefined
)
{
if
(
attr
!==
undefined
)
{
...
@@ -1244,7 +1242,7 @@ THREE.FBXLoader = ( function () {
...
@@ -1244,7 +1242,7 @@ THREE.FBXLoader = ( function () {
if
(
child
.
relationship
===
'
LookAtProperty
'
)
{
if
(
child
.
relationship
===
'
LookAtProperty
'
)
{
var
lookAtTarget
=
FBX
Tree
.
Objects
.
Model
[
child
.
ID
];
var
lookAtTarget
=
fbx
Tree
.
Objects
.
Model
[
child
.
ID
];
if
(
'
Lcl_Translation
'
in
lookAtTarget
)
{
if
(
'
Lcl_Translation
'
in
lookAtTarget
)
{
...
@@ -1313,9 +1311,9 @@ THREE.FBXLoader = ( function () {
...
@@ -1313,9 +1311,9 @@ THREE.FBXLoader = ( function () {
var
bindMatrices
=
{};
var
bindMatrices
=
{};
if
(
'
Pose
'
in
FBX
Tree
.
Objects
)
{
if
(
'
Pose
'
in
fbx
Tree
.
Objects
)
{
var
BindPoseNode
=
FBX
Tree
.
Objects
.
Pose
;
var
BindPoseNode
=
fbx
Tree
.
Objects
.
Pose
;
for
(
var
nodeID
in
BindPoseNode
)
{
for
(
var
nodeID
in
BindPoseNode
)
{
...
@@ -1350,9 +1348,9 @@ THREE.FBXLoader = ( function () {
...
@@ -1350,9 +1348,9 @@ THREE.FBXLoader = ( function () {
// Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light
// Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light
createAmbientLight
:
function
()
{
createAmbientLight
:
function
()
{
if
(
'
GlobalSettings
'
in
FBXTree
&&
'
AmbientColor
'
in
FBX
Tree
.
GlobalSettings
)
{
if
(
'
GlobalSettings
'
in
fbxTree
&&
'
AmbientColor
'
in
fbx
Tree
.
GlobalSettings
)
{
var
ambientColor
=
FBX
Tree
.
GlobalSettings
.
AmbientColor
.
value
;
var
ambientColor
=
fbx
Tree
.
GlobalSettings
.
AmbientColor
.
value
;
var
r
=
ambientColor
[
0
];
var
r
=
ambientColor
[
0
];
var
g
=
ambientColor
[
1
];
var
g
=
ambientColor
[
1
];
var
b
=
ambientColor
[
2
];
var
b
=
ambientColor
[
2
];
...
@@ -1418,9 +1416,9 @@ THREE.FBXLoader = ( function () {
...
@@ -1418,9 +1416,9 @@ THREE.FBXLoader = ( function () {
var
geometryMap
=
new
Map
();
var
geometryMap
=
new
Map
();
if
(
'
Geometry
'
in
FBX
Tree
.
Objects
)
{
if
(
'
Geometry
'
in
fbx
Tree
.
Objects
)
{
var
geoNodes
=
FBX
Tree
.
Objects
.
Geometry
;
var
geoNodes
=
fbx
Tree
.
Objects
.
Geometry
;
for
(
var
nodeID
in
geoNodes
)
{
for
(
var
nodeID
in
geoNodes
)
{
...
@@ -1462,7 +1460,7 @@ THREE.FBXLoader = ( function () {
...
@@ -1462,7 +1460,7 @@ THREE.FBXLoader = ( function () {
var
modelNodes
=
relationships
.
parents
.
map
(
function
(
parent
)
{
var
modelNodes
=
relationships
.
parents
.
map
(
function
(
parent
)
{
return
FBX
Tree
.
Objects
.
Model
[
parent
.
ID
];
return
fbx
Tree
.
Objects
.
Model
[
parent
.
ID
];
}
);
}
);
...
@@ -1990,7 +1988,7 @@ THREE.FBXLoader = ( function () {
...
@@ -1990,7 +1988,7 @@ THREE.FBXLoader = ( function () {
var
self
=
this
;
var
self
=
this
;
morphTarget
.
rawTargets
.
forEach
(
function
(
rawTarget
)
{
morphTarget
.
rawTargets
.
forEach
(
function
(
rawTarget
)
{
var
morphGeoNode
=
FBX
Tree
.
Objects
.
Geometry
[
rawTarget
.
geoID
];
var
morphGeoNode
=
fbx
Tree
.
Objects
.
Geometry
[
rawTarget
.
geoID
];
if
(
morphGeoNode
!==
undefined
)
{
if
(
morphGeoNode
!==
undefined
)
{
...
@@ -2271,7 +2269,7 @@ THREE.FBXLoader = ( function () {
...
@@ -2271,7 +2269,7 @@ THREE.FBXLoader = ( function () {
// since the actual transformation data is stored in FBXTree.Objects.AnimationCurve,
// since the actual transformation data is stored in FBXTree.Objects.AnimationCurve,
// if this is undefined we can safely assume there are no animations
// if this is undefined we can safely assume there are no animations
if
(
FBX
Tree
.
Objects
.
AnimationCurve
===
undefined
)
return
undefined
;
if
(
fbx
Tree
.
Objects
.
AnimationCurve
===
undefined
)
return
undefined
;
var
curveNodesMap
=
this
.
parseAnimationCurveNodes
();
var
curveNodesMap
=
this
.
parseAnimationCurveNodes
();
...
@@ -2289,7 +2287,7 @@ THREE.FBXLoader = ( function () {
...
@@ -2289,7 +2287,7 @@ THREE.FBXLoader = ( function () {
// and is referenced by an AnimationLayer
// and is referenced by an AnimationLayer
parseAnimationCurveNodes
:
function
()
{
parseAnimationCurveNodes
:
function
()
{
var
rawCurveNodes
=
FBX
Tree
.
Objects
.
AnimationCurveNode
;
var
rawCurveNodes
=
fbx
Tree
.
Objects
.
AnimationCurveNode
;
var
curveNodesMap
=
new
Map
();
var
curveNodesMap
=
new
Map
();
...
@@ -2322,7 +2320,7 @@ THREE.FBXLoader = ( function () {
...
@@ -2322,7 +2320,7 @@ THREE.FBXLoader = ( function () {
// axis ( e.g. times and values of x rotation)
// axis ( e.g. times and values of x rotation)
parseAnimationCurves
:
function
(
curveNodesMap
)
{
parseAnimationCurves
:
function
(
curveNodesMap
)
{
var
rawCurves
=
FBX
Tree
.
Objects
.
AnimationCurve
;
var
rawCurves
=
fbx
Tree
.
Objects
.
AnimationCurve
;
// TODO: Many values are identical up to roundoff error, but won't be optimised
// TODO: Many values are identical up to roundoff error, but won't be optimised
// e.g. position times: [0, 0.4, 0. 8]
// e.g. position times: [0, 0.4, 0. 8]
...
@@ -2377,7 +2375,7 @@ THREE.FBXLoader = ( function () {
...
@@ -2377,7 +2375,7 @@ THREE.FBXLoader = ( function () {
// note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
// note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
parseAnimationLayers
:
function
(
curveNodesMap
)
{
parseAnimationLayers
:
function
(
curveNodesMap
)
{
var
rawLayers
=
FBX
Tree
.
Objects
.
AnimationLayer
;
var
rawLayers
=
fbx
Tree
.
Objects
.
AnimationLayer
;
var
layersMap
=
new
Map
();
var
layersMap
=
new
Map
();
...
@@ -2412,7 +2410,7 @@ THREE.FBXLoader = ( function () {
...
@@ -2412,7 +2410,7 @@ THREE.FBXLoader = ( function () {
}
);
}
);
var
rawModel
=
FBX
Tree
.
Objects
.
Model
[
modelID
.
toString
()
];
var
rawModel
=
fbx
Tree
.
Objects
.
Model
[
modelID
.
toString
()
];
var
node
=
{
var
node
=
{
...
@@ -2453,12 +2451,12 @@ THREE.FBXLoader = ( function () {
...
@@ -2453,12 +2451,12 @@ THREE.FBXLoader = ( function () {
// assuming geometry is not used in more than one model
// assuming geometry is not used in more than one model
var
modelID
=
connections
.
get
(
geoID
).
parents
[
0
].
ID
;
var
modelID
=
connections
.
get
(
geoID
).
parents
[
0
].
ID
;
var
rawModel
=
FBX
Tree
.
Objects
.
Model
[
modelID
];
var
rawModel
=
fbx
Tree
.
Objects
.
Model
[
modelID
];
var
node
=
{
var
node
=
{
modelName
:
THREE
.
PropertyBinding
.
sanitizeNodeName
(
rawModel
.
attrName
),
modelName
:
THREE
.
PropertyBinding
.
sanitizeNodeName
(
rawModel
.
attrName
),
morphName
:
FBX
Tree
.
Objects
.
Deformer
[
deformerID
].
attrName
,
morphName
:
fbx
Tree
.
Objects
.
Deformer
[
deformerID
].
attrName
,
};
};
...
@@ -2508,7 +2506,7 @@ THREE.FBXLoader = ( function () {
...
@@ -2508,7 +2506,7 @@ THREE.FBXLoader = ( function () {
// hierarchy. Each Stack node will be used to create a THREE.AnimationClip
// hierarchy. Each Stack node will be used to create a THREE.AnimationClip
parseAnimStacks
:
function
(
layersMap
)
{
parseAnimStacks
:
function
(
layersMap
)
{
var
rawStacks
=
FBX
Tree
.
Objects
.
AnimationStack
;
var
rawStacks
=
fbx
Tree
.
Objects
.
AnimationStack
;
// connect the stacks (clips) up to the layers
// connect the stacks (clips) up to the layers
var
rawClips
=
{};
var
rawClips
=
{};
...
@@ -2874,6 +2872,7 @@ THREE.FBXLoader = ( function () {
...
@@ -2874,6 +2872,7 @@ THREE.FBXLoader = ( function () {
parse
:
function
(
text
)
{
parse
:
function
(
text
)
{
this
.
currentIndent
=
0
;
this
.
currentIndent
=
0
;
console
.
log
(
"
FBXTree:
"
,
FBXTree
);
this
.
allNodes
=
new
FBXTree
();
this
.
allNodes
=
new
FBXTree
();
this
.
nodeStack
=
[];
this
.
nodeStack
=
[];
this
.
currentProp
=
[];
this
.
currentProp
=
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录