mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-03-21 03:30:42 +00:00
wip
This commit is contained in:
@@ -60,6 +60,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<MkButton @click="toggleLight">Toggle Light</MkButton>
|
||||
<MkButton :primary="engine.isEditMode.value" @click="toggleEditMode">Edit mode: {{ engine.isEditMode.value ? 'on' : 'off' }}</MkButton>
|
||||
<MkButton @click="addObject">addObject</MkButton>
|
||||
<MkButton primary @click="save">save</MkButton>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -202,8 +203,7 @@ function onWheel(ev: WheelEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
engine.value = new RoomEngine({
|
||||
const data = localStorage.getItem('roomData') != null ? JSON.parse(localStorage.getItem('roomData')!) : {
|
||||
roomType: 'default',
|
||||
installedObjects: [{
|
||||
id: 'a',
|
||||
@@ -475,7 +475,10 @@ onMounted(() => {
|
||||
open: 0.5,
|
||||
},
|
||||
}],
|
||||
}, {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
engine.value = new RoomEngine(data, {
|
||||
canvas: canvas.value!,
|
||||
});
|
||||
|
||||
@@ -593,6 +596,11 @@ function getRgb(hex: string | number): [number, number, number] | null {
|
||||
return m.map(x => parseInt(x, 16) / 255) as [number, number, number];
|
||||
}
|
||||
|
||||
function save() {
|
||||
if (engine.value == null) return;
|
||||
localStorage.setItem('roomData', JSON.stringify(engine.value.roomState));
|
||||
}
|
||||
|
||||
definePage(() => ({
|
||||
title: 'Room',
|
||||
icon: 'ti ti-door',
|
||||
|
||||
@@ -521,7 +521,7 @@ export class RoomEngine {
|
||||
id: o.id,
|
||||
type: o.type,
|
||||
position: new BABYLON.Vector3(...o.position),
|
||||
rotation: new BABYLON.Vector3(o.rotation[0], -o.rotation[1], o.rotation[2]),
|
||||
rotation: new BABYLON.Vector3(o.rotation[0], o.rotation[1], o.rotation[2]),
|
||||
options: o.options,
|
||||
isMainLight: o.isMainLight,
|
||||
})));
|
||||
|
||||
Reference in New Issue
Block a user