Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
43d6053f
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,发现更多精彩内容 >>
提交
43d6053f
编写于
4月 04, 2017
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
BufferGeometryLoader/ObjectLoader: Avoid unnecessary object allocations.
上级
50b433ec
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
43 deletion
+42
-43
src/loaders/BufferGeometryLoader.js
src/loaders/BufferGeometryLoader.js
+11
-12
src/loaders/ObjectLoader.js
src/loaders/ObjectLoader.js
+31
-31
未找到文件。
src/loaders/BufferGeometryLoader.js
浏览文件 @
43d6053f
...
...
@@ -37,18 +37,6 @@ Object.assign( BufferGeometryLoader.prototype, {
var
index
=
json
.
data
.
index
;
var
TYPED_ARRAYS
=
{
'
Int8Array
'
:
Int8Array
,
'
Uint8Array
'
:
Uint8Array
,
'
Uint8ClampedArray
'
:
Uint8ClampedArray
,
'
Int16Array
'
:
Int16Array
,
'
Uint16Array
'
:
Uint16Array
,
'
Int32Array
'
:
Int32Array
,
'
Uint32Array
'
:
Uint32Array
,
'
Float32Array
'
:
Float32Array
,
'
Float64Array
'
:
Float64Array
};
if
(
index
!==
undefined
)
{
var
typedArray
=
new
TYPED_ARRAYS
[
index
.
type
](
index
.
array
);
...
...
@@ -103,5 +91,16 @@ Object.assign( BufferGeometryLoader.prototype, {
}
);
var
TYPED_ARRAYS
=
{
Int8Array
:
Int8Array
,
Uint8Array
:
Uint8Array
,
Uint8ClampedArray
:
Uint8ClampedArray
,
Int16Array
:
Int16Array
,
Uint16Array
:
Uint16Array
,
Int32Array
:
Int32Array
,
Uint32Array
:
Uint32Array
,
Float32Array
:
Float32Array
,
Float64Array
:
Float64Array
};
export
{
BufferGeometryLoader
};
src/loaders/ObjectLoader.js
浏览文件 @
43d6053f
...
...
@@ -436,32 +436,6 @@ Object.assign( ObjectLoader.prototype, {
parseTextures
:
function
(
json
,
images
)
{
var
TextureMapping
=
{
UVMapping
:
UVMapping
,
CubeReflectionMapping
:
CubeReflectionMapping
,
CubeRefractionMapping
:
CubeRefractionMapping
,
EquirectangularReflectionMapping
:
EquirectangularReflectionMapping
,
EquirectangularRefractionMapping
:
EquirectangularRefractionMapping
,
SphericalReflectionMapping
:
SphericalReflectionMapping
,
CubeUVReflectionMapping
:
CubeUVReflectionMapping
,
CubeUVRefractionMapping
:
CubeUVRefractionMapping
};
var
TextureWrapping
=
{
RepeatWrapping
:
RepeatWrapping
,
ClampToEdgeWrapping
:
ClampToEdgeWrapping
,
MirroredRepeatWrapping
:
MirroredRepeatWrapping
};
var
TextureFilter
=
{
NearestFilter
:
NearestFilter
,
NearestMipMapNearestFilter
:
NearestMipMapNearestFilter
,
NearestMipMapLinearFilter
:
NearestMipMapLinearFilter
,
LinearFilter
:
LinearFilter
,
LinearMipMapNearestFilter
:
LinearMipMapNearestFilter
,
LinearMipMapLinearFilter
:
LinearMipMapLinearFilter
};
function
parseConstant
(
value
,
type
)
{
if
(
typeof
(
value
)
===
'
number
'
)
return
value
;
...
...
@@ -499,19 +473,19 @@ Object.assign( ObjectLoader.prototype, {
if
(
data
.
name
!==
undefined
)
texture
.
name
=
data
.
name
;
if
(
data
.
mapping
!==
undefined
)
texture
.
mapping
=
parseConstant
(
data
.
mapping
,
T
extureMapping
);
if
(
data
.
mapping
!==
undefined
)
texture
.
mapping
=
parseConstant
(
data
.
mapping
,
T
EXTURE_MAPPING
);
if
(
data
.
offset
!==
undefined
)
texture
.
offset
.
fromArray
(
data
.
offset
);
if
(
data
.
repeat
!==
undefined
)
texture
.
repeat
.
fromArray
(
data
.
repeat
);
if
(
data
.
wrap
!==
undefined
)
{
texture
.
wrapS
=
parseConstant
(
data
.
wrap
[
0
],
T
extureWrapping
);
texture
.
wrapT
=
parseConstant
(
data
.
wrap
[
1
],
T
extureWrapping
);
texture
.
wrapS
=
parseConstant
(
data
.
wrap
[
0
],
T
EXTURE_WRAPPING
);
texture
.
wrapT
=
parseConstant
(
data
.
wrap
[
1
],
T
EXTURE_WRAPPING
);
}
if
(
data
.
minFilter
!==
undefined
)
texture
.
minFilter
=
parseConstant
(
data
.
minFilter
,
T
extureFilter
);
if
(
data
.
magFilter
!==
undefined
)
texture
.
magFilter
=
parseConstant
(
data
.
magFilter
,
T
extureFilter
);
if
(
data
.
minFilter
!==
undefined
)
texture
.
minFilter
=
parseConstant
(
data
.
minFilter
,
T
EXTURE_FILTER
);
if
(
data
.
magFilter
!==
undefined
)
texture
.
magFilter
=
parseConstant
(
data
.
magFilter
,
T
EXTURE_FILTER
);
if
(
data
.
anisotropy
!==
undefined
)
texture
.
anisotropy
=
data
.
anisotropy
;
if
(
data
.
flipY
!==
undefined
)
texture
.
flipY
=
data
.
flipY
;
...
...
@@ -807,5 +781,31 @@ Object.assign( ObjectLoader.prototype, {
}
);
var
TEXTURE_MAPPING
=
{
UVMapping
:
UVMapping
,
CubeReflectionMapping
:
CubeReflectionMapping
,
CubeRefractionMapping
:
CubeRefractionMapping
,
EquirectangularReflectionMapping
:
EquirectangularReflectionMapping
,
EquirectangularRefractionMapping
:
EquirectangularRefractionMapping
,
SphericalReflectionMapping
:
SphericalReflectionMapping
,
CubeUVReflectionMapping
:
CubeUVReflectionMapping
,
CubeUVRefractionMapping
:
CubeUVRefractionMapping
};
var
TEXTURE_WRAPPING
=
{
RepeatWrapping
:
RepeatWrapping
,
ClampToEdgeWrapping
:
ClampToEdgeWrapping
,
MirroredRepeatWrapping
:
MirroredRepeatWrapping
};
var
TEXTURE_FILTER
=
{
NearestFilter
:
NearestFilter
,
NearestMipMapNearestFilter
:
NearestMipMapNearestFilter
,
NearestMipMapLinearFilter
:
NearestMipMapLinearFilter
,
LinearFilter
:
LinearFilter
,
LinearMipMapNearestFilter
:
LinearMipMapNearestFilter
,
LinearMipMapLinearFilter
:
LinearMipMapLinearFilter
};
export
{
ObjectLoader
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录