本文主要是介绍Threejs学习-Stats 性能监控器、抗锯齿,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
-
stats性能监控器
import Stats from 'three/addons/libs/stats.module.js' //引入包//添加性能监视器,查看帧率 const stats = new Stats(); document.body.appendChild(stats.domElement); // //渲染 function animate() {requestAnimationFrame(animate);stats.update();//旋转 // cube.rotation.x += 0.01;// 立方体沿 x 轴旋转// cube.rotation.y += 0.01;// 立方体沿 y 轴旋转//渲染renderer.render(scene, camera); }
可以看到程序当前的运行帧率
-
抗锯齿
//创建渲染器 const renderer = new THREE.WebGLRenderer({antialias: true //渲染器锯齿属性.antialias }); renderer.setPixelRatio(window.devicePixelRatio) //设置渲染器当前设备的像素比
这篇关于Threejs学习-Stats 性能监控器、抗锯齿的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!