Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
faf189c3
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,发现更多精彩内容 >>
提交
faf189c3
编写于
7月 28, 2011
作者:
Z
zz85
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some refactoring + cleanup for TextPath, Geometries, Shapes
上级
eb17987e
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
777 addition
and
867 deletion
+777
-867
build/Three.js
build/Three.js
+401
-402
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+187
-188
src/extras/geometries/Curve.js
src/extras/geometries/Curve.js
+7
-7
src/extras/geometries/ExtrudeGeometry.js
src/extras/geometries/ExtrudeGeometry.js
+4
-2
src/extras/geometries/Path.js
src/extras/geometries/Path.js
+7
-15
src/extras/geometries/Shape.js
src/extras/geometries/Shape.js
+68
-3
src/extras/geometries/TextGeometry.js
src/extras/geometries/TextGeometry.js
+38
-250
src/extras/geometries/TextPath.js
src/extras/geometries/TextPath.js
+64
-0
utils/build.py
utils/build.py
+1
-0
未找到文件。
build/Three.js
浏览文件 @
faf189c3
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
build/custom/ThreeExtras.js
浏览文件 @
faf189c3
此差异已折叠。
点击以展开。
src/extras/geometries/Curve.js
浏览文件 @
faf189c3
...
...
@@ -206,8 +206,8 @@ THREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) {
var
tx
,
ty
;
tx
=
THREE
.
Font
Utils
.
b2
(
t
,
this
.
x0
,
this
.
x1
,
this
.
x2
);
ty
=
THREE
.
Font
Utils
.
b2
(
t
,
this
.
y0
,
this
.
y1
,
this
.
y2
);
tx
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
this
.
x0
,
this
.
x1
,
this
.
x2
);
ty
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
this
.
y0
,
this
.
y1
,
this
.
y2
);
return
new
THREE
.
Vector2
(
tx
,
ty
);
...
...
@@ -270,8 +270,8 @@ THREE.CubicBezierCurve.prototype.getPoint = function ( t ) {
var
tx
,
ty
;
tx
=
THREE
.
Font
Utils
.
b3
(
t
,
this
.
x0
,
this
.
x1
,
this
.
x2
,
this
.
x3
);
ty
=
THREE
.
Font
Utils
.
b3
(
t
,
this
.
y0
,
this
.
y1
,
this
.
y2
,
this
.
y3
);
tx
=
THREE
.
Shape
.
Utils
.
b3
(
t
,
this
.
x0
,
this
.
x1
,
this
.
x2
,
this
.
x3
);
ty
=
THREE
.
Shape
.
Utils
.
b3
(
t
,
this
.
y0
,
this
.
y1
,
this
.
y2
,
this
.
y3
);
return
new
THREE
.
Vector2
(
tx
,
ty
);
...
...
@@ -485,9 +485,9 @@ THREE.QuadraticBezierCurve3 = THREE.Curve.create(
var
tx
,
ty
,
tz
;
tx
=
THREE
.
Font
Utils
.
b2
(
t
,
this
.
x0
,
this
.
x1
,
this
.
x2
);
ty
=
THREE
.
Font
Utils
.
b2
(
t
,
this
.
y0
,
this
.
y1
,
this
.
y2
);
tz
=
THREE
.
Font
Utils
.
b2
(
t
,
this
.
z0
,
this
.
z1
,
this
.
z2
);
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
);
return
new
THREE
.
Vector2
(
tx
,
ty
,
tz
);
...
...
src/extras/geometries/ExtrudeGeometry.js
浏览文件 @
faf189c3
...
...
@@ -6,6 +6,7 @@
THREE
.
ExtrudeGeometry
=
function
(
shapes
,
options
)
{
if
(
typeof
(
shapes
)
==
"
undefined
"
)
{
shapes
=
[];
return
;
}
THREE
.
Geometry
.
call
(
this
);
...
...
@@ -33,8 +34,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var
amount
=
options
.
amount
!==
undefined
?
options
.
amount
:
100
;
var
bevelThickness
=
options
.
bevelThickness
!==
undefined
?
options
.
bevelThickness
:
10
;
// 10
var
bevelSize
=
options
.
bevelSize
!==
undefined
?
options
.
bevelSize
:
bevelThickness
;
// 8
var
bevelThickness
=
options
.
bevelThickness
!==
undefined
?
options
.
bevelThickness
:
6
;
// 10
var
bevelSize
=
options
.
bevelSize
!==
undefined
?
options
.
bevelSize
:
bevelThickness
-
2
;
// 8
var
bevelEnabled
=
options
.
bevelEnabled
!==
undefined
?
options
.
bevelEnabled
:
true
;
// false
var
bevelSegments
=
options
.
bevelSegments
!==
undefined
?
options
.
bevelSegments
:
3
;
...
...
@@ -68,6 +69,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var
shapesOffset
=
this
.
vertices
.
length
;
//extractAllPoints
var
shapePoints
=
shape
.
extractAllPoints
();
// use shape.extractAllSpacedPoints() for points with equal divisions
var
vertices
=
shapePoints
.
shape
;
...
...
src/extras/geometries/Path.js
浏览文件 @
faf189c3
...
...
@@ -251,8 +251,8 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
t
=
j
/
divisions
;
tx
=
THREE
.
Font
Utils
.
b2
(
t
,
cpx0
,
cpx1
,
cpx
);
ty
=
THREE
.
Font
Utils
.
b2
(
t
,
cpy0
,
cpy1
,
cpy
);
tx
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
cpx0
,
cpx1
,
cpx
);
ty
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
cpy0
,
cpy1
,
cpy
);
points
.
push
(
new
THREE
.
Vector2
(
tx
,
ty
)
);
...
...
@@ -292,8 +292,8 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
t
=
j
/
divisions
;
tx
=
THREE
.
Font
Utils
.
b3
(
t
,
cpx0
,
cpx1
,
cpx2
,
cpx
);
ty
=
THREE
.
Font
Utils
.
b3
(
t
,
cpy0
,
cpy1
,
cpy2
,
cpy
);
tx
=
THREE
.
Shape
.
Utils
.
b3
(
t
,
cpx0
,
cpx1
,
cpx2
,
cpx
);
ty
=
THREE
.
Shape
.
Utils
.
b3
(
t
,
cpy0
,
cpy1
,
cpy2
,
cpy
);
points
.
push
(
new
THREE
.
Vector2
(
tx
,
ty
)
);
...
...
@@ -681,10 +681,10 @@ THREE.Path.prototype.debug = function( canvas ) {
/* TO CLEAN UP */
//
var p, points = this.getPoints();
var
p
,
points
=
this
.
getPoints
();
var
theta
=
-
90
/
180
*
Math
.
PI
;
var
p
,
points
=
this
.
transform
(
0.866
,
-
0.866
,
0
,
0.500
,
0.50
,
-
50
);
//
var theta = -90 /180 * Math.PI;
//
var p, points = this.transform( 0.866, - 0.866,0, 0.500 , 0.50,-50 );
//0.866, - 0.866,0, 0.500 , 0.50,-50
...
...
@@ -693,14 +693,6 @@ THREE.Path.prototype.debug = function( canvas ) {
// translate, scale, rotation
// a - horizontal size
// b - lean
// c - x offset
// d - vertical size
// e - climb
// f - y offset
// 1,0,0,
// -1,0,100
for
(
i
=
0
,
il
=
points
.
length
;
i
<
il
;
i
++
)
{
...
...
src/extras/geometries/Shape.js
浏览文件 @
faf189c3
...
...
@@ -352,7 +352,7 @@ THREE.Shape.Utils = {
},
// end triangulate shapes
/*
/*
triangulate2 : function( pts, holes ) {
// For use with Poly2Tri.js
...
...
@@ -407,13 +407,78 @@ THREE.Shape.Utils = {
// Returns array of faces with 3 element each
return facesPts;
},
*/
*/
isClockWise
:
function
(
pts
)
{
return
THREE
.
FontUtils
.
Triangulate
.
area
(
pts
)
<
0
;
}
},
// Bezier Curves formulas obtained from
// http://en.wikipedia.org/wiki/B%C3%A9zier_curve
// Quad Bezier Functions
b2p0
:
function
(
t
,
p
)
{
var
k
=
1
-
t
;
return
k
*
k
*
p
;
},
b2p1
:
function
(
t
,
p
)
{
return
2
*
(
1
-
t
)
*
t
*
p
;
},
b2p2
:
function
(
t
,
p
)
{
return
t
*
t
*
p
;
},
b2
:
function
(
t
,
p0
,
p1
,
p2
)
{
return
this
.
b2p0
(
t
,
p0
)
+
this
.
b2p1
(
t
,
p1
)
+
this
.
b2p2
(
t
,
p2
);
},
// Cubic Bezier Functions
b3p0
:
function
(
t
,
p
)
{
var
k
=
1
-
t
;
return
k
*
k
*
k
*
p
;
},
b3p1
:
function
(
t
,
p
)
{
var
k
=
1
-
t
;
return
3
*
k
*
k
*
t
*
p
;
},
b3p2
:
function
(
t
,
p
)
{
var
k
=
1
-
t
;
return
3
*
k
*
t
*
t
*
p
;
},
b3p3
:
function
(
t
,
p
)
{
return
t
*
t
*
t
*
p
;
},
b3
:
function
(
t
,
p0
,
p1
,
p2
,
p3
)
{
return
this
.
b3p0
(
t
,
p0
)
+
this
.
b3p1
(
t
,
p1
)
+
this
.
b3p2
(
t
,
p2
)
+
this
.
b3p3
(
t
,
p3
);
}
};
src/extras/geometries/TextGeometry.js
浏览文件 @
faf189c3
...
...
@@ -36,102 +36,35 @@
*/
THREE
.
TextPath
=
function
(
text
,
parameters
)
{
THREE
.
Path
.
call
(
this
);
this
.
parameters
=
parameters
||
{};
this
.
set
(
text
);
};
THREE
.
TextPath
.
prototype
.
set
=
function
(
text
,
parameters
)
{
this
.
text
=
text
;
var
parameters
=
parameters
||
this
.
parameters
;
var
size
=
parameters
.
size
!==
undefined
?
parameters
.
size
:
100
;
var
height
=
parameters
.
height
!==
undefined
?
parameters
.
height
:
50
;
var
curveSegments
=
parameters
.
curveSegments
!==
undefined
?
parameters
.
curveSegments
:
4
;
var
font
=
parameters
.
font
!==
undefined
?
parameters
.
font
:
"
helvetiker
"
;
var
weight
=
parameters
.
weight
!==
undefined
?
parameters
.
weight
:
"
normal
"
;
var
style
=
parameters
.
style
!==
undefined
?
parameters
.
style
:
"
normal
"
;
var
bevelThickness
=
parameters
.
bevelThickness
!==
undefined
?
parameters
.
bevelThickness
:
10
;
var
bevelSize
=
parameters
.
bevelSize
!==
undefined
?
parameters
.
bevelSize
:
8
;
var
bevelEnabled
=
parameters
.
bevelEnabled
!==
undefined
?
parameters
.
bevelEnabled
:
false
;
THREE
.
FontUtils
.
size
=
size
;
THREE
.
FontUtils
.
divisions
=
curveSegments
;
THREE
.
FontUtils
.
face
=
font
;
THREE
.
FontUtils
.
weight
=
weight
;
THREE
.
FontUtils
.
style
=
style
;
THREE
.
FontUtils
.
bevelSize
=
bevelSize
;
};
THREE
.
TextPath
.
prototype
.
toShapes
=
function
()
{
// Get a Font data json object
var
data
=
THREE
.
FontUtils
.
drawText
(
this
.
text
);
var
paths
=
data
.
paths
;
var
shapes
=
[];
for
(
var
p
=
0
,
pl
=
paths
.
length
;
p
<
pl
;
p
++
)
{
shapes
=
shapes
.
concat
(
paths
[
p
].
toShapes
());
}
return
shapes
;
//console.log(path);
//console.log(fontShapes);
// Either find actions or curves.
//var text3d = new THREE.ExtrudeGeometry( shapes , { amount: 20, bevelEnabled:true, bevelThickness:3 } );
//return text3d;
};
THREE
.
TextGeometry
=
function
(
text
,
parameters
)
{
var
textPath
=
new
THREE
.
TextPath
(
text
,
parameters
);
var
textShapes
=
textPath
.
toShapes
();
console
.
log
(
"
params
"
,
parameters
);
THREE
.
ExtrudeGeometry
.
call
(
this
,
textShapes
,
parameters
);
};
THREE
.
TextGeometry
.
prototype
=
new
THREE
.
ExtrudeGeometry
();
THREE
.
TextGeometry
.
prototype
.
constructor
=
THREE
.
TextGeometry
;
/*
var text3d = new TextGeometry(text);
// TextGeometry Wrapper
var text3d = new TextGeometry(text, options);
FactoryStyle
var text3d = FontUtils.createText(text);
var textPath = new TextPath(text);
// Complete Manner
var textPath = new TextPath(text, options);
var textShapes = textPath.toShapes();
var text3d = new ExtrudeGeometry(textShapes, options);
var textShapes = FontUtils.getTextShapes(text);
// Factory Method
var textShapes = FontUtils.getTextShapes(text, options);
text3d = new ExtrudeGeometry(textShapes, options);
*/
THREE
.
TextGeometry
.
prototype
=
new
THREE
.
ExtrudeGeometry
();
THREE
.
TextGeometry
.
prototype
.
constructor
=
THREE
.
TextGeometry
;
*/
THREE
.
FontUtils
=
{
...
...
@@ -151,6 +84,12 @@ THREE.FontUtils = {
return
this
.
faces
[
this
.
face
][
this
.
weight
][
this
.
style
];
},
getTextShapes
:
function
(
text
,
options
)
{
var
textPath
=
new
TextPath
(
text
,
options
);
var
textShapes
=
textPath
.
toShapes
();
return
textShapes
;
},
loadFace
:
function
(
data
)
{
...
...
@@ -169,7 +108,7 @@ THREE.FontUtils = {
},
/* LAGACY CODE
extractPoints : function( allPoints, charactersPoints ) {
// Quick exit
...
...
@@ -288,7 +227,7 @@ THREE.FontUtils = {
//console.log("isolatedShapes", isolatedShapes);
/
* For each isolated shape, find the closest points and break to the hole to allow triangulation*/
/
/ For each isolated shape, find the closest points and break to the hole to allow triangulation
// Find closest points between holes
...
...
@@ -523,7 +462,7 @@ THREE.FontUtils = {
};
},
},
*/
drawText
:
function
(
text
)
{
...
...
@@ -546,8 +485,8 @@ THREE.FontUtils = {
var
ret
=
this
.
extractGlyphPoints
(
chars
[
i
],
face
,
scale
,
offset
,
path
);
offset
+=
ret
.
offset
;
characterPts
.
push
(
ret
.
points
);
allPts
=
allPts
.
concat
(
ret
.
points
);
//
characterPts.push( ret.points );
//
allPts = allPts.concat( ret.points );
fontPaths
.
push
(
ret
.
path
);
}
...
...
@@ -555,175 +494,24 @@ THREE.FontUtils = {
// get the width
var
width
=
offset
/
2
;
for
(
p
=
0
;
p
<
allPts
.
length
;
p
++
)
{
allPts
[
p
].
x
-=
width
;
}
//
//
for ( p = 0; p < allPts.length; p++ ) {
//
//
allPts[ p ].x -= width;
//
//
}
var
extract
=
this
.
extractPoints
(
allPts
,
characterPts
);
extract
.
contour
=
allPts
;
//extract.contour = allPts;
extract
.
paths
=
fontPaths
;
var
bevelPoints
=
[];
var
centroids
=
[],
forCentroids
=
[],
expandOutwards
=
[],
sum
=
new
THREE
.
Vector2
(),
lastV
;
i
=
allPts
.
length
;
while
(
--
i
>=
0
)
{
if
(
!
lastV
)
{
lastV
=
allPts
[
i
];
}
else
if
(
lastV
.
equals
(
allPts
[
i
]
)
)
{
// We reached the last point of a closed loop
lastV
=
null
;
var
bool
=
this
.
Triangulate
.
area
(
forCentroids
)
>
0
;
expandOutwards
.
push
(
bool
);
centroids
.
push
(
sum
.
divideScalar
(
forCentroids
.
length
)
);
forCentroids
=
[];
sum
=
new
THREE
.
Vector2
();
continue
;
}
sum
.
addSelf
(
allPts
[
i
]
);
forCentroids
.
push
(
allPts
[
i
]
);
}
i
=
allPts
.
length
;
p
=
0
;
var
pt
,
centroid
;
var
dirV
,
adj
;
while
(
--
i
>=
0
)
{
pt
=
allPts
[
i
];
centroid
=
centroids
[
p
];
dirV
=
pt
.
clone
().
subSelf
(
centroid
);
adj
=
this
.
bevelSize
/
dirV
.
length
();
if
(
expandOutwards
[
p
]
)
{
adj
+=
1
;
}
else
{
adj
=
1
-
adj
;
}
adj
=
dirV
.
multiplyScalar
(
adj
).
addSelf
(
centroid
);
bevelPoints
.
unshift
(
adj
);
if
(
!
lastV
)
{
lastV
=
allPts
[
i
];
}
else
if
(
lastV
.
equals
(
allPts
[
i
]
)
)
{
// We reached the last point of a closed loop
lastV
=
null
;
p
++
;
continue
;
}
}
/*
for ( p = 0; p < allPts.length; p++ ) {
pt = allPts[ p ];
bevelPoints.push( new THREE.Vector2( pt.x + this.bevelSize, pt.y + this.bevelSize ) );
}
*/
extract
.
bevel
=
bevelPoints
;
extract
.
offset
=
width
;
return
extract
;
},
// Bezier Curves formulas obtained from
// http://en.wikipedia.org/wiki/B%C3%A9zier_curve
// Quad Bezier Functions
b2p0
:
function
(
t
,
p
)
{
var
k
=
1
-
t
;
return
k
*
k
*
p
;
},
b2p1
:
function
(
t
,
p
)
{
return
2
*
(
1
-
t
)
*
t
*
p
;
},
b2p2
:
function
(
t
,
p
)
{
return
t
*
t
*
p
;
},
b2
:
function
(
t
,
p0
,
p1
,
p2
)
{
return
this
.
b2p0
(
t
,
p0
)
+
this
.
b2p1
(
t
,
p1
)
+
this
.
b2p2
(
t
,
p2
);
},
// Cubic Bezier Functions
b3p0
:
function
(
t
,
p
)
{
var
k
=
1
-
t
;
return
k
*
k
*
k
*
p
;
},
b3p1
:
function
(
t
,
p
)
{
var
k
=
1
-
t
;
return
3
*
k
*
k
*
t
*
p
;
},
b3p2
:
function
(
t
,
p
)
{
var
k
=
1
-
t
;
return
3
*
k
*
t
*
t
*
p
;
},
b3p3
:
function
(
t
,
p
)
{
return
t
*
t
*
t
*
p
;
},
b3
:
function
(
t
,
p0
,
p1
,
p2
,
p3
)
{
return
this
.
b3p0
(
t
,
p0
)
+
this
.
b3p1
(
t
,
p1
)
+
this
.
b3p2
(
t
,
p2
)
+
this
.
b3p3
(
t
,
p3
);
},
extractGlyphPoints
:
function
(
c
,
face
,
scale
,
offset
,
path
)
{
...
...
@@ -797,8 +585,8 @@ THREE.FontUtils = {
for
(
i2
=
1
,
divisions
=
this
.
divisions
;
i2
<=
divisions
;
i2
++
)
{
var
t
=
i2
/
divisions
;
var
tx
=
THREE
.
Font
Utils
.
b2
(
t
,
cpx0
,
cpx1
,
cpx
);
var
ty
=
THREE
.
Font
Utils
.
b2
(
t
,
cpy0
,
cpy1
,
cpy
);
var
tx
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
cpx0
,
cpx1
,
cpx
);
var
ty
=
THREE
.
Shape
.
Utils
.
b2
(
t
,
cpy0
,
cpy1
,
cpy
);
pts
.
push
(
new
THREE
.
Vector2
(
tx
,
ty
)
);
}
...
...
@@ -830,8 +618,8 @@ THREE.FontUtils = {
for
(
i2
=
1
,
divisions
=
this
.
divisions
;
i2
<=
divisions
;
i2
++
)
{
var
t
=
i2
/
divisions
;
var
tx
=
THREE
.
Font
Utils
.
b3
(
t
,
cpx0
,
cpx1
,
cpx2
,
cpx
);
var
ty
=
THREE
.
Font
Utils
.
b3
(
t
,
cpy0
,
cpy1
,
cpy2
,
cpy
);
var
tx
=
THREE
.
Shape
.
Utils
.
b3
(
t
,
cpx0
,
cpx1
,
cpx2
,
cpx
);
var
ty
=
THREE
.
Shape
.
Utils
.
b3
(
t
,
cpy0
,
cpy1
,
cpy2
,
cpy
);
pts
.
push
(
new
THREE
.
Vector2
(
tx
,
ty
)
);
}
...
...
src/extras/geometries/TextPath.js
0 → 100644
浏览文件 @
faf189c3
THREE
.
TextPath
=
function
(
text
,
parameters
)
{
THREE
.
Path
.
call
(
this
);
this
.
parameters
=
parameters
||
{};
this
.
set
(
text
);
};
THREE
.
TextPath
.
prototype
.
set
=
function
(
text
,
parameters
)
{
this
.
text
=
text
;
var
parameters
=
parameters
||
this
.
parameters
;
var
size
=
parameters
.
size
!==
undefined
?
parameters
.
size
:
100
;
var
height
=
parameters
.
height
!==
undefined
?
parameters
.
height
:
50
;
var
curveSegments
=
parameters
.
curveSegments
!==
undefined
?
parameters
.
curveSegments
:
4
;
var
font
=
parameters
.
font
!==
undefined
?
parameters
.
font
:
"
helvetiker
"
;
var
weight
=
parameters
.
weight
!==
undefined
?
parameters
.
weight
:
"
normal
"
;
var
style
=
parameters
.
style
!==
undefined
?
parameters
.
style
:
"
normal
"
;
var
bevelThickness
=
parameters
.
bevelThickness
!==
undefined
?
parameters
.
bevelThickness
:
10
;
var
bevelSize
=
parameters
.
bevelSize
!==
undefined
?
parameters
.
bevelSize
:
8
;
var
bevelEnabled
=
parameters
.
bevelEnabled
!==
undefined
?
parameters
.
bevelEnabled
:
false
;
THREE
.
FontUtils
.
size
=
size
;
THREE
.
FontUtils
.
divisions
=
curveSegments
;
THREE
.
FontUtils
.
face
=
font
;
THREE
.
FontUtils
.
weight
=
weight
;
THREE
.
FontUtils
.
style
=
style
;
};
THREE
.
TextPath
.
prototype
.
toShapes
=
function
()
{
// Get a Font data json object
var
data
=
THREE
.
FontUtils
.
drawText
(
this
.
text
);
var
paths
=
data
.
paths
;
var
shapes
=
[];
for
(
var
p
=
0
,
pl
=
paths
.
length
;
p
<
pl
;
p
++
)
{
shapes
=
shapes
.
concat
(
paths
[
p
].
toShapes
());
}
return
shapes
;
//console.log(path);
//console.log(fontShapes);
// Either find actions or curves.
//var text3d = new THREE.ExtrudeGeometry( shapes , { amount: 20, bevelEnabled:true, bevelThickness:3 } );
//return text3d;
};
utils/build.py
浏览文件 @
faf189c3
...
...
@@ -96,6 +96,7 @@ EXTRAS_FILES = [
'extras/geometries/Curve.js'
,
'extras/geometries/Path.js'
,
'extras/geometries/Shape.js'
,
'extras/geometries/TextPath.js'
,
'extras/geometries/CubeGeometry.js'
,
'extras/geometries/CylinderGeometry.js'
,
'extras/geometries/ExtrudeGeometry.js'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录