Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
13591237
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,发现更多精彩内容 >>
提交
13591237
编写于
6月 20, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
LOD: Rename .objects to .levels. See #6661.
上级
9424f7e1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
14 deletion
+32
-14
src/objects/LOD.js
src/objects/LOD.js
+32
-14
未找到文件。
src/objects/LOD.js
浏览文件 @
13591237
...
...
@@ -8,7 +8,18 @@ THREE.LOD = function () {
THREE
.
Object3D
.
call
(
this
);
this
.
objects
=
[];
Object
.
defineProperties
(
this
,
{
levels
:
{
enumerable
:
true
,
value
:
[]
},
objects
:
{
get
:
function
()
{
console
.
warn
(
'
THREE.LOD: .objects has been renamed to .levels.
'
);
return
this
.
levels
;
}
}
}
);
};
...
...
@@ -22,9 +33,11 @@ THREE.LOD.prototype.addLevel = function ( object, distance ) {
distance
=
Math
.
abs
(
distance
);
for
(
var
l
=
0
;
l
<
this
.
objects
.
length
;
l
++
)
{
var
levels
=
this
.
levels
;
for
(
var
l
=
0
;
l
<
levels
.
length
;
l
++
)
{
if
(
distance
<
this
.
object
s
[
l
].
distance
)
{
if
(
distance
<
level
s
[
l
].
distance
)
{
break
;
...
...
@@ -32,16 +45,19 @@ THREE.LOD.prototype.addLevel = function ( object, distance ) {
}
this
.
objects
.
splice
(
l
,
0
,
{
distance
:
distance
,
object
:
object
}
);
levels
.
splice
(
l
,
0
,
{
distance
:
distance
,
object
:
object
}
);
this
.
add
(
object
);
};
THREE
.
LOD
.
prototype
.
getObjectForDistance
=
function
(
distance
)
{
for
(
var
i
=
1
,
l
=
this
.
objects
.
length
;
i
<
l
;
i
++
)
{
var
levels
=
this
.
levels
;
for
(
var
i
=
1
,
l
=
levels
.
length
;
i
<
l
;
i
++
)
{
if
(
distance
<
this
.
object
s
[
i
].
distance
)
{
if
(
distance
<
level
s
[
i
].
distance
)
{
break
;
...
...
@@ -49,7 +65,7 @@ THREE.LOD.prototype.getObjectForDistance = function ( distance ) {
}
return
this
.
object
s
[
i
-
1
].
object
;
return
level
s
[
i
-
1
].
object
;
};
...
...
@@ -76,21 +92,23 @@ THREE.LOD.prototype.update = function () {
return
function
(
camera
)
{
if
(
this
.
objects
.
length
>
1
)
{
var
levels
=
this
.
levels
;
if
(
levels
.
length
>
1
)
{
v1
.
setFromMatrixPosition
(
camera
.
matrixWorld
);
v2
.
setFromMatrixPosition
(
this
.
matrixWorld
);
var
distance
=
v1
.
distanceTo
(
v2
);
this
.
object
s
[
0
].
object
.
visible
=
true
;
level
s
[
0
].
object
.
visible
=
true
;
for
(
var
i
=
1
,
l
=
this
.
object
s
.
length
;
i
<
l
;
i
++
)
{
for
(
var
i
=
1
,
l
=
level
s
.
length
;
i
<
l
;
i
++
)
{
if
(
distance
>=
this
.
object
s
[
i
].
distance
)
{
if
(
distance
>=
level
s
[
i
].
distance
)
{
this
.
object
s
[
i
-
1
].
object
.
visible
=
false
;
this
.
object
s
[
i
].
object
.
visible
=
true
;
level
s
[
i
-
1
].
object
.
visible
=
false
;
level
s
[
i
].
object
.
visible
=
true
;
}
else
{
...
...
@@ -102,7 +120,7 @@ THREE.LOD.prototype.update = function () {
for
(
;
i
<
l
;
i
++
)
{
this
.
object
s
[
i
].
object
.
visible
=
false
;
level
s
[
i
].
object
.
visible
=
false
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录