提交 f962eb2e 编写于 作者: A alteredq

bezel => bevel in TextGeometry and its example

上级 c35cca9e
......@@ -473,8 +473,8 @@ THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f
h-1:f];p=c[e-1][p?0:f+1];u=e/(g-1);v=(e-1)/(g-1);w=(f+1)/h;var t=f/h,o=new THREE.UV(1-w,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),x=new THREE.UV(1-w,v);e<c.length-1&&(v=this.vertices[j].position.clone(),w=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),v.normalize(),w.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,u,t]));e>1&&(v=
this.vertices[j].position.clone(),w=this.vertices[n].position.clone(),z=this.vertices[p].position.clone(),v.normalize(),w.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,t,x]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){w.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){w.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,o=c.bezelSize!==void 0?c.bezelSize:8,t=c.bezelEnabled!==
void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=j;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=o;var m=THREE.FontUtils.drawText(b),h=m.points,u=m.faces,j=m.contour,v=m.bezel,w=this;w.vertices=[];w.faces=[];for(var z,n=h.length,x=u.length,o=v.length,m=0;m<n;m++)z=h[m],e(z.x,z.y,0);for(m=0;m<n;m++)z=h[m],e(z.x,z.y,g);if(t){for(m=0;m<o;m++)z=v[m],e(z.x,z.y,p);for(m=0;m<o;m++)z=v[m],e(z.x,z.y,g-p)}for(m=
THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){w.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){w.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bevelThickness!==void 0?c.bevelThickness:10,o=c.bevelSize!==void 0?c.bevelSize:8,t=c.bevelEnabled!==
void 0?c.bevelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=j;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bevelSize=o;var m=THREE.FontUtils.drawText(b),h=m.points,u=m.faces,j=m.contour,v=m.bevel,w=this;w.vertices=[];w.faces=[];for(var z,n=h.length,x=u.length,o=v.length,m=0;m<n;m++)z=h[m],e(z.x,z.y,0);for(m=0;m<n;m++)z=h[m],e(z.x,z.y,g);if(t){for(m=0;m<o;m++)z=v[m],e(z.x,z.y,p);for(m=0;m<o;m++)z=v[m],e(z.x,z.y,g-p)}for(m=
0;m<x;m++)g=u[m],w.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<x;m++)g=u[m],w.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var y;if(t)for(m=v.length;--m>0;){if(y){if(y.equals(j[m])){y=null;continue}}else y=j[m];p=n*2+m;u=p-1;f(p,u,u+o,p+o);for(t=0;t<n;t++)if(h[t].equals(j[m]))break;for(g=0;g<n;g++)if(h[g].equals(j[m-1]))break;f(t,g,u,p);f(p+o,u+o,g+n,t+n)}else for(m=j.length;--m>0;){if(y){if(y.equals(j[m])){y=null;continue}}else y=j[m];for(t=0;t<n;t++)if(h[t].equals(j[m]))break;for(g=
0;g<n;g++)if(h[g].equals(j[m-1]))break;f(t,g,g+n,t+n)}this.computeCentroids();this.computeFaceNormals()};
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
......@@ -483,7 +483,7 @@ z,x,y;h=[];for(j=0;j<m.length;j++){n=m[j];g=n.shape;f=n.holes;for(p=0;p<f.length
1>=0?v-1:g.length-1;t=u-1>=0?u-1:o.length-1;F=[];F.push(o[u]);F.push(g[v]);F.push(g[e]);F=this.Triangulate.area(F);C=[];C.push(o[u]);C.push(o[t]);C.push(g[v]);C=this.Triangulate.area(C);w+x>F+C&&(v=z,u=y,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=o.length),u%=g.length,e=v-1>=0?v-1:g.length-1,t=u-1>=0?u-1:o.length-1);w=g.slice(0,v);x=g.slice(v);z=o.slice(u);y=o.slice(0,u);h.push(o[u]);h.push(g[v]);h.push(g[e]);h.push(o[u]);h.push(o[t]);h.push(g[v]);g=w.concat(z).concat(y).concat(x)}n.shape=g}u=[];v=[];
for(j=p=0;j<m.length;j++){n=m[j];g=n.shape;u=u.concat(g);o=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<o.length;f++)n=o[f],n[0]+=p,n[1]+=p,n[2]+=p;v=v.concat(o);p+=g.length}var E;for(f=0;f<h.length/3;f++){n=[];for(m=0;m<3;m++){j=!1;for(g=0;g<u.length&&!j;g++)E=f*3+m,u[g].equals(h[E])&&(n.push(g),j=!0);j||(u.push(h[E]),n.push(u.length-1),console.log("not found"))}v.push(n)}return{points:u,faces:v}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),h=this.size/g.resolution,j=0;f=String(b).split("");
for(var m=f.length,n=new THREE.Path,b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,h,j,n);j+=p.offset;c.push(p.points);e=e.concat(p.points)}console.log(n);b=j/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];h=[];f=[];for(var j=[],m=new THREE.Vector2,o,b=e.length;--b>=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;j.push(n);h.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=
0;--b>=0;)n=e[b],m=h[f],n=n.clone().subSelf(m),p=this.bezelSize/n.length(),j[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*
0;--b>=0;)n=e[b],m=h[f],n=n.clone().subSelf(m),p=this.bevelSize/n.length(),j[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bevel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*
(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f,g){var h=[],j,m,n,p,o,t,u,v,w,z,x=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){c=x._cachedOutline||(x._cachedOutline=x.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,p));g.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,
p));g.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;u=c[b++]*e+f;v=c[b++]*e;g.quadraticCurveTo(u,v,m,p);if(j=h[h.length-1]){o=j.x;t=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++){var y=j/divisions,F=THREE.FontUtils.b2(y,o,u,m),y=THREE.FontUtils.b2(y,t,v,p);h.push(new THREE.Vector2(F,y))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,u=c[b++]*e+f,v=c[b++]*-e,w=c[b++]*e+f,z=c[b++]*-e,g.bezierCurveTo(m,p,u,v,w,z),j=h[h.length-1]){o=j.x;t=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++)y=
j/divisions,F=THREE.FontUtils.b3(y,o,u,w,m),y=THREE.FontUtils.b3(y,t,v,z,p),h.push(new THREE.Vector2(F,y))}}}return{offset:x.ha*e,points:h,path:g}}}};
......
此差异已折叠。
......@@ -26,14 +26,14 @@
<body>
<div id="info">
<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - procedural 3D text by <a href="http://www.lab4games.net/zz85/blog" target="_blank">zz85</a> &amp; alteredq
<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - procedural 3D text by <a href="http://www.lab4games.net/zz85/blog" target="_blank">zz85</a> &amp; alteredq
(fonts from <a href="http://typeface.neocracy.org/">typeface.js</a> and <a href="http://en.wikipedia.org/wiki/Droid_%28font%29">Droid</a>)
<br/>type to enter new text, drag to spin the text
<br/><span class="button" id="color">change color</span>,
<span class="button" id="font">change font</span>,
<br/><span class="button" id="color">change color</span>,
<span class="button" id="font">change font</span>,
<span class="button" id="weight">change weight</span>,
<span class="button" id="bezel">change bezel</span>,
<span class="button" id="postprocessing">change postprocessing</span>,
<span class="button" id="bevel">change bevel</span>,
<span class="button" id="postprocessing">change postprocessing</span>,
<a id="permalink" href="#">permalink</a>
</div>
......@@ -43,12 +43,12 @@
<script type="text/javascript" src="js/Detector.js"></script>
<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
<script type="text/javascript" src="js/Stats.js"></script>
<!-- load the font file from canvas-text -->
<!--
-->
<script type="text/javascript" src="fonts/gentilis_bold.typeface.js"></script>
<script type="text/javascript" src="fonts/gentilis_regular.typeface.js"></script>
......@@ -60,7 +60,7 @@
<script type="text/javascript" src="fonts/droid/droid_sans_bold.typeface.js"></script>
<script type="text/javascript" src="fonts/droid/droid_serif_regular.typeface.js"></script>
<script type="text/javascript" src="fonts/droid/droid_serif_bold.typeface.js"></script>
<script type="text/javascript">
......@@ -82,9 +82,9 @@
curveSegments = 6,
bezelThickness = 2,
bezelSize = 1.5,
bezelEnabled = true,
bevelThickness = 2,
bevelSize = 1.5,
bevelEnabled = true,
font = "optimer", // helvetiker, optimer, gentilis, droid sans, droid serif
weight = "bold", // normal bold
......@@ -134,9 +134,9 @@
}
function decimalToHex( d ) {
var hex = Number( d ).toString( 16 );
hex = "000000".substr( 0, 6 - hex.length ) + hex;
hex = "000000".substr( 0, 6 - hex.length ) + hex;
return hex.toUpperCase();
}
......@@ -180,7 +180,7 @@
var fonthash = hash.substring( 6, 7 );
var weighthash = hash.substring( 7, 8 );
var pphash = hash.substring( 8, 9 );
var bezelhash = hash.substring( 9, 10 );
var bevelhash = hash.substring( 9, 10 );
var texthash = hash.substring( 11 );
hex = colorhash;
......@@ -190,7 +190,7 @@
weight = reverseWeightMap[ parseInt( weighthash ) ];
postprocessing.enabled = parseInt( pphash );
bezelEnabled = parseInt( bezelhash );
bevelEnabled = parseInt( bevelhash );
text = decodeURI( texthash );
......@@ -206,7 +206,7 @@
textGeo = new THREE.TextGeometry( text, {
size: size,
size: size,
height: height,
curveSegments: curveSegments,
......@@ -214,16 +214,16 @@
weight: weight,
style: style,
bezelThickness: bezelThickness,
bezelSize: bezelSize,
bezelEnabled: bezelEnabled
bevelThickness: bevelThickness,
bevelSize: bevelSize,
bevelEnabled: bevelEnabled
});
textMaterial = new THREE.MeshPhongMaterial( { color: 0xffffff, wireframe: false } );
parent = new THREE.Object3D();
textMesh1 = new THREE.Mesh( textGeo, textMaterial );
textMesh1.position.x = 0;
......@@ -247,7 +247,7 @@
textMesh2.rotation.y = Math.PI * 2;
parent.addChild( textMesh2 );
}
parent.position.y = 100;
......@@ -260,7 +260,7 @@
renderer = new THREE.WebGLRenderer( { antialias: false } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setClearColor( scene.fog.color, 1 );
container.appendChild( renderer.domElement );
......@@ -277,91 +277,91 @@
document.addEventListener( 'keydown', onDocumentKeyDown, false );
document.getElementById( "color" ).addEventListener( 'click', function() {
pointLight.color.setHSV( Math.random(), 0.95, 0.85 );
pointLight.color.updateHex();
hex = decimalToHex( pointLight.color.hex );
updatePermalink();
}, false );
document.getElementById( "font" ).addEventListener( 'click', function() {
if ( font == "helvetiker" ) {
font = "optimer";
} else if ( font == "optimer" ) {
font = "gentilis";
} else if ( font == "gentilis" ) {
font = "droid sans";
} else if ( font == "droid sans" ) {
font = "droid serif";
} else {
font = "helvetiker";
}
refreshText();
}, false );
document.getElementById( "weight" ).addEventListener( 'click', function() {
if ( weight == "bold" ) {
weight = "normal";
} else {
weight = "bold";
}
refreshText();
}, false );
document.getElementById( "bezel" ).addEventListener( 'click', function() {
bezelEnabled = !bezelEnabled;
document.getElementById( "bevel" ).addEventListener( 'click', function() {
bevelEnabled = !bevelEnabled;
refreshText();
}, false );
document.getElementById( "postprocessing" ).addEventListener( 'click', function() {
postprocessing.enabled = !postprocessing.enabled;
updatePermalink();
}, false );
initPostprocessing();
renderer.autoClear = false;
}
//
function boolToNum( b ) {
return b ? 1 : 0;
}
function updatePermalink() {
var link = hex + fontMap[ font ] + weightMap[ weight ] + boolToNum( postprocessing.enabled ) + boolToNum( bezelEnabled ) + "#" + encodeURI( text );
var link = hex + fontMap[ font ] + weightMap[ weight ] + boolToNum( postprocessing.enabled ) + boolToNum( bevelEnabled ) + "#" + encodeURI( text );
permalink.href = "#" + link;
window.location.hash = link;
......@@ -370,14 +370,14 @@
function onDocumentKeyDown( event ) {
if ( firstLetter ) {
firstLetter = false;
text = "";
}
var keyCode = event.keyCode;
// backspace
if ( keyCode == 8 ) {
......@@ -388,23 +388,23 @@
refreshText();
return false;
}
}
function onDocumentKeyPress( event ) {
var keyCode = event.which;
// backspace
if ( keyCode == 8 ) {
event.preventDefault();
} else {
var ch = String.fromCharCode( keyCode );
text += ch;
......@@ -413,16 +413,16 @@
}
}
function refreshText() {
updatePermalink();
scene.removeChild( textMesh1 );
textGeo = new THREE.TextGeometry( text, {
size: size,
size: size,
height: height,
curveSegments: curveSegments,
......@@ -430,9 +430,9 @@
weight: weight,
style: style,
bezelThickness: bezelThickness,
bezelSize: bezelSize,
bezelEnabled: bezelEnabled
bevelThickness: bevelThickness,
bevelSize: bevelSize,
bevelEnabled: bevelEnabled
});
......@@ -459,14 +459,14 @@
textMesh2.rotation.x = Math.PI;
textMesh2.rotation.y = Math.PI * 2;
parent.addChild( textMesh2 );
}
}
function onDocumentMouseDown( event ) {
event.preventDefault();
......@@ -531,7 +531,7 @@
}
//
function initPostprocessing() {
postprocessing.scene = new THREE.Scene();
......@@ -621,9 +621,9 @@
time = new Date().getTime();
delta = 0.1 * ( time - oldTime );
oldTime = time;
parent.rotation.y += ( targetRotation - parent.rotation.y ) * 0.05;
if ( postprocessing.enabled ) {
renderer.clear();
......@@ -669,7 +669,7 @@
renderer.clear();
renderer.render( scene, camera );
}
}
}
......
......@@ -15,9 +15,9 @@
* weight: <string>, // font weight (normal, bold)
* style: <string>, // font style (normal, italics)
*
* bezelEnabled: <bool>, // turn on bezel
* bezelThickness: <float>, // how deep into text bezel goes
* bezelSize: <float>, // how far from text outline is bezel
* bevelEnabled: <bool>, // turn on bevel
* bevelThickness: <float>, // how deep into text bevel goes
* bevelSize: <float>, // how far from text outline is bevel
* }
*
* It uses techniques used in:
......@@ -60,9 +60,9 @@ THREE.TextGeometry.prototype.set = function ( text, parameters ) {
var weight = parameters.weight !== undefined ? parameters.weight : "normal";
var style = parameters.style !== undefined ? parameters.style : "normal";
var bezelThickness = parameters.bezelThickness !== undefined ? parameters.bezelThickness : 10;
var bezelSize = parameters.bezelSize !== undefined ? parameters.bezelSize : 8;
var bezelEnabled = parameters.bezelEnabled !== undefined ? parameters.bezelEnabled : false;
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;
......@@ -71,7 +71,7 @@ THREE.TextGeometry.prototype.set = function ( text, parameters ) {
THREE.FontUtils.weight = weight;
THREE.FontUtils.style = style;
THREE.FontUtils.bezelSize = bezelSize;
THREE.FontUtils.bevelSize = bevelSize;
// Get a Font data json object
......@@ -80,7 +80,7 @@ THREE.TextGeometry.prototype.set = function ( text, parameters ) {
var vertices = data.points;
var faces = data.faces;
var contour = data.contour;
var bezelPoints = data.bezel;
var bevelPoints = data.bevel;
var scope = this;
......@@ -90,7 +90,7 @@ THREE.TextGeometry.prototype.set = function ( text, parameters ) {
var i,
vert, vlen = vertices.length,
face, flen = faces.length,
bezelPt, blen = bezelPoints.length;
bevelPt, blen = bevelPoints.length;
// Back facing vertices
......@@ -110,19 +110,19 @@ THREE.TextGeometry.prototype.set = function ( text, parameters ) {
}
if ( bezelEnabled ) {
if ( bevelEnabled ) {
for ( i = 0; i < blen; i++ ) {
bezelPt = bezelPoints[ i ];
v( bezelPt.x, bezelPt.y, bezelThickness );
bevelPt = bevelPoints[ i ];
v( bevelPt.x, bevelPt.y, bevelThickness );
}
for ( i = 0; i < blen; i++ ) {
bezelPt = bezelPoints[ i ];
v( bezelPt.x, bezelPt.y, height - bezelThickness );
bevelPt = bevelPoints[ i ];
v( bevelPt.x, bevelPt.y, height - bevelThickness );
}
......@@ -149,9 +149,9 @@ THREE.TextGeometry.prototype.set = function ( text, parameters ) {
var lastV;
var j, k, l, m;
if ( bezelEnabled ) {
if ( bevelEnabled ) {
i = bezelPoints.length;
i = bevelPoints.length;
while ( --i > 0 ) {
......@@ -668,18 +668,18 @@ THREE.FontUtils = {
var path = new THREE.Path();
for ( i = 0; i < length; i++ ) {
var ret = this.extractGlyphPoints( chars[ i ], face, scale, offset, path );
offset += ret.offset;
characterPts.push( ret.points );
allPts = allPts.concat( ret.points );
//fontPaths.push( ret.path );
}
//path.debug(document.getElementById("boo"));
console.log(path);
// get the width
......@@ -694,7 +694,7 @@ THREE.FontUtils = {
var extract = this.extractPoints( allPts, characterPts );
extract.contour = allPts;
var bezelPoints = [];
var bevelPoints = [];
var centroids = [], forCentroids = [], expandOutwards = [], sum = new THREE.Vector2(), lastV;
......@@ -739,7 +739,7 @@ THREE.FontUtils = {
centroid = centroids[ p ];
dirV = pt.clone().subSelf( centroid );
adj = this.bezelSize / dirV.length();
adj = this.bevelSize / dirV.length();
if ( expandOutwards[ p ] ) {
......@@ -752,7 +752,7 @@ THREE.FontUtils = {
}
adj = dirV.multiplyScalar( adj ).addSelf( centroid );
bezelPoints.unshift( adj );
bevelPoints.unshift( adj );
if ( !lastV ) {
......@@ -776,12 +776,12 @@ THREE.FontUtils = {
for ( p = 0; p < allPts.length; p++ ) {
pt = allPts[ p ];
bezelPoints.push( new THREE.Vector2( pt.x + this.bezelSize, pt.y + this.bezelSize ) );
bevelPoints.push( new THREE.Vector2( pt.x + this.bevelSize, pt.y + this.bevelSize ) );
}
*/
extract.bezel = bezelPoints;
extract.bevel = bevelPoints;
return extract;
......@@ -857,7 +857,7 @@ THREE.FontUtils = {
extractGlyphPoints : function( c, face, scale, offset, path ) {
var pts = [];
var i, i2,
......@@ -1074,10 +1074,10 @@ THREE.FontUtils = {
result.push( contour[ b ] );
result.push( contour[ c ] );
*/
result.push( [ contour[ a ],
result.push( [ contour[ a ],
contour[ b ],
contour[ c ] ] );
vertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册