mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-23 08:44:05 +02: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 @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>
|
||||||
<MkButton @click="addObject">addObject</MkButton>
|
<MkButton @click="addObject">addObject</MkButton>
|
||||||
|
<MkButton primary @click="save">save</MkButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -202,8 +203,7 @@ function onWheel(ev: WheelEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
const data = localStorage.getItem('roomData') != null ? JSON.parse(localStorage.getItem('roomData')!) : {
|
||||||
engine.value = new RoomEngine({
|
|
||||||
roomType: 'default',
|
roomType: 'default',
|
||||||
installedObjects: [{
|
installedObjects: [{
|
||||||
id: 'a',
|
id: 'a',
|
||||||
@@ -475,7 +475,10 @@ onMounted(() => {
|
|||||||
open: 0.5,
|
open: 0.5,
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
}, {
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
engine.value = new RoomEngine(data, {
|
||||||
canvas: canvas.value!,
|
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];
|
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(() => ({
|
definePage(() => ({
|
||||||
title: 'Room',
|
title: 'Room',
|
||||||
icon: 'ti ti-door',
|
icon: 'ti ti-door',
|
||||||
|
|||||||
@@ -521,7 +521,7 @@ export class RoomEngine {
|
|||||||
id: o.id,
|
id: o.id,
|
||||||
type: o.type,
|
type: o.type,
|
||||||
position: new BABYLON.Vector3(...o.position),
|
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,
|
options: o.options,
|
||||||
isMainLight: o.isMainLight,
|
isMainLight: o.isMainLight,
|
||||||
})));
|
})));
|
||||||
|
|||||||
Reference in New Issue
Block a user