fix
This commit is contained in:
parent
b6ebcf4bc4
commit
27bbe3047c
4
dist/index.html
vendored
4
dist/index.html
vendored
@ -26,7 +26,9 @@
|
||||
</span>
|
||||
<span class="menu-right" id="nav-mobile">
|
||||
<button id='btn-user'><i class="fa-solid fa-user"></i></button>
|
||||
<button id='btn-sandar'><i class="fa-solid fa-earth-americas"></i></button>
|
||||
<button id='btn-grid'><i class="fa-solid fa-border-none"></i></button>
|
||||
<button id='btn-sandar'><i class="fa-solid fa-location-dot"></i></button>
|
||||
<button id='btn-tera'><i class="fa-solid fa-earth-americas"></i></button>
|
||||
</span>
|
||||
<span class="menu-nav">
|
||||
<button id='nav'><i class="fa-solid fa-bars"></i></button>
|
||||
|
46
src/index.ts
46
src/index.ts
@ -6,10 +6,6 @@ import { createVRMAnimationClip, VRMAnimationLoaderPlugin } from "@pixiv/three-v
|
||||
import { GridHelper, Mesh, MeshLambertMaterial, BoxGeometry, Vector3, Vector2, Color, DirectionalLight, Fog, HemisphereLight, HalfFloatType } from 'three';
|
||||
import { VRMSpringBoneManager, VRMSpringBoneJoint, VRMSpringBoneJointHelper } from '@pixiv/three-vrm-springbone';
|
||||
import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader";
|
||||
//import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer';
|
||||
//import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass';
|
||||
//import { RenderPass } from "three/examples/jsm/postprocessing/RenderPass";
|
||||
// https://github.com/pmndrs/postprocessing
|
||||
import { BloomEffect, EffectComposer, EffectPass, RenderPass } from "postprocessing";
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
@ -104,7 +100,6 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
|
||||
const loader = new GLTFLoader(manager);
|
||||
|
||||
loader.register((parser) => {
|
||||
return new VRMLoaderPlugin(parser);
|
||||
});
|
||||
@ -115,6 +110,14 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
load("/vrma/model/ai.vrm");
|
||||
load("/vrma/anime/fly_c.vrma");
|
||||
|
||||
let item = null;
|
||||
loader.load( '/vrma/item/tera.glb', function ( gltf ) {
|
||||
item = gltf.scene;
|
||||
|
||||
}, undefined, function ( error ) {
|
||||
console.error( error );
|
||||
});
|
||||
|
||||
const clock = new THREE.Clock();
|
||||
clock.start();
|
||||
|
||||
@ -394,7 +397,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
currentVrm.update(delta);
|
||||
}
|
||||
requestAnimationFrame(animate);
|
||||
scene.rotation.y += 0.005;
|
||||
scene.rotation.y += 0.0005;
|
||||
renderer.render(scene, camera);
|
||||
}
|
||||
|
||||
@ -434,4 +437,35 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
});
|
||||
}
|
||||
|
||||
let grid_enable = true;
|
||||
const el_grid = document.querySelector('#btn-grid') as HTMLInputElement | null;
|
||||
if(el_grid != null) {
|
||||
el_grid.addEventListener('click', function(){
|
||||
if (grid_enable == true) {
|
||||
scene.remove(grid);
|
||||
grid_enable = false;
|
||||
} else {
|
||||
scene.add(grid);
|
||||
grid_enable = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let tera_enable = true;
|
||||
const el_tera = document.querySelector('#btn-tera') as HTMLInputElement | null;
|
||||
if(el_tera != null) {
|
||||
el_tera.addEventListener('click', function(){
|
||||
if (tera_enable == true) {
|
||||
item.rotation.set(0, 0, 5);
|
||||
item.position.set(0, -15, 0);
|
||||
item.scale.set(8, 8, 8);
|
||||
scene.add(item);
|
||||
tera_enable = false;
|
||||
} else {
|
||||
scene.remove(item);
|
||||
tera_enable = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user