1
0

rm update

This commit is contained in:
syui 2024-03-19 13:07:07 +09:00
parent 7c3912e69b
commit f3eab1c169
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56

View File

@ -99,21 +99,6 @@ window.addEventListener("DOMContentLoaded", () => {
const clock = new THREE.Clock(); const clock = new THREE.Clock();
clock.start(); clock.start();
const update = () => {
controls.update();
requestAnimationFrame(update);
const deltaTime = clock.getDelta();
if (currentMixer) {
currentMixer.update(deltaTime);
}
if (currentVrm) {
currentVrm.update(deltaTime);
}
renderer.render(scene, camera);
}
scene.background = new THREE.Color( 0xffffff ); scene.background = new THREE.Color( 0xffffff );
const directionalLight = new THREE.DirectionalLight(0xffffff); const directionalLight = new THREE.DirectionalLight(0xffffff);
directionalLight.position.set(1, 1, 1); directionalLight.position.set(1, 1, 1);
@ -157,9 +142,15 @@ window.addEventListener("DOMContentLoaded", () => {
floor_grid(); floor_grid();
floor_bg(); floor_bg();
update();
function animate() { function animate() {
controls.update();
const delta = clock.getDelta();
if (currentMixer) {
currentMixer.update(delta);
}
if (currentVrm) {
currentVrm.update(delta);
}
requestAnimationFrame(animate); requestAnimationFrame(animate);
scene.rotation.y += 0.005; scene.rotation.y += 0.005;
renderer.render(scene, camera); renderer.render(scene, camera);