add stats
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as THREE from 'three'
|
||||
import { Tween } from '@tweenjs/tween.js'
|
||||
import Stats from 'stats.js'
|
||||
|
||||
const global = (0,eval)('this')
|
||||
const scene = new THREE.Scene()
|
||||
@@ -70,10 +71,15 @@ const tweenDuration = 33
|
||||
const keysDown = {}
|
||||
const mouse = {}
|
||||
|
||||
var stats = new Stats()
|
||||
stats.showPanel(0)
|
||||
|
||||
function render() {
|
||||
stats.begin()
|
||||
cameraMovement()
|
||||
Object.values(positionTweens).forEach((tween) => tween.update()) // TODO: clean up tweens
|
||||
renderer.render(scene, camera)
|
||||
stats.end()
|
||||
}
|
||||
|
||||
function minimapRender() {
|
||||
@@ -560,4 +566,6 @@ window.addEventListener('load', () => {
|
||||
const minimap = minimapRenderer.domElement
|
||||
minimap.classList.add('minimap')
|
||||
document.body.appendChild(minimap)
|
||||
|
||||
document.body.appendChild(stats.dom)
|
||||
})
|
||||
|
||||
+2
-1
@@ -7,7 +7,8 @@
|
||||
"imports": {
|
||||
"three": "/three/build/three.module.js",
|
||||
"three/addons/": "/three/examples/jsm/",
|
||||
"@tweenjs/tween.js": "/@tweenjs/tween.js/dist/tween.esm.js"
|
||||
"@tweenjs/tween.js": "/@tweenjs/tween.js/dist/tween.esm.js",
|
||||
"stats.js": "/stats.js/src/stats.js"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user