Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ce207788
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,发现更多精彩内容 >>
提交
ce207788
编写于
1月 07, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
344b375c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
26 deletion
+45
-26
build/three.js
build/three.js
+43
-24
build/three.min.js
build/three.min.js
+2
-2
未找到文件。
build/three.js
浏览文件 @
ce207788
...
...
@@ -31719,55 +31719,74 @@ THREE.ShapeGeometry.prototype.addShape = function ( shape, options ) {
/**
* @author astrodud / http://astrodud.isgreat.org/
* @author zz85 / https://github.com/zz85
* @author bhouston / http://exocortex.com
*/
THREE.LatheGeometry = function ( points, steps, angle ) {
// points - to create a closed torus, one must use a set of points
// like so: [ a, b, c, d, a ], see first is the same as last.
// segments - the number of circumference segments to create
// phiStart - the starting radian
// phiLength - the radian (0 to 2*PI) range of the lathed section
// 2*pi is a closed lathe, less than 2PI is a portion.
THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {
THREE.Geometry.call( this );
var _steps = steps || 12;
var _angle = angle || 2 * Math.PI;
segments = segments || 12;
phiStart = phiStart || 0;
phiLength = phiLength || 2 * Math.PI;
var
_newV = []
;
var
_matrix = new THREE.Matrix4().makeRotationZ( _angle / _steps )
;
var
inversePointLength = 1.0 / points.length
;
var
inverseSegments = 1.0 / segments
;
for ( var
j = 0; j < points.length; j
++ ) {
for ( var
i = 0, il = segments; i <= il; i
++ ) {
_newV[ j ] = points[ j ].clone();
this.vertices.push( _newV[ j ] );
var phi = phiStart + i * inverseSegments * phiLength;
}
var c = Math.cos( phi ),
s = Math.sin( phi );
var i, il = _steps + 1;
for ( var j = 0, jl = points.length; j < jl; j ++ ) {
for ( i = 0; i < il; i ++ ) {
var pt = points[ j ];
var vertex = new THREE.Vector3();
for ( var j = 0; j < _newV.length; j ++ ) {
vertex.x = c * pt.x - s * pt.y;
vertex.y = s * pt.x + c * pt.y;
vertex.z = pt.z;
_newV[ j ] = _newV[ j ].clone().applyMatrix4( _matrix );
this.vertices.push( _newV[ j ] );
this.vertices.push( vertex );
}
}
for ( i = 0; i < _steps; i ++ ) {
var np = points.length;
for ( var k = 0, kl = points.length; k < kl - 1; k
++ ) {
for ( var i = 0, il = segments; i < il; i
++ ) {
var a = i * kl + k;
var b = ( ( i + 1 ) % il ) * kl + k;
var c = ( ( i + 1 ) % il ) * kl + ( k + 1 ) % kl;
var d = i * kl + ( k + 1 ) % kl;
for ( var j = 0, jl = points.length - 1; j < jl; j ++ ) {
var base = j + np * i;
var a = base;
var b = base + np;
var c = base + 1 + np;
var d = base + 1;
this.faces.push( new THREE.Face4( a, b, c, d ) );
var u0 = 1 - i * inverseSegments;
var v0 = j * inversePointLength;
var u1 = u0 - inverseSegments;
var v1 = v0 + inversePointLength;
this.faceVertexUvs[ 0 ].push( [
new THREE.Vector2(
1 - i / _steps, k / kl ),
new THREE.Vector2(
1 - ( i + 1 ) / _steps, k / kl
),
new THREE.Vector2(
1 - ( i + 1 ) / _steps, ( k + 1 ) / kl
),
new THREE.Vector2(
1 - i / _steps, ( k + 1 ) / kl
)
new THREE.Vector2(
u0, v0 ),
new THREE.Vector2(
u1, v0
),
new THREE.Vector2(
u1, v1
),
new THREE.Vector2(
u0, v1
)
] );
...
...
build/three.min.js
浏览文件 @
ce207788
...
...
@@ -609,8 +609,8 @@ THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.
m
=
a
.
vertices
[
g
].
y
,
g
=
a
.
vertices
[
g
].
z
,
p
=
a
.
vertices
[
h
].
x
,
n
=
a
.
vertices
[
h
].
y
,
a
=
a
.
vertices
[
h
].
z
;
return
0.01
>
Math
.
abs
(
c
-
i
)?[
new
THREE
.
Vector2
(
b
,
1
-
e
),
new
THREE
.
Vector2
(
d
,
1
-
f
),
new
THREE
.
Vector2
(
k
,
1
-
g
),
new
THREE
.
Vector2
(
p
,
1
-
a
)]:[
new
THREE
.
Vector2
(
c
,
1
-
e
),
new
THREE
.
Vector2
(
i
,
1
-
f
),
new
THREE
.
Vector2
(
m
,
1
-
g
),
new
THREE
.
Vector2
(
n
,
1
-
a
)]}};
THREE
.
ExtrudeGeometry
.
__v1
=
new
THREE
.
Vector2
;
THREE
.
ExtrudeGeometry
.
__v2
=
new
THREE
.
Vector2
;
THREE
.
ExtrudeGeometry
.
__v3
=
new
THREE
.
Vector2
;
THREE
.
ExtrudeGeometry
.
__v4
=
new
THREE
.
Vector2
;
THREE
.
ExtrudeGeometry
.
__v5
=
new
THREE
.
Vector2
;
THREE
.
ExtrudeGeometry
.
__v6
=
new
THREE
.
Vector2
;
THREE
.
ShapeGeometry
=
function
(
a
,
b
){
THREE
.
Geometry
.
call
(
this
);
!
1
===
a
instanceof
Array
&&
(
a
=
[
a
]);
this
.
shapebb
=
a
[
a
.
length
-
1
].
getBoundingBox
();
this
.
addShapeList
(
a
,
b
);
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
THREE
.
ShapeGeometry
.
prototype
=
Object
.
create
(
THREE
.
Geometry
.
prototype
);
THREE
.
ShapeGeometry
.
prototype
.
addShapeList
=
function
(
a
,
b
){
for
(
var
c
=
0
,
d
=
a
.
length
;
c
<
d
;
c
++
)
this
.
addShape
(
a
[
c
],
b
);
return
this
};
THREE
.
ShapeGeometry
.
prototype
.
addShape
=
function
(
a
,
b
){
void
0
===
b
&&
(
b
=
{});
var
c
=
b
.
material
,
d
=
void
0
===
b
.
UVGenerator
?
THREE
.
ExtrudeGeometry
.
WorldUVGenerator
:
b
.
UVGenerator
,
e
,
f
,
g
,
h
=
this
.
vertices
.
length
;
e
=
a
.
extractPoints
(
void
0
!==
b
.
curveSegments
?
b
.
curveSegments
:
12
);
var
i
=
e
.
shape
,
k
=
e
.
holes
;
if
(
!
THREE
.
Shape
.
Utils
.
isClockWise
(
i
)){
i
=
i
.
reverse
();
e
=
0
;
for
(
f
=
k
.
length
;
e
<
f
;
e
++
)
g
=
k
[
e
],
THREE
.
Shape
.
Utils
.
isClockWise
(
g
)
&&
(
k
[
e
]
=
g
.
reverse
())}
var
m
=
THREE
.
Shape
.
Utils
.
triangulateShape
(
i
,
k
);
e
=
0
;
for
(
f
=
k
.
length
;
e
<
f
;
e
++
)
g
=
k
[
e
],
i
=
i
.
concat
(
g
);
k
=
i
.
length
;
f
=
m
.
length
;
for
(
e
=
0
;
e
<
k
;
e
++
)
g
=
i
[
e
],
this
.
vertices
.
push
(
new
THREE
.
Vector3
(
g
.
x
,
g
.
y
,
0
));
for
(
e
=
0
;
e
<
f
;
e
++
)
k
=
m
[
e
],
i
=
k
[
0
]
+
h
,
g
=
k
[
1
]
+
h
,
k
=
k
[
2
]
+
h
,
this
.
faces
.
push
(
new
THREE
.
Face3
(
i
,
g
,
k
,
null
,
null
,
c
)),
this
.
faceVertexUvs
[
0
].
push
(
d
.
generateBottomUV
(
this
,
a
,
b
,
i
,
g
,
k
))};
THREE
.
LatheGeometry
=
function
(
a
,
b
,
c
){
THREE
.
Geometry
.
call
(
this
);
for
(
var
b
=
b
||
12
,
c
=
c
||
2
*
Math
.
PI
,
d
=
[],
e
=
(
new
THREE
.
Matrix4
).
makeRotationZ
(
c
/
b
),
f
=
0
;
f
<
a
.
length
;
f
++
)
d
[
f
]
=
a
[
f
].
clone
(),
this
.
vertices
.
push
(
d
[
f
]);
for
(
var
g
=
b
+
1
,
c
=
0
;
c
<
g
;
c
++
)
for
(
f
=
0
;
f
<
d
.
length
;
f
++
)
d
[
f
]
=
d
[
f
].
clone
().
applyMatrix4
(
e
),
this
.
vertices
.
push
(
d
[
f
]);
for
(
c
=
0
;
c
<
b
;
c
++
){
d
=
0
;
for
(
e
=
a
.
length
;
d
<
e
-
1
;
d
++
)
this
.
faces
.
push
(
new
THREE
.
Face4
(
c
*
e
+
d
,(
c
+
1
)
%
g
*
e
+
d
,(
c
+
1
)
%
g
*
e
+
(
d
+
1
)
%
e
,
c
*
e
+
(
d
+
1
)
%
e
)),
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
Vector2
(
1
-
c
/
b
,
d
/
e
),
new
THREE
.
Vector2
(
1
-
(
c
+
1
)
/
b
,
d
/
e
),
new
THREE
.
Vector2
(
1
-
(
c
+
1
)
/
b
,(
d
+
1
)
/
e
),
new
THREE
.
Vector2
(
1
-
c
/
b
,(
d
+
1
)
/
e
)])}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
THREE
.
LatheGeometry
.
prototype
=
Object
.
create
(
THREE
.
Geometry
.
prototype
);
THREE
.
PlaneGeometry
=
function
(
a
,
b
,
c
,
d
){
THREE
.
Geometry
.
call
(
this
);
this
.
width
=
a
;
this
.
height
=
b
;
this
.
widthSegments
=
c
||
1
;
this
.
heightSegments
=
d
||
1
;
for
(
var
c
=
a
/
2
,
e
=
b
/
2
,
d
=
this
.
widthSegments
,
f
=
this
.
heightSegments
,
g
=
d
+
1
,
h
=
f
+
1
,
i
=
this
.
width
/
d
,
k
=
this
.
height
/
f
,
m
=
new
THREE
.
Vector3
(
0
,
0
,
1
),
a
=
0
;
a
<
h
;
a
++
)
for
(
b
=
0
;
b
<
g
;
b
++
)
this
.
vertices
.
push
(
new
THREE
.
Vector3
(
b
*
i
-
c
,
-
(
a
*
k
-
e
),
0
));
for
(
a
=
0
;
a
<
f
;
a
++
)
for
(
b
=
0
;
b
<
d
;
b
++
)
c
=
new
THREE
.
Face4
(
b
+
g
*
a
,
b
+
g
*
(
a
+
1
),
b
+
1
+
g
*
(
a
+
1
),
b
+
1
+
g
*
a
),
c
.
normal
.
copy
(
m
),
c
.
vertexNormals
.
push
(
m
.
clone
(),
m
.
clone
(),
i
=
i
.
concat
(
g
);
k
=
i
.
length
;
f
=
m
.
length
;
for
(
e
=
0
;
e
<
k
;
e
++
)
g
=
i
[
e
],
this
.
vertices
.
push
(
new
THREE
.
Vector3
(
g
.
x
,
g
.
y
,
0
));
for
(
e
=
0
;
e
<
f
;
e
++
)
k
=
m
[
e
],
i
=
k
[
0
]
+
h
,
g
=
k
[
1
]
+
h
,
k
=
k
[
2
]
+
h
,
this
.
faces
.
push
(
new
THREE
.
Face3
(
i
,
g
,
k
,
null
,
null
,
c
)),
this
.
faceVertexUvs
[
0
].
push
(
d
.
generateBottomUV
(
this
,
a
,
b
,
i
,
g
,
k
))};
THREE
.
LatheGeometry
=
function
(
a
,
b
,
c
,
d
){
THREE
.
Geometry
.
call
(
this
);
for
(
var
b
=
b
||
12
,
c
=
c
||
0
,
d
=
d
||
2
*
Math
.
PI
,
e
=
1
/
a
.
length
,
f
=
1
/
b
,
g
=
0
,
h
=
b
;
g
<=
h
;
g
++
)
for
(
var
i
=
c
+
g
*
f
*
d
,
k
=
Math
.
cos
(
i
),
m
=
Math
.
sin
(
i
),
i
=
0
,
p
=
a
.
length
;
i
<
p
;
i
++
){
var
n
=
a
[
i
],
s
=
new
THREE
.
Vector3
;
s
.
x
=
k
*
n
.
x
-
m
*
n
.
y
;
s
.
y
=
m
*
n
.
x
+
k
*
n
.
y
;
s
.
z
=
n
.
z
;
this
.
vertices
.
push
(
s
)}
c
=
a
.
length
;
g
=
0
;
for
(
h
=
b
;
g
<
h
;
g
++
){
i
=
0
;
for
(
p
=
a
.
length
-
1
;
i
<
p
;
i
++
)
d
=
b
=
i
+
c
*
g
,
m
=
b
+
c
,
k
=
b
+
1
+
c
,
this
.
faces
.
push
(
new
THREE
.
Face4
(
d
,
m
,
k
,
b
+
1
)),
k
=
1
-
g
*
f
,
b
=
i
*
e
,
d
=
k
-
f
,
m
=
b
+
e
,
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
Vector2
(
k
,
b
),
new
THREE
.
Vector2
(
d
,
b
),
new
THREE
.
Vector2
(
d
,
m
),
new
THREE
.
Vector2
(
k
,
m
)])}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
THREE
.
LatheGeometry
.
prototype
=
Object
.
create
(
THREE
.
Geometry
.
prototype
);
THREE
.
PlaneGeometry
=
function
(
a
,
b
,
c
,
d
){
THREE
.
Geometry
.
call
(
this
);
this
.
width
=
a
;
this
.
height
=
b
;
this
.
widthSegments
=
c
||
1
;
this
.
heightSegments
=
d
||
1
;
for
(
var
c
=
a
/
2
,
e
=
b
/
2
,
d
=
this
.
widthSegments
,
f
=
this
.
heightSegments
,
g
=
d
+
1
,
h
=
f
+
1
,
i
=
this
.
width
/
d
,
k
=
this
.
height
/
f
,
m
=
new
THREE
.
Vector3
(
0
,
0
,
1
),
a
=
0
;
a
<
h
;
a
++
)
for
(
b
=
0
;
b
<
g
;
b
++
)
this
.
vertices
.
push
(
new
THREE
.
Vector3
(
b
*
i
-
c
,
-
(
a
*
k
-
e
),
0
));
for
(
a
=
0
;
a
<
f
;
a
++
)
for
(
b
=
0
;
b
<
d
;
b
++
)
c
=
new
THREE
.
Face4
(
b
+
g
*
a
,
b
+
g
*
(
a
+
1
),
b
+
1
+
g
*
(
a
+
1
),
b
+
1
+
g
*
a
),
c
.
normal
.
copy
(
m
),
c
.
vertexNormals
.
push
(
m
.
clone
(),
m
.
clone
(),
m
.
clone
(),
m
.
clone
()),
this
.
faces
.
push
(
c
),
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
Vector2
(
b
/
d
,
1
-
a
/
f
),
new
THREE
.
Vector2
(
b
/
d
,
1
-
(
a
+
1
)
/
f
),
new
THREE
.
Vector2
((
b
+
1
)
/
d
,
1
-
(
a
+
1
)
/
f
),
new
THREE
.
Vector2
((
b
+
1
)
/
d
,
1
-
a
/
f
)]);
this
.
computeCentroids
()};
THREE
.
PlaneGeometry
.
prototype
=
Object
.
create
(
THREE
.
Geometry
.
prototype
);
THREE
.
SphereGeometry
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
THREE
.
Geometry
.
call
(
this
);
this
.
radius
=
a
||
50
;
this
.
widthSegments
=
Math
.
max
(
3
,
Math
.
floor
(
b
)
||
8
);
this
.
heightSegments
=
Math
.
max
(
2
,
Math
.
floor
(
c
)
||
6
);
for
(
var
d
=
void
0
!==
d
?
d
:
0
,
e
=
void
0
!==
e
?
e
:
2
*
Math
.
PI
,
f
=
void
0
!==
f
?
f
:
0
,
g
=
void
0
!==
g
?
g
:
Math
.
PI
,
h
=
[],
i
=
[],
c
=
0
;
c
<=
this
.
heightSegments
;
c
++
){
for
(
var
k
=
[],
m
=
[],
b
=
0
;
b
<=
this
.
widthSegments
;
b
++
){
var
p
=
b
/
this
.
widthSegments
,
n
=
c
/
this
.
heightSegments
,
s
=
new
THREE
.
Vector3
;
s
.
x
=-
this
.
radius
*
Math
.
cos
(
d
+
p
*
e
)
*
Math
.
sin
(
f
+
n
*
g
);
s
.
y
=
this
.
radius
*
Math
.
cos
(
f
+
n
*
g
);
s
.
z
=
this
.
radius
*
Math
.
sin
(
d
+
p
*
e
)
*
Math
.
sin
(
f
+
n
*
g
);
this
.
vertices
.
push
(
s
);
k
.
push
(
this
.
vertices
.
length
-
1
);
m
.
push
(
new
THREE
.
Vector2
(
p
,
1
-
n
))}
h
.
push
(
k
);
i
.
push
(
m
)}
for
(
c
=
0
;
c
<
this
.
heightSegments
;
c
++
)
for
(
b
=
0
;
b
<
this
.
widthSegments
;
b
++
){
var
d
=
h
[
c
][
b
+
1
],
e
=
h
[
c
][
b
],
f
=
h
[
c
+
1
][
b
],
g
=
h
[
c
+
1
][
b
+
1
],
k
=
this
.
vertices
[
d
].
clone
().
normalize
(),
m
=
this
.
vertices
[
e
].
clone
().
normalize
(),
p
=
this
.
vertices
[
f
].
clone
().
normalize
(),
n
=
this
.
vertices
[
g
].
clone
().
normalize
(),
s
=
i
[
c
][
b
+
1
].
clone
(),
q
=
i
[
c
][
b
].
clone
(),
l
=
i
[
c
+
1
][
b
].
clone
(),
r
=
i
[
c
+
1
][
b
+
1
].
clone
();
Math
.
abs
(
this
.
vertices
[
d
].
y
)
===
this
.
radius
?(
this
.
faces
.
push
(
new
THREE
.
Face3
(
d
,
f
,
g
,[
k
,
p
,
n
])),
this
.
faceVertexUvs
[
0
].
push
([
s
,
l
,
r
])):
Math
.
abs
(
this
.
vertices
[
f
].
y
)
===
this
.
radius
?(
this
.
faces
.
push
(
new
THREE
.
Face3
(
d
,
e
,
f
,[
k
,
m
,
p
])),
this
.
faceVertexUvs
[
0
].
push
([
s
,
q
,
l
])):(
this
.
faces
.
push
(
new
THREE
.
Face4
(
d
,
e
,
f
,
g
,[
k
,
m
,
p
,
n
])),
this
.
faceVertexUvs
[
0
].
push
([
s
,
q
,
l
,
r
]))}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
boundingSphere
=
new
THREE
.
Sphere
(
new
THREE
.
Vector3
,
a
)};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录