|
@@ -339,7 +339,7 @@
|
|
|
|
|
|
function createText() {
|
|
|
|
|
|
- textGeo = new THREE.TextGeometry( text, {
|
|
|
+ textGeo = new THREE.TextBufferGeometry( text, {
|
|
|
|
|
|
font: font,
|
|
|
|
|
@@ -354,56 +354,9 @@
|
|
|
} );
|
|
|
|
|
|
textGeo.computeBoundingBox();
|
|
|
- textGeo.computeVertexNormals();
|
|
|
-
|
|
|
- const triangle = new THREE.Triangle();
|
|
|
-
|
|
|
- // "fix" side normals by removing z-component of normals for side faces
|
|
|
- // (this doesn't work well for beveled geometry as then we lose nice curvature around z-axis)
|
|
|
-
|
|
|
- if ( ! bevelEnabled ) {
|
|
|
-
|
|
|
- const triangleAreaHeuristics = 0.1 * ( height * size );
|
|
|
-
|
|
|
- for ( let i = 0; i < textGeo.faces.length; i ++ ) {
|
|
|
-
|
|
|
- const face = textGeo.faces[ i ];
|
|
|
-
|
|
|
- if ( face.materialIndex == 1 ) {
|
|
|
-
|
|
|
- for ( let j = 0; j < face.vertexNormals.length; j ++ ) {
|
|
|
-
|
|
|
- face.vertexNormals[ j ].z = 0;
|
|
|
- face.vertexNormals[ j ].normalize();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- const va = textGeo.vertices[ face.a ];
|
|
|
- const vb = textGeo.vertices[ face.b ];
|
|
|
- const vc = textGeo.vertices[ face.c ];
|
|
|
-
|
|
|
- const s = triangle.set( va, vb, vc ).getArea();
|
|
|
-
|
|
|
- if ( s > triangleAreaHeuristics ) {
|
|
|
-
|
|
|
- for ( let j = 0; j < face.vertexNormals.length; j ++ ) {
|
|
|
-
|
|
|
- face.vertexNormals[ j ].copy( face.normal );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
const centerOffset = - 0.5 * ( textGeo.boundingBox.max.x - textGeo.boundingBox.min.x );
|
|
|
|
|
|
- textGeo = new THREE.BufferGeometry().fromGeometry( textGeo );
|
|
|
-
|
|
|
textMesh1 = new THREE.Mesh( textGeo, materials );
|
|
|
|
|
|
textMesh1.position.x = centerOffset;
|