提交 114d3587 编写于 作者: M Mr.doob

Removed bend stuff from ExtrudeGeometry and TextGeometry.

Uhm, some day it would be nice to rewrite all this Shape/Path/Curve/CurvePath code...
上级 b6861b3e
...@@ -30162,30 +30162,28 @@ THREE.CylinderGeometry.prototype = Object.create( THREE.Geometry.prototype ); ...@@ -30162,30 +30162,28 @@ THREE.CylinderGeometry.prototype = Object.create( THREE.Geometry.prototype );
* *
* parameters = { * parameters = {
* *
* size: <float>, // size of the text * size: <float>, // size of the text
* height: <float>, // thickness to extrude text * height: <float>, // thickness to extrude text
* curveSegments: <int>, // number of points on the curves * curveSegments: <int>, // number of points on the curves
* steps: <int>, // number of points for z-side extrusions / used for subdividing segements of extrude spline too * steps: <int>, // number of points for z-side extrusions / used for subdividing segements of extrude spline too
amount: <int>, // Amount * amount: <int>, // Amount
* *
* bevelEnabled: <bool>, // turn on bevel * bevelEnabled: <bool>, // turn on bevel
* bevelThickness: <float>, // how deep into text bevel goes * bevelThickness: <float>, // how deep into text bevel goes
* bevelSize: <float>, // how far from text outline is bevel * bevelSize: <float>, // how far from text outline is bevel
* bevelSegments: <int>, // number of bevel layers * bevelSegments: <int>, // number of bevel layers
* *
* extrudePath: <THREE.CurvePath> // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined) * extrudePath: <THREE.CurvePath> // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined)
* frames: <THREE.TubeGeometry.FrenetFrames> // containing arrays of tangents, normals, binormals * frames: <THREE.TubeGeometry.FrenetFrames> // containing arrays of tangents, normals, binormals
* bendPath: <THREE.CurvePath> // 2d path for bend the shape around x/y plane
* *
* material: <int> // material index for front and back faces * material: <int> // material index for front and back faces
* extrudeMaterial: <int> // material index for extrusion and beveled faces * extrudeMaterial: <int> // material index for extrusion and beveled faces
* uvGenerator: <Object> // object that provides UV generator functions * uvGenerator: <Object> // object that provides UV generator functions
* *
* } * }
**/ **/
THREE.ExtrudeGeometry = function( shapes, options ) { THREE.ExtrudeGeometry = function ( shapes, options ) {
if ( typeof( shapes ) === "undefined" ) { if ( typeof( shapes ) === "undefined" ) {
shapes = []; shapes = [];
...@@ -30215,7 +30213,7 @@ THREE.ExtrudeGeometry = function( shapes, options ) { ...@@ -30215,7 +30213,7 @@ THREE.ExtrudeGeometry = function( shapes, options ) {
THREE.ExtrudeGeometry.prototype = Object.create( THREE.Geometry.prototype ); THREE.ExtrudeGeometry.prototype = Object.create( THREE.Geometry.prototype );
THREE.ExtrudeGeometry.prototype.addShapeList = function(shapes, options) { THREE.ExtrudeGeometry.prototype.addShapeList = function ( shapes, options ) {
var sl = shapes.length; var sl = shapes.length;
for ( var s = 0; s < sl; s ++ ) { for ( var s = 0; s < sl; s ++ ) {
...@@ -30224,7 +30222,7 @@ THREE.ExtrudeGeometry.prototype.addShapeList = function(shapes, options) { ...@@ -30224,7 +30222,7 @@ THREE.ExtrudeGeometry.prototype.addShapeList = function(shapes, options) {
} }
}; };
THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
var amount = options.amount !== undefined ? options.amount : 100; var amount = options.amount !== undefined ? options.amount : 100;
...@@ -30238,8 +30236,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -30238,8 +30236,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var steps = options.steps !== undefined ? options.steps : 1; var steps = options.steps !== undefined ? options.steps : 1;
var bendPath = options.bendPath;
var extrudePath = options.extrudePath; var extrudePath = options.extrudePath;
var extrudePts, extrudeByPath = false; var extrudePts, extrudeByPath = false;
...@@ -30267,9 +30263,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -30267,9 +30263,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
// Reuse TNB from TubeGeomtry for now. // Reuse TNB from TubeGeomtry for now.
// TODO1 - have a .isClosed in spline? // TODO1 - have a .isClosed in spline?
splineTube = options.frames !== undefined ? splineTube = options.frames !== undefined ? options.frames : new THREE.TubeGeometry.FrenetFrames(extrudePath, steps, false);
options.frames :
new THREE.TubeGeometry.FrenetFrames(extrudePath, steps, false);
// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
...@@ -30297,15 +30291,9 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -30297,15 +30291,9 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var shapesOffset = this.vertices.length; var shapesOffset = this.vertices.length;
if ( bendPath ) {
shape.addWrapPath( bendPath );
}
var shapePoints = shape.extractPoints(); var shapePoints = shape.extractPoints();
var vertices = shapePoints.shape; var vertices = shapePoints.shape;
var holes = shapePoints.holes; var holes = shapePoints.holes;
var reverse = !THREE.Shape.Utils.isClockWise( vertices ) ; var reverse = !THREE.Shape.Utils.isClockWise( vertices ) ;
...@@ -30334,18 +30322,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -30334,18 +30322,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var faces = THREE.Shape.Utils.triangulateShape ( vertices, holes ); var faces = THREE.Shape.Utils.triangulateShape ( vertices, holes );
//var faces = THREE.Shape.Utils.triangulate2( vertices, holes );
// Would it be better to move points after triangulation? /* Vertices */
// shapePoints = shape.extractAllPointsWithBend( curveSegments, bendPath );
// vertices = shapePoints.shape;
// holes = shapePoints.holes;
//console.log(faces);
////
/// Handle Vertices
////
var contour = vertices; // vertices has all points but contour has only points of circumference var contour = vertices; // vertices has all points but contour has only points of circumference
...@@ -30372,9 +30350,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -30372,9 +30350,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
cont, clen = contour.length; cont, clen = contour.length;
//------
// Find directions for point movement // Find directions for point movement
//
var RAD_TO_DEGREES = 180 / Math.PI; var RAD_TO_DEGREES = 180 / Math.PI;
...@@ -30687,11 +30663,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -30687,11 +30663,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
} }
/* Faces */
////
/// Handle Faces
////
// Top and bottom faces // Top and bottom faces
...@@ -30823,8 +30795,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -30823,8 +30795,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
// normal, color, material // normal, color, material
scope.faces.push( new THREE.Face3( a, b, c, null, null, material ) ); scope.faces.push( new THREE.Face3( a, b, c, null, null, material ) );
var uvs = isBottom ? uvgen.generateBottomUV( scope, shape, options, a, b, c ) var uvs = isBottom ? uvgen.generateBottomUV( scope, shape, options, a, b, c ) : uvgen.generateTopUV( scope, shape, options, a, b, c );
: uvgen.generateTopUV( scope, shape, options, a, b, c );
scope.faceVertexUvs[ 0 ].push( uvs ); scope.faceVertexUvs[ 0 ].push( uvs );
...@@ -30847,8 +30818,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -30847,8 +30818,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
}; };
THREE.ExtrudeGeometry.WorldUVGenerator = { THREE.ExtrudeGeometry.WorldUVGenerator = {
generateTopUV: function( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC ) { generateTopUV: function( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC ) {
...@@ -30878,6 +30847,7 @@ THREE.ExtrudeGeometry.WorldUVGenerator = { ...@@ -30878,6 +30847,7 @@ THREE.ExtrudeGeometry.WorldUVGenerator = {
generateSideWallUV: function( geometry, extrudedShape, wallContour, extrudeOptions, generateSideWallUV: function( geometry, extrudedShape, wallContour, extrudeOptions,
indexA, indexB, indexC, indexD, stepIndex, stepsLength, indexA, indexB, indexC, indexD, stepIndex, stepsLength,
contourIndex1, contourIndex2 ) { contourIndex1, contourIndex2 ) {
var ax = geometry.vertices[ indexA ].x, var ax = geometry.vertices[ indexA ].x,
ay = geometry.vertices[ indexA ].y, ay = geometry.vertices[ indexA ].y,
az = geometry.vertices[ indexA ].z, az = geometry.vertices[ indexA ].z,
...@@ -31163,15 +31133,12 @@ THREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype ); ...@@ -31163,15 +31133,12 @@ THREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype );
* bevelEnabled: <bool>, // turn on bevel * bevelEnabled: <bool>, // turn on bevel
* bevelThickness: <float>, // how deep into text bevel goes * bevelThickness: <float>, // how deep into text bevel goes
* bevelSize: <float>, // how far from text outline is bevel * bevelSize: <float>, // how far from text outline is bevel
*
* bend: <bool> // bend according to hardcoded curve (generates bendPath)
* bendPath: <curve> // wraps text according to bend Path
* } * }
* *
*/ */
/* Usage Examples /* Usage Examples
// TextGeometry wrapper // TextGeometry wrapper
var text3d = new TextGeometry( text, options ); var text3d = new TextGeometry( text, options );
...@@ -31180,7 +31147,7 @@ THREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype ); ...@@ -31180,7 +31147,7 @@ THREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype );
var textShapes = THREE.FontUtils.generateShapes( text, options ); var textShapes = THREE.FontUtils.generateShapes( text, options );
var text3d = new ExtrudeGeometry( textShapes, options ); var text3d = new ExtrudeGeometry( textShapes, options );
*/ */
...@@ -31198,19 +31165,6 @@ THREE.TextGeometry = function ( text, parameters ) { ...@@ -31198,19 +31165,6 @@ THREE.TextGeometry = function ( text, parameters ) {
if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
if ( parameters.bend ) {
var b = textShapes[ textShapes.length - 1 ].getBoundingBox();
var max = b.maxX;
parameters.bendPath = new THREE.QuadraticBezierCurve(
new THREE.Vector2( 0, 0 ),
new THREE.Vector2( max / 2, 120 ),
new THREE.Vector2( max, 0 )
);
}
THREE.ExtrudeGeometry.call( this, textShapes, parameters ); THREE.ExtrudeGeometry.call( this, textShapes, parameters );
}; };
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<div id="container"></div> <div id="container"></div>
<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> webgl - buffergeometry</div> <div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> webgl - buffergeometry</div>
<script src="../build/three.js"></script> <script src="../build/three.min.js"></script>
<script src="js/Detector.js"></script> <script src="js/Detector.js"></script>
<script src="js/Stats.js"></script> <script src="js/Stats.js"></script>
......
...@@ -95,7 +95,6 @@ ...@@ -95,7 +95,6 @@
bevelSize = 1.5, bevelSize = 1.5,
bevelSegments = 10, bevelSegments = 10,
bevelEnabled = true, bevelEnabled = true,
bend = false,
font = "helvetiker", // helvetiker, optimer, gentilis, droid sans, droid serif font = "helvetiker", // helvetiker, optimer, gentilis, droid sans, droid serif
weight = "bold", // normal bold weight = "bold", // normal bold
...@@ -158,8 +157,6 @@ ...@@ -158,8 +157,6 @@
bevelEnabled: bevelEnabled, bevelEnabled: bevelEnabled,
bevelSegments: bevelSegments, bevelSegments: bevelSegments,
bend: bend,
steps: steps steps: steps
}); });
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
<span class="button" id="font">change font</span>, <span class="button" id="font">change font</span>,
<span class="button" id="weight">change weight</span>, <span class="button" id="weight">change weight</span>,
<span class="button" id="bevel">change bevel</span>, <span class="button" id="bevel">change bevel</span>,
<span class="button" id="bend">bend</span>,
<span class="button" id="postprocessing">change postprocessing</span>, <span class="button" id="postprocessing">change postprocessing</span>,
<a id="permalink" href="#">permalink</a> <a id="permalink" href="#">permalink</a>
</div> </div>
...@@ -95,27 +94,29 @@ ...@@ -95,27 +94,29 @@
bevelSize = 1.5, bevelSize = 1.5,
bevelSegments = 3, bevelSegments = 3,
bevelEnabled = true, bevelEnabled = true,
bend = true,
font = "optimer", // helvetiker, optimer, gentilis, droid sans, droid serif font = "optimer", // helvetiker, optimer, gentilis, droid sans, droid serif
weight = "bold", // normal bold weight = "bold", // normal bold
style = "normal"; // normal italic style = "normal"; // normal italic
var mirror = true; var mirror = true;
var fontMap = { var fontMap = {
"helvetiker" : 0,
"optimer" : 1, "helvetiker": 0,
"gentilis" : 2, "optimer": 1,
"droid sans" : 3, "gentilis": 2,
"droid serif" : 4 "droid sans": 3,
"droid serif": 4
}; };
var weightMap = { var weightMap = {
"normal" : 0,
"bold" : 1 "normal": 0,
} "bold": 1
};
var reverseFontMap = {}; var reverseFontMap = {};
var reverseWeightMap = {}; var reverseWeightMap = {};
...@@ -196,8 +197,7 @@ ...@@ -196,8 +197,7 @@
var weighthash = hash.substring( 7, 8 ); var weighthash = hash.substring( 7, 8 );
var pphash = hash.substring( 8, 9 ); var pphash = hash.substring( 8, 9 );
var bevelhash = hash.substring( 9, 10 ); var bevelhash = hash.substring( 9, 10 );
var bendhash = hash.substring( 10, 11 ); var texthash = hash.substring( 10 );
var texthash = hash.substring( 12 );
hex = colorhash; hex = colorhash;
pointLight.color.setHex( parseInt( colorhash, 16 ) ); pointLight.color.setHex( parseInt( colorhash, 16 ) );
...@@ -207,7 +207,6 @@ ...@@ -207,7 +207,6 @@
postprocessing.enabled = parseInt( pphash ); postprocessing.enabled = parseInt( pphash );
bevelEnabled = parseInt( bevelhash ); bevelEnabled = parseInt( bevelhash );
bend = parseInt( bendhash );
text = decodeURI( texthash ); text = decodeURI( texthash );
...@@ -322,13 +321,6 @@ ...@@ -322,13 +321,6 @@
}, false ); }, false );
document.getElementById( "bend" ).addEventListener( 'click', function() {
bend = !bend;
refreshText();
}, false );
document.getElementById( "postprocessing" ).addEventListener( 'click', function() { document.getElementById( "postprocessing" ).addEventListener( 'click', function() {
postprocessing.enabled = !postprocessing.enabled; postprocessing.enabled = !postprocessing.enabled;
...@@ -393,8 +385,7 @@ ...@@ -393,8 +385,7 @@
function updatePermalink() { function updatePermalink() {
var link = hex + fontMap[ font ] + weightMap[ weight ] + boolToNum( postprocessing.enabled ) + boolToNum( bevelEnabled ) var link = hex + fontMap[ font ] + weightMap[ weight ] + boolToNum( postprocessing.enabled ) + boolToNum( bevelEnabled ) + "#" + encodeURI( text );
+ boolToNum( bend ) + "#" + encodeURI( text );
permalink.href = "#" + link; permalink.href = "#" + link;
window.location.hash = link; window.location.hash = link;
...@@ -464,8 +455,6 @@ ...@@ -464,8 +455,6 @@
bevelSize: bevelSize, bevelSize: bevelSize,
bevelEnabled: bevelEnabled, bevelEnabled: bevelEnabled,
bend: bend,
material: 0, material: 0,
extrudeMaterial: 1 extrudeMaterial: 1
......
...@@ -5,30 +5,28 @@ ...@@ -5,30 +5,28 @@
* *
* parameters = { * parameters = {
* *
* size: <float>, // size of the text * size: <float>, // size of the text
* height: <float>, // thickness to extrude text * height: <float>, // thickness to extrude text
* curveSegments: <int>, // number of points on the curves * curveSegments: <int>, // number of points on the curves
* steps: <int>, // number of points for z-side extrusions / used for subdividing segements of extrude spline too * steps: <int>, // number of points for z-side extrusions / used for subdividing segements of extrude spline too
amount: <int>, // Amount * amount: <int>, // Amount
* *
* bevelEnabled: <bool>, // turn on bevel * bevelEnabled: <bool>, // turn on bevel
* bevelThickness: <float>, // how deep into text bevel goes * bevelThickness: <float>, // how deep into text bevel goes
* bevelSize: <float>, // how far from text outline is bevel * bevelSize: <float>, // how far from text outline is bevel
* bevelSegments: <int>, // number of bevel layers * bevelSegments: <int>, // number of bevel layers
* *
* extrudePath: <THREE.CurvePath> // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined) * extrudePath: <THREE.CurvePath> // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined)
* frames: <THREE.TubeGeometry.FrenetFrames> // containing arrays of tangents, normals, binormals * frames: <THREE.TubeGeometry.FrenetFrames> // containing arrays of tangents, normals, binormals
* bendPath: <THREE.CurvePath> // 2d path for bend the shape around x/y plane
* *
* material: <int> // material index for front and back faces * material: <int> // material index for front and back faces
* extrudeMaterial: <int> // material index for extrusion and beveled faces * extrudeMaterial: <int> // material index for extrusion and beveled faces
* uvGenerator: <Object> // object that provides UV generator functions * uvGenerator: <Object> // object that provides UV generator functions
* *
* } * }
**/ **/
THREE.ExtrudeGeometry = function ( shapes, options ) {
THREE.ExtrudeGeometry = function( shapes, options ) {
if ( typeof( shapes ) === "undefined" ) { if ( typeof( shapes ) === "undefined" ) {
shapes = []; shapes = [];
...@@ -58,7 +56,7 @@ THREE.ExtrudeGeometry = function( shapes, options ) { ...@@ -58,7 +56,7 @@ THREE.ExtrudeGeometry = function( shapes, options ) {
THREE.ExtrudeGeometry.prototype = Object.create( THREE.Geometry.prototype ); THREE.ExtrudeGeometry.prototype = Object.create( THREE.Geometry.prototype );
THREE.ExtrudeGeometry.prototype.addShapeList = function(shapes, options) { THREE.ExtrudeGeometry.prototype.addShapeList = function ( shapes, options ) {
var sl = shapes.length; var sl = shapes.length;
for ( var s = 0; s < sl; s ++ ) { for ( var s = 0; s < sl; s ++ ) {
...@@ -67,7 +65,7 @@ THREE.ExtrudeGeometry.prototype.addShapeList = function(shapes, options) { ...@@ -67,7 +65,7 @@ THREE.ExtrudeGeometry.prototype.addShapeList = function(shapes, options) {
} }
}; };
THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
var amount = options.amount !== undefined ? options.amount : 100; var amount = options.amount !== undefined ? options.amount : 100;
...@@ -81,8 +79,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -81,8 +79,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var steps = options.steps !== undefined ? options.steps : 1; var steps = options.steps !== undefined ? options.steps : 1;
var bendPath = options.bendPath;
var extrudePath = options.extrudePath; var extrudePath = options.extrudePath;
var extrudePts, extrudeByPath = false; var extrudePts, extrudeByPath = false;
...@@ -110,9 +106,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -110,9 +106,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
// Reuse TNB from TubeGeomtry for now. // Reuse TNB from TubeGeomtry for now.
// TODO1 - have a .isClosed in spline? // TODO1 - have a .isClosed in spline?
splineTube = options.frames !== undefined ? splineTube = options.frames !== undefined ? options.frames : new THREE.TubeGeometry.FrenetFrames(extrudePath, steps, false);
options.frames :
new THREE.TubeGeometry.FrenetFrames(extrudePath, steps, false);
// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
...@@ -140,15 +134,9 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -140,15 +134,9 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var shapesOffset = this.vertices.length; var shapesOffset = this.vertices.length;
if ( bendPath ) {
shape.addWrapPath( bendPath );
}
var shapePoints = shape.extractPoints(); var shapePoints = shape.extractPoints();
var vertices = shapePoints.shape; var vertices = shapePoints.shape;
var holes = shapePoints.holes; var holes = shapePoints.holes;
var reverse = !THREE.Shape.Utils.isClockWise( vertices ) ; var reverse = !THREE.Shape.Utils.isClockWise( vertices ) ;
...@@ -177,18 +165,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -177,18 +165,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var faces = THREE.Shape.Utils.triangulateShape ( vertices, holes ); var faces = THREE.Shape.Utils.triangulateShape ( vertices, holes );
//var faces = THREE.Shape.Utils.triangulate2( vertices, holes );
// Would it be better to move points after triangulation?
// shapePoints = shape.extractAllPointsWithBend( curveSegments, bendPath );
// vertices = shapePoints.shape;
// holes = shapePoints.holes;
//console.log(faces); /* Vertices */
////
/// Handle Vertices
////
var contour = vertices; // vertices has all points but contour has only points of circumference var contour = vertices; // vertices has all points but contour has only points of circumference
...@@ -215,9 +193,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -215,9 +193,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
cont, clen = contour.length; cont, clen = contour.length;
//------
// Find directions for point movement // Find directions for point movement
//
var RAD_TO_DEGREES = 180 / Math.PI; var RAD_TO_DEGREES = 180 / Math.PI;
...@@ -530,11 +506,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -530,11 +506,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
} }
/* Faces */
////
/// Handle Faces
////
// Top and bottom faces // Top and bottom faces
...@@ -666,8 +638,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -666,8 +638,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
// normal, color, material // normal, color, material
scope.faces.push( new THREE.Face3( a, b, c, null, null, material ) ); scope.faces.push( new THREE.Face3( a, b, c, null, null, material ) );
var uvs = isBottom ? uvgen.generateBottomUV( scope, shape, options, a, b, c ) var uvs = isBottom ? uvgen.generateBottomUV( scope, shape, options, a, b, c ) : uvgen.generateTopUV( scope, shape, options, a, b, c );
: uvgen.generateTopUV( scope, shape, options, a, b, c );
scope.faceVertexUvs[ 0 ].push( uvs ); scope.faceVertexUvs[ 0 ].push( uvs );
...@@ -690,8 +661,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { ...@@ -690,8 +661,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
}; };
THREE.ExtrudeGeometry.WorldUVGenerator = { THREE.ExtrudeGeometry.WorldUVGenerator = {
generateTopUV: function( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC ) { generateTopUV: function( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC ) {
...@@ -721,6 +690,7 @@ THREE.ExtrudeGeometry.WorldUVGenerator = { ...@@ -721,6 +690,7 @@ THREE.ExtrudeGeometry.WorldUVGenerator = {
generateSideWallUV: function( geometry, extrudedShape, wallContour, extrudeOptions, generateSideWallUV: function( geometry, extrudedShape, wallContour, extrudeOptions,
indexA, indexB, indexC, indexD, stepIndex, stepsLength, indexA, indexB, indexC, indexD, stepIndex, stepsLength,
contourIndex1, contourIndex2 ) { contourIndex1, contourIndex2 ) {
var ax = geometry.vertices[ indexA ].x, var ax = geometry.vertices[ indexA ].x,
ay = geometry.vertices[ indexA ].y, ay = geometry.vertices[ indexA ].y,
az = geometry.vertices[ indexA ].z, az = geometry.vertices[ indexA ].z,
......
...@@ -18,15 +18,12 @@ ...@@ -18,15 +18,12 @@
* bevelEnabled: <bool>, // turn on bevel * bevelEnabled: <bool>, // turn on bevel
* bevelThickness: <float>, // how deep into text bevel goes * bevelThickness: <float>, // how deep into text bevel goes
* bevelSize: <float>, // how far from text outline is bevel * bevelSize: <float>, // how far from text outline is bevel
*
* bend: <bool> // bend according to hardcoded curve (generates bendPath)
* bendPath: <curve> // wraps text according to bend Path
* } * }
* *
*/ */
/* Usage Examples /* Usage Examples
// TextGeometry wrapper // TextGeometry wrapper
var text3d = new TextGeometry( text, options ); var text3d = new TextGeometry( text, options );
...@@ -35,7 +32,7 @@ ...@@ -35,7 +32,7 @@
var textShapes = THREE.FontUtils.generateShapes( text, options ); var textShapes = THREE.FontUtils.generateShapes( text, options );
var text3d = new ExtrudeGeometry( textShapes, options ); var text3d = new ExtrudeGeometry( textShapes, options );
*/ */
...@@ -53,19 +50,6 @@ THREE.TextGeometry = function ( text, parameters ) { ...@@ -53,19 +50,6 @@ THREE.TextGeometry = function ( text, parameters ) {
if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8; if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false; if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
if ( parameters.bend ) {
var b = textShapes[ textShapes.length - 1 ].getBoundingBox();
var max = b.maxX;
parameters.bendPath = new THREE.QuadraticBezierCurve(
new THREE.Vector2( 0, 0 ),
new THREE.Vector2( max / 2, 120 ),
new THREE.Vector2( max, 0 )
);
}
THREE.ExtrudeGeometry.call( this, textShapes, parameters ); THREE.ExtrudeGeometry.call( this, textShapes, parameters );
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册