解决报错“material.onBeforeRender is not a function”
2022-02-16
解决方法:升级Three.js 版本。
ForceGraph3D中给node添加Three精灵文本时,出现“material.onBeforeRender is not a function”。
const nodeThreeObject = node => {
console.log('node', node);
const sprite = new SpriteText(node.name);
sprite.material.depthWrite = false;
sprite.color = node.color;
sprite.textHeight = 3;
var group = new THREE.Group();
group.add( sprite );
return group;
}
顺带也升级下three-spritetext。
(版权归cpury.com所有,转载请注明出处。)