mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-25 20:13:57 +02:00
wip
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -10,13 +10,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<MkButton @click="toggleLight">Toggle Light</MkButton>
|
<MkButton @click="toggleLight">Toggle Light</MkButton>
|
||||||
<MkButton :primary="engine.isEditMode.value" @click="toggleEditMode">Edit mode: {{ engine.isEditMode.value ? 'on' : 'off' }}</MkButton>
|
<MkButton :primary="engine.isEditMode.value" @click="toggleEditMode">Edit mode: {{ engine.isEditMode.value ? 'on' : 'off' }}</MkButton>
|
||||||
<template v-if="engine.isEditMode.value">
|
<template v-if="engine.isEditMode.value">
|
||||||
<MkButton @click="grab">Grab</MkButton>
|
<MkButton @click="grab">Grab (E)</MkButton>
|
||||||
<MkButton :primary="engine.enableGridSnapping.value" @click="toggleGridSnapping">Grid Snap: {{ engine.enableGridSnapping.value ? 'on' : 'off' }}</MkButton>
|
<MkButton :primary="engine.enableGridSnapping.value" @click="toggleGridSnapping">Grid Snap: {{ engine.enableGridSnapping.value ? 'on' : 'off' }}</MkButton>
|
||||||
<MkButton v-if="engine.enableGridSnapping.value" :primary="engine.gridSnappingScale.value === 1" @click="engine.gridSnappingScale.value = 1">Snap: 1cm</MkButton>
|
<MkButton v-if="engine.enableGridSnapping.value" :primary="engine.gridSnappingScale.value === 1" @click="engine.gridSnappingScale.value = 1">Snap: 1cm</MkButton>
|
||||||
<MkButton v-if="engine.enableGridSnapping.value" :primary="engine.gridSnappingScale.value === 2" @click="engine.gridSnappingScale.value = 2">Snap: 2cm</MkButton>
|
<MkButton v-if="engine.enableGridSnapping.value" :primary="engine.gridSnappingScale.value === 2" @click="engine.gridSnappingScale.value = 2">Snap: 2cm</MkButton>
|
||||||
<MkButton v-if="engine.enableGridSnapping.value" :primary="engine.gridSnappingScale.value === 4" @click="engine.gridSnappingScale.value = 4">Snap: 4cm</MkButton>
|
<MkButton v-if="engine.enableGridSnapping.value" :primary="engine.gridSnappingScale.value === 4" @click="engine.gridSnappingScale.value = 4">Snap: 4cm</MkButton>
|
||||||
<MkButton v-if="engine.enableGridSnapping.value" :primary="engine.gridSnappingScale.value === 8" @click="engine.gridSnappingScale.value = 8">Snap: 8cm</MkButton>
|
<MkButton v-if="engine.enableGridSnapping.value" :primary="engine.gridSnappingScale.value === 8" @click="engine.gridSnappingScale.value = 8">Snap: 8cm</MkButton>
|
||||||
</template>
|
</template>
|
||||||
|
<MkButton v-if="engine.isSitting.value" @click="engine.standUp()">降りる (Q)</MkButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -172,6 +173,11 @@ onMounted(() => {
|
|||||||
type: 'wall-clock',
|
type: 'wall-clock',
|
||||||
position: [-150, 200, 100],
|
position: [-150, 200, 100],
|
||||||
rotation: [0, -Math.PI / 2, 0],
|
rotation: [0, -Math.PI / 2, 0],
|
||||||
|
}, {
|
||||||
|
id: 's2',
|
||||||
|
type: 'wood-sound-absorbing-panel',
|
||||||
|
position: [-150, 140, 80],
|
||||||
|
rotation: [0, -Math.PI / 2, 0],
|
||||||
}, {
|
}, {
|
||||||
id: 't',
|
id: 't',
|
||||||
type: 'book',
|
type: 'book',
|
||||||
|
|||||||
@@ -302,6 +302,9 @@ const OBJECTS = {
|
|||||||
'round-rug': {
|
'round-rug': {
|
||||||
placement: 'floor',
|
placement: 'floor',
|
||||||
},
|
},
|
||||||
|
'wood-sound-absorbing-panel': {
|
||||||
|
placement: 'side',
|
||||||
|
},
|
||||||
} as Record<string, ObjectDef>;
|
} as Record<string, ObjectDef>;
|
||||||
|
|
||||||
const _assumedFramesPerSecond = 60;
|
const _assumedFramesPerSecond = 60;
|
||||||
@@ -711,8 +714,8 @@ export class RoomEngine {
|
|||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
if (this.isEditMode.value) {
|
if (this.isEditMode.value) {
|
||||||
this.toggleGrab();
|
this.toggleGrab();
|
||||||
} else {
|
} else if (this.selectedObjectId != null) {
|
||||||
this.interact();
|
this.interact(this.selectedObjectId);
|
||||||
}
|
}
|
||||||
} else if (ev.code === 'KeyR') {
|
} else if (ev.code === 'KeyR') {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
@@ -720,6 +723,12 @@ export class RoomEngine {
|
|||||||
if (this.grabbing != null) {
|
if (this.grabbing != null) {
|
||||||
this.grabbing.rotation += Math.PI / 8;
|
this.grabbing.rotation += Math.PI / 8;
|
||||||
}
|
}
|
||||||
|
} else if (ev.code === 'KeyQ') {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
if (this.isSitting.value) {
|
||||||
|
this.standUp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1244,28 +1253,31 @@ export class RoomEngine {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private interact() {
|
private interact(oid: string) {
|
||||||
if (this.selectedObjectId == null) return;
|
const o = this.def.objects.find(o => o.id === oid)!;
|
||||||
|
|
||||||
const o = this.def.objects.find(o => o.id === this.selectedObjectId)!;
|
|
||||||
const mesh = this.objectMeshs.get(o.id)!;
|
const mesh = this.objectMeshs.get(o.id)!;
|
||||||
const objDef = OBJECTS[o.type];
|
const objDef = OBJECTS[o.type];
|
||||||
|
|
||||||
if (objDef.isChair) {
|
if (objDef.isChair) {
|
||||||
if (this.isSitting.value) {
|
this.sitChair(o.id);
|
||||||
this.isSitting.value = false;
|
|
||||||
this.scene.activeCamera = this.camera;
|
|
||||||
this.fixedCamera.parent = null;
|
|
||||||
} else {
|
|
||||||
this.isSitting.value = true;
|
|
||||||
this.fixedCamera.parent = this.objectMeshs.get(o.id);
|
|
||||||
this.fixedCamera.position = new BABYLON.Vector3(0, 120/*cm*/, 0);
|
|
||||||
this.fixedCamera.rotation = new BABYLON.Vector3(0, 0, 0);
|
|
||||||
this.scene.activeCamera = this.fixedCamera;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sitChair(objectId: string) {
|
||||||
|
this.isSitting.value = true;
|
||||||
|
this.fixedCamera.parent = this.objectMeshs.get(objectId);
|
||||||
|
this.fixedCamera.position = new BABYLON.Vector3(0, 120/*cm*/, 0);
|
||||||
|
this.fixedCamera.rotation = new BABYLON.Vector3(0, 0, 0);
|
||||||
|
this.scene.activeCamera = this.fixedCamera;
|
||||||
|
this.selectObject(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public standUp() {
|
||||||
|
this.isSitting.value = false;
|
||||||
|
this.scene.activeCamera = this.camera;
|
||||||
|
this.fixedCamera.parent = null;
|
||||||
|
}
|
||||||
|
|
||||||
private turnOnRoomLight() {
|
private turnOnRoomLight() {
|
||||||
this.roomLight.intensity = 300000;
|
this.roomLight.intensity = 300000;
|
||||||
this.envMapIndoor.level = 0.3;
|
this.envMapIndoor.level = 0.3;
|
||||||
|
|||||||
Reference in New Issue
Block a user