Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
d507705b
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,发现更多精彩内容 >>
提交
d507705b
编写于
9月 23, 2017
作者:
M
Mr.doob
提交者:
GitHub
9月 23, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12256 from looeee/fbxloader_support_cameras
FBXloader: added support for cameras
上级
c09304fd
fb20a407
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
134 addition
and
40 deletion
+134
-40
examples/js/loaders/FBXLoader.js
examples/js/loaders/FBXLoader.js
+134
-40
未找到文件。
examples/js/loaders/FBXLoader.js
浏览文件 @
d507705b
...
...
@@ -1377,76 +1377,98 @@
switch
(
node
.
attrType
)
{
case
'
Mesh
'
:
/**
* @type {?THREE.BufferGeometry}
*/
var
geometry
=
null
;
case
'
Camera
'
:
/* ***********
* Supported light types:
* PerspectiveCamera
* OrthographicCamera
*
* TODO: Support targets via camera.lookAt
************** */
var
cameraAttribute
;
/**
* @type {THREE.MultiMaterial|THREE.Material}
*/
var
material
=
null
;
for
(
var
childrenIndex
=
0
,
childrenLength
=
conns
.
children
.
length
;
childrenIndex
<
childrenLength
;
++
childrenIndex
)
{
/**
* @type {Array.<THREE.Material>}
*/
var
materials
=
[];
var
childID
=
conns
.
children
[
childrenIndex
].
ID
;
for
(
var
childrenIndex
=
0
,
childrenLength
=
conns
.
children
.
length
;
childrenIndex
<
childrenLength
;
++
childrenIndex
)
{
var
attr
=
FBXTree
.
Objects
.
subNodes
.
NodeAttribute
[
childID
];
var
child
=
conns
.
children
[
childrenIndex
];
if
(
attr
!==
undefined
&&
attr
.
properties
!==
undefined
)
{
if
(
geometryMap
.
has
(
child
.
ID
)
)
{
cameraAttribute
=
attr
.
properties
;
geometry
=
geometryMap
.
get
(
child
.
ID
);
}
}
if
(
materialMap
.
has
(
child
.
ID
)
)
{
if
(
cameraAttribute
===
undefined
)
{
materials
.
push
(
materialMap
.
get
(
child
.
ID
)
);
model
=
new
THREE
.
Object3D
(
);
}
}
else
{
var
type
=
0
;
if
(
cameraAttribute
.
CameraProjectionType
!==
undefined
&&
(
cameraAttribute
.
CameraProjectionType
.
value
===
'
1
'
||
cameraAttribute
.
CameraProjectionType
.
value
===
1
)
)
{
type
=
1
;
}
if
(
materials
.
length
>
1
)
{
material
=
materials
;
var
nearClippingPlane
=
1
;
if
(
cameraAttribute
.
NearPlane
!==
undefined
)
{
}
else
if
(
materials
.
length
>
0
)
{
nearClippingPlane
=
cameraAttribute
.
NearPlane
.
value
/
1000
;
material
=
materials
[
0
];
}
}
else
{
var
farClippingPlane
=
1000
;
if
(
cameraAttribute
.
FarPlane
!==
undefined
)
{
material
=
new
THREE
.
MeshStandardMaterial
(
{
color
:
0x3300ff
}
);
materials
.
push
(
material
);
farClippingPlane
=
cameraAttribute
.
FarPlane
.
value
/
1000
;
}
if
(
'
color
'
in
geometry
.
attributes
)
{
for
(
var
materialIndex
=
0
,
numMaterials
=
materials
.
length
;
materialIndex
<
numMaterials
;
++
materialIndex
)
{
materials
[
materialIndex
].
vertexColors
=
THREE
.
VertexColors
;
var
width
=
window
.
innerWidth
;
var
height
=
window
.
innerHeight
;
}
if
(
cameraAttribute
.
AspectWidth
!==
undefined
&&
cameraAttribute
.
AspectHeight
!==
undefined
)
{
width
=
parseFloat
(
cameraAttribute
.
AspectWidth
.
value
);
height
=
parseFloat
(
cameraAttribute
.
AspectHeight
.
value
);
}
if
(
geometry
.
FBX_Deformer
)
{
for
(
var
materialsIndex
=
0
,
materialsLength
=
materials
.
length
;
materialsIndex
<
materialsLength
;
++
materialsIndex
)
{
var
aspect
=
width
/
height
;
materials
[
materialsIndex
].
skinning
=
true
;
var
fov
=
45
;
if
(
cameraAttribute
.
FieldOfView
!==
undefined
)
{
fov
=
parseFloat
(
cameraAttribute
.
FieldOfView
.
value
);
}
model
=
new
THREE
.
SkinnedMesh
(
geometry
,
material
);
}
else
{
switch
(
type
)
{
model
=
new
THREE
.
Mesh
(
geometry
,
material
);
case
'
0
'
:
// Perspective
case
0
:
model
=
new
THREE
.
PerspectiveCamera
(
fov
,
aspect
,
nearClippingPlane
,
farClippingPlane
);
break
;
case
'
1
'
:
// Orthographic
case
1
:
model
=
new
THREE
.
OrthographicCamera
(
-
width
/
2
,
width
/
2
,
height
/
2
,
-
height
/
2
,
nearClippingPlane
,
farClippingPlane
);
break
;
default
:
console
.
warn
(
'
THREE.FBXLoader: Unknown camera type
'
+
type
+
'
.
'
);
model
=
new
THREE
.
Object3D
();
break
;
}
}
break
;
case
'
Light
'
:
...
...
@@ -1589,6 +1611,78 @@
break
;
case
'
Mesh
'
:
/**
* @type {?THREE.BufferGeometry}
*/
var
geometry
=
null
;
/**
* @type {THREE.MultiMaterial|THREE.Material}
*/
var
material
=
null
;
/**
* @type {Array.<THREE.Material>}
*/
var
materials
=
[];
for
(
var
childrenIndex
=
0
,
childrenLength
=
conns
.
children
.
length
;
childrenIndex
<
childrenLength
;
++
childrenIndex
)
{
var
child
=
conns
.
children
[
childrenIndex
];
if
(
geometryMap
.
has
(
child
.
ID
)
)
{
geometry
=
geometryMap
.
get
(
child
.
ID
);
}
if
(
materialMap
.
has
(
child
.
ID
)
)
{
materials
.
push
(
materialMap
.
get
(
child
.
ID
)
);
}
}
if
(
materials
.
length
>
1
)
{
material
=
materials
;
}
else
if
(
materials
.
length
>
0
)
{
material
=
materials
[
0
];
}
else
{
material
=
new
THREE
.
MeshStandardMaterial
(
{
color
:
0x3300ff
}
);
materials
.
push
(
material
);
}
if
(
'
color
'
in
geometry
.
attributes
)
{
for
(
var
materialIndex
=
0
,
numMaterials
=
materials
.
length
;
materialIndex
<
numMaterials
;
++
materialIndex
)
{
materials
[
materialIndex
].
vertexColors
=
THREE
.
VertexColors
;
}
}
if
(
geometry
.
FBX_Deformer
)
{
for
(
var
materialsIndex
=
0
,
materialsLength
=
materials
.
length
;
materialsIndex
<
materialsLength
;
++
materialsIndex
)
{
materials
[
materialsIndex
].
skinning
=
true
;
}
model
=
new
THREE
.
SkinnedMesh
(
geometry
,
material
);
}
else
{
model
=
new
THREE
.
Mesh
(
geometry
,
material
);
}
break
;
case
'
NurbsCurve
'
:
var
geometry
=
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录