Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
bcb0c577
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,发现更多精彩内容 >>
未验证
提交
bcb0c577
编写于
8月 31, 2019
作者:
M
Michael Herzog
提交者:
GitHub
8月 31, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17398 from Mugen87/dev37
Examples: Inherit from Loader IV.
上级
ba08ba94
7d603a80
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
193 addition
and
332 deletion
+193
-332
examples/js/loaders/HDRCubeTextureLoader.js
examples/js/loaders/HDRCubeTextureLoader.js
+75
-82
examples/js/loaders/TTFLoader.js
examples/js/loaders/TTFLoader.js
+6
-11
examples/js/loaders/VRMLoader.js
examples/js/loaders/VRMLoader.js
+4
-26
examples/js/loaders/XLoader.js
examples/js/loaders/XLoader.js
+4
-30
examples/jsm/loaders/HDRCubeTextureLoader.d.ts
examples/jsm/loaders/HDRCubeTextureLoader.d.ts
+2
-4
examples/jsm/loaders/HDRCubeTextureLoader.js
examples/jsm/loaders/HDRCubeTextureLoader.js
+76
-83
examples/jsm/loaders/MTLLoader.d.ts
examples/jsm/loaders/MTLLoader.d.ts
+0
-1
examples/jsm/loaders/TTFLoader.d.ts
examples/jsm/loaders/TTFLoader.d.ts
+2
-5
examples/jsm/loaders/TTFLoader.js
examples/jsm/loaders/TTFLoader.js
+8
-13
examples/jsm/loaders/VRMLoader.d.ts
examples/jsm/loaders/VRMLoader.d.ts
+3
-10
examples/jsm/loaders/VRMLoader.js
examples/jsm/loaders/VRMLoader.js
+5
-27
examples/jsm/loaders/XLoader.d.ts
examples/jsm/loaders/XLoader.d.ts
+3
-9
examples/jsm/loaders/XLoader.js
examples/jsm/loaders/XLoader.js
+5
-31
未找到文件。
examples/js/loaders/HDRCubeTextureLoader.js
浏览文件 @
bcb0c577
...
...
@@ -5,134 +5,127 @@
THREE
.
HDRCubeTextureLoader
=
function
(
manager
)
{
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
THREE
.
DefaultLoadingManager
;
THREE
.
Loader
.
call
(
this
,
manager
);
this
.
hdrLoader
=
new
THREE
.
RGBELoader
();
this
.
type
=
THREE
.
UnsignedByteType
;
};
THREE
.
HDRCubeTextureLoader
.
prototype
.
load
=
function
(
urls
,
onLoad
,
onProgress
,
onError
)
{
THREE
.
HDRCubeTextureLoader
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Loader
.
prototype
),
{
if
(
!
Array
.
isArray
(
urls
)
)
{
constructor
:
THREE
.
HDRCubeTextureLoader
,
console
.
warn
(
'
THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.
'
);
load
:
function
(
urls
,
onLoad
,
onProgress
,
onError
)
{
this
.
setDataType
(
urls
);
if
(
!
Array
.
isArray
(
urls
)
)
{
urls
=
onLoad
;
onLoad
=
onProgress
;
onProgress
=
onError
;
onError
=
arguments
[
4
];
console
.
warn
(
'
THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.
'
);
}
this
.
setDataType
(
urls
);
var
texture
=
new
THREE
.
CubeTexture
();
urls
=
onLoad
;
onLoad
=
onProgress
;
onProgress
=
onError
;
onError
=
arguments
[
4
];
texture
.
type
=
this
.
type
;
}
switch
(
texture
.
type
)
{
var
texture
=
new
THREE
.
CubeTexture
();
case
THREE
.
UnsignedByteType
:
texture
.
type
=
this
.
type
;
texture
.
encoding
=
THREE
.
RGBEEncoding
;
texture
.
format
=
THREE
.
RGBAFormat
;
texture
.
minFilter
=
THREE
.
NearestFilter
;
texture
.
magFilter
=
THREE
.
NearestFilter
;
texture
.
generateMipmaps
=
false
;
break
;
switch
(
texture
.
type
)
{
case
THREE
.
Float
Type
:
case
THREE
.
UnsignedByte
Type
:
texture
.
encoding
=
THREE
.
Linear
Encoding
;
texture
.
format
=
THREE
.
RGB
Format
;
texture
.
minFilter
=
THREE
.
Linear
Filter
;
texture
.
magFilter
=
THREE
.
Linear
Filter
;
texture
.
generateMipmaps
=
false
;
break
;
texture
.
encoding
=
THREE
.
RGBE
Encoding
;
texture
.
format
=
THREE
.
RGBA
Format
;
texture
.
minFilter
=
THREE
.
Nearest
Filter
;
texture
.
magFilter
=
THREE
.
Nearest
Filter
;
texture
.
generateMipmaps
=
false
;
break
;
case
THREE
.
Half
FloatType
:
case
THREE
.
FloatType
:
texture
.
encoding
=
THREE
.
LinearEncoding
;
texture
.
format
=
THREE
.
RGBFormat
;
texture
.
minFilter
=
THREE
.
LinearFilter
;
texture
.
magFilter
=
THREE
.
LinearFilter
;
texture
.
generateMipmaps
=
false
;
break
;
texture
.
encoding
=
THREE
.
LinearEncoding
;
texture
.
format
=
THREE
.
RGBFormat
;
texture
.
minFilter
=
THREE
.
LinearFilter
;
texture
.
magFilter
=
THREE
.
LinearFilter
;
texture
.
generateMipmaps
=
false
;
break
;
}
case
THREE
.
HalfFloatType
:
var
scope
=
this
;
texture
.
encoding
=
THREE
.
LinearEncoding
;
texture
.
format
=
THREE
.
RGBFormat
;
texture
.
minFilter
=
THREE
.
LinearFilter
;
texture
.
magFilter
=
THREE
.
LinearFilter
;
texture
.
generateMipmaps
=
false
;
break
;
var
loaded
=
0
;
}
function
loadHDRData
(
i
,
onLoad
,
onProgress
,
onError
)
{
var
scope
=
this
;
new
THREE
.
FileLoader
(
scope
.
manager
)
.
setPath
(
scope
.
path
)
.
setResponseType
(
'
arraybuffer
'
)
.
load
(
urls
[
i
],
function
(
buffer
)
{
var
loaded
=
0
;
loaded
++
;
function
loadHDRData
(
i
,
onLoad
,
onProgress
,
onError
)
{
var
texData
=
scope
.
hdrLoader
.
_parser
(
buffer
);
new
THREE
.
FileLoader
(
scope
.
manager
)
.
setPath
(
scope
.
path
)
.
setResponseType
(
'
arraybuffer
'
)
.
load
(
urls
[
i
],
function
(
buffer
)
{
if
(
!
texData
)
return
;
loaded
++
;
if
(
texData
.
data
!==
undefined
)
{
var
texData
=
scope
.
hdrLoader
.
_parser
(
buffer
);
var
dataTexture
=
new
THREE
.
DataTexture
(
texData
.
data
,
texData
.
width
,
texData
.
height
)
;
if
(
!
texData
)
return
;
dataTexture
.
type
=
texture
.
type
;
dataTexture
.
encoding
=
texture
.
encoding
;
dataTexture
.
format
=
texture
.
format
;
dataTexture
.
minFilter
=
texture
.
minFilter
;
dataTexture
.
magFilter
=
texture
.
magFilter
;
dataTexture
.
generateMipmaps
=
texture
.
generateMipmaps
;
if
(
texData
.
data
!==
undefined
)
{
texture
.
images
[
i
]
=
dataTexture
;
var
dataTexture
=
new
THREE
.
DataTexture
(
texData
.
data
,
texData
.
width
,
texData
.
height
)
;
}
dataTexture
.
type
=
texture
.
type
;
dataTexture
.
encoding
=
texture
.
encoding
;
dataTexture
.
format
=
texture
.
format
;
dataTexture
.
minFilter
=
texture
.
minFilter
;
dataTexture
.
magFilter
=
texture
.
magFilter
;
dataTexture
.
generateMipmaps
=
texture
.
generateMipmaps
;
if
(
loaded
===
6
)
{
texture
.
images
[
i
]
=
dataTexture
;
texture
.
needsUpdate
=
true
;
if
(
onLoad
)
onLoad
(
texture
);
}
}
if
(
loaded
===
6
)
{
},
onProgress
,
onError
);
texture
.
needsUpdate
=
true
;
if
(
onLoad
)
onLoad
(
texture
);
}
}
for
(
var
i
=
0
;
i
<
urls
.
length
;
i
++
)
{
},
onProgress
,
onError
);
loadHDRData
(
i
,
onLoad
,
onProgress
,
onError
);
}
}
for
(
var
i
=
0
;
i
<
urls
.
length
;
i
++
)
{
return
texture
;
loadHDRData
(
i
,
onLoad
,
onProgress
,
onError
)
;
};
}
THREE
.
HDRCubeTextureLoader
.
prototype
.
setPath
=
function
(
value
)
{
return
texture
;
this
.
path
=
value
;
return
this
;
},
};
setDataType
:
function
(
value
)
{
THREE
.
HDRCubeTextureLoader
.
prototype
.
setDataType
=
function
(
value
)
{
this
.
type
=
value
;
this
.
hdrLoader
.
setDataType
(
value
);
this
.
type
=
value
;
this
.
hdrLoader
.
setDataType
(
value
);
return
this
;
return
this
;
};
THREE
.
HDRCubeTextureLoader
.
prototype
.
setType
=
function
(
value
)
{
console
.
warn
(
'
THREE.HDRCubeTextureLoader: .setType() has been renamed to .setDataType().
'
);
return
this
.
setDataType
(
value
);
}
};
}
)
;
examples/js/loaders/TTFLoader.js
浏览文件 @
bcb0c577
...
...
@@ -10,12 +10,14 @@
THREE
.
TTFLoader
=
function
(
manager
)
{
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
THREE
.
DefaultLoadingManager
;
THREE
.
Loader
.
call
(
this
,
manager
);
this
.
reversed
=
false
;
};
THREE
.
TTFLoader
.
prototype
=
{
THREE
.
TTFLoader
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Loader
.
prototype
),
{
constructor
:
THREE
.
TTFLoader
,
...
...
@@ -34,13 +36,6 @@ THREE.TTFLoader.prototype = {
},
setPath
:
function
(
value
)
{
this
.
path
=
value
;
return
this
;
},
parse
:
function
(
arraybuffer
)
{
function
convert
(
font
,
reversed
)
{
...
...
@@ -49,7 +44,7 @@ THREE.TTFLoader.prototype = {
var
glyphs
=
{};
var
scale
=
(
100000
)
/
(
(
font
.
unitsPerEm
||
2048
)
*
72
);
var
glyphIndexMap
=
font
.
encoding
.
cmap
.
glyphIndexMap
;
var
unicodes
=
Object
.
keys
(
glyphIndexMap
);
...
...
@@ -202,4 +197,4 @@ THREE.TTFLoader.prototype = {
}
};
}
)
;
examples/js/loaders/VRMLoader.js
浏览文件 @
bcb0c577
...
...
@@ -17,17 +17,16 @@ THREE.VRMLoader = ( function () {
}
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
THREE
.
DefaultLoadingManager
;
THREE
.
Loader
.
call
(
this
,
manager
);
this
.
gltfLoader
=
new
THREE
.
GLTFLoader
(
this
.
manager
);
}
VRMLoader
.
prototype
=
{
VRMLoader
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Loader
.
prototype
),
{
constructor
:
VRMLoader
,
crossOrigin
:
'
anonymous
'
,
load
:
function
(
url
,
onLoad
,
onProgress
,
onError
)
{
var
scope
=
this
;
...
...
@@ -40,27 +39,6 @@ THREE.VRMLoader = ( function () {
},
setCrossOrigin
:
function
(
value
)
{
this
.
glTFLoader
.
setCrossOrigin
(
value
);
return
this
;
},
setPath
:
function
(
value
)
{
this
.
glTFLoader
.
setPath
(
value
);
return
this
;
},
setResourcePath
:
function
(
value
)
{
this
.
glTFLoader
.
setResourcePath
(
value
);
return
this
;
},
setDRACOLoader
:
function
(
dracoLoader
)
{
this
.
glTFLoader
.
setDRACOLoader
(
dracoLoader
);
...
...
@@ -80,7 +58,7 @@ THREE.VRMLoader = ( function () {
}
};
}
)
;
return
VRMLoader
;
...
...
examples/js/loaders/XLoader.js
浏览文件 @
bcb0c577
...
...
@@ -201,10 +201,11 @@ THREE.XLoader = ( function () {
function
XLoader
(
manager
)
{
THREE
.
Loader
.
call
(
this
,
manager
);
classCallCheck
(
this
,
XLoader
);
this
.
debug
=
false
;
this
.
manager
=
manager
!==
undefined
?
manager
:
THREE
.
DefaultLoadingManager
;
this
.
texloader
=
new
THREE
.
TextureLoader
(
this
.
manager
);
this
.
url
=
""
;
this
.
_putMatLength
=
0
;
...
...
@@ -228,9 +229,6 @@ THREE.XLoader = ( function () {
}
createClass
(
XLoader
,
[
{
key
:
'
crossOrigin
'
,
value
:
'
anonymous
'
},
{
key
:
'
_setArgOption
'
,
value
:
function
_setArgOption
(
_arg
)
{
...
...
@@ -278,30 +276,6 @@ THREE.XLoader = ( function () {
},
onProgress
,
onError
);
}
},
{
key
:
'
setCrossOrigin
'
,
value
:
function
setCrossOrigin
(
value
)
{
this
.
crossOrigin
=
value
;
return
this
;
}
},
{
key
:
'
setPath
'
,
value
:
function
setPath
(
value
)
{
this
.
path
=
value
;
return
this
;
}
},
{
key
:
'
setResourcePath
'
,
value
:
function
setResourcePath
(
value
)
{
this
.
resourcePath
=
value
;
return
this
;
}
},
{
key
:
'
_readLine
'
,
...
...
@@ -482,11 +456,11 @@ THREE.XLoader = ( function () {
var
path
;
if
(
this
.
resourcePath
!==
undefined
)
{
if
(
this
.
resourcePath
!==
''
)
{
path
=
this
.
resourcePath
;
}
else
if
(
this
.
path
!==
undefined
)
{
}
else
if
(
this
.
path
!==
''
)
{
path
=
this
.
path
;
...
...
examples/jsm/loaders/HDRCubeTextureLoader.d.ts
浏览文件 @
bcb0c577
import
{
CubeTexture
,
Loader
,
LoadingManager
,
TextureDataType
}
from
'
../../../src/Three
'
;
import
{
RGBELoader
}
from
'
./RGBELoader
'
;
export
class
HDRCubeTextureLoader
{
export
class
HDRCubeTextureLoader
extends
Loader
{
constructor
(
manager
?:
LoadingManager
);
manager
:
LoadingManager
;
hdrLoader
:
RGBELoader
;
path
:
string
;
type
:
TextureDataType
;
load
(
urls
:
string
[],
onLoad
:
(
texture
:
CubeTexture
)
=>
void
,
onProgress
?:
(
event
:
ProgressEvent
)
=>
void
,
onError
?:
(
event
:
ErrorEvent
)
=>
void
):
void
;
setPath
(
value
:
string
):
this
;
setDataType
(
type
:
TextureDataType
):
this
;
}
examples/jsm/loaders/HDRCubeTextureLoader.js
浏览文件 @
bcb0c577
...
...
@@ -6,12 +6,12 @@
import
{
CubeTexture
,
DataTexture
,
DefaultLoadingManager
,
FileLoader
,
FloatType
,
HalfFloatType
,
LinearEncoding
,
LinearFilter
,
Loader
,
NearestFilter
,
RGBAFormat
,
RGBEEncoding
,
...
...
@@ -22,136 +22,129 @@ import { RGBELoader } from "../loaders/RGBELoader.js";
var
HDRCubeTextureLoader
=
function
(
manager
)
{
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
DefaultLoadingManager
;
Loader
.
call
(
this
,
manager
);
this
.
hdrLoader
=
new
RGBELoader
();
this
.
type
=
UnsignedByteType
;
};
HDRCubeTextureLoader
.
prototype
.
load
=
function
(
urls
,
onLoad
,
onProgress
,
onError
)
{
HDRCubeTextureLoader
.
prototype
=
Object
.
assign
(
Object
.
create
(
Loader
.
prototype
),
{
if
(
!
Array
.
isArray
(
urls
)
)
{
constructor
:
HDRCubeTextureLoader
,
console
.
warn
(
'
THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.
'
);
load
:
function
(
urls
,
onLoad
,
onProgress
,
onError
)
{
this
.
setDataType
(
urls
);
if
(
!
Array
.
isArray
(
urls
)
)
{
urls
=
onLoad
;
onLoad
=
onProgress
;
onProgress
=
onError
;
onError
=
arguments
[
4
];
console
.
warn
(
'
THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.
'
);
}
this
.
setDataType
(
urls
);
var
texture
=
new
CubeTexture
();
urls
=
onLoad
;
onLoad
=
onProgress
;
onProgress
=
onError
;
onError
=
arguments
[
4
];
texture
.
type
=
this
.
type
;
}
switch
(
texture
.
type
)
{
var
texture
=
new
CubeTexture
();
case
UnsignedByteType
:
texture
.
type
=
this
.
type
;
texture
.
encoding
=
RGBEEncoding
;
texture
.
format
=
RGBAFormat
;
texture
.
minFilter
=
NearestFilter
;
texture
.
magFilter
=
NearestFilter
;
texture
.
generateMipmaps
=
false
;
break
;
switch
(
texture
.
type
)
{
case
Float
Type
:
case
UnsignedByte
Type
:
texture
.
encoding
=
Linear
Encoding
;
texture
.
format
=
RGB
Format
;
texture
.
minFilter
=
Linear
Filter
;
texture
.
magFilter
=
Linear
Filter
;
texture
.
generateMipmaps
=
false
;
break
;
texture
.
encoding
=
RGBE
Encoding
;
texture
.
format
=
RGBA
Format
;
texture
.
minFilter
=
Nearest
Filter
;
texture
.
magFilter
=
Nearest
Filter
;
texture
.
generateMipmaps
=
false
;
break
;
case
Half
FloatType
:
case
FloatType
:
texture
.
encoding
=
LinearEncoding
;
texture
.
format
=
RGBFormat
;
texture
.
minFilter
=
LinearFilter
;
texture
.
magFilter
=
LinearFilter
;
texture
.
generateMipmaps
=
false
;
break
;
texture
.
encoding
=
LinearEncoding
;
texture
.
format
=
RGBFormat
;
texture
.
minFilter
=
LinearFilter
;
texture
.
magFilter
=
LinearFilter
;
texture
.
generateMipmaps
=
false
;
break
;
}
case
HalfFloatType
:
var
scope
=
this
;
texture
.
encoding
=
LinearEncoding
;
texture
.
format
=
RGBFormat
;
texture
.
minFilter
=
LinearFilter
;
texture
.
magFilter
=
LinearFilter
;
texture
.
generateMipmaps
=
false
;
break
;
var
loaded
=
0
;
}
function
loadHDRData
(
i
,
onLoad
,
onProgress
,
onError
)
{
var
scope
=
this
;
new
FileLoader
(
scope
.
manager
)
.
setPath
(
scope
.
path
)
.
setResponseType
(
'
arraybuffer
'
)
.
load
(
urls
[
i
],
function
(
buffer
)
{
var
loaded
=
0
;
loaded
++
;
function
loadHDRData
(
i
,
onLoad
,
onProgress
,
onError
)
{
var
texData
=
scope
.
hdrLoader
.
_parser
(
buffer
);
new
FileLoader
(
scope
.
manager
)
.
setPath
(
scope
.
path
)
.
setResponseType
(
'
arraybuffer
'
)
.
load
(
urls
[
i
],
function
(
buffer
)
{
if
(
!
texData
)
return
;
loaded
++
;
if
(
texData
.
data
!==
undefined
)
{
var
texData
=
scope
.
hdrLoader
.
_parser
(
buffer
);
var
dataTexture
=
new
DataTexture
(
texData
.
data
,
texData
.
width
,
texData
.
height
)
;
if
(
!
texData
)
return
;
dataTexture
.
type
=
texture
.
type
;
dataTexture
.
encoding
=
texture
.
encoding
;
dataTexture
.
format
=
texture
.
format
;
dataTexture
.
minFilter
=
texture
.
minFilter
;
dataTexture
.
magFilter
=
texture
.
magFilter
;
dataTexture
.
generateMipmaps
=
texture
.
generateMipmaps
;
if
(
texData
.
data
!==
undefined
)
{
texture
.
images
[
i
]
=
dataTexture
;
var
dataTexture
=
new
DataTexture
(
texData
.
data
,
texData
.
width
,
texData
.
height
)
;
}
dataTexture
.
type
=
texture
.
type
;
dataTexture
.
encoding
=
texture
.
encoding
;
dataTexture
.
format
=
texture
.
format
;
dataTexture
.
minFilter
=
texture
.
minFilter
;
dataTexture
.
magFilter
=
texture
.
magFilter
;
dataTexture
.
generateMipmaps
=
texture
.
generateMipmaps
;
if
(
loaded
===
6
)
{
texture
.
images
[
i
]
=
dataTexture
;
texture
.
needsUpdate
=
true
;
if
(
onLoad
)
onLoad
(
texture
);
}
}
if
(
loaded
===
6
)
{
},
onProgress
,
onError
);
texture
.
needsUpdate
=
true
;
if
(
onLoad
)
onLoad
(
texture
);
}
}
for
(
var
i
=
0
;
i
<
urls
.
length
;
i
++
)
{
},
onProgress
,
onError
);
loadHDRData
(
i
,
onLoad
,
onProgress
,
onError
);
}
}
for
(
var
i
=
0
;
i
<
urls
.
length
;
i
++
)
{
return
texture
;
loadHDRData
(
i
,
onLoad
,
onProgress
,
onError
)
;
};
}
HDRCubeTextureLoader
.
prototype
.
setPath
=
function
(
value
)
{
return
texture
;
this
.
path
=
value
;
return
this
;
},
};
setDataType
:
function
(
value
)
{
HDRCubeTextureLoader
.
prototype
.
setDataType
=
function
(
value
)
{
this
.
type
=
value
;
this
.
hdrLoader
.
setDataType
(
value
);
this
.
type
=
value
;
this
.
hdrLoader
.
setDataType
(
value
);
return
this
;
return
this
;
};
HDRCubeTextureLoader
.
prototype
.
setType
=
function
(
value
)
{
console
.
warn
(
'
THREE.HDRCubeTextureLoader: .setType() has been renamed to .setDataType().
'
);
return
this
.
setDataType
(
value
);
}
};
}
)
;
export
{
HDRCubeTextureLoader
};
examples/jsm/loaders/MTLLoader.d.ts
浏览文件 @
bcb0c577
...
...
@@ -45,7 +45,6 @@ export class MTLLoader extends Loader {
load
(
url
:
string
,
onLoad
:
(
materialCreator
:
MaterialCreator
)
=>
void
,
onProgress
?:
(
event
:
ProgressEvent
)
=>
void
,
onError
?:
(
event
:
ErrorEvent
)
=>
void
):
void
;
parse
(
text
:
string
)
:
MaterialCreator
;
setBaseUrl
(
path
:
string
)
:
void
;
setMaterialOptions
(
value
:
MaterialCreatorOptions
)
:
void
;
}
...
...
examples/jsm/loaders/TTFLoader.d.ts
浏览文件 @
bcb0c577
import
{
BufferGeometry
,
Loader
,
LoadingManager
}
from
'
../../../src/Three
'
;
export
class
TTFLoader
{
export
class
TTFLoader
extends
Loader
{
constructor
(
manager
?:
LoadingManager
);
manager
:
LoadingManager
;
path
:
string
;
reversed
:
boolean
;
load
(
url
:
string
,
onLoad
:
(
json
:
object
)
=>
void
,
onProgress
?:
(
event
:
ProgressEvent
)
=>
void
,
onError
?:
(
event
:
ErrorEvent
)
=>
void
):
void
;
setPath
(
path
:
string
):
this
;
parse
(
arraybuffer
:
ArrayBuffer
):
object
;
}
examples/jsm/loaders/TTFLoader.js
浏览文件 @
bcb0c577
...
...
@@ -9,18 +9,20 @@
*/
import
{
DefaultLoadingManag
er
,
File
Loader
FileLoad
er
,
Loader
}
from
"
../../../build/three.module.js
"
;
var
TTFLoader
=
function
(
manager
)
{
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
DefaultLoadingManager
;
Loader
.
call
(
this
,
manager
);
this
.
reversed
=
false
;
};
TTFLoader
.
prototype
=
{
TTFLoader
.
prototype
=
Object
.
assign
(
Object
.
create
(
Loader
.
prototype
),
{
constructor
:
TTFLoader
,
...
...
@@ -39,13 +41,6 @@ TTFLoader.prototype = {
},
setPath
:
function
(
value
)
{
this
.
path
=
value
;
return
this
;
},
parse
:
function
(
arraybuffer
)
{
function
convert
(
font
,
reversed
)
{
...
...
@@ -54,7 +49,7 @@ TTFLoader.prototype = {
var
glyphs
=
{};
var
scale
=
(
100000
)
/
(
(
font
.
unitsPerEm
||
2048
)
*
72
);
var
glyphIndexMap
=
font
.
encoding
.
cmap
.
glyphIndexMap
;
var
unicodes
=
Object
.
keys
(
glyphIndexMap
);
...
...
@@ -207,6 +202,6 @@ TTFLoader.prototype = {
}
};
}
)
;
export
{
TTFLoader
};
examples/jsm/loaders/VRMLoader.d.ts
浏览文件 @
bcb0c577
import
{
Loader
,
LoadingManager
}
from
'
../../../src/Three
'
;
import
{
GLTFLoader
,
GLTF
}
from
'
./GLTFLoader
'
;
import
{
DRACOLoader
}
from
'
./DRACOLoader
'
;
export
class
VRMLoader
{
export
class
VRMLoader
extends
Loader
{
constructor
(
manager
?:
LoadingManager
);
gltfLoader
:
GLTFLoader
;
manager
:
LoadingManager
;
path
:
string
;
resourcePath
:
string
;
crossOrigin
:
string
;
load
(
url
:
string
,
onLoad
:
(
scene
:
GLTF
)
=>
void
,
onProgress
?:
(
event
:
ProgressEvent
)
=>
void
,
onError
?:
(
event
:
ErrorEvent
)
=>
void
)
:
void
;
setDRACOLoader
(
dracoLoader
:
DRACOLoader
):
this
;
setPath
(
path
:
string
):
this
;
setResourcePath
(
path
:
string
):
this
;
setCrossOrigin
(
path
:
string
):
this
;
parse
(
gltf
:
GLTF
,
onLoad
:
(
scene
:
GLTF
)
=>
void
):
void
;
setDRACOLoader
(
dracoLoader
:
DRACOLoader
):
this
;
}
examples/jsm/loaders/VRMLoader.js
浏览文件 @
bcb0c577
...
...
@@ -3,7 +3,7 @@
*/
import
{
DefaultLoadingManag
er
Load
er
}
from
"
../../../build/three.module.js
"
;
import
{
GLTFLoader
}
from
"
../loaders/GLTFLoader.js
"
;
...
...
@@ -22,17 +22,16 @@ var VRMLoader = ( function () {
}
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
DefaultLoadingManager
;
Loader
.
call
(
this
,
manager
);
this
.
gltfLoader
=
new
GLTFLoader
(
this
.
manager
);
}
VRMLoader
.
prototype
=
{
VRMLoader
.
prototype
=
Object
.
assign
(
Object
.
create
(
Loader
.
prototype
),
{
constructor
:
VRMLoader
,
crossOrigin
:
'
anonymous
'
,
load
:
function
(
url
,
onLoad
,
onProgress
,
onError
)
{
var
scope
=
this
;
...
...
@@ -45,27 +44,6 @@ var VRMLoader = ( function () {
},
setCrossOrigin
:
function
(
value
)
{
this
.
glTFLoader
.
setCrossOrigin
(
value
);
return
this
;
},
setPath
:
function
(
value
)
{
this
.
glTFLoader
.
setPath
(
value
);
return
this
;
},
setResourcePath
:
function
(
value
)
{
this
.
glTFLoader
.
setResourcePath
(
value
);
return
this
;
},
setDRACOLoader
:
function
(
dracoLoader
)
{
this
.
glTFLoader
.
setDRACOLoader
(
dracoLoader
);
...
...
@@ -85,7 +63,7 @@ var VRMLoader = ( function () {
}
};
}
)
;
return
VRMLoader
;
...
...
examples/jsm/loaders/XLoader.d.ts
浏览文件 @
bcb0c577
import
{
Mesh
,
Loader
,
LoadingManager
}
from
'
../../../src/Three
'
;
...
...
@@ -8,16 +9,9 @@ export interface XResult {
models
:
Mesh
[];
}
export
class
VRML
Loader
{
export
class
XLoader
extends
Loader
{
constructor
(
manager
?:
LoadingManager
);
crossOrigin
:
string
;
manager
:
LoadingManager
;
path
:
string
;
resourcePath
:
string
;
load
(
url
:
string
,
onLoad
:
(
object
:
object
)
=>
void
,
onProgress
?:
(
event
:
ProgressEvent
)
=>
void
,
onError
?:
(
event
:
ErrorEvent
)
=>
void
):
void
;
setCrossOrigin
(
path
:
string
):
this
;
load
(
url
:
string
,
onLoad
:
(
object
:
XResult
)
=>
void
,
onProgress
?:
(
event
:
ProgressEvent
)
=>
void
,
onError
?:
(
event
:
ErrorEvent
)
=>
void
):
void
;
parse
(
data
:
ArrayBuffer
|
string
,
onLoad
:
(
object
:
object
)
=>
void
):
object
;
setPath
(
path
:
string
):
this
;
setResourcePath
(
path
:
string
):
this
;
}
examples/jsm/loaders/XLoader.js
浏览文件 @
bcb0c577
...
...
@@ -7,10 +7,10 @@ import {
AnimationMixer
,
Bone
,
BufferGeometry
,
DefaultLoadingManager
,
FileLoader
,
Float32BufferAttribute
,
FrontSide
,
Loader
,
LoaderUtils
,
Matrix4
,
Mesh
,
...
...
@@ -223,10 +223,11 @@ var XLoader = ( function () {
function
XLoader
(
manager
)
{
Loader
.
call
(
this
,
manager
);
classCallCheck
(
this
,
XLoader
);
this
.
debug
=
false
;
this
.
manager
=
manager
!==
undefined
?
manager
:
DefaultLoadingManager
;
this
.
texloader
=
new
TextureLoader
(
this
.
manager
);
this
.
url
=
""
;
this
.
_putMatLength
=
0
;
...
...
@@ -250,9 +251,6 @@ var XLoader = ( function () {
}
createClass
(
XLoader
,
[
{
key
:
'
crossOrigin
'
,
value
:
'
anonymous
'
},
{
key
:
'
_setArgOption
'
,
value
:
function
_setArgOption
(
_arg
)
{
...
...
@@ -300,30 +298,6 @@ var XLoader = ( function () {
},
onProgress
,
onError
);
}
},
{
key
:
'
setCrossOrigin
'
,
value
:
function
setCrossOrigin
(
value
)
{
this
.
crossOrigin
=
value
;
return
this
;
}
},
{
key
:
'
setPath
'
,
value
:
function
setPath
(
value
)
{
this
.
path
=
value
;
return
this
;
}
},
{
key
:
'
setResourcePath
'
,
value
:
function
setResourcePath
(
value
)
{
this
.
resourcePath
=
value
;
return
this
;
}
},
{
key
:
'
_readLine
'
,
...
...
@@ -504,11 +478,11 @@ var XLoader = ( function () {
var
path
;
if
(
this
.
resourcePath
!==
undefined
)
{
if
(
this
.
resourcePath
!==
''
)
{
path
=
this
.
resourcePath
;
}
else
if
(
this
.
path
!==
undefined
)
{
}
else
if
(
this
.
path
!==
''
)
{
path
=
this
.
path
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录