diff --git a/packages/frontend/assets/room/objects/aircon/aircon.blend b/packages/frontend/assets/room/objects/aircon/aircon.blend new file mode 100644 index 0000000000..b21ca1a1c1 Binary files /dev/null and b/packages/frontend/assets/room/objects/aircon/aircon.blend differ diff --git a/packages/frontend/assets/room/objects/aircon/aircon.glb b/packages/frontend/assets/room/objects/aircon/aircon.glb new file mode 100644 index 0000000000..66f2c853f7 Binary files /dev/null and b/packages/frontend/assets/room/objects/aircon/aircon.glb differ diff --git a/packages/frontend/assets/room/objects/lava-lamp/lava-lamp.blend b/packages/frontend/assets/room/objects/lava-lamp/lava-lamp.blend new file mode 100644 index 0000000000..8d68cc405e Binary files /dev/null and b/packages/frontend/assets/room/objects/lava-lamp/lava-lamp.blend differ diff --git a/packages/frontend/assets/room/objects/lava-lamp/lava-lamp.glb b/packages/frontend/assets/room/objects/lava-lamp/lava-lamp.glb new file mode 100644 index 0000000000..01c5546926 Binary files /dev/null and b/packages/frontend/assets/room/objects/lava-lamp/lava-lamp.glb differ diff --git a/packages/frontend/assets/room/rooms/default.blend b/packages/frontend/assets/room/rooms/default.blend index b64dbc6476..b169daec3c 100644 Binary files a/packages/frontend/assets/room/rooms/default.blend and b/packages/frontend/assets/room/rooms/default.blend differ diff --git a/packages/frontend/src/pages/room.vue b/packages/frontend/src/pages/room.vue index a693df23bd..3361be5fe6 100644 --- a/packages/frontend/src/pages/room.vue +++ b/packages/frontend/src/pages/room.vue @@ -71,6 +71,16 @@ onMounted(() => { type: 'mug', position: [-45, 90, 160], rotation: [0, Math.PI / 2, 0], + }, { + id: 'h', + type: 'aircon', + position: [80, 215, 150], + rotation: [0, Math.PI / 2, 0], + }, { + id: 'i', + type: 'lava-lamp', + position: [60, 90, 170], + rotation: [0, 0, 0], }], }); diff --git a/packages/frontend/src/utility/room/engine.ts b/packages/frontend/src/utility/room/engine.ts index cf1fd520c2..f644c7504b 100644 --- a/packages/frontend/src/utility/room/engine.ts +++ b/packages/frontend/src/utility/room/engine.ts @@ -58,6 +58,37 @@ const OBJECTS = { stickyNote: { placement: 'side', }, + 'lava-lamp': { + placement: 'top', + onInit: (room, obj) => { + const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), room.scene); + light.parent = obj.meshes[0]; + light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2); + light.intensity = 300; + light.range = 100/*cm*/; + + const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, room.scene); + sphere.parent = obj.meshes[0]; + sphere.position = new BABYLON.Vector3(0, 15/*cm*/, 0); + const mat = new BABYLON.StandardMaterial('lavaLampLightMat', room.scene); + mat.emissiveColor = new BABYLON.Color3(1.0, 0.5, 0.2); + + mat.alpha = 0.5; + //mat.disableLighting = true; + sphere.material = mat; + + const anim = new BABYLON.Animation('lavaLampLightAnim', 'position.y', 60, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); + anim.setKeys([ + { frame: 0, value: 11/*cm*/ }, + { frame: 500, value: 38/*cm*/ }, + ]); + sphere.animations = [anim]; + room.scene.beginAnimation(sphere, 0, 500, true); + }, + }, + aircon: { + placement: 'side', + }, } as Record; function vecToLocal(vector: BABYLON.Vector3, mesh: BABYLON.Mesh): BABYLON.Vector3 { @@ -194,7 +225,7 @@ export class RoomEngine { private grabbingStartDistance: number | null = null; private grabbingGhost: BABYLON.AbstractMesh | null = null; private highlightedObjectId: string | null = null; - private time: 0 | 1 | 2 = 0; // 0: 昼, 1: 夕, 2: 夜 + private time: 0 | 1 | 2 = 2; // 0: 昼, 1: 夕, 2: 夜 public moveForward = false; public moveBackward = false; @@ -265,7 +296,7 @@ export class RoomEngine { ambientLight.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0); ambientLight.intensity = 0.5; - const roomLight = new BABYLON.SpotLight('roomLight', new BABYLON.Vector3(0, 250/*cm*/, 0), new BABYLON.Vector3(0, -1, 0), 4, 8, this.scene); + const roomLight = new BABYLON.SpotLight('roomLight', new BABYLON.Vector3(0, 249/*cm*/, 0), new BABYLON.Vector3(0, -1, 0), 16, 8, this.scene); roomLight.diffuse = new BABYLON.Color3(1.0, 0.9, 0.8); roomLight.intensity = 150000; roomLight.shadowMinZ = 10/*cm*/; @@ -290,6 +321,12 @@ export class RoomEngine { this.shadowGenerator2.usePercentageCloserFiltering = true; this.shadowGenerator2.usePoissonSampling = true; + const gl = new BABYLON.GlowLayer('glow', this.scene, { + //mainTextureFixedSize: 512, + blurKernelSize: 64, + }); + gl.intensity = 0.5; + { const postProcess = new BABYLON.ImageProcessingPostProcess('processing', 1.0, this.camera); postProcess.exposure = 2; @@ -446,7 +483,7 @@ export class RoomEngine { private async loadEnvModel() { const envObj = await BABYLON.ImportMeshAsync('/client-assets/room/env.glb', this.scene); envObj.meshes[0].scaling = new BABYLON.Vector3(-100, 100, 100); - envObj.meshes[0].position = new BABYLON.Vector3(0, -600/*cm*/, 0); // 3階くらいの想定 + envObj.meshes[0].position = new BABYLON.Vector3(0, -900/*cm*/, 0); // 4階くらいの想定 envObj.meshes[0].bakeCurrentTransformIntoVertices(); for (const mesh of envObj.meshes) { mesh.isPickable = false;