Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
79321a61
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,发现更多精彩内容 >>
提交
79321a61
编写于
3月 26, 2017
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FBXLoader2: Performance optimisations and clean up.
上级
461a9574
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
28 addition
and
39 deletion
+28
-39
examples/js/loaders/FBXLoader2.js
examples/js/loaders/FBXLoader2.js
+28
-39
未找到文件。
examples/js/loaders/FBXLoader2.js
浏览文件 @
79321a61
...
...
@@ -633,6 +633,7 @@
var
currentWeight
=
weight
;
var
currentIndex
=
weightIndices
[
weightIndex
];
Weight
.
forEach
(
function
(
comparedWeight
,
comparedWeightIndex
,
comparedWeightArray
)
{
if
(
currentWeight
>
comparedWeight
)
{
...
...
@@ -738,15 +739,19 @@
}
// Convert the material indices of each vertex into rendering groups on the geometry.
var
prevMaterialIndex
=
bufferInfo
.
materialIndexBuffer
[
0
];
var
materialIndexBuffer
=
bufferInfo
.
materialIndexBuffer
;
var
prevMaterialIndex
=
materialIndexBuffer
[
0
];
var
startIndex
=
0
;
for
(
var
materialBufferIndex
=
0
;
materialBufferIndex
<
bufferInfo
.
materialIndexBuffer
.
length
;
++
materialBufferIndex
)
{
if
(
bufferInfo
.
materialIndexBuffer
[
materialBufferIndex
]
!==
prevMaterialIndex
)
{
for
(
var
i
=
0
;
i
<
materialIndexBuffer
.
length
;
++
i
)
{
if
(
materialIndexBuffer
[
i
]
!==
prevMaterialIndex
)
{
geo
.
addGroup
(
startIndex
,
i
-
startIndex
,
prevMaterialIndex
);
geo
.
addGroup
(
startIndex
,
materialBufferIndex
-
startIndex
,
prevMaterialIndex
);
startIndex
=
materialBufferIndex
;
prevMaterialIndex
=
bufferInfo
.
materialIndexBuffer
[
materialBufferIndex
];
prevMaterialIndex
=
materialIndexBuffer
[
i
];
startIndex
=
i
;
}
...
...
@@ -2518,11 +2523,7 @@
version
:
null
,
id
:
animationCurve
.
id
,
internalID
:
animationCurve
.
id
,
times
:
parseFloatArray
(
animationCurve
.
subNodes
.
KeyTime
.
properties
.
a
).
map
(
function
(
time
)
{
return
ConvertFBXTimeToSeconds
(
time
);
}
),
times
:
parseFloatArray
(
animationCurve
.
subNodes
.
KeyTime
.
properties
.
a
).
map
(
convertFBXTimeToSeconds
),
values
:
parseFloatArray
(
animationCurve
.
subNodes
.
KeyValueFloat
.
properties
.
a
),
attrFlag
:
parseIntArray
(
animationCurve
.
subNodes
.
KeyAttrFlags
.
properties
.
a
),
...
...
@@ -3038,7 +3039,7 @@
}
var
AXES
=
[
'
x
'
,
'
y
'
,
'
z
'
];
function
hasCurve
(
animationNode
,
attribute
)
{
...
...
@@ -3049,13 +3050,14 @@
}
var
attributeNode
=
animationNode
[
attribute
];
if
(
!
attributeNode
)
{
return
false
;
}
return
[
'
x
'
,
'
y
'
,
'
z
'
]
.
every
(
function
(
key
)
{
return
AXES
.
every
(
function
(
key
)
{
return
attributeNode
.
curves
[
key
]
!==
null
;
...
...
@@ -3065,17 +3067,17 @@
function
hasKeyOnFrame
(
attributeNode
,
frame
)
{
return
[
'
x
'
,
'
y
'
,
'
z
'
]
.
every
(
function
(
key
)
{
return
AXES
.
every
(
function
(
key
)
{
return
isKeyExistOnFrame
(
attributeNode
.
curves
[
key
],
frame
);
function
isKeyExistOnFrame
(
curve
,
frame
)
{
return
curve
.
values
[
frame
]
!==
undefined
;
}
);
}
}
);
function
isKeyExistOnFrame
(
curve
,
frame
)
{
return
curve
.
values
[
frame
]
!==
undefined
;
}
...
...
@@ -3672,8 +3674,7 @@
case
"
ColorRGB
"
:
case
"
Vector3D
"
:
var
tmp
=
innerPropValue
.
split
(
'
,
'
);
innerPropValue
=
new
THREE
.
Vector3
(
tmp
[
0
],
tmp
[
1
],
tmp
[
2
]
);
innerPropValue
=
new
THREE
.
Vector3
().
fromArray
(
innerPropValue
.
split
(
'
,
'
).
map
(
parseFloatMap
)
);
break
;
}
...
...
@@ -3907,7 +3908,7 @@
* @param {number} time - FBX tick timestamp to convert.
* @returns {number} - FBX tick in real world time.
*/
function
C
onvertFBXTimeToSeconds
(
time
)
{
function
c
onvertFBXTimeToSeconds
(
time
)
{
// Constant is FBX ticks per second.
return
time
/
46186158000
;
...
...
@@ -3923,17 +3924,11 @@
*/
function
parseFloatArray
(
string
)
{
var
array
=
string
.
split
(
'
,
'
);
for
(
var
i
=
0
,
l
=
array
.
length
;
i
<
l
;
i
++
)
{
array
[
i
]
=
parseFloat
(
array
[
i
]
);
return
string
.
split
(
'
,
'
).
map
(
parseFloatMap
);
}
return
array
;
}
function
parseFloatMap
(
string
)
{
return
parseFloat
(
string
);
}
/**
* Parses comma separated list of int numbers and returns them in an array.
...
...
@@ -3944,17 +3939,11 @@
*/
function
parseIntArray
(
string
)
{
var
array
=
string
.
split
(
'
,
'
);
for
(
var
i
=
0
,
l
=
array
.
length
;
i
<
l
;
i
++
)
{
array
[
i
]
=
parseInt
(
array
[
i
]
);
return
string
.
split
(
'
,
'
).
map
(
parseIntMap
);
}
return
array
;
}
function
parseIntMap
(
string
)
{
return
parseInt
(
string
);
}
/**
* Parses Vector3 property from FBXTree. Property is given as .value.x, .value.y, etc.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录