1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 12:55:30 +02:00
This commit is contained in:
syuilo
2026-04-29 20:07:34 +09:00
parent 1427d887dd
commit 0f69a284c6
2 changed files with 44 additions and 4 deletions

View File

@@ -8,19 +8,34 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps">
<MkFolder>
<template #label>Wall N</template>
<XWallOption :options="options.walls.n" @update="v => { emit('update', { ...options, walls: { ...options.walls, n: v } }); }"></XWallOption>
<XWallOption :options="options.walls.n" @update="v => { update({ walls: { ...options.walls, n: v } }); }"></XWallOption>
</MkFolder>
<MkFolder>
<template #label>Wall S</template>
<XWallOption :options="options.walls.s" @update="v => { emit('update', { ...options, walls: { ...options.walls, s: v } }); }"></XWallOption>
<XWallOption :options="options.walls.s" @update="v => { update({ walls: { ...options.walls, s: v } }); }"></XWallOption>
</MkFolder>
<MkFolder>
<template #label>Wall W</template>
<XWallOption :options="options.walls.w" @update="v => { emit('update', { ...options, walls: { ...options.walls, w: v } }); }"></XWallOption>
<XWallOption :options="options.walls.w" @update="v => { update({ walls: { ...options.walls, w: v } }); }"></XWallOption>
</MkFolder>
<MkFolder>
<template #label>Wall E</template>
<XWallOption :options="options.walls.e" @update="v => { emit('update', { ...options, walls: { ...options.walls, e: v } }); }"></XWallOption>
<XWallOption :options="options.walls.e" @update="v => { update({ walls: { ...options.walls, e: v } }); }"></XWallOption>
</MkFolder>
<MkFolder>
<template #label>Ceiling</template>
<MkSelect
:items="[
{ label: 'None', value: null },
{ label: 'Wood', value: 'wood' },
{ label: 'Concrete', value: 'concrete' },
]" :modelValue="options.ceiling.material" @update:modelValue="v => { update({ ceiling: { ...options.ceiling, material: v } }); }"
>
<template #label>wallpaper</template>
</MkSelect>
<MkInput :modelValue="getHex(options.ceiling.color)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) update({ ceiling: { ...options.ceiling, color: c } }); }">
<template #label>color</template>
</MkInput>
</MkFolder>
</div>
</div>
@@ -48,6 +63,10 @@ const props = defineProps<{
const emit = defineEmits<{
(ev: 'update', v: SimpleHeyaOptions): void;
}>();
function update(v: Partial<SimpleHeyaOptions>) {
emit('update', { ...props.options, ...v });
}
</script>
<style lang="scss" module>

View File

@@ -79,6 +79,7 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
w: BABYLON.PBRMaterial;
e: BABYLON.PBRMaterial;
} | null = null;
private ceilingMaterial: BABYLON.PBRMaterial | null = null;
constructor(onMeshUpdatedCallback?: ((meshes: BABYLON.AbstractMesh[]) => void) | null) {
super(onMeshUpdatedCallback);
@@ -144,6 +145,8 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
}
}
this.ceilingMaterial = findMaterial(this.meshes[0], '__X_CEILING__');
await this.applyOptions(options);
}
@@ -203,6 +206,24 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
}
}
{
this.ceilingMaterial.unfreeze();
this.ceilingMaterial.albedoColor = new BABYLON.Color3(...options.ceiling.color);
const texPath = options.ceiling.material === 'wood' ? '/client-assets/room/wall-textures/wood.png'
: options.ceiling.material === 'concrete' ? '/client-assets/room/wall-textures/concrete.png'
: null;
if (texPath != null) {
const tex = new BABYLON.Texture(texPath, this.meshes[0].getScene(), false, false);
this.ceilingMaterial.albedoTexture = tex;
} else {
this.ceilingMaterial.albedoTexture = null;
}
this.ceilingMaterial.freeze();
}
this.onMeshUpdatedCallback?.(this.meshes);
}