three.js TextBufferGeometry创建3d文字(文字乱码问题解答)

it2024-12-29  10

//需要网上找ttf格式中文字体,然后转json,不然中文文字就是乱码

initText() { let loader = new Three.FontLoader() //需要网上找ttf格式中文字体,然后转json //three.js有fonts文件夹,里面有英文的json格式字体 loader.load(this.fileUrl + '/gltfl/fbx/text/FZXingHeiS-R-GB_Regular.json', function (font) { var geometry = new Three.TextBufferGeometry("我的", { font: font, size: 2, height: 0.01, curveSegments: 0.01, bevelEnabled: true, bevelThickness: 0.01, bevelSize: 0.01, }) let textMaterial = new Three.MeshBasicMaterial({color: 0xff6600}) let mesh = new Three.Mesh(geometry, textMaterial) scene.add(mesh) }) },

//转json格式的在线网站 http://gero3.github.io/facetype.js/

最新回复(0)