本文介绍了Three.js中的TextGeometry的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Three.js r74中的TextGeometry存在一些问题.

I am having some problems with the TextGeometry in Three.js r74..

如何正确实施?

这是我的Codepen:

Here is my Codepen:

codepen.io/cheesyeyes/pen/eJqZxK

提前谢谢!

推荐答案

Okey,适合所有正在寻找简单答案而不是链接和其他超载示例的链接的人:

Okey, for everyone who is looking for simple answers and not links and links to other overloaded examples:

必须首先使用三个js FontLoader加载字体:

fonts have to be loaded with the three js FontLoader first:

var loader = new THREE.FontLoader();
loader.load( 'fonts/fontname.js', function ( font ) {

  var textGeometry = new THREE.TextGeometry( "text", {

    font: font,

    size: 50,
    height: 10,
    curveSegments: 12,

    bevelThickness: 1,
    bevelSize: 1,
    bevelEnabled: true

  });

  var textMaterial = new THREE.MeshPhongMaterial(
    { color: 0xff0000, specular: 0xffffff }
  );

  var mesh = new THREE.Mesh( textGeometry, textMaterial );

  scene.add( mesh );

});

这篇关于Three.js中的TextGeometry的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 02:58