1 . 在init()函数中添加1
2
3
4
5
6
7
8
9
10
11
12var stat = null;
function init() {
stat = new Stats();
stat.domElement.style.position = 'absolute';
stat.domElement.style.right = '0px';
stat.domElement.style.top = '0px';
document.body.appendChild(stat.domElement);
}
2 . 设置开始帧和结束帧1
2
3
4
5
6
7
8
9function animate() {
stat.begin();
//动画函数
//renderer.render(scene, camera);
stat.end();
}
也可以直接添加
stat.update();