Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
07d57df5
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,发现更多精彩内容 >>
提交
07d57df5
编写于
8月 15, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Transplanted Geometry.computeBoundingSphere optimization to BufferGeometry.computeBoundingSphere.
上级
a85e59ed
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
7 addition
and
7 deletion
+7
-7
build/Three.js
build/Three.js
+1
-1
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+1
-1
src/extras/core/BufferGeometry.js
src/extras/core/BufferGeometry.js
+4
-4
未找到文件。
build/Three.js
浏览文件 @
07d57df5
...
...
@@ -519,7 +519,7 @@ G=void 0,A=void 0,w=void 0,C=void 0,u=n[s[p]].x,t=n[s[p]].y,z=n[s[r]].x,D=n[s[r]
a
[
g
[
i
]],
a
[
g
[
m
]]]);
h
.
push
([
g
[
j
],
g
[
i
],
g
[
m
]]);
j
=
i
;
for
(
m
=
i
+
1
;
m
<
e
;
j
++
,
m
++
)
g
[
j
]
=
g
[
m
];
e
--
;
l
=
2
*
e
}}
return
d
?
h
:
f
};
a
.
Triangulate
.
area
=
b
;
return
a
})(
THREE
.
FontUtils
);
self
.
_typeface_js
=
{
faces
:
THREE
.
FontUtils
.
faces
,
loadFace
:
THREE
.
FontUtils
.
loadFace
};
THREE
.
BufferGeometry
=
function
(){
this
.
id
=
THREE
.
GeometryCount
++
;
this
.
attributes
=
{};
this
.
dynamic
=
false
;
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=
false
;
this
.
morphTargets
=
[]};
THREE
.
BufferGeometry
.
prototype
=
{
constructor
:
THREE
.
BufferGeometry
,
applyMatrix
:
function
(
a
){
var
b
,
c
;
if
(
this
.
attributes
.
position
)
b
=
this
.
attributes
.
position
.
array
;
if
(
this
.
attributes
.
normal
)
c
=
this
.
attributes
.
normal
.
array
;
if
(
b
!==
void
0
){
a
.
multiplyVector3Array
(
b
);
this
.
verticesNeedUpdate
=
true
}
if
(
c
!==
void
0
){
b
=
new
THREE
.
Matrix4
;
b
.
extractRotation
(
a
);
b
.
multiplyVector3Array
(
c
);
this
.
normalsNeedUpdate
=
true
}},
computeBoundingBox
:
function
(){
if
(
!
this
.
boundingBox
)
this
.
boundingBox
=
{
min
:
new
THREE
.
Vector3
(
Infinity
,
Infinity
,
Infinity
),
max
:
new
THREE
.
Vector3
(
-
Infinity
,
-
Infinity
,
-
Infinity
)};
var
a
=
this
.
attributes
.
position
.
array
;
if
(
a
)
for
(
var
b
=
this
.
boundingBox
,
c
,
d
,
e
,
f
=
0
,
g
=
a
.
length
;
f
<
g
;
f
=
f
+
3
){
c
=
a
[
f
];
d
=
a
[
f
+
1
];
e
=
a
[
f
+
2
];
if
(
c
<
b
.
min
.
x
)
b
.
min
.
x
=
c
;
else
if
(
c
>
b
.
max
.
x
)
b
.
max
.
x
=
c
;
if
(
d
<
b
.
min
.
y
)
b
.
min
.
y
=
d
;
else
if
(
d
>
b
.
max
.
y
)
b
.
max
.
y
=
d
;
if
(
e
<
b
.
min
.
z
)
b
.
min
.
z
=
e
;
else
if
(
e
>
b
.
max
.
z
)
b
.
max
.
z
=
e
}
if
(
a
===
void
0
||
a
.
length
===
0
){
this
.
boundingBox
.
min
.
set
(
0
,
0
,
0
);
this
.
boundingBox
.
max
.
set
(
0
,
0
,
0
)}},
computeBoundingSphere
:
function
(){
if
(
!
this
.
boundingSphere
)
this
.
boundingSphere
=
{
radius
:
0
};
var
a
=
this
.
attributes
.
position
.
array
;
if
(
a
){
for
(
var
b
,
c
=
0
,
d
,
e
,
f
=
0
,
g
=
a
.
length
;
f
<
g
;
f
=
f
+
3
){
b
=
a
[
f
];
d
=
a
[
f
+
1
];
e
=
a
[
f
+
2
];
b
=
Math
.
sqrt
(
b
*
b
+
d
*
d
+
e
*
e
);
b
>
c
&&
(
c
=
b
)}
this
.
boundingSphere
.
radius
=
c
}},
computeVertexNormals
:
function
(){
if
(
this
.
attributes
.
position
&&
this
.
attributes
.
index
){
var
a
,
b
,
c
,
d
;
a
=
this
.
attributes
.
position
.
array
.
length
;
if
(
this
.
attributes
.
normal
===
void
0
)
this
.
attributes
.
normal
=
{
itemSize
:
3
,
array
:
new
Float32Array
(
a
),
numItems
:
a
};
else
{
a
=
0
;
for
(
b
=
this
.
attributes
.
normal
.
array
.
length
;
a
<
b
;
a
++
)
this
.
attributes
.
normal
.
array
[
a
]
=
{
radius
:
0
};
var
a
=
this
.
attributes
.
position
.
array
;
if
(
a
){
for
(
var
b
,
c
=
0
,
d
,
e
,
f
=
0
,
g
=
a
.
length
;
f
<
g
;
f
=
f
+
3
){
b
=
a
[
f
];
d
=
a
[
f
+
1
];
e
=
a
[
f
+
2
];
b
=
b
*
b
+
d
*
d
+
e
*
e
;
b
>
c
&&
(
c
=
b
)}
this
.
boundingSphere
.
radius
=
Math
.
sqrt
(
c
)
}},
computeVertexNormals
:
function
(){
if
(
this
.
attributes
.
position
&&
this
.
attributes
.
index
){
var
a
,
b
,
c
,
d
;
a
=
this
.
attributes
.
position
.
array
.
length
;
if
(
this
.
attributes
.
normal
===
void
0
)
this
.
attributes
.
normal
=
{
itemSize
:
3
,
array
:
new
Float32Array
(
a
),
numItems
:
a
};
else
{
a
=
0
;
for
(
b
=
this
.
attributes
.
normal
.
array
.
length
;
a
<
b
;
a
++
)
this
.
attributes
.
normal
.
array
[
a
]
=
0
}
var
e
=
this
.
offsets
,
f
=
this
.
attributes
.
index
.
array
,
g
=
this
.
attributes
.
position
.
array
,
h
=
this
.
attributes
.
normal
.
array
,
j
,
i
,
m
,
l
,
n
,
p
,
r
=
new
THREE
.
Vector3
,
o
=
new
THREE
.
Vector3
,
q
=
new
THREE
.
Vector3
,
s
=
new
THREE
.
Vector3
,
x
=
new
THREE
.
Vector3
;
c
=
0
;
for
(
d
=
e
.
length
;
c
<
d
;
++
c
){
b
=
e
[
c
].
start
;
j
=
e
[
c
].
count
;
var
u
=
e
[
c
].
index
;
a
=
b
;
for
(
b
=
b
+
j
;
a
<
b
;
a
=
a
+
3
){
j
=
u
+
f
[
a
];
i
=
u
+
f
[
a
+
1
];
m
=
u
+
f
[
a
+
2
];
l
=
g
[
j
*
3
];
n
=
g
[
j
*
3
+
1
];
p
=
g
[
j
*
3
+
2
];
r
.
set
(
l
,
n
,
p
);
l
=
g
[
i
*
3
];
n
=
g
[
i
*
3
+
1
];
p
=
g
[
i
*
3
+
2
];
o
.
set
(
l
,
n
,
p
);
l
=
g
[
m
*
3
];
n
=
g
[
m
*
3
+
1
];
p
=
g
[
m
*
3
+
2
];
q
.
set
(
l
,
n
,
p
);
s
.
sub
(
q
,
o
);
x
.
sub
(
r
,
o
);
s
.
crossSelf
(
x
);
h
[
j
*
3
]
=
h
[
j
*
3
]
+
s
.
x
;
h
[
j
*
3
+
1
]
=
h
[
j
*
3
+
1
]
+
s
.
y
;
h
[
j
*
3
+
2
]
=
h
[
j
*
3
+
2
]
+
s
.
z
;
h
[
i
*
3
]
=
h
[
i
*
3
]
+
s
.
x
;
h
[
i
*
3
+
1
]
=
h
[
i
*
3
+
1
]
+
s
.
y
;
h
[
i
*
3
+
2
]
=
h
[
i
*
3
+
2
]
+
s
.
z
;
h
[
m
*
3
]
=
h
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
].
addSelf
(
aa
);
m
[
b
].
addSelf
(
aa
);
m
[
c
].
addSelf
(
aa
)}
function
b
(
a
){
Fa
.
x
=
e
[
a
*
3
];
Fa
.
y
=
e
[
a
*
3
+
1
];
Fa
.
z
=
e
[
a
*
3
+
2
];
na
.
copy
(
Fa
);
ea
=
i
[
a
];
Z
.
copy
(
ea
);
Z
.
subSelf
(
Fa
.
multiplyScalar
(
Fa
.
dot
(
ea
))).
normalize
();
ja
.
cross
(
na
,
ea
);
Ia
=
ja
.
dot
(
m
[
a
]);
Aa
=
Ia
<
0
?
-
1
:
1
;
...
...
build/custom/ThreeExtras.js
浏览文件 @
07d57df5
...
...
@@ -50,7 +50,7 @@ A=void 0,x=void 0,w=void 0,C=void 0,t=n[s[k]].x,r=n[s[k]].y,v=n[s[o]].x,z=n[s[o]
b
[
g
[
j
]],
b
[
g
[
l
]]]);
h
.
push
([
g
[
i
],
g
[
j
],
g
[
l
]]);
i
=
j
;
for
(
l
=
j
+
1
;
l
<
e
;
i
++
,
l
++
)
g
[
i
]
=
g
[
l
];
e
--
;
m
=
2
*
e
}}
return
d
?
h
:
f
};
b
.
Triangulate
.
area
=
a
;
return
b
})(
THREE
.
FontUtils
);
self
.
_typeface_js
=
{
faces
:
THREE
.
FontUtils
.
faces
,
loadFace
:
THREE
.
FontUtils
.
loadFace
};
THREE
.
BufferGeometry
=
function
(){
this
.
id
=
THREE
.
GeometryCount
++
;
this
.
attributes
=
{};
this
.
dynamic
=
false
;
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=
false
;
this
.
morphTargets
=
[]};
THREE
.
BufferGeometry
.
prototype
=
{
constructor
:
THREE
.
BufferGeometry
,
applyMatrix
:
function
(
b
){
var
a
,
c
;
if
(
this
.
attributes
.
position
)
a
=
this
.
attributes
.
position
.
array
;
if
(
this
.
attributes
.
normal
)
c
=
this
.
attributes
.
normal
.
array
;
if
(
a
!==
void
0
){
b
.
multiplyVector3Array
(
a
);
this
.
verticesNeedUpdate
=
true
}
if
(
c
!==
void
0
){
a
=
new
THREE
.
Matrix4
;
a
.
extractRotation
(
b
);
a
.
multiplyVector3Array
(
c
);
this
.
normalsNeedUpdate
=
true
}},
computeBoundingBox
:
function
(){
if
(
!
this
.
boundingBox
)
this
.
boundingBox
=
{
min
:
new
THREE
.
Vector3
(
Infinity
,
Infinity
,
Infinity
),
max
:
new
THREE
.
Vector3
(
-
Infinity
,
-
Infinity
,
-
Infinity
)};
var
b
=
this
.
attributes
.
position
.
array
;
if
(
b
)
for
(
var
a
=
this
.
boundingBox
,
c
,
d
,
e
,
f
=
0
,
g
=
b
.
length
;
f
<
g
;
f
=
f
+
3
){
c
=
b
[
f
];
d
=
b
[
f
+
1
];
e
=
b
[
f
+
2
];
if
(
c
<
a
.
min
.
x
)
a
.
min
.
x
=
c
;
else
if
(
c
>
a
.
max
.
x
)
a
.
max
.
x
=
c
;
if
(
d
<
a
.
min
.
y
)
a
.
min
.
y
=
d
;
else
if
(
d
>
a
.
max
.
y
)
a
.
max
.
y
=
d
;
if
(
e
<
a
.
min
.
z
)
a
.
min
.
z
=
e
;
else
if
(
e
>
a
.
max
.
z
)
a
.
max
.
z
=
e
}
if
(
b
===
void
0
||
b
.
length
===
0
){
this
.
boundingBox
.
min
.
set
(
0
,
0
,
0
);
this
.
boundingBox
.
max
.
set
(
0
,
0
,
0
)}},
computeBoundingSphere
:
function
(){
if
(
!
this
.
boundingSphere
)
this
.
boundingSphere
=
{
radius
:
0
};
var
b
=
this
.
attributes
.
position
.
array
;
if
(
b
){
for
(
var
a
,
c
=
0
,
d
,
e
,
f
=
0
,
g
=
b
.
length
;
f
<
g
;
f
=
f
+
3
){
a
=
b
[
f
];
d
=
b
[
f
+
1
];
e
=
b
[
f
+
2
];
a
=
Math
.
sqrt
(
a
*
a
+
d
*
d
+
e
*
e
);
a
>
c
&&
(
c
=
a
)}
this
.
boundingSphere
.
radius
=
c
}},
computeVertexNormals
:
function
(){
if
(
this
.
attributes
.
position
&&
this
.
attributes
.
index
){
var
b
,
a
,
c
,
d
;
b
=
this
.
attributes
.
position
.
array
.
length
;
if
(
this
.
attributes
.
normal
===
void
0
)
this
.
attributes
.
normal
=
{
itemSize
:
3
,
array
:
new
Float32Array
(
b
),
numItems
:
b
};
else
{
b
=
0
;
for
(
a
=
this
.
attributes
.
normal
.
array
.
length
;
b
<
a
;
b
++
)
this
.
attributes
.
normal
.
array
[
b
]
=
{
radius
:
0
};
var
b
=
this
.
attributes
.
position
.
array
;
if
(
b
){
for
(
var
a
,
c
=
0
,
d
,
e
,
f
=
0
,
g
=
b
.
length
;
f
<
g
;
f
=
f
+
3
){
a
=
b
[
f
];
d
=
b
[
f
+
1
];
e
=
b
[
f
+
2
];
a
=
a
*
a
+
d
*
d
+
e
*
e
;
a
>
c
&&
(
c
=
a
)}
this
.
boundingSphere
.
radius
=
Math
.
sqrt
(
c
)
}},
computeVertexNormals
:
function
(){
if
(
this
.
attributes
.
position
&&
this
.
attributes
.
index
){
var
b
,
a
,
c
,
d
;
b
=
this
.
attributes
.
position
.
array
.
length
;
if
(
this
.
attributes
.
normal
===
void
0
)
this
.
attributes
.
normal
=
{
itemSize
:
3
,
array
:
new
Float32Array
(
b
),
numItems
:
b
};
else
{
b
=
0
;
for
(
a
=
this
.
attributes
.
normal
.
array
.
length
;
b
<
a
;
b
++
)
this
.
attributes
.
normal
.
array
[
b
]
=
0
}
var
e
=
this
.
offsets
,
f
=
this
.
attributes
.
index
.
array
,
g
=
this
.
attributes
.
position
.
array
,
h
=
this
.
attributes
.
normal
.
array
,
i
,
j
,
l
,
m
,
n
,
k
,
o
=
new
THREE
.
Vector3
,
q
=
new
THREE
.
Vector3
,
p
=
new
THREE
.
Vector3
,
s
=
new
THREE
.
Vector3
,
u
=
new
THREE
.
Vector3
;
c
=
0
;
for
(
d
=
e
.
length
;
c
<
d
;
++
c
){
a
=
e
[
c
].
start
;
i
=
e
[
c
].
count
;
var
t
=
e
[
c
].
index
;
b
=
a
;
for
(
a
=
a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
=
d
[
a
*
3
+
1
];
k
=
d
[
a
*
3
+
2
];
o
=
d
[
b
*
3
];
q
=
d
[
b
*
3
+
1
];
p
=
d
[
b
*
3
+
2
];
s
=
d
[
c
*
3
];
u
=
d
[
c
*
3
+
1
];
t
=
d
[
c
*
3
+
2
];
r
=
f
[
a
*
2
];
v
=
f
[
a
*
2
+
1
];
z
=
f
[
b
*
2
];
A
=
f
[
b
*
2
+
1
];
x
=
f
[
c
*
2
];
w
=
f
[
c
*
2
+
1
];
C
=
o
-
m
;
B
=
s
-
m
;
E
=
q
-
n
;
G
=
u
-
n
;
L
=
p
-
k
;
H
=
t
-
k
;
D
=
z
-
r
;
K
=
x
-
r
;
F
=
A
-
v
;
O
=
w
-
v
;
I
=
1
/
(
D
*
O
-
K
*
F
);
M
.
set
((
O
*
C
-
F
*
B
)
*
I
,(
O
*
E
-
F
*
G
)
*
I
,(
O
*
L
-
F
*
H
)
*
I
);
J
.
set
((
D
*
B
-
K
*
C
)
*
I
,(
D
*
G
-
K
*
E
)
*
I
,(
D
*
H
-
K
*
L
)
*
I
);
j
[
a
].
addSelf
(
M
);
j
[
b
].
addSelf
(
M
);
j
[
c
].
addSelf
(
M
);
l
[
a
].
addSelf
(
J
);
l
[
b
].
addSelf
(
J
);
l
[
c
].
addSelf
(
J
)}
function
a
(
a
){
U
.
x
=
e
[
a
*
3
];
U
.
y
=
e
[
a
*
3
+
1
];
U
.
z
=
e
[
a
*
3
+
2
];
X
.
copy
(
U
);
W
=
j
[
a
];
V
.
copy
(
W
);
V
.
subSelf
(
U
.
multiplyScalar
(
U
.
dot
(
W
))).
normalize
();
Y
.
cross
(
X
,
W
);
Z
=
Y
.
dot
(
l
[
a
]);
$
=
Z
<
0
?
-
1
:
1
;
i
[
a
*
4
]
=
V
.
x
;
i
[
a
*
4
+
1
]
=
V
.
y
;
...
...
build/custom/ThreeWebGL.js
浏览文件 @
07d57df5
...
...
@@ -431,7 +431,7 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
THREE
.
RenderableParticle
=
function
(){
this
.
rotation
=
this
.
z
=
this
.
y
=
this
.
x
=
this
.
object
=
null
;
this
.
scale
=
new
THREE
.
Vector2
;
this
.
material
=
null
};
THREE
.
RenderableLine
=
function
(){
this
.
z
=
null
;
this
.
v1
=
new
THREE
.
RenderableVertex
;
this
.
v2
=
new
THREE
.
RenderableVertex
;
this
.
material
=
null
};
THREE
.
BufferGeometry
=
function
(){
this
.
id
=
THREE
.
GeometryCount
++
;
this
.
attributes
=
{};
this
.
dynamic
=
false
;
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=
false
;
this
.
morphTargets
=
[]};
THREE
.
BufferGeometry
.
prototype
=
{
constructor
:
THREE
.
BufferGeometry
,
applyMatrix
:
function
(
a
){
var
b
,
c
;
if
(
this
.
attributes
.
position
)
b
=
this
.
attributes
.
position
.
array
;
if
(
this
.
attributes
.
normal
)
c
=
this
.
attributes
.
normal
.
array
;
if
(
b
!==
void
0
){
a
.
multiplyVector3Array
(
b
);
this
.
verticesNeedUpdate
=
true
}
if
(
c
!==
void
0
){
b
=
new
THREE
.
Matrix4
;
b
.
extractRotation
(
a
);
b
.
multiplyVector3Array
(
c
);
this
.
normalsNeedUpdate
=
true
}},
computeBoundingBox
:
function
(){
if
(
!
this
.
boundingBox
)
this
.
boundingBox
=
{
min
:
new
THREE
.
Vector3
(
Infinity
,
Infinity
,
Infinity
),
max
:
new
THREE
.
Vector3
(
-
Infinity
,
-
Infinity
,
-
Infinity
)};
var
a
=
this
.
attributes
.
position
.
array
;
if
(
a
)
for
(
var
b
=
this
.
boundingBox
,
c
,
d
,
e
,
f
=
0
,
h
=
a
.
length
;
f
<
h
;
f
=
f
+
3
){
c
=
a
[
f
];
d
=
a
[
f
+
1
];
e
=
a
[
f
+
2
];
if
(
c
<
b
.
min
.
x
)
b
.
min
.
x
=
c
;
else
if
(
c
>
b
.
max
.
x
)
b
.
max
.
x
=
c
;
if
(
d
<
b
.
min
.
y
)
b
.
min
.
y
=
d
;
else
if
(
d
>
b
.
max
.
y
)
b
.
max
.
y
=
d
;
if
(
e
<
b
.
min
.
z
)
b
.
min
.
z
=
e
;
else
if
(
e
>
b
.
max
.
z
)
b
.
max
.
z
=
e
}
if
(
a
===
void
0
||
a
.
length
===
0
){
this
.
boundingBox
.
min
.
set
(
0
,
0
,
0
);
this
.
boundingBox
.
max
.
set
(
0
,
0
,
0
)}},
computeBoundingSphere
:
function
(){
if
(
!
this
.
boundingSphere
)
this
.
boundingSphere
=
{
radius
:
0
};
var
a
=
this
.
attributes
.
position
.
array
;
if
(
a
){
for
(
var
b
,
c
=
0
,
d
,
e
,
f
=
0
,
h
=
a
.
length
;
f
<
h
;
f
=
f
+
3
){
b
=
a
[
f
];
d
=
a
[
f
+
1
];
e
=
a
[
f
+
2
];
b
=
Math
.
sqrt
(
b
*
b
+
d
*
d
+
e
*
e
);
b
>
c
&&
(
c
=
b
)}
this
.
boundingSphere
.
radius
=
c
}},
computeVertexNormals
:
function
(){
if
(
this
.
attributes
.
position
&&
this
.
attributes
.
index
){
var
a
,
b
,
c
,
d
;
a
=
this
.
attributes
.
position
.
array
.
length
;
if
(
this
.
attributes
.
normal
===
void
0
)
this
.
attributes
.
normal
=
{
itemSize
:
3
,
array
:
new
Float32Array
(
a
),
numItems
:
a
};
else
{
a
=
0
;
for
(
b
=
this
.
attributes
.
normal
.
array
.
length
;
a
<
b
;
a
++
)
this
.
attributes
.
normal
.
array
[
a
]
=
{
radius
:
0
};
var
a
=
this
.
attributes
.
position
.
array
;
if
(
a
){
for
(
var
b
,
c
=
0
,
d
,
e
,
f
=
0
,
h
=
a
.
length
;
f
<
h
;
f
=
f
+
3
){
b
=
a
[
f
];
d
=
a
[
f
+
1
];
e
=
a
[
f
+
2
];
b
=
b
*
b
+
d
*
d
+
e
*
e
;
b
>
c
&&
(
c
=
b
)}
this
.
boundingSphere
.
radius
=
Math
.
sqrt
(
c
)
}},
computeVertexNormals
:
function
(){
if
(
this
.
attributes
.
position
&&
this
.
attributes
.
index
){
var
a
,
b
,
c
,
d
;
a
=
this
.
attributes
.
position
.
array
.
length
;
if
(
this
.
attributes
.
normal
===
void
0
)
this
.
attributes
.
normal
=
{
itemSize
:
3
,
array
:
new
Float32Array
(
a
),
numItems
:
a
};
else
{
a
=
0
;
for
(
b
=
this
.
attributes
.
normal
.
array
.
length
;
a
<
b
;
a
++
)
this
.
attributes
.
normal
.
array
[
a
]
=
0
}
var
e
=
this
.
offsets
,
f
=
this
.
attributes
.
index
.
array
,
h
=
this
.
attributes
.
position
.
array
,
i
=
this
.
attributes
.
normal
.
array
,
l
,
k
,
j
,
o
,
m
,
p
,
u
=
new
THREE
.
Vector3
,
n
=
new
THREE
.
Vector3
,
q
=
new
THREE
.
Vector3
,
r
=
new
THREE
.
Vector3
,
w
=
new
THREE
.
Vector3
;
c
=
0
;
for
(
d
=
e
.
length
;
c
<
d
;
++
c
){
b
=
e
[
c
].
start
;
l
=
e
[
c
].
count
;
var
v
=
e
[
c
].
index
;
a
=
b
;
for
(
b
=
b
+
l
;
a
<
b
;
a
=
a
+
3
){
l
=
v
+
f
[
a
];
k
=
v
+
f
[
a
+
1
];
j
=
v
+
f
[
a
+
2
];
o
=
h
[
l
*
3
];
m
=
h
[
l
*
3
+
1
];
p
=
h
[
l
*
3
+
2
];
u
.
set
(
o
,
m
,
p
);
o
=
h
[
k
*
3
];
m
=
h
[
k
*
3
+
1
];
p
=
h
[
k
*
3
+
2
];
n
.
set
(
o
,
m
,
p
);
o
=
h
[
j
*
3
];
m
=
h
[
j
*
3
+
1
];
p
=
h
[
j
*
3
+
2
];
q
.
set
(
o
,
m
,
p
);
r
.
sub
(
q
,
n
);
w
.
sub
(
u
,
n
);
r
.
crossSelf
(
w
);
i
[
l
*
3
]
=
i
[
l
*
3
]
+
r
.
x
;
i
[
l
*
3
+
1
]
=
i
[
l
*
3
+
1
]
+
r
.
y
;
i
[
l
*
3
+
2
]
=
i
[
l
*
3
+
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
T
-
ea
*
A
)
*
aa
);
Aa
.
set
((
M
*
F
-
G
*
Q
)
*
aa
,(
M
*
V
-
G
*
W
)
*
aa
,(
M
*
A
-
G
*
T
)
*
aa
);
k
[
a
].
addSelf
(
P
);
k
[
b
].
addSelf
(
P
);
k
[
c
].
addSelf
(
P
);
j
[
a
].
addSelf
(
Aa
);
j
[
b
].
addSelf
(
Aa
);
j
[
c
].
addSelf
(
Aa
)}
function
b
(
a
){
Ga
.
x
=
e
[
a
*
3
];
Ga
.
y
=
e
[
a
*
3
+
1
];
Ga
.
z
=
e
[
a
*
3
+
2
];
la
.
copy
(
Ga
);
ua
=
k
[
a
];
fa
.
copy
(
ua
);
fa
.
subSelf
(
Ga
.
multiplyScalar
(
Ga
.
dot
(
ua
))).
normalize
();
Ja
.
cross
(
la
,
ua
);
Xa
=
Ja
.
dot
(
j
[
a
]);
...
...
src/extras/core/BufferGeometry.js
浏览文件 @
07d57df5
...
...
@@ -137,7 +137,7 @@ THREE.BufferGeometry.prototype = {
if
(
positions
)
{
var
radius
,
maxRadius
=
0
;
var
radius
Sq
,
maxRadiusSq
=
0
;
var
x
,
y
,
z
;
for
(
var
i
=
0
,
il
=
positions
.
length
;
i
<
il
;
i
+=
3
)
{
...
...
@@ -146,12 +146,12 @@ THREE.BufferGeometry.prototype = {
y
=
positions
[
i
+
1
];
z
=
positions
[
i
+
2
];
radius
=
Math
.
sqrt
(
x
*
x
+
y
*
y
+
z
*
z
)
;
if
(
radius
>
maxRadius
)
maxRadius
=
radius
;
radius
Sq
=
x
*
x
+
y
*
y
+
z
*
z
;
if
(
radius
Sq
>
maxRadiusSq
)
maxRadiusSq
=
radiusSq
;
}
this
.
boundingSphere
.
radius
=
maxRadius
;
this
.
boundingSphere
.
radius
=
Math
.
sqrt
(
maxRadiusSq
)
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录