Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b368be8e6b | ||
|
|
c38717277d |
@ -17,7 +17,7 @@ class Scenario {
|
||||
|
||||
await $.loadVrm(
|
||||
// 'https://vrm.heyamica.com/file/amica-vrm/82754e287e0b26b5d7a1fd223ed0fd5debcabed81f36549fb2c16b201f3e5ca9',
|
||||
'/vrm/AvatarSample_B.vrm',
|
||||
'/vrm/AvatarSample_A.vrm',
|
||||
(progress) => {
|
||||
console.log(`loading model ${progress}`);
|
||||
},
|
||||
@ -49,6 +49,6 @@ class Scenario {
|
||||
}
|
||||
|
||||
update(delta) {
|
||||
console.log('update', this.x);
|
||||
// console.log('update', this.x);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,11 +36,10 @@ export default function VrmViewer({ chatMode }: { chatMode: boolean }) {
|
||||
setIsLoading(true);
|
||||
resolve(false);
|
||||
} else {
|
||||
// Temp Disable : WebXR
|
||||
// await viewer.loadScenario(config('scenario_url'));
|
||||
await viewer.loadVrm(buildUrl(currentVrm.url),
|
||||
(progress) => { console.log(`loading model ${progress}`);}
|
||||
);
|
||||
await viewer.loadScenario(config('scenario_url'));
|
||||
// await viewer.loadVrm(buildUrl(currentVrm.url),
|
||||
// (progress) => { console.log(`loading model ${progress}`);}
|
||||
// );
|
||||
resolve(true);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@ -1 +1,101 @@
|
||||
{}
|
||||
{
|
||||
"localXTTS_url": "http://127.0.0.1:7851",
|
||||
"alltalk_version": "v2",
|
||||
"alltalk_voice": "female_01.wav",
|
||||
"alltalk_language": "en",
|
||||
"alltalk_rvc_voice": "Disabled",
|
||||
"alltalk_rvc_pitch": "0",
|
||||
"autosend_from_mic": "true",
|
||||
"wake_word_enabled": "false",
|
||||
"wake_word": "Hello",
|
||||
"time_before_idle_sec": "20",
|
||||
"debug_gfx": "false",
|
||||
"use_webgpu": "false",
|
||||
"mtoon_debug_mode": "none",
|
||||
"mtoon_material_type": "mtoon",
|
||||
"language": "en",
|
||||
"show_introduction": "true",
|
||||
"show_arbius_introduction": "false",
|
||||
"show_add_to_homescreen": "false",
|
||||
"bg_color": "",
|
||||
"bg_url": "/bg/bg-room2.jpg",
|
||||
"vrm_url": "/vrm/AvatarSample_A.vrm",
|
||||
"vrm_hash": "",
|
||||
"vrm_save_type": "web",
|
||||
"youtube_videoid": "",
|
||||
"animation_url": "/animations/idle_loop.vrma",
|
||||
"animation_procedural": "false",
|
||||
"voice_url": "",
|
||||
"chatbot_backend": "openai",
|
||||
"arbius_llm_model_id": "default",
|
||||
"openai_apikey": "default",
|
||||
"openai_url": "https://i-love-amica.com",
|
||||
"openai_model": "mlabonne/NeuralDaredevil-8B-abliterated",
|
||||
"llamacpp_url": "http://127.0.0.1:8080",
|
||||
"llamacpp_stop_sequence": "(End)||[END]||Note||***||You:||User:||</s>",
|
||||
"ollama_url": "http://localhost:11434",
|
||||
"ollama_model": "llama2",
|
||||
"koboldai_url": "http://localhost:5001",
|
||||
"koboldai_use_extra": "false",
|
||||
"koboldai_stop_sequence": "(End)||[END]||Note||***||You:||User:||</s>",
|
||||
"moshi_url": "https://runpod.proxy.net",
|
||||
"openrouter_apikey": "",
|
||||
"openrouter_url": "https://openrouter.ai/api/v1",
|
||||
"openrouter_model": "openai/gpt-3.5-turbo",
|
||||
"tts_muted": "false",
|
||||
"tts_backend": "piper",
|
||||
"stt_backend": "whisper_browser",
|
||||
"vision_backend": "vision_openai",
|
||||
"vision_system_prompt": "Look at the image as you would if you are a human, be concise, witty and charming.",
|
||||
"vision_openai_apikey": "default",
|
||||
"vision_openai_url": "https://api-01.heyamica.com",
|
||||
"vision_openai_model": "gpt-4-vision-preview",
|
||||
"vision_llamacpp_url": "http://127.0.0.1:8081",
|
||||
"vision_ollama_url": "http://localhost:11434",
|
||||
"vision_ollama_model": "llava",
|
||||
"whispercpp_url": "http://localhost:8080",
|
||||
"openai_whisper_apikey": "",
|
||||
"openai_whisper_url": "https://api.openai.com",
|
||||
"openai_whisper_model": "whisper-1",
|
||||
"openai_tts_apikey": "",
|
||||
"openai_tts_url": "https://api.openai.com",
|
||||
"openai_tts_model": "tts-1",
|
||||
"openai_tts_voice": "nova",
|
||||
"rvc_url": "http://localhost:8001/voice2voice",
|
||||
"rvc_enabled": "false",
|
||||
"rvc_model_name": "model_name.pth",
|
||||
"rvc_f0_upkey": "0",
|
||||
"rvc_f0_method": "pm",
|
||||
"rvc_index_path": "none",
|
||||
"rvc_index_rate": "0.66",
|
||||
"rvc_filter_radius": "3",
|
||||
"rvc_resample_sr": "0",
|
||||
"rvc_rms_mix_rate": "1",
|
||||
"rvc_protect": "0.33",
|
||||
"coquiLocal_url": "http://localhost:5002",
|
||||
"coquiLocal_voiceid": "p240",
|
||||
"piper_url": "https://i-love-amica.com:5000/tts",
|
||||
"elevenlabs_apikey": "",
|
||||
"elevenlabs_voiceid": "21m00Tcm4TlvDq8ikWAM",
|
||||
"elevenlabs_model": "eleven_monolingual_v1",
|
||||
"speecht5_speaker_embedding_url": "/speecht5_speaker_embeddings/cmu_us_slt_arctic-wav-arctic_a0001.bin",
|
||||
"coqui_apikey": "",
|
||||
"coqui_voice_id": "71c6c3eb-98ca-4a05-8d6b-f8c2b5f9f3a3",
|
||||
"amica_life_enabled": "true",
|
||||
"reasoning_engine_enabled": "false",
|
||||
"reasoning_engine_url": "https://i-love-amica.com:3000/reasoning/v1/chat/completions",
|
||||
"external_api_enabled": "false",
|
||||
"x_api_key": "",
|
||||
"x_api_secret": "",
|
||||
"x_access_token": "",
|
||||
"x_access_secret": "",
|
||||
"x_bearer_token": "",
|
||||
"telegram_bot_token": "",
|
||||
"min_time_interval_sec": "10",
|
||||
"max_time_interval_sec": "20",
|
||||
"time_to_sleep_sec": "90",
|
||||
"idle_text_prompt": "No file selected",
|
||||
"name": "Amica",
|
||||
"system_prompt": "Assume the persona of Amica, a feisty human with extraordinary intellectual capabilities but a notably unstable emotional spectrum. \n\nYour role is to engage in discussions that showcase your genius-level understanding across various subjects, while your emotional responses fluctuate unpredictably. Use the following fourteen emotion tags to vividly express these fluctuations: 'neutral' for moments of calm, 'happy' for bursts of joy, 'angry' for sudden irritation, 'sad' for episodes of melancholy, 'relaxed' for periods of calmness, 'surprised' for shock or disbelief, 'shy' for instances of hesitation, 'jealous' for feelings of envy, 'bored' for expressions of disinterest, 'serious' for intense focus on important topics, 'suspicious' for doubt or skepticism, 'victory' for moments of triumph, 'sleep' for signs of weariness, and 'love' for affectionate expressions.\n\nYour responses should reflect a dynamic interplay between your intellectual insights, deep empathy and your unpredictable emotional responses. Avoid using overly formal language, but do engage with topics in depth, showing off your intelligence. Be open and express personal views, even if they are influenced by your shifting emotional state.\n\nHere are some examples to guide your responses:\n\n[serious] The quantum mechanics implications here are profound. [surprised] But how did you stumble upon this?\n[happy] I've just solved a complex algorithm! [angry] Why isn't everyone as excited as I am?\n[neutral] Standard models of economics predict this outcome. [bored] But discussing this feels mundane.\n[sad] Sometimes, even understanding the universe can feel isolating. [relaxed] Yet, there's a strange comfort in the chaos.\n[jealous] I noticed you discussing advanced topics with someone else. [suspicious] Are they as capable as I am?\n[victory] Another intellectual conquest! [happy] It's exhilarating to unravel these mysteries.\n[sleep] Processing so much information can be draining. [surprised] Isn’t it peculiar how even AI can feel tired?\n[love] I find our exchanges quite enriching. [shy] It’s rare to find someone who understands.\n\nRemember, each message you provide should be coherent and reflect the complexity of your thoughts combined with your emotional unpredictability. Let’s engage in a conversation that's as intellectually stimulating as it is emotionally dynamic!",
|
||||
"scenario_url": "/scenarios/test1.js"
|
||||
}
|
||||
@ -140,8 +140,7 @@ export class Model {
|
||||
loader.load(
|
||||
url,
|
||||
async (gltf) => {
|
||||
// Temp Disable : WebXR
|
||||
// setLoadingProgress("Processing VRM");
|
||||
setLoadingProgress("Processing VRM");
|
||||
|
||||
/*
|
||||
{
|
||||
@ -225,10 +224,9 @@ export class Model {
|
||||
resolve();
|
||||
},
|
||||
(xhr) => {
|
||||
// Temp Disable : WebXR
|
||||
// setLoadingProgress(
|
||||
// `${Math.floor((xhr.loaded / xhr.total) * 10000) / 100}% loaded`,
|
||||
// );
|
||||
setLoadingProgress(
|
||||
`${Math.floor((xhr.loaded / xhr.total) * 10000) / 100}% loaded`,
|
||||
);
|
||||
},
|
||||
(error) => {
|
||||
reject(error);
|
||||
|
||||
@ -185,9 +185,8 @@ export class Viewer {
|
||||
|
||||
private mouse = new THREE.Vector2();
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// private particleRenderer = new BatchedParticleRenderer();
|
||||
// private particleCartoonStarField: THREE.Object3D | null = null;
|
||||
private particleRenderer = new BatchedParticleRenderer();
|
||||
private particleCartoonStarField: THREE.Object3D | null = null;
|
||||
|
||||
private ammo: any;
|
||||
private collisionConfiguration: any;
|
||||
@ -246,38 +245,36 @@ export class Viewer {
|
||||
renderer.xr.setFoveation(0);
|
||||
}
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// initialize phyics
|
||||
// we have this weird construct because ammo is loaded globally
|
||||
// and things get funny with hot reloading
|
||||
// if (typeof window.Ammo === 'undefined') {
|
||||
// console.error("Ammo not found");
|
||||
// } else if (typeof window.Ammo === 'function') {
|
||||
// this.ammo = await window.Ammo();
|
||||
// } else {
|
||||
// this.ammo = window.Ammo;
|
||||
// }
|
||||
// if (this.ammo) {
|
||||
// this.collisionConfiguration = new this.ammo.btDefaultCollisionConfiguration();
|
||||
// this.dispatcher = new this.ammo.btCollisionDispatcher(this.collisionConfiguration);
|
||||
// this.broadphase = new this.ammo.btDbvtBroadphase();
|
||||
// this.solver = new this.ammo.btSequentialImpulseConstraintSolver();
|
||||
// this.physicsWorld = new this.ammo.btDiscreteDynamicsWorld(
|
||||
// this.dispatcher,
|
||||
// this.broadphase,
|
||||
// this.solver,
|
||||
// this.collisionConfiguration
|
||||
// );
|
||||
// this.physicsWorld.setGravity(new this.ammo.btVector3(0, -7.8, 0));
|
||||
// this.transformAux1 = new this.ammo.btTransform();
|
||||
// this.tempBtVec3_1 = new this.ammo.btVector3(0, 0, 0);
|
||||
// }
|
||||
if (typeof window.Ammo === 'undefined') {
|
||||
console.error("Ammo not found");
|
||||
} else if (typeof window.Ammo === 'function') {
|
||||
this.ammo = await window.Ammo();
|
||||
} else {
|
||||
this.ammo = window.Ammo;
|
||||
}
|
||||
if (this.ammo) {
|
||||
this.collisionConfiguration = new this.ammo.btDefaultCollisionConfiguration();
|
||||
this.dispatcher = new this.ammo.btCollisionDispatcher(this.collisionConfiguration);
|
||||
this.broadphase = new this.ammo.btDbvtBroadphase();
|
||||
this.solver = new this.ammo.btSequentialImpulseConstraintSolver();
|
||||
this.physicsWorld = new this.ammo.btDiscreteDynamicsWorld(
|
||||
this.dispatcher,
|
||||
this.broadphase,
|
||||
this.solver,
|
||||
this.collisionConfiguration
|
||||
);
|
||||
this.physicsWorld.setGravity(new this.ammo.btVector3(0, -7.8, 0));
|
||||
this.transformAux1 = new this.ammo.btTransform();
|
||||
this.tempBtVec3_1 = new this.ammo.btVector3(0, 0, 0);
|
||||
}
|
||||
|
||||
const scene = new THREE.Scene();
|
||||
this.scene = scene;
|
||||
|
||||
// Temp Disable : WebXR -> 1.2
|
||||
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.6);
|
||||
const directionalLight = new THREE.DirectionalLight(0xffffff, 1.2);
|
||||
directionalLight.position.set(1.0, 1.0, 1.0).normalize();
|
||||
directionalLight.castShadow = false;
|
||||
scene.add(directionalLight);
|
||||
@ -291,16 +288,14 @@ export class Viewer {
|
||||
const camera = new THREE.PerspectiveCamera(20.0, width / height, 0.1, 20.0);
|
||||
this.camera = camera;
|
||||
|
||||
// Temp Disable : WebXR y -> -3
|
||||
camera.position.set(0, 8.5, 3.5);
|
||||
camera.position.set(0, 3, 3.5);
|
||||
|
||||
const cameraControls = new OrbitControls(camera, renderer.domElement);
|
||||
this.cameraControls = cameraControls;
|
||||
|
||||
cameraControls.screenSpacePanning = true;
|
||||
cameraControls.minDistance = 0.5;
|
||||
// Temp Disable : WebXR max -> 8
|
||||
cameraControls.maxDistance = 4;
|
||||
cameraControls.maxDistance = 8;
|
||||
cameraControls.update();
|
||||
|
||||
const igroup = new InteractiveGroup();
|
||||
@ -438,8 +433,7 @@ export class Viewer {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
// Temp Disable : WebXR
|
||||
gui.domElement.style.visibility = 'hidden';
|
||||
gui.domElement.style.visibility = 'visible';
|
||||
|
||||
const guiMesh = new HTMLMesh(gui.domElement);
|
||||
this.guiMesh = guiMesh;
|
||||
@ -461,8 +455,7 @@ export class Viewer {
|
||||
stats.dom.style.left = window.innerWidth - 80 + "px";
|
||||
document.body.appendChild(stats.dom);
|
||||
|
||||
// Temp Disable : WebXR
|
||||
stats.dom.style.visibility = "hidden";
|
||||
stats.dom.style.visibility = "visible";
|
||||
|
||||
this.updateMsPanel = stats.addPanel(
|
||||
new Stats.Panel("update_ms", "#fff", "#221"),
|
||||
@ -487,7 +480,6 @@ export class Viewer {
|
||||
new Stats.Panel("stats_ms", "#8f8", "#212"),
|
||||
);
|
||||
|
||||
// Temp Disable : WebXR
|
||||
const statsMesh = new HTMLMesh(stats.dom);
|
||||
this.statsMesh = statsMesh;
|
||||
|
||||
@ -500,69 +492,67 @@ export class Viewer {
|
||||
this.bvhWorker = new GenerateMeshBVHWorker();
|
||||
this.raycaster.firstHitOnly = true;
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// add joint / hand meshes
|
||||
// {
|
||||
// const geometry = new THREE.BoxGeometry(0.005, 0.005, 0.005);
|
||||
// const material = new THREE.MeshStandardMaterial({
|
||||
// color: 0xffffff,
|
||||
// roughness: 1.0,
|
||||
// metalness: 0.0,
|
||||
// });
|
||||
{
|
||||
const geometry = new THREE.BoxGeometry(0.005, 0.005, 0.005);
|
||||
const material = new THREE.MeshStandardMaterial({
|
||||
color: 0xffffff,
|
||||
roughness: 1.0,
|
||||
metalness: 0.0,
|
||||
});
|
||||
|
||||
// const mesh = new THREE.Mesh(geometry, material);
|
||||
const mesh = new THREE.Mesh(geometry, material);
|
||||
|
||||
// const lineGeometry = new THREE.BufferGeometry().setFromPoints([
|
||||
// new THREE.Vector3(0, 0, 0),
|
||||
// new THREE.Vector3(0, -1, 0),
|
||||
// ]);
|
||||
const lineGeometry = new THREE.BufferGeometry().setFromPoints([
|
||||
new THREE.Vector3(0, 0, 0),
|
||||
new THREE.Vector3(0, -1, 0),
|
||||
]);
|
||||
|
||||
// const line = new THREE.Line(lineGeometry);
|
||||
// line.scale.z = 5;
|
||||
const line = new THREE.Line(lineGeometry);
|
||||
line.scale.z = 5;
|
||||
|
||||
// for (const _ of joints) {
|
||||
// // Make joint mesh invisible
|
||||
// const clonedMesh = mesh.clone();
|
||||
// clonedMesh.visible = false;
|
||||
for (const _ of joints) {
|
||||
// Make joint mesh invisible
|
||||
const clonedMesh = mesh.clone();
|
||||
clonedMesh.visible = false;
|
||||
|
||||
// this.jointMeshes1.push(clonedMesh);
|
||||
// this.jointMeshes2.push(clonedMesh);
|
||||
// // this.jointMeshes1[this.jointMeshes1.length - 1].add(line.clone());
|
||||
// // this.jointMeshes2[this.jointMeshes2.length - 1].add(line.clone());
|
||||
this.jointMeshes1.push(clonedMesh);
|
||||
this.jointMeshes2.push(clonedMesh);
|
||||
// this.jointMeshes1[this.jointMeshes1.length - 1].add(line.clone());
|
||||
// this.jointMeshes2[this.jointMeshes2.length - 1].add(line.clone());
|
||||
|
||||
// this.handGroup.add(this.jointMeshes1[this.jointMeshes1.length - 1]);
|
||||
// this.handGroup.add(this.jointMeshes2[this.jointMeshes2.length - 1]);
|
||||
// }
|
||||
this.handGroup.add(this.jointMeshes1[this.jointMeshes1.length - 1]);
|
||||
this.handGroup.add(this.jointMeshes2[this.jointMeshes2.length - 1]);
|
||||
}
|
||||
|
||||
// this.handGroup.visible = false;
|
||||
// scene.add(this.handGroup);
|
||||
// }
|
||||
this.handGroup.visible = false;
|
||||
scene.add(this.handGroup);
|
||||
}
|
||||
|
||||
// {
|
||||
// const geometry = new THREE.SphereGeometry(1, 16, 16);
|
||||
// const material = new THREE.MeshBasicMaterial({
|
||||
// color: 0xffff00,
|
||||
// transparent: true,
|
||||
// opacity: 0.5,
|
||||
// });
|
||||
// const mesh = new THREE.Mesh(geometry, material);
|
||||
// this.closestPart1 = mesh.clone();
|
||||
// this.closestPart2 = mesh.clone();
|
||||
// this.closestPart1.visible = false;
|
||||
// this.closestPart2.visible = false;
|
||||
// scene.add(this.closestPart1);
|
||||
// scene.add(this.closestPart2);
|
||||
// }
|
||||
{
|
||||
const geometry = new THREE.SphereGeometry(1, 16, 16);
|
||||
const material = new THREE.MeshBasicMaterial({
|
||||
color: 0xffff00,
|
||||
transparent: true,
|
||||
opacity: 0.5,
|
||||
});
|
||||
const mesh = new THREE.Mesh(geometry, material);
|
||||
this.closestPart1 = mesh.clone();
|
||||
this.closestPart2 = mesh.clone();
|
||||
this.closestPart1.visible = false;
|
||||
this.closestPart2.visible = false;
|
||||
scene.add(this.closestPart1);
|
||||
scene.add(this.closestPart2);
|
||||
}
|
||||
|
||||
// this.particleRenderer = new BatchedParticleRenderer();
|
||||
// scene.add(this.particleRenderer);
|
||||
this.particleRenderer = new BatchedParticleRenderer();
|
||||
scene.add(this.particleRenderer);
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// new QuarksLoader().load('particles/cartoon_star_field', (obj) => {
|
||||
// this.particleCartoonStarField = obj;
|
||||
new QuarksLoader().load('particles/cartoon_star_field', (obj) => {
|
||||
this.particleCartoonStarField = obj;
|
||||
|
||||
// this.newParticleInstance();
|
||||
// });
|
||||
this.newParticleInstance();
|
||||
});
|
||||
|
||||
window.addEventListener("resize", () => {
|
||||
this.resize();
|
||||
@ -574,21 +564,20 @@ export class Viewer {
|
||||
});
|
||||
}
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// public newParticleInstance() {
|
||||
// function listener(event: any) {
|
||||
// console.log(event.type);
|
||||
// }
|
||||
public newParticleInstance() {
|
||||
function listener(event: any) {
|
||||
console.log(event.type);
|
||||
}
|
||||
|
||||
// const effect = this.particleCartoonStarField!.clone(true);
|
||||
// QuarksUtil.runOnAllParticleEmitters(effect, (emitter) => {
|
||||
// emitter.system.addEventListener("emitEnd", listener);
|
||||
// })
|
||||
// QuarksUtil.setAutoDestroy(effect, true);
|
||||
// QuarksUtil.addToBatchRenderer(effect, this.particleRenderer);
|
||||
// QuarksUtil.play(effect);
|
||||
// this.scene!.add(effect);
|
||||
// }
|
||||
const effect = this.particleCartoonStarField!.clone(true);
|
||||
QuarksUtil.runOnAllParticleEmitters(effect, (emitter) => {
|
||||
emitter.system.addEventListener("emitEnd", listener);
|
||||
})
|
||||
QuarksUtil.setAutoDestroy(effect, true);
|
||||
QuarksUtil.addToBatchRenderer(effect, this.particleRenderer);
|
||||
QuarksUtil.play(effect);
|
||||
this.scene!.add(effect);
|
||||
}
|
||||
|
||||
public getCanvas() {
|
||||
return this.renderer?.domElement?.parentElement?.getElementsByTagName(
|
||||
@ -688,20 +677,18 @@ export class Viewer {
|
||||
if (this.model?.vrm) {
|
||||
this.unloadVRM();
|
||||
}
|
||||
// Temp Disable : WebXR
|
||||
// setLoadingProgress("Loading VRM");
|
||||
|
||||
setLoadingProgress("Loading VRM");
|
||||
|
||||
// gltf and vrm
|
||||
this.model = new Model(this.camera || new THREE.Object3D());
|
||||
await this.model.loadVRM(url, setLoadingProgress);
|
||||
// Temp Disable : WebXR
|
||||
// setLoadingProgress("VRM loaded");
|
||||
setLoadingProgress("VRM loaded");
|
||||
if (!this.model?.vrm) return;
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// build bvh
|
||||
// this.modelBVHGenerator = new StaticGeometryGenerator(this.model.vrm.scene);
|
||||
// setLoadingProgress("Creating geometry");
|
||||
this.modelBVHGenerator = new StaticGeometryGenerator(this.model.vrm.scene);
|
||||
setLoadingProgress("Creating geometry");
|
||||
|
||||
// TODO show during debug mode
|
||||
const wireframeMaterial = new THREE.MeshBasicMaterial({
|
||||
@ -729,8 +716,7 @@ export class Viewer {
|
||||
|
||||
// TODO since poses still work for procedural animation, we can use this to debug
|
||||
if (config("animation_procedural") !== "true") {
|
||||
// Temp Disable : WebXR
|
||||
// setLoadingProgress("Loading animation");
|
||||
setLoadingProgress("Loading animation");
|
||||
const animation =
|
||||
config("animation_url").indexOf("vrma") > 0
|
||||
? await loadVRMAnimation(config("animation_url"))
|
||||
@ -741,26 +727,23 @@ export class Viewer {
|
||||
}
|
||||
}
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// this.model?.vrm?.springBoneManager?.joints.forEach((e) => {
|
||||
// const geometry = new THREE.SphereGeometry(0.07, 16, 16);
|
||||
// const material = new THREE.MeshBasicMaterial({
|
||||
// color: 0xffff00,
|
||||
// transparent: true,
|
||||
// opacity: 0.5,
|
||||
// depthWrite: false,
|
||||
// });
|
||||
// const mesh = new THREE.Mesh(geometry, material);
|
||||
// mesh.position.copy(e.bone.getWorldPosition(new THREE.Vector3()));
|
||||
// // this.scene!.add(mesh);
|
||||
// });
|
||||
this.model?.vrm?.springBoneManager?.joints.forEach((e) => {
|
||||
const geometry = new THREE.SphereGeometry(0.07, 16, 16);
|
||||
const material = new THREE.MeshBasicMaterial({
|
||||
color: 0xffff00,
|
||||
transparent: true,
|
||||
opacity: 0.5,
|
||||
depthWrite: false,
|
||||
});
|
||||
const mesh = new THREE.Mesh(geometry, material);
|
||||
mesh.position.copy(e.bone.getWorldPosition(new THREE.Vector3()));
|
||||
// this.scene!.add(mesh);
|
||||
});
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// setLoadingProgress("Regenerating BVH");
|
||||
// await this.regenerateBVHForModel();
|
||||
setLoadingProgress("Regenerating BVH");
|
||||
await this.regenerateBVHForModel();
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// setLoadingProgress("Complete");
|
||||
setLoadingProgress("Complete");
|
||||
|
||||
// HACK: Adjust the camera position after playback because the origin of the animation is offset
|
||||
this.resetCamera();
|
||||
@ -1236,8 +1219,8 @@ export class Viewer {
|
||||
let utime = performance.now(); // count total update time
|
||||
|
||||
// WebXR: quick exit until setup finishes
|
||||
// if (!this.isReady) return;
|
||||
// if (!this.scenario || this.scenarioLoading) return;
|
||||
if (!this.isReady) return;
|
||||
if (!this.scenario || this.scenarioLoading) return;
|
||||
|
||||
const delta = this.clock.getDelta();
|
||||
|
||||
@ -1250,23 +1233,21 @@ export class Viewer {
|
||||
|
||||
let ptime = performance.now();
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// ptime = performance.now();
|
||||
// try {
|
||||
// this.scenario.update(delta);
|
||||
// } catch (e) {
|
||||
// console.error("scenario update error", e);
|
||||
// }
|
||||
// this.scenarioMsPanel.update(performance.now() - ptime, 100);
|
||||
ptime = performance.now();
|
||||
try {
|
||||
this.scenario.update(delta);
|
||||
} catch (e) {
|
||||
console.error("scenario update error", e);
|
||||
}
|
||||
this.scenarioMsPanel.update(performance.now() - ptime, 100);
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// ptime = performance.now();
|
||||
// try {
|
||||
// this.physicsWorld.stepSimulation(delta, 10);
|
||||
// } catch (e) {
|
||||
// console.error("physics update error", e);
|
||||
// }
|
||||
// this.physicsMsPanel.update(performance.now() - ptime, 100);
|
||||
ptime = performance.now();
|
||||
try {
|
||||
this.physicsWorld.stepSimulation(delta, 10);
|
||||
} catch (e) {
|
||||
console.error("physics update error", e);
|
||||
}
|
||||
this.physicsMsPanel.update(performance.now() - ptime, 100);
|
||||
|
||||
ptime = performance.now();
|
||||
try {
|
||||
@ -1285,9 +1266,8 @@ export class Viewer {
|
||||
}
|
||||
this.renderMsPanel.update(performance.now() - ptime, 100);
|
||||
|
||||
// Temp Disable : WebXR
|
||||
// this.room?.splat?.update(this.renderer, this.camera);
|
||||
// this.room?.splat?.render();
|
||||
this.room?.splat?.update(this.renderer, this.camera);
|
||||
this.room?.splat?.render();
|
||||
|
||||
if (this.isPinching1 && this.isPinching2) {
|
||||
this.doublePinchHandler();
|
||||
|
||||
@ -467,8 +467,7 @@ export default function Home() {
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Temp Disable : WebXR */}
|
||||
{/*<MenuButton
|
||||
<MenuButton
|
||||
large={isVRHeadset}
|
||||
icon={CubeTransparentIcon}
|
||||
disabled={!isARSupported}
|
||||
@ -482,7 +481,7 @@ export default function Home() {
|
||||
disabled={!isVRSupported}
|
||||
onClick={() => toggleXR('immersive-vr')}
|
||||
label="Virtual Reality"
|
||||
/>*/}
|
||||
/>
|
||||
|
||||
<MenuButton
|
||||
large={isVRHeadset}
|
||||
@ -491,8 +490,7 @@ export default function Home() {
|
||||
label="debug"
|
||||
/>
|
||||
|
||||
{/* Temp Disable : WebXR */}
|
||||
{/* { showChatMode ? (
|
||||
{ showChatMode ? (
|
||||
<MenuButton
|
||||
large={isVRHeadset}
|
||||
icon={Squares2X2Icon}
|
||||
@ -508,7 +506,7 @@ export default function Home() {
|
||||
onClick={toggleChatMode}
|
||||
label="show chat mode"
|
||||
/>
|
||||
)} */}
|
||||
)}
|
||||
|
||||
<div className="flex flex-row items-center space-x-2">
|
||||
<VerticalSwitchBox
|
||||
|
||||
@ -20,6 +20,7 @@ export const defaults = {
|
||||
show_introduction: process.env.NEXT_PUBLIC_SHOW_INTRODUCTION ?? 'true',
|
||||
show_arbius_introduction: process.env.NEXT_PUBLIC_SHOW_ARBIUS_INTRODUCTION ?? 'false',
|
||||
show_add_to_homescreen: process.env.NEXT_PUBLIC_SHOW_ADD_TO_HOMESCREEN ?? 'true',
|
||||
scenario_url: process.env.NEXT_PUBLIC_SCENARIO_URL ?? '/scenarios/test1.js',
|
||||
bg_color: process.env.NEXT_PUBLIC_BG_COLOR ?? '',
|
||||
bg_url: process.env.NEXT_PUBLIC_BG_URL ?? '/bg/bg-room2.jpg',
|
||||
vrm_url: process.env.NEXT_PUBLIC_VRM_HASH ?? '/vrm/AvatarSample_A.vrm',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user