1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /**
- * @author zz85 / http://www.lab4games.net/zz85/blog
- * @author alteredq / http://alteredqualia.com/
- *
- * For creating 3D text geometry in three.js
- *
- * Text = 3D Text
- *
- * parameters = {
- * size: <float>, // size of the text
- * height: <float>, // thickness to extrude text
- * curveSegments: <int>, // number of points on the curves
- *
- * font: <string>, // font name
- * weight: <string>, // font weight (normal, bold)
- * style: <string>, // font style (normal, italics)
- *
- * bevelEnabled: <bool>, // turn on bevel
- * bevelThickness: <float>, // how deep into text bevel goes
- * bevelSize: <float>, // how far from text outline is bevel
- * }
- *
- */
- /* Usage Examples
- // TextGeometry wrapper
- var text3d = new TextGeometry( text, options );
- // Complete manner
- var textShapes = THREE.FontUtils.generateShapes( text, options );
- var text3d = new ExtrudeGeometry( textShapes, options );
- */
- THREE.TextGeometry = function ( text, parameters ) {
- parameters = parameters || {};
- var textShapes = THREE.FontUtils.generateShapes( text, parameters );
- // translate parameters to ExtrudeGeometry API
- parameters.amount = parameters.height !== undefined ? parameters.height : 50;
- // defaults
- if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;
- if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
- if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
- THREE.ExtrudeGeometry.call( this, textShapes, parameters );
- this.type = 'TextGeometry';
- };
- THREE.TextGeometry.prototype = Object.create( THREE.ExtrudeGeometry.prototype );
- THREE.TextGeometry.prototype.constructor = THREE.TextGeometry;
|