Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
23269242
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,发现更多精彩内容 >>
提交
23269242
编写于
7月 30, 2019
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JSM: Update modules.
上级
b163e54d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
24 deletion
+54
-24
examples/jsm/loaders/GLTFLoader.js
examples/jsm/loaders/GLTFLoader.js
+52
-22
examples/jsm/loaders/TTFLoader.js
examples/jsm/loaders/TTFLoader.js
+2
-2
未找到文件。
examples/jsm/loaders/GLTFLoader.js
浏览文件 @
23269242
...
@@ -1940,13 +1940,15 @@ var GLTFLoader = ( function () {
...
@@ -1940,13 +1940,15 @@ var GLTFLoader = ( function () {
// The buffer is not interleaved if the stride is the item size in bytes.
// The buffer is not interleaved if the stride is the item size in bytes.
if
(
byteStride
&&
byteStride
!==
itemBytes
)
{
if
(
byteStride
&&
byteStride
!==
itemBytes
)
{
var
ibCacheKey
=
'
InterleavedBuffer:
'
+
accessorDef
.
bufferView
+
'
:
'
+
accessorDef
.
componentType
;
// Each "slice" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer
// This makes sure that IBA.count reflects accessor.count properly
var
ibSlice
=
Math
.
floor
(
byteOffset
/
byteStride
);
var
ibCacheKey
=
'
InterleavedBuffer:
'
+
accessorDef
.
bufferView
+
'
:
'
+
accessorDef
.
componentType
+
'
:
'
+
ibSlice
+
'
:
'
+
accessorDef
.
count
;
var
ib
=
parser
.
cache
.
get
(
ibCacheKey
);
var
ib
=
parser
.
cache
.
get
(
ibCacheKey
);
if
(
!
ib
)
{
if
(
!
ib
)
{
// Use the full buffer if it's interleaved.
array
=
new
TypedArray
(
bufferView
,
ibSlice
*
byteStride
,
accessorDef
.
count
*
byteStride
/
elementBytes
);
array
=
new
TypedArray
(
bufferView
);
// Integer parameters to IB/IBA are in array elements, not bytes.
// Integer parameters to IB/IBA are in array elements, not bytes.
ib
=
new
InterleavedBuffer
(
array
,
byteStride
/
elementBytes
);
ib
=
new
InterleavedBuffer
(
array
,
byteStride
/
elementBytes
);
...
@@ -1955,7 +1957,7 @@ var GLTFLoader = ( function () {
...
@@ -1955,7 +1957,7 @@ var GLTFLoader = ( function () {
}
}
bufferAttribute
=
new
InterleavedBufferAttribute
(
ib
,
itemSize
,
byteOffset
/
elementBytes
,
normalized
);
bufferAttribute
=
new
InterleavedBufferAttribute
(
ib
,
itemSize
,
(
byteOffset
%
byteStride
)
/
elementBytes
,
normalized
);
}
else
{
}
else
{
...
@@ -2977,14 +2979,11 @@ var GLTFLoader = ( function () {
...
@@ -2977,14 +2979,11 @@ var GLTFLoader = ( function () {
return
(
function
()
{
return
(
function
()
{
// .isBone isn't in glTF spec. See .markDefs
var
pending
=
[];
if
(
nodeDef
.
isBone
===
true
)
{
return
Promise
.
resolve
(
new
Bone
()
);
}
else
if
(
nodeDef
.
mesh
!==
undefined
)
{
if
(
nodeDef
.
mesh
!==
undefined
)
{
return
parser
.
getDependency
(
'
mesh
'
,
nodeDef
.
mesh
).
then
(
function
(
mesh
)
{
pending
.
push
(
parser
.
getDependency
(
'
mesh
'
,
nodeDef
.
mesh
).
then
(
function
(
mesh
)
{
var
node
;
var
node
;
...
@@ -3030,25 +3029,58 @@ var GLTFLoader = ( function () {
...
@@ -3030,25 +3029,58 @@ var GLTFLoader = ( function () {
return
node
;
return
node
;
}
);
}
)
);
}
}
else
if
(
nodeDef
.
camera
!==
undefined
)
{
if
(
nodeDef
.
camera
!==
undefined
)
{
return
parser
.
getDependency
(
'
camera
'
,
nodeDef
.
camera
);
pending
.
push
(
parser
.
getDependency
(
'
camera
'
,
nodeDef
.
camera
)
);
}
else
if
(
nodeDef
.
extensions
}
if
(
nodeDef
.
extensions
&&
nodeDef
.
extensions
[
EXTENSIONS
.
KHR_LIGHTS_PUNCTUAL
]
&&
nodeDef
.
extensions
[
EXTENSIONS
.
KHR_LIGHTS_PUNCTUAL
]
&&
nodeDef
.
extensions
[
EXTENSIONS
.
KHR_LIGHTS_PUNCTUAL
].
light
!==
undefined
)
{
&&
nodeDef
.
extensions
[
EXTENSIONS
.
KHR_LIGHTS_PUNCTUAL
].
light
!==
undefined
)
{
return
parser
.
getDependency
(
'
light
'
,
nodeDef
.
extensions
[
EXTENSIONS
.
KHR_LIGHTS_PUNCTUAL
].
light
);
pending
.
push
(
parser
.
getDependency
(
'
light
'
,
nodeDef
.
extensions
[
EXTENSIONS
.
KHR_LIGHTS_PUNCTUAL
].
light
)
);
}
return
Promise
.
all
(
pending
);
}()
).
then
(
function
(
objects
)
{
var
node
;
// .isBone isn't in glTF spec. See .markDefs
if
(
nodeDef
.
isBone
===
true
)
{
node
=
new
Bone
();
}
else
if
(
objects
.
length
>
1
)
{
node
=
new
Group
();
}
else
if
(
objects
.
length
===
1
)
{
node
=
objects
[
0
];
}
else
{
}
else
{
return
Promise
.
resolve
(
new
Object3D
()
);
node
=
new
Object3D
(
);
}
}
}()
).
then
(
function
(
node
)
{
if
(
node
!==
objects
[
0
]
)
{
for
(
var
i
=
0
,
il
=
objects
.
length
;
i
<
il
;
i
++
)
{
node
.
add
(
objects
[
i
]
);
}
}
if
(
nodeDef
.
name
!==
undefined
)
{
if
(
nodeDef
.
name
!==
undefined
)
{
...
@@ -3132,11 +3164,9 @@ var GLTFLoader = ( function () {
...
@@ -3132,11 +3164,9 @@ var GLTFLoader = ( function () {
}
).
then
(
function
(
jointNodes
)
{
}
).
then
(
function
(
jointNodes
)
{
var
meshes
=
node
.
isGroup
===
true
?
node
.
children
:
[
node
];
node
.
traverse
(
function
(
mesh
)
{
for
(
var
i
=
0
,
il
=
meshes
.
length
;
i
<
il
;
i
++
)
{
var
mesh
=
meshes
[
i
]
;
if
(
!
mesh
.
isMesh
)
return
;
var
bones
=
[];
var
bones
=
[];
var
boneInverses
=
[];
var
boneInverses
=
[];
...
@@ -3169,7 +3199,7 @@ var GLTFLoader = ( function () {
...
@@ -3169,7 +3199,7 @@ var GLTFLoader = ( function () {
mesh
.
bind
(
new
Skeleton
(
bones
,
boneInverses
),
mesh
.
matrixWorld
);
mesh
.
bind
(
new
Skeleton
(
bones
,
boneInverses
),
mesh
.
matrixWorld
);
}
}
);
return
node
;
return
node
;
...
...
examples/jsm/loaders/TTFLoader.js
浏览文件 @
23269242
...
@@ -54,7 +54,7 @@ TTFLoader.prototype = {
...
@@ -54,7 +54,7 @@ TTFLoader.prototype = {
var
glyphs
=
{};
var
glyphs
=
{};
var
scale
=
(
100000
)
/
(
(
font
.
unitsPerEm
||
2048
)
*
72
);
var
scale
=
(
100000
)
/
(
(
font
.
unitsPerEm
||
2048
)
*
72
);
var
glyphIndexMap
=
font
.
encoding
.
cmap
.
glyphIndexMap
;
var
glyphIndexMap
=
font
.
encoding
.
cmap
.
glyphIndexMap
;
var
unicodes
=
Object
.
keys
(
glyphIndexMap
);
var
unicodes
=
Object
.
keys
(
glyphIndexMap
);
...
@@ -108,7 +108,7 @@ TTFLoader.prototype = {
...
@@ -108,7 +108,7 @@ TTFLoader.prototype = {
}
);
}
);
glyphs
[
String
.
fromCodePoint
(
unicode
)
]
=
token
;
glyphs
[
String
.
fromCodePoint
(
glyph
.
unicode
)
]
=
token
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录