一、
//创建动态纹理
let dynaicTexture=new BABYLON.DynamicTexture('dy',{width:100,height:100},scene)
dynaicTexture.drawText('someting',50,50,
'Times New Roman','green','red',true,true)
sphereMaterial.diffuseTexture=dynaicTexture
sphere.material=sphereMaterial
书写文字的参数:
- text:字符串,要写入的单词;
- x:数字,距左侧边缘的距离;
- y:数字,与顶部或底部边缘的距离,取决于 invertY;
- font:字符串,字体定义形式为font-style、font-size、font_name;
- invertY:布尔值,默认为true,此时y是到顶部的距离,当为false时,y是到底部的距离并且字母反转;
- update:布尔值,默认为true,动态纹理会立即更新。
通过动态纹理获取画布对象:
let dynaicTexture=new BABYLON.DynamicTexture('dy',{width:100,h