Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
a7b7377c
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,发现更多精彩内容 >>
提交
a7b7377c
编写于
8月 02, 2011
作者:
Z
zz85
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added curve segments parameter passing. defaults to 6
上级
15c6845a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
48 deletion
+37
-48
src/extras/geometries/Curve.js
src/extras/geometries/Curve.js
+18
-34
src/extras/geometries/ExtrudeGeometry.js
src/extras/geometries/ExtrudeGeometry.js
+9
-4
src/extras/geometries/Shape.js
src/extras/geometries/Shape.js
+10
-10
未找到文件。
src/extras/geometries/Curve.js
浏览文件 @
a7b7377c
...
...
@@ -430,29 +430,23 @@ THREE.Curve.create = function(constructor, getpointfunc) {
THREE
.
LineCurve3
=
THREE
.
Curve
.
create
(
function
(
x1
,
y1
,
z1
,
x2
,
y2
,
z
2
)
{
function
(
v1
,
v
2
)
{
this
.
x1
=
x1
;
this
.
y1
=
y1
;
this
.
z1
=
z1
;
this
.
x2
=
x2
;
this
.
y2
=
y2
;
this
.
z2
=
z2
;
this
.
v1
=
v1
;
this
.
v2
=
v2
;
},
function
(
t
)
{
var
dx
=
this
.
x2
-
this
.
x1
;
var
dy
=
this
.
y2
-
this
.
y1
;
var
dz
=
this
.
z2
-
this
.
z1
;
var
tx
=
this
.
x1
+
dx
*
t
;
var
ty
=
this
.
y1
+
dy
*
t
;
var
tz
=
this
.
z1
+
dz
*
t
;
var
r
=
new
THREE
.
Vector3
();
r
.
sub
(
v2
,
v1
);
// diff
r
.
multiplyScalar
(
t
);
r
.
addSelf
(
this
.
v1
);
return
new
THREE
.
Vector3
(
tx
,
ty
,
tz
)
;
return
r
;
}
);
...
...
@@ -463,21 +457,11 @@ THREE.LineCurve3 = THREE.Curve.create(
**************************************************************/
THREE
.
QuadraticBezierCurve3
=
THREE
.
Curve
.
create
(
function
(
x0
,
y0
,
z0
,
x1
,
y1
,
z1
,
x2
,
y2
,
z2
)
{
// Qn should we use 2 Vector3 instead?
this
.
x0
=
x0
;
this
.
y0
=
y0
;
this
.
z0
=
z0
;
function
(
v0
,
v1
,
v2
)
{
// Qn should we use 2 Vector3 instead?
this
.
x1
=
x1
;
this
.
y1
=
y1
;
this
.
z1
=
z1
;
this
.
x2
=
x2
;
this
.
y2
=
y2
;
this
.
z2
=
z2
;
this
.
v0
=
v0
;
this
.
v1
=
v1
;
this
.
v2
=
v2
;
},
...
...
@@ -485,11 +469,11 @@ THREE.QuadraticBezierCurve3 = THREE.Curve.create(
var
tx
,
ty
,
tz
;
tx
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
this
.
x0
,
this
.
x1
,
this
.
x2
);
ty
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
this
.
y0
,
this
.
y1
,
this
.
y2
);
tz
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
this
.
z0
,
this
.
z1
,
this
.
z2
);
tx
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
this
.
v0
.
x
,
this
.
v1
.
x
,
this
.
v2
.
x
);
ty
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
this
.
v0
.
y
,
this
.
v1
.
y
,
this
.
v2
.
y
);
tz
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
this
.
v0
.
z
,
this
.
v1
.
z
,
this
.
v2
.
z
);
return
new
THREE
.
Vector
2
(
tx
,
ty
,
tz
);
return
new
THREE
.
Vector
3
(
tx
,
ty
,
tz
);
}
);
src/extras/geometries/ExtrudeGeometry.js
浏览文件 @
a7b7377c
...
...
@@ -21,6 +21,8 @@
THREE
.
ExtrudeGeometry
=
function
(
shapes
,
options
)
{
// var startTime = Date.now();
if
(
typeof
(
shapes
)
==
"
undefined
"
)
{
shapes
=
[];
...
...
@@ -41,6 +43,9 @@ THREE.ExtrudeGeometry = function( shapes, options ) {
this
.
addShape
(
shape
,
options
);
}
// console.log( "faces", this.faces.length, "vertices", this.vertices.length );
// console.log( "took", ( Date.now() - startTime ) );
};
...
...
@@ -50,7 +55,7 @@ THREE.ExtrudeGeometry.prototype.constructor = THREE.ExtrudeGeometry;
THREE
.
ExtrudeGeometry
.
prototype
.
addShape
=
function
(
shape
,
options
)
{
//var startTime = Date.now();
var
amount
=
options
.
amount
!==
undefined
?
options
.
amount
:
100
;
...
...
@@ -59,7 +64,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var
bevelSegments
=
options
.
bevelSegments
!==
undefined
?
options
.
bevelSegments
:
3
;
var
bevelEnabled
=
options
.
bevelEnabled
!==
undefined
?
options
.
bevelEnabled
:
true
;
// false
var
curveSegments
=
options
.
curveSegments
!==
undefined
?
options
.
curveSegments
:
2
;
var
steps
=
options
.
steps
!==
undefined
?
options
.
steps
:
1
;
...
...
@@ -96,7 +102,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var
shapesOffset
=
this
.
vertices
.
length
;
var
shapePoints
=
shape
.
extractAllPoints
();
// use shape.extractAllSpacedPoints() for points with equal divisions
var
shapePoints
=
shape
.
extractAllPoints
(
curveSegments
);
// use shape.extractAllSpacedPoints() for points with equal divisions
var
vertices
=
shapePoints
.
shape
;
var
holes
=
shapePoints
.
holes
;
...
...
@@ -630,7 +636,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
this
.
computeFaceNormals
();
//this.computeVertexNormals();
//console.log( "took", ( Date.now() - startTime ) );
function
v
(
x
,
y
,
z
)
{
...
...
src/extras/geometries/Shape.js
浏览文件 @
a7b7377c
...
...
@@ -30,14 +30,14 @@ THREE.Shape.prototype.extrude = function ( options ) {
// Get points of holes
THREE
.
Shape
.
prototype
.
getPointsHoles
=
function
()
{
THREE
.
Shape
.
prototype
.
getPointsHoles
=
function
(
segments
)
{
var
i
,
il
=
this
.
holes
.
length
,
holesPts
=
[];
for
(
i
=
0
;
i
<
il
;
i
++
)
{
holesPts
[
i
]
=
this
.
holes
[
i
].
getPoints
();
holesPts
[
i
]
=
this
.
holes
[
i
].
getPoints
(
segments
);
}
...
...
@@ -47,13 +47,13 @@ THREE.Shape.prototype.getPointsHoles = function () {
// Get points of holes (spaced by regular distance)
THREE
.
Shape
.
prototype
.
getSpacedPointsHoles
=
function
()
{
THREE
.
Shape
.
prototype
.
getSpacedPointsHoles
=
function
(
segments
)
{
var
i
,
il
=
this
.
holes
.
length
,
holesPts
=
[];
for
(
i
=
0
;
i
<
il
;
i
++
)
{
holesPts
[
i
]
=
this
.
holes
[
i
].
getSpacedPoints
();
holesPts
[
i
]
=
this
.
holes
[
i
].
getSpacedPoints
(
segments
);
}
...
...
@@ -64,12 +64,12 @@ THREE.Shape.prototype.getSpacedPointsHoles = function () {
// Get points of shape and holes (keypoints based on segments parameter)
THREE
.
Shape
.
prototype
.
extractAllPoints
=
function
()
{
THREE
.
Shape
.
prototype
.
extractAllPoints
=
function
(
segments
)
{
return
{
shape
:
this
.
getPoints
(),
holes
:
this
.
getPointsHoles
()
shape
:
this
.
getPoints
(
segments
),
holes
:
this
.
getPointsHoles
(
segments
)
};
...
...
@@ -77,12 +77,12 @@ THREE.Shape.prototype.extractAllPoints = function () {
// Get points of shape and holes (spaced by regular distance)
THREE
.
Shape
.
prototype
.
extractAllSpacedPoints
=
function
()
{
THREE
.
Shape
.
prototype
.
extractAllSpacedPoints
=
function
(
segments
)
{
return
{
shape
:
this
.
getSpacedPoints
(),
holes
:
this
.
getSpacedPointsHoles
()
shape
:
this
.
getSpacedPoints
(
segments
),
holes
:
this
.
getSpacedPointsHoles
(
segments
)
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录