mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-28 18:14:58 +02:00
wip
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -19,24 +19,24 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<template #label>color</template>
|
<template #label>color</template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
<hr>
|
<hr>
|
||||||
<MkSwitch :modelValue="options.withHari" @update:modelValue="v => { update({ withHari: v }); }">
|
<MkSwitch :modelValue="options.withBeam" @update:modelValue="v => { update({ withBeam: v }); }">
|
||||||
<template #label>with Hari</template>
|
<template #label>with Beam</template>
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
<MkSelect
|
<MkSelect
|
||||||
:items="[
|
:items="[
|
||||||
{ label: 'None', value: null },
|
{ label: 'None', value: null },
|
||||||
{ label: 'Wood', value: 'wood' },
|
{ label: 'Wood', value: 'wood' },
|
||||||
{ label: 'Concrete', value: 'concrete' },
|
{ label: 'Concrete', value: 'concrete' },
|
||||||
]" :modelValue="options.hariMaterial" @update:modelValue="v => { update({ hariMaterial: v }); }"
|
]" :modelValue="options.beamMaterial" @update:modelValue="v => { update({ beamMaterial: v }); }"
|
||||||
>
|
>
|
||||||
<template #label>hari material</template>
|
<template #label>beam material</template>
|
||||||
</MkSelect>
|
</MkSelect>
|
||||||
<MkInput :modelValue="getHex(options.hariColor)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) update({ hariColor: c }); }">
|
<MkInput :modelValue="getHex(options.beamColor)" type="color" @update:modelValue="v => { const c = getRgb(v); if (c != null) update({ beamColor: c }); }">
|
||||||
<template #label>hari color</template>
|
<template #label>beam color</template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
<hr>
|
<hr>
|
||||||
<MkSwitch :modelValue="options.withHabaki" @update:modelValue="v => { update({ withHabaki: v }); }">
|
<MkSwitch :modelValue="options.withBaseboard" @update:modelValue="v => { update({ withBaseboard: v }); }">
|
||||||
<template #label>with Habaki</template>
|
<template #label>with Baseboard</template>
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -178,34 +178,34 @@ const data = localStorage.getItem('roomData') != null ? JSON.parse(localStorage.
|
|||||||
n: {
|
n: {
|
||||||
material: null,
|
material: null,
|
||||||
color: [0.9, 0.9, 0.9],
|
color: [0.9, 0.9, 0.9],
|
||||||
withHari: false,
|
withBeam: false,
|
||||||
hariMaterial: null,
|
beamMaterial: null,
|
||||||
hariColor: [0.8, 0.8, 0.8],
|
beamColor: [0.8, 0.8, 0.8],
|
||||||
withHabaki: false,
|
withBaseboard: true,
|
||||||
},
|
},
|
||||||
e: {
|
e: {
|
||||||
material: null,
|
material: null,
|
||||||
color: [0.9, 0.9, 0.9],
|
color: [0.9, 0.9, 0.9],
|
||||||
withHari: false,
|
withBeam: false,
|
||||||
hariMaterial: null,
|
beamMaterial: null,
|
||||||
hariColor: [0.8, 0.8, 0.8],
|
beamColor: [0.8, 0.8, 0.8],
|
||||||
withHabaki: false,
|
withBaseboard: true,
|
||||||
},
|
},
|
||||||
s: {
|
s: {
|
||||||
material: null,
|
material: null,
|
||||||
color: [0.9, 0.9, 0.9],
|
color: [0.9, 0.9, 0.9],
|
||||||
withHari: false,
|
withBeam: false,
|
||||||
hariMaterial: null,
|
beamMaterial: null,
|
||||||
hariColor: [0.8, 0.8, 0.8],
|
beamColor: [0.8, 0.8, 0.8],
|
||||||
withHabaki: false,
|
withBaseboard: true,
|
||||||
},
|
},
|
||||||
w: {
|
w: {
|
||||||
material: null,
|
material: null,
|
||||||
color: [0.9, 0.9, 0.9],
|
color: [0.9, 0.9, 0.9],
|
||||||
withHari: false,
|
withBeam: false,
|
||||||
hariMaterial: null,
|
beamMaterial: null,
|
||||||
hariColor: [0.8, 0.8, 0.8],
|
beamColor: [0.8, 0.8, 0.8],
|
||||||
withHabaki: false,
|
withBaseboard: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
pillars: {
|
pillars: {
|
||||||
@@ -243,68 +243,6 @@ const data = localStorage.getItem('roomData') != null ? JSON.parse(localStorage.
|
|||||||
installedObjects: [],
|
installedObjects: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
// 後方互換性のため
|
|
||||||
if (data.heya.options.walls == null) {
|
|
||||||
data.heya.options.walls = {
|
|
||||||
n: {
|
|
||||||
material: null,
|
|
||||||
color: [0.9, 0.9, 0.9],
|
|
||||||
withHari: false,
|
|
||||||
hariMaterial: null,
|
|
||||||
hariColor: [0.8, 0.8, 0.8],
|
|
||||||
withHabaki: false,
|
|
||||||
},
|
|
||||||
e: {
|
|
||||||
material: null,
|
|
||||||
color: [0.9, 0.9, 0.9],
|
|
||||||
withHari: false,
|
|
||||||
hariMaterial: null,
|
|
||||||
hariColor: [0.8, 0.8, 0.8],
|
|
||||||
withHabaki: false,
|
|
||||||
},
|
|
||||||
s: {
|
|
||||||
material: null,
|
|
||||||
color: [0.9, 0.9, 0.9],
|
|
||||||
withHari: false,
|
|
||||||
hariMaterial: null,
|
|
||||||
hariColor: [0.8, 0.8, 0.8],
|
|
||||||
withHabaki: false,
|
|
||||||
},
|
|
||||||
w: {
|
|
||||||
material: null,
|
|
||||||
color: [0.9, 0.9, 0.9],
|
|
||||||
withHari: false,
|
|
||||||
hariMaterial: null,
|
|
||||||
hariColor: [0.8, 0.8, 0.8],
|
|
||||||
withHabaki: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (data.heya.options.pillars == null) {
|
|
||||||
data.heya.options.pillars = {
|
|
||||||
nw: {
|
|
||||||
material: null,
|
|
||||||
color: [0.9, 0.9, 0.9],
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
ne: {
|
|
||||||
material: null,
|
|
||||||
color: [0.9, 0.9, 0.9],
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
sw: {
|
|
||||||
material: null,
|
|
||||||
color: [0.9, 0.9, 0.9],
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
se: {
|
|
||||||
material: null,
|
|
||||||
color: [0.9, 0.9, 0.9],
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('installedObjects:', data.installedObjects.length);
|
console.log('installedObjects:', data.installedObjects.length);
|
||||||
|
|
||||||
let latestData = deepClone(data);
|
let latestData = deepClone(data);
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ export type SimpleHeyaOptions = {
|
|||||||
walls: Record<'n' | 's' | 'w' | 'e', {
|
walls: Record<'n' | 's' | 'w' | 'e', {
|
||||||
material: null | 'wood' | 'concrete';
|
material: null | 'wood' | 'concrete';
|
||||||
color: [number, number, number];
|
color: [number, number, number];
|
||||||
withHari: boolean;
|
withBeam: boolean;
|
||||||
hariMaterial: null | 'wood' | 'concrete';
|
beamMaterial: null | 'wood' | 'concrete';
|
||||||
hariColor: [number, number, number];
|
beamColor: [number, number, number];
|
||||||
withHabaki: boolean;
|
withBaseboard: boolean;
|
||||||
}>;
|
}>;
|
||||||
pillars: Record<'nw' | 'ne' | 'sw' | 'se', {
|
pillars: Record<'nw' | 'ne' | 'sw' | 'se', {
|
||||||
material: null | 'wood' | 'concrete';
|
material: null | 'wood' | 'concrete';
|
||||||
@@ -64,7 +64,7 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
private meshes: BABYLON.Mesh[] = [];
|
private meshes: BABYLON.Mesh[] = [];
|
||||||
private wallRoots: Record<'n' | 's' | 'w' | 'e', BABYLON.TransformNode> = null as any;
|
private wallRoots: Record<'n' | 's' | 'w' | 'e', BABYLON.TransformNode> = null as any;
|
||||||
private wallMaterials: Record<'n' | 's' | 'w' | 'e', BABYLON.PBRMaterial> | null = null;
|
private wallMaterials: Record<'n' | 's' | 'w' | 'e', BABYLON.PBRMaterial> | null = null;
|
||||||
private wallHariMaterials: Record<'n' | 's' | 'w' | 'e', BABYLON.PBRMaterial> | null = null;
|
private wallBeamMaterials: Record<'n' | 's' | 'w' | 'e', BABYLON.PBRMaterial> | null = null;
|
||||||
private pillarRoots: Record<'nw' | 'ne' | 'sw' | 'se', BABYLON.TransformNode> | null = null;
|
private pillarRoots: Record<'nw' | 'ne' | 'sw' | 'se', BABYLON.TransformNode> | null = null;
|
||||||
private pillarMaterials: Record<'nw' | 'ne' | 'sw' | 'se', BABYLON.PBRMaterial> | null = null;
|
private pillarMaterials: Record<'nw' | 'ne' | 'sw' | 'se', BABYLON.PBRMaterial> | null = null;
|
||||||
private ceilingMaterial: BABYLON.PBRMaterial | null = null;
|
private ceilingMaterial: BABYLON.PBRMaterial | null = null;
|
||||||
@@ -116,7 +116,7 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
se: this.loaderResult.transformNodes.find(t => t.name.includes('__PILLAR_SE__'))!,
|
se: this.loaderResult.transformNodes.find(t => t.name.includes('__PILLAR_SE__'))!,
|
||||||
};
|
};
|
||||||
|
|
||||||
const wallMaterial = findMaterial(this.meshes[0], '__X_WALL__');
|
const wallMaterial = findMaterial(this.meshes[0], '__WALL__');
|
||||||
this.wallMaterials = {
|
this.wallMaterials = {
|
||||||
n: wallMaterial.clone('wallNMaterial'),
|
n: wallMaterial.clone('wallNMaterial'),
|
||||||
s: wallMaterial.clone('wallSMaterial'),
|
s: wallMaterial.clone('wallSMaterial'),
|
||||||
@@ -124,15 +124,15 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
e: wallMaterial.clone('wallEMaterial'),
|
e: wallMaterial.clone('wallEMaterial'),
|
||||||
};
|
};
|
||||||
|
|
||||||
const hariMaterial = findMaterial(this.meshes[0], '__X_HARI__');
|
const beamMaterial = findMaterial(this.meshes[0], '__BEAM__');
|
||||||
this.wallHariMaterials = {
|
this.wallBeamMaterials = {
|
||||||
n: hariMaterial.clone('wallNHariMaterial'),
|
n: beamMaterial.clone('wallNBeamMaterial'),
|
||||||
s: hariMaterial.clone('wallSHariMaterial'),
|
s: beamMaterial.clone('wallSBeamMaterial'),
|
||||||
w: hariMaterial.clone('wallWHariMaterial'),
|
w: beamMaterial.clone('wallWBeamMaterial'),
|
||||||
e: hariMaterial.clone('wallEHariMaterial'),
|
e: beamMaterial.clone('wallEBeamMaterial'),
|
||||||
};
|
};
|
||||||
|
|
||||||
const pillarMaterial = findMaterial(this.meshes[0], '__X_PILLAR__');
|
const pillarMaterial = findMaterial(this.meshes[0], '__PILLAR__');
|
||||||
this.pillarMaterials = {
|
this.pillarMaterials = {
|
||||||
nw: pillarMaterial.clone('pillarNWMaterial'),
|
nw: pillarMaterial.clone('pillarNWMaterial'),
|
||||||
ne: pillarMaterial.clone('pillarNEMaterial'),
|
ne: pillarMaterial.clone('pillarNEMaterial'),
|
||||||
@@ -144,8 +144,8 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
for (const m of v.getChildMeshes().filter(m => m.material === wallMaterial)) {
|
for (const m of v.getChildMeshes().filter(m => m.material === wallMaterial)) {
|
||||||
m.material = this.wallMaterials[k];
|
m.material = this.wallMaterials[k];
|
||||||
}
|
}
|
||||||
for (const m of v.getChildMeshes().filter(m => m.material === hariMaterial)) {
|
for (const m of v.getChildMeshes().filter(m => m.material === beamMaterial)) {
|
||||||
m.material = this.wallHariMaterials[k];
|
m.material = this.wallBeamMaterials[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const [k, v] of Object.entries(this.pillarRoots)) {
|
for (const [k, v] of Object.entries(this.pillarRoots)) {
|
||||||
@@ -154,8 +154,8 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ceilingMaterial = findMaterial(this.meshes[0], '__X_CEILING__');
|
this.ceilingMaterial = findMaterial(this.meshes[0], '__CEILING__');
|
||||||
this.floorMaterial = findMaterial(this.meshes[0], '__X_FLOOR__');
|
this.floorMaterial = findMaterial(this.meshes[0], '__FLOOR__');
|
||||||
|
|
||||||
await this.applyOptions(options);
|
await this.applyOptions(options);
|
||||||
}
|
}
|
||||||
@@ -168,10 +168,10 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
const wallOptions = options.walls[type];
|
const wallOptions = options.walls[type];
|
||||||
|
|
||||||
for (const mesh of wallRoot.getChildMeshes()) {
|
for (const mesh of wallRoot.getChildMeshes()) {
|
||||||
if (mesh.name.includes('__X_HARI__')) {
|
if (mesh.name.includes('__BEAM__')) {
|
||||||
mesh.setEnabled(wallOptions.withHari);
|
mesh.setEnabled(wallOptions.withBeam);
|
||||||
} else if (mesh.name.includes('__X_HABAKI__')) {
|
} else if (mesh.name.includes('__BASEBOARD__')) {
|
||||||
mesh.setEnabled(wallOptions.withHabaki);
|
mesh.setEnabled(wallOptions.withBaseboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,13 +196,13 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const targetMaterial = this.wallHariMaterials[type];
|
const targetMaterial = this.wallBeamMaterials[type];
|
||||||
|
|
||||||
targetMaterial.unfreeze();
|
targetMaterial.unfreeze();
|
||||||
targetMaterial.albedoColor = new BABYLON.Color3(...wallOptions.hariColor);
|
targetMaterial.albedoColor = new BABYLON.Color3(...wallOptions.beamColor);
|
||||||
|
|
||||||
const texPath = wallOptions.hariMaterial === 'wood' ? '/client-assets/room/textures/wall-wood2.png'
|
const texPath = wallOptions.beamMaterial === 'wood' ? '/client-assets/room/textures/wall-wood2.png'
|
||||||
: wallOptions.hariMaterial === 'concrete' ? '/client-assets/room/textures/concrete1.png'
|
: wallOptions.beamMaterial === 'concrete' ? '/client-assets/room/textures/concrete1.png'
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
if (texPath != null) {
|
if (texPath != null) {
|
||||||
@@ -224,13 +224,13 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
if (!isEnabled) {
|
if (!isEnabled) {
|
||||||
// 梁同士が直交することは許さない(z-fightingが発生する)ので柱を強制追加
|
// 梁同士が直交することは許さない(z-fightingが発生する)ので柱を強制追加
|
||||||
if (type === 'nw') {
|
if (type === 'nw') {
|
||||||
isEnabled = options.walls.n.withHari && options.walls.w.withHari;
|
isEnabled = options.walls.n.withBeam && options.walls.w.withBeam;
|
||||||
} else if (type === 'ne') {
|
} else if (type === 'ne') {
|
||||||
isEnabled = options.walls.n.withHari && options.walls.e.withHari;
|
isEnabled = options.walls.n.withBeam && options.walls.e.withBeam;
|
||||||
} else if (type === 'sw') {
|
} else if (type === 'sw') {
|
||||||
isEnabled = options.walls.s.withHari && options.walls.w.withHari;
|
isEnabled = options.walls.s.withBeam && options.walls.w.withBeam;
|
||||||
} else if (type === 'se') {
|
} else if (type === 'se') {
|
||||||
isEnabled = options.walls.s.withHari && options.walls.e.withHari;
|
isEnabled = options.walls.s.withBeam && options.walls.e.withBeam;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pillarRoot.setEnabled(isEnabled);
|
pillarRoot.setEnabled(isEnabled);
|
||||||
@@ -308,7 +308,7 @@ export class SimpleHeyaManager extends HeyaManager<SimpleHeyaOptions> {
|
|||||||
for (const m of Object.values(this.wallMaterials ?? {})) {
|
for (const m of Object.values(this.wallMaterials ?? {})) {
|
||||||
m.dispose();
|
m.dispose();
|
||||||
}
|
}
|
||||||
for (const m of Object.values(this.wallHariMaterials ?? {})) {
|
for (const m of Object.values(this.wallBeamMaterials ?? {})) {
|
||||||
m.dispose();
|
m.dispose();
|
||||||
}
|
}
|
||||||
for (const m of Object.values(this.pillarMaterials ?? {})) {
|
for (const m of Object.values(this.pillarMaterials ?? {})) {
|
||||||
|
|||||||
Reference in New Issue
Block a user