Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
d65aec18
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
d65aec18
编写于
8月 13, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Moved `object.dynamic` to `geometry.dynamic`.
上级
5bbb1327
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
89 addition
and
87 deletion
+89
-87
build/Three.js
build/Three.js
+59
-59
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+1
-1
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+22
-22
examples/webgl_geometry_dynamic.html
examples/webgl_geometry_dynamic.html
+1
-1
src/core/Geometry.js
src/core/Geometry.js
+2
-0
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+3
-3
未找到文件。
build/Three.js
浏览文件 @
d65aec18
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
d65aec18
...
@@ -57,7 +57,7 @@ k=this.w,l=k*c+e*f-h*d,m=k*d+h*c-g*f,i=k*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=l*k+c*-g+m
...
@@ -57,7 +57,7 @@ k=this.w,l=k*c+e*f-h*d,m=k*d+h*c-g*f,i=k*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=l*k+c*-g+m
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
f
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
f
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
f
),
e
=
Math
.
sqrt
(
1
-
f
*
f
);
if
(
Math
.
abs
(
e
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
f
=
Math
.
sin
((
1
-
d
)
*
g
)
/
e
;
d
=
Math
.
sin
(
d
*
g
)
/
e
;
c
.
w
=
a
.
w
*
f
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
f
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
f
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
f
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
f
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
f
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
f
),
e
=
Math
.
sqrt
(
1
-
f
*
f
);
if
(
Math
.
abs
(
e
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
f
=
Math
.
sin
((
1
-
d
)
*
g
)
/
e
;
d
=
Math
.
sin
(
d
*
g
)
/
e
;
c
.
w
=
a
.
w
*
f
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
f
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
f
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
f
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
f
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
f
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
f
,
g
,
e
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
e
instanceof
Array
?
e
:[
e
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
f
,
g
,
e
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
e
instanceof
Array
?
e
:[
e
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
dynamic
=
this
.
hasTangents
=!
1
};
THREE
.
Geometry
.
prototype
=
{
constructor
:
THREE
.
Geometry
,
computeCentroids
:
function
(){
var
a
,
b
,
c
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
)
c
=
this
.
faces
[
a
],
c
.
centroid
.
set
(
0
,
0
,
0
),
c
instanceof
THREE
.
Face3
?(
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
),
c
.
centroid
.
divideScalar
(
3
)):
c
instanceof
THREE
.
Face4
&&
(
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
),
THREE
.
Geometry
.
prototype
=
{
constructor
:
THREE
.
Geometry
,
computeCentroids
:
function
(){
var
a
,
b
,
c
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
)
c
=
this
.
faces
[
a
],
c
.
centroid
.
set
(
0
,
0
,
0
),
c
instanceof
THREE
.
Face3
?(
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
),
c
.
centroid
.
divideScalar
(
3
)):
c
instanceof
THREE
.
Face4
&&
(
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
d
].
position
),
c
.
centroid
.
divideScalar
(
4
))},
computeFaceNormals
:
function
(
a
){
var
b
,
c
,
d
,
f
,
g
,
e
,
h
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
;
d
=
0
;
for
(
f
=
this
.
faces
.
length
;
d
<
f
;
d
++
){
g
=
this
.
faces
[
d
];
if
(
a
&&
g
.
vertexNormals
.
length
){
h
.
set
(
0
,
0
,
0
);
b
=
0
;
for
(
c
=
g
.
vertexNormals
.
length
;
b
<
c
;
b
++
)
h
.
addSelf
(
g
.
vertexNormals
[
b
]);
h
.
divideScalar
(
3
)}
else
b
=
this
.
vertices
[
g
.
a
],
c
=
this
.
vertices
[
g
.
b
],
e
=
this
.
vertices
[
g
.
c
],
h
.
sub
(
e
.
position
,
c
.
position
),
k
.
sub
(
b
.
position
,
c
.
position
),
h
.
crossSelf
(
k
);
h
.
isZero
()
||
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
d
].
position
),
c
.
centroid
.
divideScalar
(
4
))},
computeFaceNormals
:
function
(
a
){
var
b
,
c
,
d
,
f
,
g
,
e
,
h
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
;
d
=
0
;
for
(
f
=
this
.
faces
.
length
;
d
<
f
;
d
++
){
g
=
this
.
faces
[
d
];
if
(
a
&&
g
.
vertexNormals
.
length
){
h
.
set
(
0
,
0
,
0
);
b
=
0
;
for
(
c
=
g
.
vertexNormals
.
length
;
b
<
c
;
b
++
)
h
.
addSelf
(
g
.
vertexNormals
[
b
]);
h
.
divideScalar
(
3
)}
else
b
=
this
.
vertices
[
g
.
a
],
c
=
this
.
vertices
[
g
.
b
],
e
=
this
.
vertices
[
g
.
c
],
h
.
sub
(
e
.
position
,
c
.
position
),
k
.
sub
(
b
.
position
,
c
.
position
),
h
.
crossSelf
(
k
);
h
.
isZero
()
||
h
.
normalize
();
g
.
normal
.
copy
(
h
)}},
computeVertexNormals
:
function
(){
var
a
,
b
,
c
,
d
;
if
(
this
.
__tmpVertices
==
void
0
){
d
=
this
.
__tmpVertices
=
Array
(
this
.
vertices
.
length
);
a
=
0
;
for
(
b
=
this
.
vertices
.
length
;
a
<
b
;
a
++
)
d
[
a
]
=
new
THREE
.
Vector3
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
)
if
(
c
=
this
.
faces
[
a
],
c
instanceof
THREE
.
Face3
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
];
else
if
(
c
instanceof
THREE
.
Face4
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
]}
else
{
d
=
h
.
normalize
();
g
.
normal
.
copy
(
h
)}},
computeVertexNormals
:
function
(){
var
a
,
b
,
c
,
d
;
if
(
this
.
__tmpVertices
==
void
0
){
d
=
this
.
__tmpVertices
=
Array
(
this
.
vertices
.
length
);
a
=
0
;
for
(
b
=
this
.
vertices
.
length
;
a
<
b
;
a
++
)
d
[
a
]
=
new
THREE
.
Vector3
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
)
if
(
c
=
this
.
faces
[
a
],
c
instanceof
THREE
.
Face3
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
];
else
if
(
c
instanceof
THREE
.
Face4
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
]}
else
{
d
=
...
...
build/custom/ThreeSVG.js
浏览文件 @
d65aec18
...
@@ -57,7 +57,7 @@ l=this.w,i=l*c+e*f-h*d,k=l*d+h*c-g*f,j=l*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=i*l+c*-g+k
...
@@ -57,7 +57,7 @@ l=this.w,i=l*c+e*f-h*d,k=l*d+h*c-g*f,j=l*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=i*l+c*-g+k
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
f
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
f
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
f
),
e
=
Math
.
sqrt
(
1
-
f
*
f
);
if
(
Math
.
abs
(
e
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
f
=
Math
.
sin
((
1
-
d
)
*
g
)
/
e
;
d
=
Math
.
sin
(
d
*
g
)
/
e
;
c
.
w
=
a
.
w
*
f
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
f
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
f
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
f
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
f
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
f
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
f
),
e
=
Math
.
sqrt
(
1
-
f
*
f
);
if
(
Math
.
abs
(
e
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
f
=
Math
.
sin
((
1
-
d
)
*
g
)
/
e
;
d
=
Math
.
sin
(
d
*
g
)
/
e
;
c
.
w
=
a
.
w
*
f
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
f
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
f
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
f
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
f
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
f
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
f
,
g
,
e
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
e
instanceof
Array
?
e
:[
e
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
f
,
g
,
e
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
e
instanceof
Array
?
e
:[
e
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
dynamic
=
this
.
hasTangents
=!
1
};
THREE
.
Geometry
.
prototype
=
{
constructor
:
THREE
.
Geometry
,
computeCentroids
:
function
(){
var
a
,
b
,
c
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
)
c
=
this
.
faces
[
a
],
c
.
centroid
.
set
(
0
,
0
,
0
),
c
instanceof
THREE
.
Face3
?(
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
),
c
.
centroid
.
divideScalar
(
3
)):
c
instanceof
THREE
.
Face4
&&
(
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
),
THREE
.
Geometry
.
prototype
=
{
constructor
:
THREE
.
Geometry
,
computeCentroids
:
function
(){
var
a
,
b
,
c
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
)
c
=
this
.
faces
[
a
],
c
.
centroid
.
set
(
0
,
0
,
0
),
c
instanceof
THREE
.
Face3
?(
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
),
c
.
centroid
.
divideScalar
(
3
)):
c
instanceof
THREE
.
Face4
&&
(
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
),
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
d
].
position
),
c
.
centroid
.
divideScalar
(
4
))},
computeFaceNormals
:
function
(
a
){
var
b
,
c
,
d
,
f
,
g
,
e
,
h
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
;
d
=
0
;
for
(
f
=
this
.
faces
.
length
;
d
<
f
;
d
++
){
g
=
this
.
faces
[
d
];
if
(
a
&&
g
.
vertexNormals
.
length
){
h
.
set
(
0
,
0
,
0
);
b
=
0
;
for
(
c
=
g
.
vertexNormals
.
length
;
b
<
c
;
b
++
)
h
.
addSelf
(
g
.
vertexNormals
[
b
]);
h
.
divideScalar
(
3
)}
else
b
=
this
.
vertices
[
g
.
a
],
c
=
this
.
vertices
[
g
.
b
],
e
=
this
.
vertices
[
g
.
c
],
h
.
sub
(
e
.
position
,
c
.
position
),
l
.
sub
(
b
.
position
,
c
.
position
),
h
.
crossSelf
(
l
);
h
.
isZero
()
||
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
d
].
position
),
c
.
centroid
.
divideScalar
(
4
))},
computeFaceNormals
:
function
(
a
){
var
b
,
c
,
d
,
f
,
g
,
e
,
h
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
;
d
=
0
;
for
(
f
=
this
.
faces
.
length
;
d
<
f
;
d
++
){
g
=
this
.
faces
[
d
];
if
(
a
&&
g
.
vertexNormals
.
length
){
h
.
set
(
0
,
0
,
0
);
b
=
0
;
for
(
c
=
g
.
vertexNormals
.
length
;
b
<
c
;
b
++
)
h
.
addSelf
(
g
.
vertexNormals
[
b
]);
h
.
divideScalar
(
3
)}
else
b
=
this
.
vertices
[
g
.
a
],
c
=
this
.
vertices
[
g
.
b
],
e
=
this
.
vertices
[
g
.
c
],
h
.
sub
(
e
.
position
,
c
.
position
),
l
.
sub
(
b
.
position
,
c
.
position
),
h
.
crossSelf
(
l
);
h
.
isZero
()
||
h
.
normalize
();
g
.
normal
.
copy
(
h
)}},
computeVertexNormals
:
function
(){
var
a
,
b
,
c
,
d
;
if
(
this
.
__tmpVertices
==
void
0
){
d
=
this
.
__tmpVertices
=
Array
(
this
.
vertices
.
length
);
a
=
0
;
for
(
b
=
this
.
vertices
.
length
;
a
<
b
;
a
++
)
d
[
a
]
=
new
THREE
.
Vector3
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
)
if
(
c
=
this
.
faces
[
a
],
c
instanceof
THREE
.
Face3
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
];
else
if
(
c
instanceof
THREE
.
Face4
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
]}
else
{
d
=
h
.
normalize
();
g
.
normal
.
copy
(
h
)}},
computeVertexNormals
:
function
(){
var
a
,
b
,
c
,
d
;
if
(
this
.
__tmpVertices
==
void
0
){
d
=
this
.
__tmpVertices
=
Array
(
this
.
vertices
.
length
);
a
=
0
;
for
(
b
=
this
.
vertices
.
length
;
a
<
b
;
a
++
)
d
[
a
]
=
new
THREE
.
Vector3
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
)
if
(
c
=
this
.
faces
[
a
],
c
instanceof
THREE
.
Face3
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
];
else
if
(
c
instanceof
THREE
.
Face4
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
]}
else
{
d
=
...
...
build/custom/ThreeWebGL.js
浏览文件 @
d65aec18
此差异已折叠。
点击以展开。
examples/webgl_geometry_dynamic.html
浏览文件 @
d65aec18
...
@@ -90,6 +90,7 @@
...
@@ -90,6 +90,7 @@
camera
.
target
.
position
.
y
=
camera
.
position
.
y
;
camera
.
target
.
position
.
y
=
camera
.
position
.
y
;
geometry
=
new
THREE
.
PlaneGeometry
(
20000
,
20000
,
worldWidth
-
1
,
worldDepth
-
1
);
geometry
=
new
THREE
.
PlaneGeometry
(
20000
,
20000
,
worldWidth
-
1
,
worldDepth
-
1
);
geometry
.
dynamic
=
true
;
var
i
,
j
,
il
,
jl
;
var
i
,
j
,
il
,
jl
;
...
@@ -111,7 +112,6 @@
...
@@ -111,7 +112,6 @@
material
=
new
THREE
.
MeshBasicMaterial
(
{
color
:
0x0044ff
,
opacity
:
1
,
map
:
texture
}
);
material
=
new
THREE
.
MeshBasicMaterial
(
{
color
:
0x0044ff
,
opacity
:
1
,
map
:
texture
}
);
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
dynamic
=
true
;
mesh
.
rotation
.
x
=
-
90
*
Math
.
PI
/
180
;
mesh
.
rotation
.
x
=
-
90
*
Math
.
PI
/
180
;
scene
.
addObject
(
mesh
);
scene
.
addObject
(
mesh
);
...
...
src/core/Geometry.js
浏览文件 @
d65aec18
...
@@ -30,6 +30,8 @@ THREE.Geometry = function () {
...
@@ -30,6 +30,8 @@ THREE.Geometry = function () {
this
.
hasTangents
=
false
;
this
.
hasTangents
=
false
;
this
.
dynamic
=
false
;
// unless set to true the *Arrays will be deleted once sent to a buffer.
};
};
THREE
.
Geometry
.
prototype
=
{
THREE
.
Geometry
.
prototype
=
{
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
d65aec18
...
@@ -887,7 +887,7 @@ THREE.WebGLRenderer = function ( parameters ) {
...
@@ -887,7 +887,7 @@ THREE.WebGLRenderer = function ( parameters ) {
};
};
function
setMeshBuffers
(
geometryGroup
,
object
,
hint
)
{
function
setMeshBuffers
(
geometryGroup
,
object
,
hint
,
dispose
)
{
if
(
!
geometryGroup
.
__inittedArrays
)
{
if
(
!
geometryGroup
.
__inittedArrays
)
{
...
@@ -2076,7 +2076,7 @@ THREE.WebGLRenderer = function ( parameters ) {
...
@@ -2076,7 +2076,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
}
if
(
!
object
.
dynamic
)
{
if
(
dispose
)
{
delete
geometryGroup
.
__inittedArrays
;
delete
geometryGroup
.
__inittedArrays
;
delete
geometryGroup
.
__colorArray
;
delete
geometryGroup
.
__colorArray
;
...
@@ -4715,7 +4715,7 @@ THREE.WebGLRenderer = function ( parameters ) {
...
@@ -4715,7 +4715,7 @@ THREE.WebGLRenderer = function ( parameters ) {
geometry
.
__dirtyUvs
||
geometry
.
__dirtyNormals
||
geometry
.
__dirtyUvs
||
geometry
.
__dirtyNormals
||
geometry
.
__dirtyColors
||
geometry
.
__dirtyTangents
||
customAttributeDirty
)
{
geometry
.
__dirtyColors
||
geometry
.
__dirtyTangents
||
customAttributeDirty
)
{
setMeshBuffers
(
geometryGroup
,
object
,
_gl
.
DYNAMIC_DRAW
);
setMeshBuffers
(
geometryGroup
,
object
,
_gl
.
DYNAMIC_DRAW
,
!
geometry
.
dynamic
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录