mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-25 08:34:13 +02:00
wip
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
packages/frontend/assets/room/wall-textures/concrete.png
Normal file
BIN
packages/frontend/assets/room/wall-textures/concrete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -61,16 +61,64 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
|
|
||||||
<template v-if="controller.roomState.value.heya.type === 'simple'">
|
<template v-if="controller.roomState.value.heya.type === 'simple'">
|
||||||
<div>
|
<div>
|
||||||
<div>Wall N color</div>
|
<div>Wall N</div>
|
||||||
<MkInput :modelValue="getHex(controller.roomState.value.heya.options.wallN.color)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallN: { ...controller.roomState.value.heya.options.wallN, color: c } }); }"></MkInput>
|
<MkSelect
|
||||||
|
:items="[
|
||||||
|
{ label: 'None', value: null },
|
||||||
|
{ label: 'Wood', value: 'wood' },
|
||||||
|
{ label: 'Concrete', value: 'concrete' },
|
||||||
|
]" :modelValue="controller.roomState.value.heya.options.wallN.material" @update:modelValue="v => { controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallN: { ...controller.roomState.value.heya.options.wallN, material: v } }); }"
|
||||||
|
>
|
||||||
|
<template #label>wallpaper</template>
|
||||||
|
</MkSelect>
|
||||||
|
<MkInput :modelValue="getHex(controller.roomState.value.heya.options.wallN.color)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallN: { ...controller.roomState.value.heya.options.wallN, color: c } }); }">
|
||||||
|
<template #label>color</template>
|
||||||
|
</MkInput>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div>Wall E color</div>
|
<div>Wall E</div>
|
||||||
<MkInput :modelValue="getHex(controller.roomState.value.heya.options.wallE.color)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallE: { ...controller.roomState.value.heya.options.wallE, color: c } }); }"></MkInput>
|
<MkSelect
|
||||||
|
:items="[
|
||||||
|
{ label: 'None', value: null },
|
||||||
|
{ label: 'Wood', value: 'wood' },
|
||||||
|
{ label: 'Concrete', value: 'concrete' },
|
||||||
|
]" :modelValue="controller.roomState.value.heya.options.wallE.material" @update:modelValue="v => { controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallE: { ...controller.roomState.value.heya.options.wallE, material: v } }); }"
|
||||||
|
>
|
||||||
|
<template #label>wallpaper</template>
|
||||||
|
</MkSelect>
|
||||||
|
<MkInput :modelValue="getHex(controller.roomState.value.heya.options.wallE.color)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallE: { ...controller.roomState.value.heya.options.wallE, color: c } }); }">
|
||||||
|
<template #label>color</template>
|
||||||
|
</MkInput>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div>Wall W color</div>
|
<div>Wall S</div>
|
||||||
<MkInput :modelValue="getHex(controller.roomState.value.heya.options.wallW.color)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallW: { ...controller.roomState.value.heya.options.wallW, color: c } }); }"></MkInput>
|
<MkSelect
|
||||||
|
:items="[
|
||||||
|
{ label: 'None', value: null },
|
||||||
|
{ label: 'Wood', value: 'wood' },
|
||||||
|
{ label: 'Concrete', value: 'concrete' },
|
||||||
|
]" :modelValue="controller.roomState.value.heya.options.wallS.material" @update:modelValue="v => { controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallS: { ...controller.roomState.value.heya.options.wallS, material: v } }); }"
|
||||||
|
>
|
||||||
|
<template #label>wallpaper</template>
|
||||||
|
</MkSelect>
|
||||||
|
<MkInput :modelValue="getHex(controller.roomState.value.heya.options.wallS.color)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallS: { ...controller.roomState.value.heya.options.wallS, color: c } }); }">
|
||||||
|
<template #label>color</template>
|
||||||
|
</MkInput>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>Wall W</div>
|
||||||
|
<MkSelect
|
||||||
|
:items="[
|
||||||
|
{ label: 'None', value: null },
|
||||||
|
{ label: 'Wood', value: 'wood' },
|
||||||
|
{ label: 'Concrete', value: 'concrete' },
|
||||||
|
]" :modelValue="controller.roomState.value.heya.options.wallW.material" @update:modelValue="v => { controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallW: { ...controller.roomState.value.heya.options.wallW, material: v } }); }"
|
||||||
|
>
|
||||||
|
<template #label>wallpaper</template>
|
||||||
|
</MkSelect>
|
||||||
|
<MkInput :modelValue="getHex(controller.roomState.value.heya.options.wallW.color)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) controller.updateHeyaOptions({ ...controller.roomState.value.heya.options, wallW: { ...controller.roomState.value.heya.options.wallW, color: c } }); }">
|
||||||
|
<template #label>color</template>
|
||||||
|
</MkInput>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -455,7 +455,8 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
this.emit('loadingProgress', { progress: loadedCount / objects.length });
|
this.emit('loadingProgress', { progress: loadedCount / objects.length });
|
||||||
})));
|
})));
|
||||||
|
|
||||||
this.scene.blockMaterialDirtyMechanism = true;
|
// 不具合のもと
|
||||||
|
//this.scene.blockMaterialDirtyMechanism = true;
|
||||||
|
|
||||||
if (SNAPSHOT_RENDERING) {
|
if (SNAPSHOT_RENDERING) {
|
||||||
// 早く有効にしすぎることが原因かは不明だがクラッシュすることがあるので遅らせてみる
|
// 早く有効にしすぎることが原因かは不明だがクラッシュすることがあるので遅らせてみる
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
private wallSRoot: BABYLON.TransformNode | null = null;
|
private wallSRoot: BABYLON.TransformNode | null = null;
|
||||||
private wallWRoot: BABYLON.TransformNode | null = null;
|
private wallWRoot: BABYLON.TransformNode | null = null;
|
||||||
private wallERoot: BABYLON.TransformNode | null = null;
|
private wallERoot: BABYLON.TransformNode | null = null;
|
||||||
private wallNMaterial: BABYLON.Material | null = null;
|
private wallNMaterial: BABYLON.PBRMaterial | null = null;
|
||||||
private wallSMaterial: BABYLON.Material | null = null;
|
private wallSMaterial: BABYLON.PBRMaterial | null = null;
|
||||||
private wallWMaterial: BABYLON.Material | null = null;
|
private wallWMaterial: BABYLON.PBRMaterial | null = null;
|
||||||
private wallEMaterial: BABYLON.Material | null = null;
|
private wallEMaterial: BABYLON.PBRMaterial | null = null;
|
||||||
|
|
||||||
constructor(onMeshUpdatedCallback?: ((meshes: BABYLON.AbstractMesh[]) => void) | null) {
|
constructor(onMeshUpdatedCallback?: ((meshes: BABYLON.AbstractMesh[]) => void) | null) {
|
||||||
super(onMeshUpdatedCallback);
|
super(onMeshUpdatedCallback);
|
||||||
@@ -120,14 +120,46 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
m.material = this.wallEMaterial;
|
m.material = this.wallEMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.applyOptions(options);
|
await this.applyOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public applyOptions(options: SimpleHeyaOptions) {
|
public applyOptions(options: SimpleHeyaOptions) {
|
||||||
this.wallNMaterial.albedoColor = new BABYLON.Color3(...options.wallN.color);
|
// TODO: 返り値をpromiseにしてちゃんとテクスチャが読み終わってからresolveする
|
||||||
this.wallSMaterial.albedoColor = new BABYLON.Color3(...options.wallS.color);
|
|
||||||
this.wallWMaterial.albedoColor = new BABYLON.Color3(...options.wallW.color);
|
const apply = (wall: 'N' | 'S' | 'W' | 'E') => {
|
||||||
this.wallEMaterial.albedoColor = new BABYLON.Color3(...options.wallE.color);
|
const wallOptions =
|
||||||
|
wall === 'N' ? options.wallN :
|
||||||
|
wall === 'S' ? options.wallS :
|
||||||
|
wall === 'W' ? options.wallW :
|
||||||
|
options.wallE;
|
||||||
|
const targetMaterial =
|
||||||
|
wall === 'N' ? this.wallNMaterial :
|
||||||
|
wall === 'S' ? this.wallSMaterial :
|
||||||
|
wall === 'W' ? this.wallWMaterial :
|
||||||
|
this.wallEMaterial;
|
||||||
|
|
||||||
|
targetMaterial.unfreeze();
|
||||||
|
|
||||||
|
targetMaterial.albedoColor = new BABYLON.Color3(...wallOptions.color);
|
||||||
|
|
||||||
|
const texPath = wallOptions.material === 'wood' ? '/client-assets/room/wall-textures/wood.png'
|
||||||
|
: wallOptions.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);
|
||||||
|
targetMaterial.albedoTexture = tex;
|
||||||
|
} else {
|
||||||
|
targetMaterial.albedoTexture = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetMaterial.freeze();
|
||||||
|
};
|
||||||
|
|
||||||
|
apply('N');
|
||||||
|
apply('S');
|
||||||
|
apply('W');
|
||||||
|
apply('E');
|
||||||
|
|
||||||
this.onMeshUpdatedCallback?.(this.meshes);
|
this.onMeshUpdatedCallback?.(this.meshes);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user