Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
cff069e4
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,发现更多精彩内容 >>
提交
cff069e4
编写于
6月 20, 2019
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
GLTFLoader: Introduce setDDSLoader().
上级
325a0579
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
20 deletion
+44
-20
examples/js/loaders/GLTFLoader.js
examples/js/loaders/GLTFLoader.js
+15
-7
examples/jsm/loaders/GLTFLoader.d.ts
examples/jsm/loaders/GLTFLoader.d.ts
+9
-1
examples/jsm/loaders/GLTFLoader.js
examples/jsm/loaders/GLTFLoader.js
+18
-11
examples/webgl_loader_gltf_extensions.html
examples/webgl_loader_gltf_extensions.html
+1
-0
utils/modularize.js
utils/modularize.js
+1
-1
未找到文件。
examples/js/loaders/GLTFLoader.js
浏览文件 @
cff069e4
...
...
@@ -12,6 +12,7 @@ THREE.GLTFLoader = ( function () {
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
THREE
.
DefaultLoadingManager
;
this
.
dracoLoader
=
null
;
this
.
ddsLoader
=
null
;
}
...
...
@@ -124,6 +125,13 @@ THREE.GLTFLoader = ( function () {
},
setDDSLoader
:
function
(
ddsLoader
)
{
this
.
ddsLoader
=
ddsLoader
;
return
this
;
},
parse
:
function
(
data
,
path
,
onLoad
,
onError
)
{
var
content
;
...
...
@@ -195,7 +203,7 @@ THREE.GLTFLoader = ( function () {
break
;
case
EXTENSIONS
.
MSFT_TEXTURE_DDS
:
extensions
[
EXTENSIONS
.
MSFT_TEXTURE_DDS
]
=
new
GLTFTextureDDSExtension
();
extensions
[
EXTENSIONS
.
MSFT_TEXTURE_DDS
]
=
new
GLTFTextureDDSExtension
(
this
.
ddsLoader
);
break
;
case
EXTENSIONS
.
KHR_TEXTURE_TRANSFORM
:
...
...
@@ -287,16 +295,16 @@ THREE.GLTFLoader = ( function () {
* https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
*
*/
function
GLTFTextureDDSExtension
()
{
function
GLTFTextureDDSExtension
(
ddsLoader
)
{
if
(
!
THREE
.
DDS
Loader
)
{
if
(
!
dds
Loader
)
{
throw
new
Error
(
'
THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader
'
);
}
this
.
name
=
EXTENSIONS
.
MSFT_TEXTURE_DDS
;
this
.
ddsLoader
=
new
THREE
.
DDSLoader
()
;
this
.
ddsLoader
=
ddsLoader
;
}
...
...
@@ -855,7 +863,7 @@ THREE.GLTFLoader = ( function () {
},
// Here's based on refreshUniformsCommon() and refreshUniformsStandard() in WebGLRenderer.
refreshUniforms
:
function
(
renderer
,
scene
,
camera
,
geometry
,
material
,
group
)
{
refreshUniforms
:
function
(
renderer
,
scene
,
camera
,
geometry
,
material
)
{
if
(
material
.
isGLTFSpecularGlossinessMaterial
!==
true
)
{
...
...
@@ -2549,7 +2557,7 @@ THREE.GLTFLoader = ( function () {
?
new
THREE
.
SkinnedMesh
(
geometry
,
material
)
:
new
THREE
.
Mesh
(
geometry
,
material
);
if
(
mesh
.
isSkinnedMesh
===
true
&&
!
mesh
.
geometry
.
attributes
.
skinWeight
.
normalized
)
{
if
(
mesh
.
isSkinnedMesh
===
true
&&
!
mesh
.
geometry
.
attributes
.
skinWeight
.
normalized
)
{
// we normalize floating point skin weight array to fix malformed assets (see #15319)
// it's important to skip this for non-float32 data since normalizeSkinWeights assumes non-normalized inputs
...
...
@@ -2837,7 +2845,7 @@ THREE.GLTFLoader = ( function () {
for
(
var
j
=
0
,
jl
=
outputArray
.
length
;
j
<
jl
;
j
++
)
{
scaled
[
j
]
=
outputArray
[
j
]
*
scale
;
scaled
[
j
]
=
outputArray
[
j
]
*
scale
;
}
...
...
examples/jsm/loaders/GLTFLoader.d.ts
浏览文件 @
cff069e4
...
...
@@ -5,6 +5,9 @@ import {
Scene
}
from
'
../../../src/Three
'
;
import
{
DRACOLoader
}
from
'
./DRACOLoader
'
;
import
{
DDSLoader
}
from
'
./DDSLoader
'
;
export
interface
GLTF
{
animations
:
AnimationClip
[];
scene
:
Scene
;
...
...
@@ -16,12 +19,17 @@ export interface GLTF {
export
class
GLTFLoader
{
constructor
(
manager
?:
LoadingManager
);
manager
:
LoadingManager
;
dracoLoader
:
DRACOLoader
|
null
;
ddsLoader
:
DDSLoader
|
null
;
path
:
string
;
crossOrigin
:
string
;
resourcePath
:
string
;
load
(
url
:
string
,
onLoad
:
(
gltf
:
GLTF
)
=>
void
,
onProgress
?:
(
event
:
ProgressEvent
)
=>
void
,
onError
?:
(
event
:
ErrorEvent
)
=>
void
)
:
void
;
setPath
(
path
:
string
)
:
GLTFLoader
;
setResourcePath
(
path
:
string
)
:
GLTFLoader
;
setCrossOrigin
(
value
:
string
):
GLTFLoader
;
setDRACOLoader
(
dracoLoader
:
object
):
GLTFLoader
;
setDRACOLoader
(
dracoLoader
:
DRACOLoader
):
GLTFLoader
;
setDDSLoader
(
ddsLoader
:
DDSLoader
):
GLTFLoader
;
parse
(
data
:
ArrayBuffer
|
string
,
path
:
string
,
onLoad
:
(
gltf
:
GLTF
)
=>
void
,
onError
?:
(
event
:
ErrorEvent
)
=>
void
)
:
void
;
}
examples/jsm/loaders/GLTFLoader.js
浏览文件 @
cff069e4
...
...
@@ -61,7 +61,6 @@ import {
Skeleton
,
SkinnedMesh
,
SpotLight
,
Texture
,
TextureLoader
,
TriangleFanDrawMode
,
TriangleStripDrawMode
,
...
...
@@ -78,6 +77,7 @@ var GLTFLoader = ( function () {
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
DefaultLoadingManager
;
this
.
dracoLoader
=
null
;
this
.
ddsLoader
=
null
;
}
...
...
@@ -190,6 +190,13 @@ var GLTFLoader = ( function () {
},
setDDSLoader
:
function
(
ddsLoader
)
{
this
.
ddsLoader
=
ddsLoader
;
return
this
;
},
parse
:
function
(
data
,
path
,
onLoad
,
onError
)
{
var
content
;
...
...
@@ -261,7 +268,7 @@ var GLTFLoader = ( function () {
break
;
case
EXTENSIONS
.
MSFT_TEXTURE_DDS
:
extensions
[
EXTENSIONS
.
MSFT_TEXTURE_DDS
]
=
new
GLTFTextureDDSExtension
();
extensions
[
EXTENSIONS
.
MSFT_TEXTURE_DDS
]
=
new
GLTFTextureDDSExtension
(
this
.
ddsLoader
);
break
;
case
EXTENSIONS
.
KHR_TEXTURE_TRANSFORM
:
...
...
@@ -353,16 +360,16 @@ var GLTFLoader = ( function () {
* https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
*
*/
function
GLTFTextureDDSExtension
()
{
function
GLTFTextureDDSExtension
(
ddsLoader
)
{
if
(
!
THREE
.
DDS
Loader
)
{
if
(
!
dds
Loader
)
{
throw
new
Error
(
'
THREE.GLTFLoader: Attempting to load .dds texture without importing
THREE.
DDSLoader
'
);
throw
new
Error
(
'
THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader
'
);
}
this
.
name
=
EXTENSIONS
.
MSFT_TEXTURE_DDS
;
this
.
ddsLoader
=
new
THREE
.
DDSLoader
()
;
this
.
ddsLoader
=
ddsLoader
;
}
...
...
@@ -921,7 +928,7 @@ var GLTFLoader = ( function () {
},
// Here's based on refreshUniformsCommon() and refreshUniformsStandard() in WebGLRenderer.
refreshUniforms
:
function
(
renderer
,
scene
,
camera
,
geometry
,
material
,
group
)
{
refreshUniforms
:
function
(
renderer
,
scene
,
camera
,
geometry
,
material
)
{
if
(
material
.
isGLTFSpecularGlossinessMaterial
!==
true
)
{
...
...
@@ -1719,7 +1726,7 @@ var GLTFLoader = ( function () {
* Requests the specified dependency asynchronously, with caching.
* @param {string} type
* @param {number} index
* @return {Promise<Object3D|Material|Texture|AnimationClip|ArrayBuffer|Object>}
* @return {Promise<Object3D|Material|T
HREE.T
exture|AnimationClip|ArrayBuffer|Object>}
*/
GLTFParser
.
prototype
.
getDependency
=
function
(
type
,
index
)
{
...
...
@@ -2008,7 +2015,7 @@ var GLTFLoader = ( function () {
/**
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
* @param {number} textureIndex
* @return {Promise<Texture>}
* @return {Promise<T
HREE.T
exture>}
*/
GLTFParser
.
prototype
.
loadTexture
=
function
(
textureIndex
)
{
...
...
@@ -2615,7 +2622,7 @@ var GLTFLoader = ( function () {
?
new
SkinnedMesh
(
geometry
,
material
)
:
new
Mesh
(
geometry
,
material
);
if
(
mesh
.
isSkinnedMesh
===
true
&&
!
mesh
.
geometry
.
attributes
.
skinWeight
.
normalized
)
{
if
(
mesh
.
isSkinnedMesh
===
true
&&
!
mesh
.
geometry
.
attributes
.
skinWeight
.
normalized
)
{
// we normalize floating point skin weight array to fix malformed assets (see #15319)
// it's important to skip this for non-float32 data since normalizeSkinWeights assumes non-normalized inputs
...
...
@@ -2903,7 +2910,7 @@ var GLTFLoader = ( function () {
for
(
var
j
=
0
,
jl
=
outputArray
.
length
;
j
<
jl
;
j
++
)
{
scaled
[
j
]
=
outputArray
[
j
]
*
scale
;
scaled
[
j
]
=
outputArray
[
j
]
*
scale
;
}
...
...
examples/webgl_loader_gltf_extensions.html
浏览文件 @
cff069e4
...
...
@@ -269,6 +269,7 @@
THREE
.
DRACOLoader
.
setDecoderPath
(
'
js/libs/draco/gltf/
'
);
loader
.
setDRACOLoader
(
new
THREE
.
DRACOLoader
()
);
loader
.
setDDSLoader
(
new
THREE
.
DDSLoader
()
);
var
url
=
sceneInfo
.
url
.
replace
(
/%s/g
,
state
.
extension
);
...
...
utils/modularize.js
浏览文件 @
cff069e4
...
...
@@ -90,7 +90,7 @@ var files = [
{
path
:
'
loaders/EquirectangularToCubeGenerator.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
loaders/FBXLoader.js
'
,
dependencies
:
[
{
name
:
'
Zlib
'
,
path
:
'
libs/inflate.min.js
'
},
{
name
:
'
TGALoader
'
,
path
:
'
loaders/TGALoader.js
'
},
{
name
:
'
NURBSCurve
'
,
path
:
'
curves/NURBSCurve.js
'
}
],
ignoreList
:
[]
},
{
path
:
'
loaders/GCodeLoader.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
loaders/GLTFLoader.js
'
,
dependencies
:
[],
ignoreList
:
[
'
NoSide
'
,
'
Matrix2
'
,
'
DDSLoader
'
,
'
Camera
'
]
},
{
path
:
'
loaders/GLTFLoader.js
'
,
dependencies
:
[],
ignoreList
:
[
'
NoSide
'
,
'
Matrix2
'
,
'
Camera
'
,
'
Texture
'
]
},
{
path
:
'
loaders/HDRCubeTextureLoader.js
'
,
dependencies
:
[
{
name
:
'
RGBELoader
'
,
path
:
'
loaders/RGBELoader.js
'
}
],
ignoreList
:
[]
},
{
path
:
'
loaders/KMZLoader.js
'
,
dependencies
:
[
{
name
:
'
ColladaLoader
'
,
path
:
'
loaders/ColladaLoader.js
'
}
],
ignoreList
:
[]
},
{
path
:
'
loaders/LDrawLoader.js
'
,
dependencies
:
[],
ignoreList
:
[
'
Cache
'
,
'
Material
'
,
'
Object3D
'
]
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录