Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
7ebd5141
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,发现更多精彩内容 >>
提交
7ebd5141
编写于
8月 13, 2017
作者:
T
Takahiro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support embedded base64 texture image data in FBX ascii file
上级
7c40f1c6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
14 deletion
+36
-14
examples/js/loaders/FBXLoader.js
examples/js/loaders/FBXLoader.js
+36
-14
未找到文件。
examples/js/loaders/FBXLoader.js
浏览文件 @
7ebd5141
...
...
@@ -185,12 +185,12 @@
/**
* Parses map of images referenced in FBXTree.
* @param {{Objects: {subNodes: {Texture: Object.<string, FBXTextureNode>}}}} FBXTree
* @returns {Map<number, string(image blob URL)>}
* @returns {Map<number, string(image blob
/data
URL)>}
*/
function
parseImages
(
FBXTree
)
{
/**
* @type {Map<number, string(image blob URL)>}
* @type {Map<number, string(image blob
/data
URL)>}
*/
var
imageMap
=
new
Map
();
...
...
@@ -220,12 +220,11 @@
/**
* @param {videoNode} videoNode - Node to get texture image information from.
* @returns {string} - image blob URL
* @returns {string} - image blob
/data
URL
*/
function
parseImage
(
videoNode
)
{
var
buffer
=
videoNode
.
properties
.
Content
;
var
array
=
new
Uint8Array
(
buffer
);
var
content
=
videoNode
.
properties
.
Content
;
var
fileName
=
videoNode
.
properties
.
RelativeFilename
||
videoNode
.
properties
.
Filename
;
var
extension
=
fileName
.
slice
(
fileName
.
lastIndexOf
(
'
.
'
)
+
1
).
toLowerCase
();
...
...
@@ -260,7 +259,16 @@
}
return
window
.
URL
.
createObjectURL
(
new
Blob
(
[
array
],
{
type
:
type
}
)
);
if
(
typeof
content
===
'
string
'
)
{
return
'
data:
'
+
type
+
'
;base64,
'
+
content
;
}
else
{
var
array
=
new
Uint8Array
(
content
);
return
window
.
URL
.
createObjectURL
(
new
Blob
(
[
array
],
{
type
:
type
}
)
);
}
}
...
...
@@ -268,7 +276,7 @@
* Parses map of textures referenced in FBXTree.
* @param {{Objects: {subNodes: {Texture: Object.<string, FBXTextureNode>}}}} FBXTree
* @param {THREE.TextureLoader} loader
* @param {Map<number, string(image blob URL)>} imageMap
* @param {Map<number, string(image blob
/data
URL)>} imageMap
* @param {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>} connections
* @returns {Map<number, THREE.Texture>}
*/
...
...
@@ -298,7 +306,7 @@
/**
* @param {textureNode} textureNode - Node to get texture information from.
* @param {THREE.TextureLoader} loader
* @param {Map<number, string(image blob URL)>} imageMap
* @param {Map<number, string(image blob
/data
URL)>} imageMap
* @param {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>} connections
* @returns {THREE.Texture}
*/
...
...
@@ -345,7 +353,7 @@
var
currentPath
=
loader
.
path
;
if
(
fileName
.
indexOf
(
'
blob:
'
)
===
0
)
{
if
(
fileName
.
indexOf
(
'
blob:
'
)
===
0
||
fileName
.
indexOf
(
'
data:
'
)
===
0
)
{
loader
.
setPath
(
undefined
);
...
...
@@ -3619,25 +3627,28 @@
var
split
=
text
.
split
(
'
\n
'
);
for
(
var
line
in
split
)
{
for
(
var
line
Num
=
0
,
lineLength
=
split
.
length
;
lineNum
<
lineLength
;
lineNum
++
)
{
var
l
=
split
[
line
];
var
l
=
split
[
line
Num
];
// s
hort cut
// s
kip comment line
if
(
l
.
match
(
/^
[\s\t]
*;/
)
)
{
continue
;
}
// skip comment line
}
// skip empty line
if
(
l
.
match
(
/^
[\s\t]
*$/
)
)
{
continue
;
}
// skip empty line
}
// beginning of node
var
beginningOfNodeExp
=
new
RegExp
(
'
^
\\
t{
'
+
this
.
currentIndent
+
'
}(
\\
w+):(.*){
'
,
''
);
var
match
=
l
.
match
(
beginningOfNodeExp
);
if
(
match
)
{
var
nodeName
=
match
[
1
].
trim
().
replace
(
/^"/
,
''
).
replace
(
/"$/
,
''
);
...
...
@@ -3655,11 +3666,21 @@
// node's property
var
propExp
=
new
RegExp
(
'
^
\\
t{
'
+
(
this
.
currentIndent
)
+
'
}(
\\
w+):[
\\
s
\\
t
\\
r
\\
n](.*)
'
);
var
match
=
l
.
match
(
propExp
);
if
(
match
)
{
var
propName
=
match
[
1
].
replace
(
/^"/
,
''
).
replace
(
/"$/
,
''
).
trim
();
var
propValue
=
match
[
2
].
replace
(
/^"/
,
''
).
replace
(
/"$/
,
''
).
trim
();
// for special case: base64 image data follows "Content: ," line
// Content: ,
// "iVB..."
if
(
propName
===
'
Content
'
&&
propValue
===
'
,
'
)
{
propValue
=
split
[
++
lineNum
].
replace
(
/"/g
,
''
).
trim
();
}
this
.
parseNodeProperty
(
l
,
propName
,
propValue
);
continue
;
...
...
@@ -3667,6 +3688,7 @@
// end of node
var
endOfNodeExp
=
new
RegExp
(
'
^
\\
t{
'
+
(
this
.
currentIndent
-
1
)
+
'
}}
'
);
if
(
l
.
match
(
endOfNodeExp
)
)
{
this
.
nodeEnd
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录