Skip to content

Commit bc383cf

Browse files
committed
Included FontUtils and TextGeometry in relevant examples.
1 parent 661ce3a commit bc383cf

10 files changed

+34
-17
lines changed

examples/canvas_geometry_text.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
<script src="js/libs/stats.min.js"></script>
2525

26-
<!-- load the font file from canvas-text -->
27-
26+
<script src="js/geometries/TextGeometry.js"></script>
27+
<script src="js/utils/FontUtils.js"></script>
2828
<script src="fonts/helvetiker_regular.typeface.js"></script>
2929

3030

@@ -90,8 +90,12 @@
9090
text3d.computeBoundingBox();
9191
var centerOffset = -0.5 * ( text3d.boundingBox.max.x - text3d.boundingBox.min.x );
9292

93-
var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: 0.5 } );
94-
text = new THREE.Mesh( text3d, textMaterial );
93+
var material = new THREE.MeshFaceMaterial( [
94+
new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: 0.5 } ),
95+
new THREE.MeshBasicMaterial( { color: 0x000000, overdraw: 0.5 } )
96+
] );
97+
98+
text = new THREE.Mesh( text3d, material );
9599

96100
text.position.x = centerOffset;
97101
text.position.y = 100;

examples/webgl_camera_logarithmicdepthbuffer.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@
9191

9292
<script src="../build/three.min.js"></script>
9393
<script src="js/libs/stats.min.js"></script>
94+
95+
<script src="js/geometries/TextGeometry.js"></script>
96+
<script src="js/utils/FontUtils.js"></script>
9497
<script src="fonts/helvetiker_regular.typeface.js"></script>
9598

9699
<script>

examples/webgl_custom_attributes_lines.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
<script src="../build/three.min.js"></script>
3838

39+
<script src="js/geometries/TextGeometry.js"></script>
40+
<script src="js/utils/FontUtils.js"></script>
3941
<script src="fonts/helvetiker_bold.typeface.js"></script>
4042

4143
<script type="x-shader/x-vertex" id="vertexshader">

examples/webgl_geometry_normals.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
<script src="../build/three.min.js"></script>
1919
<script src="js/controls/OrbitControls.js"></script>
2020
<script src="js/libs/stats.min.js"></script>
21+
22+
<script src="js/geometries/TextGeometry.js"></script>
23+
<script src="js/utils/FontUtils.js"></script>
2124
<script src="fonts/helvetiker_regular.typeface.js"></script>
2225

2326
<script>
@@ -141,15 +144,15 @@
141144
}
142145

143146
dropdown += '</select>';
144-
147+
145148
var text =
146149
'Drag to spin THREE.' + params.type +
147150
'<br>' +
148151
'<br>Geometry: ' + dropdown + ' <a href="#" onclick="nextGeometry();return false;">next</a>';
149152

150153
text +=
151-
'<br><br><font color="3333FF">Blue Arrows: Face Normals</font>' +
152-
'<br><font color="FF3333">Red Arrows: Vertex Normals before Geometry.mergeVertices</font>' +
154+
'<br><br><font color="3333FF">Blue Arrows: Face Normals</font>' +
155+
'<br><font color="FF3333">Red Arrows: Vertex Normals before Geometry.mergeVertices</font>' +
153156
'<br>Black Arrows: Vertex Normals after Geometry.mergeVertices';
154157

155158
info.innerHTML = text;
@@ -231,7 +234,7 @@
231234
.add( geometry.vertices[ face.c ] )
232235
.divideScalar( 3 );
233236

234-
var arrow = new THREE.ArrowHelper(
237+
var arrow = new THREE.ArrowHelper(
235238
face.normal,
236239
centroid,
237240
normalLength,
@@ -245,7 +248,7 @@
245248
continue;
246249
}
247250
for( var v = 0, vl = face.vertexNormals.length; v < vl; v ++ ) {
248-
var arrow = new THREE.ArrowHelper(
251+
var arrow = new THREE.ArrowHelper(
249252
face.vertexNormals[ v ],
250253
originalGeometry.vertices[ face[ fvNames[ v ] ] ],
251254
normalLength,
@@ -260,7 +263,7 @@
260263
continue;
261264
}
262265
for( var v = 0, vl = face.vertexNormals.length; v < vl; v ++ ) {
263-
var arrow = new THREE.ArrowHelper(
266+
var arrow = new THREE.ArrowHelper(
264267
face.vertexNormals[ v ],
265268
mesh.geometry.vertices[ face[ fvNames[ v ] ] ],
266269
normalLength,
@@ -346,4 +349,3 @@
346349

347350
</body>
348351
</html>
349-

examples/webgl_geometry_text.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
<script src="js/Detector.js"></script>
5656
<script src="js/libs/stats.min.js"></script>
5757

58-
<!-- load the font files -->
58+
<script src="js/geometries/TextGeometry.js"></script>
59+
<script src="js/utils/FontUtils.js"></script>
5960

6061
<script src="fonts/gentilis_bold.typeface.js"></script>
6162
<script src="fonts/gentilis_regular.typeface.js"></script>
@@ -67,7 +68,6 @@
6768
<script src="fonts/droid/droid_sans_bold.typeface.js"></script>
6869
<script src="fonts/droid/droid_serif_regular.typeface.js"></script>
6970
<script src="fonts/droid/droid_serif_bold.typeface.js"></script>
70-
<!-- todo async loader for fonts -->
7171

7272
<script>
7373

examples/webgl_geometry_text2.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
<script src="js/Detector.js"></script>
5757
<script src="js/libs/stats.min.js"></script>
5858

59-
<!-- load the font files -->
59+
<script src="js/geometries/TextGeometry.js"></script>
60+
<script src="js/utils/FontUtils.js"></script>
6061

6162
<script src="fonts/gentilis_bold.typeface.js"></script>
6263
<script src="fonts/gentilis_regular.typeface.js"></script>
@@ -69,9 +70,6 @@
6970
<script src="fonts/droid/droid_serif_regular.typeface.js"></script>
7071
<script src="fonts/droid/droid_serif_bold.typeface.js"></script>
7172

72-
<!-- todo async loader for fonts -->
73-
74-
7573
<!-- replace built-in triangulation with PnlTri.js -->
7674
<script src="js/libs/pnltri.min.js"></script>
7775
<script>

examples/webgl_modifier_subdivision.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<script src="js/modifiers/SubdivisionModifier.js"></script>
2121
<script src="js/libs/stats.min.js"></script>
2222

23+
<script src="js/geometries/TextGeometry.js"></script>
24+
<script src="js/utils/FontUtils.js"></script>
2325
<script src="fonts/helvetiker_regular.typeface.js"></script>
2426

2527
<script>

examples/webgl_modifier_tessellation.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
<script src="js/Detector.js"></script>
4848
<script src="js/libs/stats.min.js"></script>
4949

50+
<script src="js/geometries/TextGeometry.js"></script>
51+
<script src="js/utils/FontUtils.js"></script>
5052
<script src="fonts/helvetiker_bold.typeface.js"></script>
5153

5254
<script type="x-shader/x-vertex" id="vertexshader">

examples/webgl_shadowmap.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
<script src="js/Detector.js"></script>
4242
<script src="js/libs/stats.min.js"></script>
4343

44+
<script src="js/geometries/TextGeometry.js"></script>
45+
<script src="js/utils/FontUtils.js"></script>
4446
<script src="fonts/helvetiker_bold.typeface.js"></script>
4547

4648
<script>

examples/webgl_shadowmap_performance.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
<script src="js/Detector.js"></script>
4141
<script src="js/libs/stats.min.js"></script>
4242

43+
<script src="js/geometries/TextGeometry.js"></script>
44+
<script src="js/utils/FontUtils.js"></script>
4345
<script src="fonts/helvetiker_bold.typeface.js"></script>
4446

4547
<script>

0 commit comments

Comments
 (0)