Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
963bcc81
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,发现更多精彩内容 >>
提交
963bcc81
编写于
9月 26, 2018
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ObjectLoader: Added setPath(), setTexturePath() -> setResourcePath().
上级
2410ad1a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
18 deletion
+39
-18
docs/api/en/loaders/ObjectLoader.html
docs/api/en/loaders/ObjectLoader.html
+8
-5
editor/js/Loader.js
editor/js/Loader.js
+1
-1
src/Three.Legacy.js
src/Three.Legacy.js
+12
-0
src/loaders/ObjectLoader.js
src/loaders/ObjectLoader.js
+18
-12
未找到文件。
docs/api/en/loaders/ObjectLoader.html
浏览文件 @
963bcc81
...
...
@@ -85,9 +85,9 @@
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
</p>
<h3>
[property:String
textur
ePath]
</h3>
<h3>
[property:String
resourc
ePath]
</h3>
<p>
The base path or URL from which
textures will be loaded. See [page:.setTextur
ePath].
The base path or URL from which
additional resources like textuures will be loaded. See [page:.setResourc
ePath].
Default is the empty string.
</p>
...
...
@@ -217,11 +217,14 @@
[page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
</p>
<h3>
[method:ObjectLoader set
Texture
Path]( [param:String value] )
</h3>
<h3>
[method:ObjectLoader setPath]( [param:String value] )
</h3>
<p>
[page:String value] — The base path or URL from which textures will be loaded.
<br
/><br
/>
Set the base path for the original file.
</p>
<h3>
[method:ObjectLoader setResourcePath]( [param:String value] )
</h3>
<p>
Set the base path for dependent resources like textures.
</p>
<h2>
Source
</h2>
...
...
editor/js/Loader.js
浏览文件 @
963bcc81
...
...
@@ -626,7 +626,7 @@ var Loader = function ( editor ) {
case
'
object
'
:
var
loader
=
new
THREE
.
ObjectLoader
();
loader
.
set
Textur
ePath
(
scope
.
texturePath
);
loader
.
set
Resourc
ePath
(
scope
.
texturePath
);
var
result
=
loader
.
parse
(
data
);
...
...
src/Three.Legacy.js
浏览文件 @
963bcc81
...
...
@@ -45,6 +45,7 @@ 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
{
ObjectLoader
}
from
'
./loaders/ObjectLoader.js
'
;
import
{
TextureLoader
}
from
'
./loaders/TextureLoader.js
'
;
import
{
Material
}
from
'
./materials/Material.js
'
;
import
{
LineBasicMaterial
}
from
'
./materials/LineBasicMaterial.js
'
;
...
...
@@ -447,6 +448,17 @@ Object.assign( JSONLoader.prototype, {
}
);
Object
.
assign
(
ObjectLoader
.
prototype
,
{
setTexturePath
:
function
(
value
)
{
console
.
warn
(
'
THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().
'
);
return
this
.
setResourcePath
(
value
);
}
}
);
//
Object
.
assign
(
Box2
.
prototype
,
{
...
...
src/loaders/ObjectLoader.js
浏览文件 @
963bcc81
...
...
@@ -48,6 +48,7 @@ import { ImageLoader } from './ImageLoader.js';
import
{
LoadingManager
,
DefaultLoadingManager
}
from
'
./LoadingManager.js
'
;
import
{
AnimationClip
}
from
'
../animation/AnimationClip.js
'
;
import
{
MaterialLoader
}
from
'
./MaterialLoader.js
'
;
import
{
LoaderUtils
}
from
'
./LoaderUtils.js
'
;
import
{
BufferGeometryLoader
}
from
'
./BufferGeometryLoader.js
'
;
import
{
JSONLoader
}
from
'
./JSONLoader.js
'
;
import
{
FileLoader
}
from
'
./FileLoader.js
'
;
...
...
@@ -61,7 +62,7 @@ import * as Curves from '../extras/curves/Curves.js';
function
ObjectLoader
(
manager
)
{
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
DefaultLoadingManager
;
this
.
textur
ePath
=
''
;
this
.
resourc
ePath
=
''
;
}
...
...
@@ -71,15 +72,13 @@ Object.assign( ObjectLoader.prototype, {
load
:
function
(
url
,
onLoad
,
onProgress
,
onError
)
{
if
(
this
.
texturePath
===
''
)
{
this
.
texturePath
=
url
.
substring
(
0
,
url
.
lastIndexOf
(
'
/
'
)
+
1
);
}
var
scope
=
this
;
var
path
=
(
this
.
path
===
undefined
)
?
LoaderUtils
.
extractUrlBase
(
url
)
:
this
.
path
;
this
.
resourcePath
=
this
.
resourcePath
||
path
;
var
loader
=
new
FileLoader
(
scope
.
manager
);
loader
.
setPath
(
this
.
path
);
loader
.
load
(
url
,
function
(
text
)
{
var
json
=
null
;
...
...
@@ -113,9 +112,16 @@ Object.assign( ObjectLoader.prototype, {
},
setTexturePath
:
function
(
value
)
{
setPath
:
function
(
value
)
{
this
.
path
=
value
;
return
this
;
},
setResourcePath
:
function
(
value
)
{
this
.
textur
ePath
=
value
;
this
.
resourc
ePath
=
value
;
return
this
;
},
...
...
@@ -418,7 +424,7 @@ Object.assign( ObjectLoader.prototype, {
case
'
Geometry
'
:
geometry
=
geometryLoader
.
parse
(
data
,
this
.
textur
ePath
).
geometry
;
geometry
=
geometryLoader
.
parse
(
data
,
this
.
resourc
ePath
).
geometry
;
break
;
...
...
@@ -550,7 +556,7 @@ Object.assign( ObjectLoader.prototype, {
var
currentUrl
=
url
[
j
];
var
path
=
/^
(\/\/)
|
([
a-z
]
+:
(\/\/)?)
/i
.
test
(
currentUrl
)
?
currentUrl
:
scope
.
textur
ePath
+
currentUrl
;
var
path
=
/^
(\/\/)
|
([
a-z
]
+:
(\/\/)?)
/i
.
test
(
currentUrl
)
?
currentUrl
:
scope
.
resourc
ePath
+
currentUrl
;
images
[
image
.
uuid
].
push
(
loadImage
(
path
)
);
...
...
@@ -560,7 +566,7 @@ Object.assign( ObjectLoader.prototype, {
// load single image
var
path
=
/^
(\/\/)
|
([
a-z
]
+:
(\/\/)?)
/i
.
test
(
image
.
url
)
?
image
.
url
:
scope
.
textur
ePath
+
image
.
url
;
var
path
=
/^
(\/\/)
|
([
a-z
]
+:
(\/\/)?)
/i
.
test
(
image
.
url
)
?
image
.
url
:
scope
.
resourc
ePath
+
image
.
url
;
images
[
image
.
uuid
]
=
loadImage
(
path
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录