Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
3116de8c
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,发现更多精彩内容 >>
提交
3116de8c
编写于
9月 19, 2018
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JSONLoader: Add setPath(), rename setTexturePath() to setResourcePath()
上级
eb6ef2e3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
17 deletion
+41
-17
docs/api/en/loaders/JSONLoader.html
docs/api/en/loaders/JSONLoader.html
+12
-8
editor/js/Loader.js
editor/js/Loader.js
+1
-1
src/Three.Legacy.js
src/Three.Legacy.js
+12
-0
src/loaders/JSONLoader.js
src/loaders/JSONLoader.js
+16
-8
未找到文件。
docs/api/en/loaders/JSONLoader.html
浏览文件 @
3116de8c
...
...
@@ -93,23 +93,27 @@
Begin loading from url and pass the
<em>
JSON
</em>
to onLoad.
</p>
<h3>
[method:Object3D parse]( [param:Object json], [param:String path] )
</h3>
<p>
[page:String json] — JSON object to parse.
<br
/>
[page:String path] — Base path for resources if no resource path is defined.
<br
/><br
/>
Parse a
<em>
JSON
</em>
structure and return an [page:object] containing the parsed [page:Geometry geometry] and [page:Array materials].
</p>
<h3>
[method:JSONLoader setCrossOrigin]( [param:String value] )
</h3>
<p>
Set the [page:.crossOrigin] attribute.
</p>
<h3>
[method:JSONLoader set
TexturePath]( [param:String texturePath
] )
</h3>
<h3>
[method:JSONLoader set
Path]( [param:String value
] )
</h3>
<p>
Set the base path or URL from which to load files. This can be useful if
you are loading many files from the same directory.
Set the base path for the original file.
</p>
<h3>
[method:
Object3D parse]( [param:Object json], [param:String texturePath
] )
</h3>
<h3>
[method:
JSONLoader setResourcePath]( [param:String value
] )
</h3>
<p>
[page:String json] — JSON object to parse.
<br
/>
[page:String texturePath] — Base path for textures.
<br
/><br
/>
Parse a
<em>
JSON
</em>
structure and return an [page:object] containing the parsed [page:Geometry geometry] and [page:Array materials].
Set the base path for dependent resources like textures.
</p>
<h2>
Source
</h2>
...
...
editor/js/Loader.js
浏览文件 @
3116de8c
...
...
@@ -577,7 +577,7 @@ var Loader = function ( editor ) {
case
'
geometry
'
:
var
loader
=
new
THREE
.
JSONLoader
();
loader
.
set
Textur
ePath
(
scope
.
texturePath
);
loader
.
set
Resourc
ePath
(
scope
.
texturePath
);
var
result
=
loader
.
parse
(
data
);
...
...
src/Three.Legacy.js
浏览文件 @
3116de8c
...
...
@@ -44,6 +44,7 @@ import { FileLoader } from './loaders/FileLoader.js';
import
{
AudioLoader
}
from
'
./loaders/AudioLoader.js
'
;
import
{
CubeTextureLoader
}
from
'
./loaders/CubeTextureLoader.js
'
;
import
{
DataTextureLoader
}
from
'
./loaders/DataTextureLoader.js
'
;
import
{
JSONLoader
}
from
'
./loaders/JSONLoader.js
'
;
import
{
TextureLoader
}
from
'
./loaders/TextureLoader.js
'
;
import
{
Material
}
from
'
./materials/Material.js
'
;
import
{
LineBasicMaterial
}
from
'
./materials/LineBasicMaterial.js
'
;
...
...
@@ -435,6 +436,17 @@ export function BinaryTextureLoader( manager ) {
}
Object
.
assign
(
JSONLoader
.
prototype
,
{
setTexturePath
:
function
(
value
)
{
console
.
warn
(
'
THREE.JSONLoader: .setTexturePath() has been renamed to .setResourcePath().
'
);
return
this
.
setResourcePath
(
value
);
}
}
);
//
Object
.
assign
(
Box2
.
prototype
,
{
...
...
src/loaders/JSONLoader.js
浏览文件 @
3116de8c
...
...
@@ -38,9 +38,10 @@ Object.assign( JSONLoader.prototype, {
var
scope
=
this
;
var
texturePath
=
this
.
texturePath
&&
(
typeof
this
.
texturePath
===
'
string
'
)
?
this
.
texturePath
:
LoaderUtils
.
extractUrlBase
(
url
)
;
var
path
=
(
this
.
path
===
undefined
)
?
LoaderUtils
.
extractUrlBase
(
url
)
:
this
.
path
;
var
loader
=
new
FileLoader
(
this
.
manager
);
loader
.
setPath
(
this
.
path
);
loader
.
setWithCredentials
(
this
.
withCredentials
);
loader
.
load
(
url
,
function
(
text
)
{
...
...
@@ -64,23 +65,30 @@ Object.assign( JSONLoader.prototype, {
}
var
object
=
scope
.
parse
(
json
,
textureP
ath
);
var
object
=
scope
.
parse
(
json
,
p
ath
);
onLoad
(
object
.
geometry
,
object
.
materials
);
},
onProgress
,
onError
);
},
set
CrossOrigin
:
function
(
value
)
{
set
Path
:
function
(
value
)
{
this
.
crossOrigin
=
value
;
this
.
path
=
value
;
return
this
;
},
set
Textur
ePath
:
function
(
value
)
{
set
Resourc
ePath
:
function
(
value
)
{
this
.
texturePath
=
value
;
this
.
resourcePath
=
value
;
return
this
;
},
setCrossOrigin
:
function
(
value
)
{
this
.
crossOrigin
=
value
;
return
this
;
},
...
...
@@ -528,7 +536,7 @@ Object.assign( JSONLoader.prototype, {
}
return
function
parse
(
json
,
textureP
ath
)
{
return
function
parse
(
json
,
p
ath
)
{
if
(
json
.
data
!==
undefined
)
{
...
...
@@ -563,7 +571,7 @@ Object.assign( JSONLoader.prototype, {
}
else
{
var
materials
=
Loader
.
prototype
.
initMaterials
(
json
.
materials
,
t
extureP
ath
,
this
.
crossOrigin
);
var
materials
=
Loader
.
prototype
.
initMaterials
(
json
.
materials
,
t
his
.
resourcePath
||
p
ath
,
this
.
crossOrigin
);
return
{
geometry
:
geometry
,
materials
:
materials
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录