I tried to create text using three-bmfont-text
import * as THREE from "three";
import createGeometry from "three-bmfont-text"
import MSDFShader from "three-bmfont-text/shaders/msdf"
import fontFile from './static/ChrustyRock-ORLA-msdf.json';
import fontTexture from './static/ChrustyRock-ORLA.png';
global.THREE = require('three')
let textTexture;
let text;
export default function TextInit( ) {
new THREE.TextureLoader().load(fontTexture,(t)=>{
textTexture= t;
addText();
})
const addText=()=>{
const geom = createGeometry({
text: 'dkjfkdjfkdjf',
font: fontFile,
align: 'left',
flipY: textTexture.flipY
})
const materialText = new THREE.RawShaderMaterial(MSDFShader({
map: textTexture,
transparent: true,
color: 0xff0000
}))
let layout=geom.layout;
text = new THREE.Mesh(geom,materialText)
text.scale.set(0.01, 0.01, 0.01)
}
return text;
}
but I got this error
I do not want to downgrade the root three.js dependency. Is there any way around that